tomoto 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +123 -0
- data/ext/tomoto/ext.cpp +245 -0
- data/ext/tomoto/extconf.rb +28 -0
- data/lib/tomoto.rb +12 -0
- data/lib/tomoto/ct.rb +11 -0
- data/lib/tomoto/hdp.rb +11 -0
- data/lib/tomoto/lda.rb +67 -0
- data/lib/tomoto/version.rb +3 -0
- data/vendor/EigenRand/EigenRand/Core.h +1139 -0
- data/vendor/EigenRand/EigenRand/Dists/Basic.h +111 -0
- data/vendor/EigenRand/EigenRand/Dists/Discrete.h +877 -0
- data/vendor/EigenRand/EigenRand/Dists/GammaPoisson.h +108 -0
- data/vendor/EigenRand/EigenRand/Dists/NormalExp.h +626 -0
- data/vendor/EigenRand/EigenRand/EigenRand +19 -0
- data/vendor/EigenRand/EigenRand/Macro.h +24 -0
- data/vendor/EigenRand/EigenRand/MorePacketMath.h +978 -0
- data/vendor/EigenRand/EigenRand/PacketFilter.h +286 -0
- data/vendor/EigenRand/EigenRand/PacketRandomEngine.h +624 -0
- data/vendor/EigenRand/EigenRand/RandUtils.h +413 -0
- data/vendor/EigenRand/EigenRand/doc.h +220 -0
- data/vendor/EigenRand/LICENSE +21 -0
- data/vendor/EigenRand/README.md +288 -0
- data/vendor/eigen/COPYING.BSD +26 -0
- data/vendor/eigen/COPYING.GPL +674 -0
- data/vendor/eigen/COPYING.LGPL +502 -0
- data/vendor/eigen/COPYING.MINPACK +52 -0
- data/vendor/eigen/COPYING.MPL2 +373 -0
- data/vendor/eigen/COPYING.README +18 -0
- data/vendor/eigen/Eigen/CMakeLists.txt +19 -0
- data/vendor/eigen/Eigen/Cholesky +46 -0
- data/vendor/eigen/Eigen/CholmodSupport +48 -0
- data/vendor/eigen/Eigen/Core +537 -0
- data/vendor/eigen/Eigen/Dense +7 -0
- data/vendor/eigen/Eigen/Eigen +2 -0
- data/vendor/eigen/Eigen/Eigenvalues +61 -0
- data/vendor/eigen/Eigen/Geometry +62 -0
- data/vendor/eigen/Eigen/Householder +30 -0
- data/vendor/eigen/Eigen/IterativeLinearSolvers +48 -0
- data/vendor/eigen/Eigen/Jacobi +33 -0
- data/vendor/eigen/Eigen/LU +50 -0
- data/vendor/eigen/Eigen/MetisSupport +35 -0
- data/vendor/eigen/Eigen/OrderingMethods +73 -0
- data/vendor/eigen/Eigen/PaStiXSupport +48 -0
- data/vendor/eigen/Eigen/PardisoSupport +35 -0
- data/vendor/eigen/Eigen/QR +51 -0
- data/vendor/eigen/Eigen/QtAlignedMalloc +40 -0
- data/vendor/eigen/Eigen/SPQRSupport +34 -0
- data/vendor/eigen/Eigen/SVD +51 -0
- data/vendor/eigen/Eigen/Sparse +36 -0
- data/vendor/eigen/Eigen/SparseCholesky +45 -0
- data/vendor/eigen/Eigen/SparseCore +69 -0
- data/vendor/eigen/Eigen/SparseLU +46 -0
- data/vendor/eigen/Eigen/SparseQR +37 -0
- data/vendor/eigen/Eigen/StdDeque +27 -0
- data/vendor/eigen/Eigen/StdList +26 -0
- data/vendor/eigen/Eigen/StdVector +27 -0
- data/vendor/eigen/Eigen/SuperLUSupport +64 -0
- data/vendor/eigen/Eigen/UmfPackSupport +40 -0
- data/vendor/eigen/Eigen/src/Cholesky/LDLT.h +673 -0
- data/vendor/eigen/Eigen/src/Cholesky/LLT.h +542 -0
- data/vendor/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h +99 -0
- data/vendor/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +639 -0
- data/vendor/eigen/Eigen/src/Core/Array.h +329 -0
- data/vendor/eigen/Eigen/src/Core/ArrayBase.h +226 -0
- data/vendor/eigen/Eigen/src/Core/ArrayWrapper.h +209 -0
- data/vendor/eigen/Eigen/src/Core/Assign.h +90 -0
- data/vendor/eigen/Eigen/src/Core/AssignEvaluator.h +935 -0
- data/vendor/eigen/Eigen/src/Core/Assign_MKL.h +178 -0
- data/vendor/eigen/Eigen/src/Core/BandMatrix.h +353 -0
- data/vendor/eigen/Eigen/src/Core/Block.h +452 -0
- data/vendor/eigen/Eigen/src/Core/BooleanRedux.h +164 -0
- data/vendor/eigen/Eigen/src/Core/CommaInitializer.h +160 -0
- data/vendor/eigen/Eigen/src/Core/ConditionEstimator.h +175 -0
- data/vendor/eigen/Eigen/src/Core/CoreEvaluators.h +1688 -0
- data/vendor/eigen/Eigen/src/Core/CoreIterators.h +127 -0
- data/vendor/eigen/Eigen/src/Core/CwiseBinaryOp.h +184 -0
- data/vendor/eigen/Eigen/src/Core/CwiseNullaryOp.h +866 -0
- data/vendor/eigen/Eigen/src/Core/CwiseTernaryOp.h +197 -0
- data/vendor/eigen/Eigen/src/Core/CwiseUnaryOp.h +103 -0
- data/vendor/eigen/Eigen/src/Core/CwiseUnaryView.h +128 -0
- data/vendor/eigen/Eigen/src/Core/DenseBase.h +611 -0
- data/vendor/eigen/Eigen/src/Core/DenseCoeffsBase.h +681 -0
- data/vendor/eigen/Eigen/src/Core/DenseStorage.h +570 -0
- data/vendor/eigen/Eigen/src/Core/Diagonal.h +260 -0
- data/vendor/eigen/Eigen/src/Core/DiagonalMatrix.h +343 -0
- data/vendor/eigen/Eigen/src/Core/DiagonalProduct.h +28 -0
- data/vendor/eigen/Eigen/src/Core/Dot.h +318 -0
- data/vendor/eigen/Eigen/src/Core/EigenBase.h +159 -0
- data/vendor/eigen/Eigen/src/Core/ForceAlignedAccess.h +146 -0
- data/vendor/eigen/Eigen/src/Core/Fuzzy.h +155 -0
- data/vendor/eigen/Eigen/src/Core/GeneralProduct.h +455 -0
- data/vendor/eigen/Eigen/src/Core/GenericPacketMath.h +593 -0
- data/vendor/eigen/Eigen/src/Core/GlobalFunctions.h +187 -0
- data/vendor/eigen/Eigen/src/Core/IO.h +225 -0
- data/vendor/eigen/Eigen/src/Core/Inverse.h +118 -0
- data/vendor/eigen/Eigen/src/Core/Map.h +171 -0
- data/vendor/eigen/Eigen/src/Core/MapBase.h +303 -0
- data/vendor/eigen/Eigen/src/Core/MathFunctions.h +1415 -0
- data/vendor/eigen/Eigen/src/Core/MathFunctionsImpl.h +101 -0
- data/vendor/eigen/Eigen/src/Core/Matrix.h +459 -0
- data/vendor/eigen/Eigen/src/Core/MatrixBase.h +529 -0
- data/vendor/eigen/Eigen/src/Core/NestByValue.h +110 -0
- data/vendor/eigen/Eigen/src/Core/NoAlias.h +108 -0
- data/vendor/eigen/Eigen/src/Core/NumTraits.h +248 -0
- data/vendor/eigen/Eigen/src/Core/PermutationMatrix.h +633 -0
- data/vendor/eigen/Eigen/src/Core/PlainObjectBase.h +1035 -0
- data/vendor/eigen/Eigen/src/Core/Product.h +186 -0
- data/vendor/eigen/Eigen/src/Core/ProductEvaluators.h +1112 -0
- data/vendor/eigen/Eigen/src/Core/Random.h +182 -0
- data/vendor/eigen/Eigen/src/Core/Redux.h +505 -0
- data/vendor/eigen/Eigen/src/Core/Ref.h +283 -0
- data/vendor/eigen/Eigen/src/Core/Replicate.h +142 -0
- data/vendor/eigen/Eigen/src/Core/ReturnByValue.h +117 -0
- data/vendor/eigen/Eigen/src/Core/Reverse.h +211 -0
- data/vendor/eigen/Eigen/src/Core/Select.h +162 -0
- data/vendor/eigen/Eigen/src/Core/SelfAdjointView.h +352 -0
- data/vendor/eigen/Eigen/src/Core/SelfCwiseBinaryOp.h +47 -0
- data/vendor/eigen/Eigen/src/Core/Solve.h +188 -0
- data/vendor/eigen/Eigen/src/Core/SolveTriangular.h +235 -0
- data/vendor/eigen/Eigen/src/Core/SolverBase.h +130 -0
- data/vendor/eigen/Eigen/src/Core/StableNorm.h +221 -0
- data/vendor/eigen/Eigen/src/Core/Stride.h +111 -0
- data/vendor/eigen/Eigen/src/Core/Swap.h +67 -0
- data/vendor/eigen/Eigen/src/Core/Transpose.h +403 -0
- data/vendor/eigen/Eigen/src/Core/Transpositions.h +407 -0
- data/vendor/eigen/Eigen/src/Core/TriangularMatrix.h +983 -0
- data/vendor/eigen/Eigen/src/Core/VectorBlock.h +96 -0
- data/vendor/eigen/Eigen/src/Core/VectorwiseOp.h +695 -0
- data/vendor/eigen/Eigen/src/Core/Visitor.h +273 -0
- data/vendor/eigen/Eigen/src/Core/arch/AVX/Complex.h +451 -0
- data/vendor/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +439 -0
- data/vendor/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +637 -0
- data/vendor/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +51 -0
- data/vendor/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +391 -0
- data/vendor/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +1316 -0
- data/vendor/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +430 -0
- data/vendor/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +322 -0
- data/vendor/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h +1061 -0
- data/vendor/eigen/Eigen/src/Core/arch/CUDA/Complex.h +103 -0
- data/vendor/eigen/Eigen/src/Core/arch/CUDA/Half.h +674 -0
- data/vendor/eigen/Eigen/src/Core/arch/CUDA/MathFunctions.h +91 -0
- data/vendor/eigen/Eigen/src/Core/arch/CUDA/PacketMath.h +333 -0
- data/vendor/eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h +1124 -0
- data/vendor/eigen/Eigen/src/Core/arch/CUDA/TypeCasting.h +212 -0
- data/vendor/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +29 -0
- data/vendor/eigen/Eigen/src/Core/arch/Default/Settings.h +49 -0
- data/vendor/eigen/Eigen/src/Core/arch/NEON/Complex.h +490 -0
- data/vendor/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +91 -0
- data/vendor/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +760 -0
- data/vendor/eigen/Eigen/src/Core/arch/SSE/Complex.h +471 -0
- data/vendor/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +562 -0
- data/vendor/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +895 -0
- data/vendor/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +77 -0
- data/vendor/eigen/Eigen/src/Core/arch/ZVector/Complex.h +397 -0
- data/vendor/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +137 -0
- data/vendor/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +945 -0
- data/vendor/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +168 -0
- data/vendor/eigen/Eigen/src/Core/functors/BinaryFunctors.h +475 -0
- data/vendor/eigen/Eigen/src/Core/functors/NullaryFunctors.h +188 -0
- data/vendor/eigen/Eigen/src/Core/functors/StlFunctors.h +136 -0
- data/vendor/eigen/Eigen/src/Core/functors/TernaryFunctors.h +25 -0
- data/vendor/eigen/Eigen/src/Core/functors/UnaryFunctors.h +792 -0
- data/vendor/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +2156 -0
- data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +492 -0
- data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +311 -0
- data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +145 -0
- data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +122 -0
- data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +619 -0
- data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +136 -0
- data/vendor/eigen/Eigen/src/Core/products/Parallelizer.h +163 -0
- data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +521 -0
- data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +287 -0
- data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +260 -0
- data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h +118 -0
- data/vendor/eigen/Eigen/src/Core/products/SelfadjointProduct.h +133 -0
- data/vendor/eigen/Eigen/src/Core/products/SelfadjointRank2Update.h +93 -0
- data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h +466 -0
- data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +315 -0
- data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixVector.h +350 -0
- data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h +255 -0
- data/vendor/eigen/Eigen/src/Core/products/TriangularSolverMatrix.h +335 -0
- data/vendor/eigen/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +163 -0
- data/vendor/eigen/Eigen/src/Core/products/TriangularSolverVector.h +145 -0
- data/vendor/eigen/Eigen/src/Core/util/BlasUtil.h +398 -0
- data/vendor/eigen/Eigen/src/Core/util/Constants.h +547 -0
- data/vendor/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +83 -0
- data/vendor/eigen/Eigen/src/Core/util/ForwardDeclarations.h +302 -0
- data/vendor/eigen/Eigen/src/Core/util/MKL_support.h +130 -0
- data/vendor/eigen/Eigen/src/Core/util/Macros.h +1001 -0
- data/vendor/eigen/Eigen/src/Core/util/Memory.h +993 -0
- data/vendor/eigen/Eigen/src/Core/util/Meta.h +534 -0
- data/vendor/eigen/Eigen/src/Core/util/NonMPL2.h +3 -0
- data/vendor/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h +27 -0
- data/vendor/eigen/Eigen/src/Core/util/StaticAssert.h +218 -0
- data/vendor/eigen/Eigen/src/Core/util/XprHelper.h +821 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h +346 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/ComplexSchur.h +459 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h +91 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/EigenSolver.h +622 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +418 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +226 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h +374 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +158 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/RealQZ.h +654 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/RealSchur.h +546 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +77 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +870 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +87 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +556 -0
- data/vendor/eigen/Eigen/src/Geometry/AlignedBox.h +392 -0
- data/vendor/eigen/Eigen/src/Geometry/AngleAxis.h +247 -0
- data/vendor/eigen/Eigen/src/Geometry/EulerAngles.h +114 -0
- data/vendor/eigen/Eigen/src/Geometry/Homogeneous.h +497 -0
- data/vendor/eigen/Eigen/src/Geometry/Hyperplane.h +282 -0
- data/vendor/eigen/Eigen/src/Geometry/OrthoMethods.h +234 -0
- data/vendor/eigen/Eigen/src/Geometry/ParametrizedLine.h +195 -0
- data/vendor/eigen/Eigen/src/Geometry/Quaternion.h +814 -0
- data/vendor/eigen/Eigen/src/Geometry/Rotation2D.h +199 -0
- data/vendor/eigen/Eigen/src/Geometry/RotationBase.h +206 -0
- data/vendor/eigen/Eigen/src/Geometry/Scaling.h +170 -0
- data/vendor/eigen/Eigen/src/Geometry/Transform.h +1542 -0
- data/vendor/eigen/Eigen/src/Geometry/Translation.h +208 -0
- data/vendor/eigen/Eigen/src/Geometry/Umeyama.h +166 -0
- data/vendor/eigen/Eigen/src/Geometry/arch/Geometry_SSE.h +161 -0
- data/vendor/eigen/Eigen/src/Householder/BlockHouseholder.h +103 -0
- data/vendor/eigen/Eigen/src/Householder/Householder.h +172 -0
- data/vendor/eigen/Eigen/src/Householder/HouseholderSequence.h +470 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +226 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +228 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +246 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +400 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +462 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +394 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +216 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +115 -0
- data/vendor/eigen/Eigen/src/Jacobi/Jacobi.h +462 -0
- data/vendor/eigen/Eigen/src/LU/Determinant.h +101 -0
- data/vendor/eigen/Eigen/src/LU/FullPivLU.h +891 -0
- data/vendor/eigen/Eigen/src/LU/InverseImpl.h +415 -0
- data/vendor/eigen/Eigen/src/LU/PartialPivLU.h +611 -0
- data/vendor/eigen/Eigen/src/LU/PartialPivLU_LAPACKE.h +83 -0
- data/vendor/eigen/Eigen/src/LU/arch/Inverse_SSE.h +338 -0
- data/vendor/eigen/Eigen/src/MetisSupport/MetisSupport.h +137 -0
- data/vendor/eigen/Eigen/src/OrderingMethods/Amd.h +445 -0
- data/vendor/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +1843 -0
- data/vendor/eigen/Eigen/src/OrderingMethods/Ordering.h +157 -0
- data/vendor/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h +678 -0
- data/vendor/eigen/Eigen/src/PardisoSupport/PardisoSupport.h +543 -0
- data/vendor/eigen/Eigen/src/QR/ColPivHouseholderQR.h +653 -0
- data/vendor/eigen/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +97 -0
- data/vendor/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +562 -0
- data/vendor/eigen/Eigen/src/QR/FullPivHouseholderQR.h +676 -0
- data/vendor/eigen/Eigen/src/QR/HouseholderQR.h +409 -0
- data/vendor/eigen/Eigen/src/QR/HouseholderQR_LAPACKE.h +68 -0
- data/vendor/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +313 -0
- data/vendor/eigen/Eigen/src/SVD/BDCSVD.h +1246 -0
- data/vendor/eigen/Eigen/src/SVD/JacobiSVD.h +804 -0
- data/vendor/eigen/Eigen/src/SVD/JacobiSVD_LAPACKE.h +91 -0
- data/vendor/eigen/Eigen/src/SVD/SVDBase.h +315 -0
- data/vendor/eigen/Eigen/src/SVD/UpperBidiagonalization.h +414 -0
- data/vendor/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +689 -0
- data/vendor/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +199 -0
- data/vendor/eigen/Eigen/src/SparseCore/AmbiVector.h +377 -0
- data/vendor/eigen/Eigen/src/SparseCore/CompressedStorage.h +258 -0
- data/vendor/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +352 -0
- data/vendor/eigen/Eigen/src/SparseCore/MappedSparseMatrix.h +67 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseAssign.h +216 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseBlock.h +603 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseColEtree.h +206 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +341 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +726 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +148 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +320 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseDiagonalProduct.h +138 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseDot.h +98 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseFuzzy.h +29 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseMap.h +305 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseMatrix.h +1403 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +405 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparsePermutation.h +178 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseProduct.h +169 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseRedux.h +49 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseRef.h +397 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h +656 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseSolverBase.h +124 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +198 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseTranspose.h +92 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseTriangularView.h +189 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseUtil.h +178 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseVector.h +478 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseView.h +253 -0
- data/vendor/eigen/Eigen/src/SparseCore/TriangularSolver.h +315 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU.h +773 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLUImpl.h +66 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_Memory.h +226 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_Structs.h +110 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +301 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_Utils.h +80 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_column_bmod.h +181 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +179 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +107 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +280 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +126 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +130 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_panel_bmod.h +223 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_panel_dfs.h +258 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_pivotL.h +137 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_pruneL.h +136 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_relax_snode.h +83 -0
- data/vendor/eigen/Eigen/src/SparseQR/SparseQR.h +745 -0
- data/vendor/eigen/Eigen/src/StlSupport/StdDeque.h +126 -0
- data/vendor/eigen/Eigen/src/StlSupport/StdList.h +106 -0
- data/vendor/eigen/Eigen/src/StlSupport/StdVector.h +131 -0
- data/vendor/eigen/Eigen/src/StlSupport/details.h +84 -0
- data/vendor/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h +1027 -0
- data/vendor/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h +506 -0
- data/vendor/eigen/Eigen/src/misc/Image.h +82 -0
- data/vendor/eigen/Eigen/src/misc/Kernel.h +79 -0
- data/vendor/eigen/Eigen/src/misc/RealSvd2x2.h +55 -0
- data/vendor/eigen/Eigen/src/misc/blas.h +440 -0
- data/vendor/eigen/Eigen/src/misc/lapack.h +152 -0
- data/vendor/eigen/Eigen/src/misc/lapacke.h +16291 -0
- data/vendor/eigen/Eigen/src/misc/lapacke_mangling.h +17 -0
- data/vendor/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h +332 -0
- data/vendor/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +552 -0
- data/vendor/eigen/Eigen/src/plugins/BlockMethods.h +1058 -0
- data/vendor/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.h +115 -0
- data/vendor/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.h +163 -0
- data/vendor/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +152 -0
- data/vendor/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +85 -0
- data/vendor/eigen/README.md +3 -0
- data/vendor/eigen/bench/README.txt +55 -0
- data/vendor/eigen/bench/btl/COPYING +340 -0
- data/vendor/eigen/bench/btl/README +154 -0
- data/vendor/eigen/bench/tensors/README +21 -0
- data/vendor/eigen/blas/README.txt +6 -0
- data/vendor/eigen/demos/mandelbrot/README +10 -0
- data/vendor/eigen/demos/mix_eigen_and_c/README +9 -0
- data/vendor/eigen/demos/opengl/README +13 -0
- data/vendor/eigen/unsupported/Eigen/CXX11/src/Tensor/README.md +1760 -0
- data/vendor/eigen/unsupported/README.txt +50 -0
- data/vendor/tomotopy/LICENSE +21 -0
- data/vendor/tomotopy/README.kr.rst +375 -0
- data/vendor/tomotopy/README.rst +382 -0
- data/vendor/tomotopy/src/Labeling/FoRelevance.cpp +362 -0
- data/vendor/tomotopy/src/Labeling/FoRelevance.h +88 -0
- data/vendor/tomotopy/src/Labeling/Labeler.h +50 -0
- data/vendor/tomotopy/src/TopicModel/CT.h +37 -0
- data/vendor/tomotopy/src/TopicModel/CTModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/CTModel.hpp +293 -0
- data/vendor/tomotopy/src/TopicModel/DMR.h +51 -0
- data/vendor/tomotopy/src/TopicModel/DMRModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/DMRModel.hpp +374 -0
- data/vendor/tomotopy/src/TopicModel/DT.h +65 -0
- data/vendor/tomotopy/src/TopicModel/DTM.h +22 -0
- data/vendor/tomotopy/src/TopicModel/DTModel.cpp +15 -0
- data/vendor/tomotopy/src/TopicModel/DTModel.hpp +572 -0
- data/vendor/tomotopy/src/TopicModel/GDMR.h +37 -0
- data/vendor/tomotopy/src/TopicModel/GDMRModel.cpp +14 -0
- data/vendor/tomotopy/src/TopicModel/GDMRModel.hpp +485 -0
- data/vendor/tomotopy/src/TopicModel/HDP.h +74 -0
- data/vendor/tomotopy/src/TopicModel/HDPModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/HDPModel.hpp +592 -0
- data/vendor/tomotopy/src/TopicModel/HLDA.h +40 -0
- data/vendor/tomotopy/src/TopicModel/HLDAModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/HLDAModel.hpp +681 -0
- data/vendor/tomotopy/src/TopicModel/HPA.h +27 -0
- data/vendor/tomotopy/src/TopicModel/HPAModel.cpp +21 -0
- data/vendor/tomotopy/src/TopicModel/HPAModel.hpp +588 -0
- data/vendor/tomotopy/src/TopicModel/LDA.h +144 -0
- data/vendor/tomotopy/src/TopicModel/LDACVB0Model.hpp +442 -0
- data/vendor/tomotopy/src/TopicModel/LDAModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/LDAModel.hpp +1058 -0
- data/vendor/tomotopy/src/TopicModel/LLDA.h +45 -0
- data/vendor/tomotopy/src/TopicModel/LLDAModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/LLDAModel.hpp +203 -0
- data/vendor/tomotopy/src/TopicModel/MGLDA.h +63 -0
- data/vendor/tomotopy/src/TopicModel/MGLDAModel.cpp +17 -0
- data/vendor/tomotopy/src/TopicModel/MGLDAModel.hpp +558 -0
- data/vendor/tomotopy/src/TopicModel/PA.h +43 -0
- data/vendor/tomotopy/src/TopicModel/PAModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/PAModel.hpp +467 -0
- data/vendor/tomotopy/src/TopicModel/PLDA.h +17 -0
- data/vendor/tomotopy/src/TopicModel/PLDAModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/PLDAModel.hpp +214 -0
- data/vendor/tomotopy/src/TopicModel/SLDA.h +54 -0
- data/vendor/tomotopy/src/TopicModel/SLDAModel.cpp +17 -0
- data/vendor/tomotopy/src/TopicModel/SLDAModel.hpp +456 -0
- data/vendor/tomotopy/src/TopicModel/TopicModel.hpp +692 -0
- data/vendor/tomotopy/src/Utils/AliasMethod.hpp +169 -0
- data/vendor/tomotopy/src/Utils/Dictionary.h +80 -0
- data/vendor/tomotopy/src/Utils/EigenAddonOps.hpp +181 -0
- data/vendor/tomotopy/src/Utils/LBFGS.h +202 -0
- data/vendor/tomotopy/src/Utils/LBFGS/LineSearchBacktracking.h +120 -0
- data/vendor/tomotopy/src/Utils/LBFGS/LineSearchBracketing.h +122 -0
- data/vendor/tomotopy/src/Utils/LBFGS/Param.h +213 -0
- data/vendor/tomotopy/src/Utils/LUT.hpp +82 -0
- data/vendor/tomotopy/src/Utils/MultiNormalDistribution.hpp +69 -0
- data/vendor/tomotopy/src/Utils/PolyaGamma.hpp +200 -0
- data/vendor/tomotopy/src/Utils/PolyaGammaHybrid.hpp +672 -0
- data/vendor/tomotopy/src/Utils/ThreadPool.hpp +150 -0
- data/vendor/tomotopy/src/Utils/Trie.hpp +220 -0
- data/vendor/tomotopy/src/Utils/TruncMultiNormal.hpp +94 -0
- data/vendor/tomotopy/src/Utils/Utils.hpp +337 -0
- data/vendor/tomotopy/src/Utils/avx_gamma.h +46 -0
- data/vendor/tomotopy/src/Utils/avx_mathfun.h +736 -0
- data/vendor/tomotopy/src/Utils/exception.h +28 -0
- data/vendor/tomotopy/src/Utils/math.h +281 -0
- data/vendor/tomotopy/src/Utils/rtnorm.hpp +2690 -0
- data/vendor/tomotopy/src/Utils/sample.hpp +192 -0
- data/vendor/tomotopy/src/Utils/serializer.hpp +695 -0
- data/vendor/tomotopy/src/Utils/slp.hpp +131 -0
- data/vendor/tomotopy/src/Utils/sse_gamma.h +48 -0
- data/vendor/tomotopy/src/Utils/sse_mathfun.h +710 -0
- data/vendor/tomotopy/src/Utils/text.hpp +49 -0
- data/vendor/tomotopy/src/Utils/tvector.hpp +543 -0
- metadata +531 -0
@@ -0,0 +1,27 @@
|
|
1
|
+
#ifdef EIGEN_WARNINGS_DISABLED
|
2
|
+
#undef EIGEN_WARNINGS_DISABLED
|
3
|
+
|
4
|
+
#ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
|
5
|
+
#ifdef _MSC_VER
|
6
|
+
#pragma warning( pop )
|
7
|
+
#elif defined __INTEL_COMPILER
|
8
|
+
#pragma warning pop
|
9
|
+
#elif defined __clang__
|
10
|
+
#pragma clang diagnostic pop
|
11
|
+
#elif defined __GNUC__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
|
12
|
+
#pragma GCC diagnostic pop
|
13
|
+
#endif
|
14
|
+
|
15
|
+
#if defined __NVCC__
|
16
|
+
// Don't reenable the diagnostic messages, as it turns out these messages need
|
17
|
+
// to be disabled at the point of the template instantiation (i.e the user code)
|
18
|
+
// otherwise they'll be triggered by nvcc.
|
19
|
+
// #pragma diag_default code_is_unreachable
|
20
|
+
// #pragma diag_default initialization_not_reachable
|
21
|
+
// #pragma diag_default 2651
|
22
|
+
// #pragma diag_default 2653
|
23
|
+
#endif
|
24
|
+
|
25
|
+
#endif
|
26
|
+
|
27
|
+
#endif // EIGEN_WARNINGS_DISABLED
|
@@ -0,0 +1,218 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
|
5
|
+
// Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>
|
6
|
+
//
|
7
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
8
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
9
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
10
|
+
|
11
|
+
#ifndef EIGEN_STATIC_ASSERT_H
|
12
|
+
#define EIGEN_STATIC_ASSERT_H
|
13
|
+
|
14
|
+
/* Some notes on Eigen's static assertion mechanism:
|
15
|
+
*
|
16
|
+
* - in EIGEN_STATIC_ASSERT(CONDITION,MSG) the parameter CONDITION must be a compile time boolean
|
17
|
+
* expression, and MSG an enum listed in struct internal::static_assertion<true>
|
18
|
+
*
|
19
|
+
* - define EIGEN_NO_STATIC_ASSERT to disable them (and save compilation time)
|
20
|
+
* in that case, the static assertion is converted to the following runtime assert:
|
21
|
+
* eigen_assert(CONDITION && "MSG")
|
22
|
+
*
|
23
|
+
* - currently EIGEN_STATIC_ASSERT can only be used in function scope
|
24
|
+
*
|
25
|
+
*/
|
26
|
+
|
27
|
+
#ifndef EIGEN_STATIC_ASSERT
|
28
|
+
#ifndef EIGEN_NO_STATIC_ASSERT
|
29
|
+
|
30
|
+
#if EIGEN_MAX_CPP_VER>=11 && (__has_feature(cxx_static_assert) || (defined(__cplusplus) && __cplusplus >= 201103L) || (EIGEN_COMP_MSVC >= 1600))
|
31
|
+
|
32
|
+
// if native static_assert is enabled, let's use it
|
33
|
+
#define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG);
|
34
|
+
|
35
|
+
#else // not CXX0X
|
36
|
+
|
37
|
+
namespace Eigen {
|
38
|
+
|
39
|
+
namespace internal {
|
40
|
+
|
41
|
+
template<bool condition>
|
42
|
+
struct static_assertion {};
|
43
|
+
|
44
|
+
template<>
|
45
|
+
struct static_assertion<true>
|
46
|
+
{
|
47
|
+
enum {
|
48
|
+
YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX=1,
|
49
|
+
YOU_MIXED_VECTORS_OF_DIFFERENT_SIZES=1,
|
50
|
+
YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES=1,
|
51
|
+
THIS_METHOD_IS_ONLY_FOR_VECTORS_OF_A_SPECIFIC_SIZE=1,
|
52
|
+
THIS_METHOD_IS_ONLY_FOR_MATRICES_OF_A_SPECIFIC_SIZE=1,
|
53
|
+
THIS_METHOD_IS_ONLY_FOR_OBJECTS_OF_A_SPECIFIC_SIZE=1,
|
54
|
+
OUT_OF_RANGE_ACCESS=1,
|
55
|
+
YOU_MADE_A_PROGRAMMING_MISTAKE=1,
|
56
|
+
EIGEN_INTERNAL_ERROR_PLEASE_FILE_A_BUG_REPORT=1,
|
57
|
+
EIGEN_INTERNAL_COMPILATION_ERROR_OR_YOU_MADE_A_PROGRAMMING_MISTAKE=1,
|
58
|
+
YOU_CALLED_A_FIXED_SIZE_METHOD_ON_A_DYNAMIC_SIZE_MATRIX_OR_VECTOR=1,
|
59
|
+
YOU_CALLED_A_DYNAMIC_SIZE_METHOD_ON_A_FIXED_SIZE_MATRIX_OR_VECTOR=1,
|
60
|
+
UNALIGNED_LOAD_AND_STORE_OPERATIONS_UNIMPLEMENTED_ON_ALTIVEC=1,
|
61
|
+
THIS_FUNCTION_IS_NOT_FOR_INTEGER_NUMERIC_TYPES=1,
|
62
|
+
FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED=1,
|
63
|
+
NUMERIC_TYPE_MUST_BE_REAL=1,
|
64
|
+
COEFFICIENT_WRITE_ACCESS_TO_SELFADJOINT_NOT_SUPPORTED=1,
|
65
|
+
WRITING_TO_TRIANGULAR_PART_WITH_UNIT_DIAGONAL_IS_NOT_SUPPORTED=1,
|
66
|
+
THIS_METHOD_IS_ONLY_FOR_FIXED_SIZE=1,
|
67
|
+
INVALID_MATRIX_PRODUCT=1,
|
68
|
+
INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS=1,
|
69
|
+
INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION=1,
|
70
|
+
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY=1,
|
71
|
+
THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES=1,
|
72
|
+
THIS_METHOD_IS_ONLY_FOR_ROW_MAJOR_MATRICES=1,
|
73
|
+
INVALID_MATRIX_TEMPLATE_PARAMETERS=1,
|
74
|
+
INVALID_MATRIXBASE_TEMPLATE_PARAMETERS=1,
|
75
|
+
BOTH_MATRICES_MUST_HAVE_THE_SAME_STORAGE_ORDER=1,
|
76
|
+
THIS_METHOD_IS_ONLY_FOR_DIAGONAL_MATRIX=1,
|
77
|
+
THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE=1,
|
78
|
+
THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_WITH_DIRECT_MEMORY_ACCESS_SUCH_AS_MAP_OR_PLAIN_MATRICES=1,
|
79
|
+
YOU_ALREADY_SPECIFIED_THIS_STRIDE=1,
|
80
|
+
INVALID_STORAGE_ORDER_FOR_THIS_VECTOR_EXPRESSION=1,
|
81
|
+
THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD=1,
|
82
|
+
PACKET_ACCESS_REQUIRES_TO_HAVE_INNER_STRIDE_FIXED_TO_1=1,
|
83
|
+
THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS=1,
|
84
|
+
YOU_CANNOT_MIX_ARRAYS_AND_MATRICES=1,
|
85
|
+
YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION=1,
|
86
|
+
THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY=1,
|
87
|
+
YOU_ARE_TRYING_TO_USE_AN_INDEX_BASED_ACCESSOR_ON_AN_EXPRESSION_THAT_DOES_NOT_SUPPORT_THAT=1,
|
88
|
+
THIS_METHOD_IS_ONLY_FOR_1x1_EXPRESSIONS=1,
|
89
|
+
THIS_METHOD_IS_ONLY_FOR_INNER_OR_LAZY_PRODUCTS=1,
|
90
|
+
THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL=1,
|
91
|
+
THIS_METHOD_IS_ONLY_FOR_ARRAYS_NOT_MATRICES=1,
|
92
|
+
YOU_PASSED_A_ROW_VECTOR_BUT_A_COLUMN_VECTOR_WAS_EXPECTED=1,
|
93
|
+
YOU_PASSED_A_COLUMN_VECTOR_BUT_A_ROW_VECTOR_WAS_EXPECTED=1,
|
94
|
+
THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE=1,
|
95
|
+
THE_STORAGE_ORDER_OF_BOTH_SIDES_MUST_MATCH=1,
|
96
|
+
OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG=1,
|
97
|
+
IMPLICIT_CONVERSION_TO_SCALAR_IS_FOR_INNER_PRODUCT_ONLY=1,
|
98
|
+
STORAGE_LAYOUT_DOES_NOT_MATCH=1,
|
99
|
+
EIGEN_INTERNAL_ERROR_PLEASE_FILE_A_BUG_REPORT__INVALID_COST_VALUE=1,
|
100
|
+
THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS=1,
|
101
|
+
MATRIX_FREE_CONJUGATE_GRADIENT_IS_COMPATIBLE_WITH_UPPER_UNION_LOWER_MODE_ONLY=1,
|
102
|
+
THIS_TYPE_IS_NOT_SUPPORTED=1,
|
103
|
+
STORAGE_KIND_MUST_MATCH=1,
|
104
|
+
STORAGE_INDEX_MUST_MATCH=1,
|
105
|
+
CHOLMOD_SUPPORTS_DOUBLE_PRECISION_ONLY=1,
|
106
|
+
SELFADJOINTVIEW_ACCEPTS_UPPER_AND_LOWER_MODE_ONLY=1
|
107
|
+
};
|
108
|
+
};
|
109
|
+
|
110
|
+
} // end namespace internal
|
111
|
+
|
112
|
+
} // end namespace Eigen
|
113
|
+
|
114
|
+
// Specialized implementation for MSVC to avoid "conditional
|
115
|
+
// expression is constant" warnings. This implementation doesn't
|
116
|
+
// appear to work under GCC, hence the multiple implementations.
|
117
|
+
#if EIGEN_COMP_MSVC
|
118
|
+
|
119
|
+
#define EIGEN_STATIC_ASSERT(CONDITION,MSG) \
|
120
|
+
{Eigen::internal::static_assertion<bool(CONDITION)>::MSG;}
|
121
|
+
|
122
|
+
#else
|
123
|
+
// In some cases clang interprets bool(CONDITION) as function declaration
|
124
|
+
#define EIGEN_STATIC_ASSERT(CONDITION,MSG) \
|
125
|
+
if (Eigen::internal::static_assertion<static_cast<bool>(CONDITION)>::MSG) {}
|
126
|
+
|
127
|
+
#endif
|
128
|
+
|
129
|
+
#endif // not CXX0X
|
130
|
+
|
131
|
+
#else // EIGEN_NO_STATIC_ASSERT
|
132
|
+
|
133
|
+
#define EIGEN_STATIC_ASSERT(CONDITION,MSG) eigen_assert((CONDITION) && #MSG);
|
134
|
+
|
135
|
+
#endif // EIGEN_NO_STATIC_ASSERT
|
136
|
+
#endif // EIGEN_STATIC_ASSERT
|
137
|
+
|
138
|
+
// static assertion failing if the type \a TYPE is not a vector type
|
139
|
+
#define EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE) \
|
140
|
+
EIGEN_STATIC_ASSERT(TYPE::IsVectorAtCompileTime, \
|
141
|
+
YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX)
|
142
|
+
|
143
|
+
// static assertion failing if the type \a TYPE is not fixed-size
|
144
|
+
#define EIGEN_STATIC_ASSERT_FIXED_SIZE(TYPE) \
|
145
|
+
EIGEN_STATIC_ASSERT(TYPE::SizeAtCompileTime!=Eigen::Dynamic, \
|
146
|
+
YOU_CALLED_A_FIXED_SIZE_METHOD_ON_A_DYNAMIC_SIZE_MATRIX_OR_VECTOR)
|
147
|
+
|
148
|
+
// static assertion failing if the type \a TYPE is not dynamic-size
|
149
|
+
#define EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(TYPE) \
|
150
|
+
EIGEN_STATIC_ASSERT(TYPE::SizeAtCompileTime==Eigen::Dynamic, \
|
151
|
+
YOU_CALLED_A_DYNAMIC_SIZE_METHOD_ON_A_FIXED_SIZE_MATRIX_OR_VECTOR)
|
152
|
+
|
153
|
+
// static assertion failing if the type \a TYPE is not a vector type of the given size
|
154
|
+
#define EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(TYPE, SIZE) \
|
155
|
+
EIGEN_STATIC_ASSERT(TYPE::IsVectorAtCompileTime && TYPE::SizeAtCompileTime==SIZE, \
|
156
|
+
THIS_METHOD_IS_ONLY_FOR_VECTORS_OF_A_SPECIFIC_SIZE)
|
157
|
+
|
158
|
+
// static assertion failing if the type \a TYPE is not a vector type of the given size
|
159
|
+
#define EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(TYPE, ROWS, COLS) \
|
160
|
+
EIGEN_STATIC_ASSERT(TYPE::RowsAtCompileTime==ROWS && TYPE::ColsAtCompileTime==COLS, \
|
161
|
+
THIS_METHOD_IS_ONLY_FOR_MATRICES_OF_A_SPECIFIC_SIZE)
|
162
|
+
|
163
|
+
// static assertion failing if the two vector expression types are not compatible (same fixed-size or dynamic size)
|
164
|
+
#define EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(TYPE0,TYPE1) \
|
165
|
+
EIGEN_STATIC_ASSERT( \
|
166
|
+
(int(TYPE0::SizeAtCompileTime)==Eigen::Dynamic \
|
167
|
+
|| int(TYPE1::SizeAtCompileTime)==Eigen::Dynamic \
|
168
|
+
|| int(TYPE0::SizeAtCompileTime)==int(TYPE1::SizeAtCompileTime)),\
|
169
|
+
YOU_MIXED_VECTORS_OF_DIFFERENT_SIZES)
|
170
|
+
|
171
|
+
#define EIGEN_PREDICATE_SAME_MATRIX_SIZE(TYPE0,TYPE1) \
|
172
|
+
( \
|
173
|
+
(int(Eigen::internal::size_of_xpr_at_compile_time<TYPE0>::ret)==0 && int(Eigen::internal::size_of_xpr_at_compile_time<TYPE1>::ret)==0) \
|
174
|
+
|| (\
|
175
|
+
(int(TYPE0::RowsAtCompileTime)==Eigen::Dynamic \
|
176
|
+
|| int(TYPE1::RowsAtCompileTime)==Eigen::Dynamic \
|
177
|
+
|| int(TYPE0::RowsAtCompileTime)==int(TYPE1::RowsAtCompileTime)) \
|
178
|
+
&& (int(TYPE0::ColsAtCompileTime)==Eigen::Dynamic \
|
179
|
+
|| int(TYPE1::ColsAtCompileTime)==Eigen::Dynamic \
|
180
|
+
|| int(TYPE0::ColsAtCompileTime)==int(TYPE1::ColsAtCompileTime))\
|
181
|
+
) \
|
182
|
+
)
|
183
|
+
|
184
|
+
#define EIGEN_STATIC_ASSERT_NON_INTEGER(TYPE) \
|
185
|
+
EIGEN_STATIC_ASSERT(!NumTraits<TYPE>::IsInteger, THIS_FUNCTION_IS_NOT_FOR_INTEGER_NUMERIC_TYPES)
|
186
|
+
|
187
|
+
|
188
|
+
// static assertion failing if it is guaranteed at compile-time that the two matrix expression types have different sizes
|
189
|
+
#define EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(TYPE0,TYPE1) \
|
190
|
+
EIGEN_STATIC_ASSERT( \
|
191
|
+
EIGEN_PREDICATE_SAME_MATRIX_SIZE(TYPE0,TYPE1),\
|
192
|
+
YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES)
|
193
|
+
|
194
|
+
#define EIGEN_STATIC_ASSERT_SIZE_1x1(TYPE) \
|
195
|
+
EIGEN_STATIC_ASSERT((TYPE::RowsAtCompileTime == 1 || TYPE::RowsAtCompileTime == Dynamic) && \
|
196
|
+
(TYPE::ColsAtCompileTime == 1 || TYPE::ColsAtCompileTime == Dynamic), \
|
197
|
+
THIS_METHOD_IS_ONLY_FOR_1x1_EXPRESSIONS)
|
198
|
+
|
199
|
+
#define EIGEN_STATIC_ASSERT_LVALUE(Derived) \
|
200
|
+
EIGEN_STATIC_ASSERT(Eigen::internal::is_lvalue<Derived>::value, \
|
201
|
+
THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY)
|
202
|
+
|
203
|
+
#define EIGEN_STATIC_ASSERT_ARRAYXPR(Derived) \
|
204
|
+
EIGEN_STATIC_ASSERT((Eigen::internal::is_same<typename Eigen::internal::traits<Derived>::XprKind, ArrayXpr>::value), \
|
205
|
+
THIS_METHOD_IS_ONLY_FOR_ARRAYS_NOT_MATRICES)
|
206
|
+
|
207
|
+
#define EIGEN_STATIC_ASSERT_SAME_XPR_KIND(Derived1, Derived2) \
|
208
|
+
EIGEN_STATIC_ASSERT((Eigen::internal::is_same<typename Eigen::internal::traits<Derived1>::XprKind, \
|
209
|
+
typename Eigen::internal::traits<Derived2>::XprKind \
|
210
|
+
>::value), \
|
211
|
+
YOU_CANNOT_MIX_ARRAYS_AND_MATRICES)
|
212
|
+
|
213
|
+
// Check that a cost value is positive, and that is stay within a reasonable range
|
214
|
+
// TODO this check could be enabled for internal debugging only
|
215
|
+
#define EIGEN_INTERNAL_CHECK_COST_VALUE(C) \
|
216
|
+
EIGEN_STATIC_ASSERT((C)>=0 && (C)<=HugeCost*HugeCost, EIGEN_INTERNAL_ERROR_PLEASE_FILE_A_BUG_REPORT__INVALID_COST_VALUE);
|
217
|
+
|
218
|
+
#endif // EIGEN_STATIC_ASSERT_H
|
@@ -0,0 +1,821 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
|
5
|
+
// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
|
6
|
+
//
|
7
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
8
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
9
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
10
|
+
|
11
|
+
#ifndef EIGEN_XPRHELPER_H
|
12
|
+
#define EIGEN_XPRHELPER_H
|
13
|
+
|
14
|
+
// just a workaround because GCC seems to not really like empty structs
|
15
|
+
// FIXME: gcc 4.3 generates bad code when strict-aliasing is enabled
|
16
|
+
// so currently we simply disable this optimization for gcc 4.3
|
17
|
+
#if EIGEN_COMP_GNUC && !EIGEN_GNUC_AT(4,3)
|
18
|
+
#define EIGEN_EMPTY_STRUCT_CTOR(X) \
|
19
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE X() {} \
|
20
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE X(const X& ) {}
|
21
|
+
#else
|
22
|
+
#define EIGEN_EMPTY_STRUCT_CTOR(X)
|
23
|
+
#endif
|
24
|
+
|
25
|
+
namespace Eigen {
|
26
|
+
|
27
|
+
namespace internal {
|
28
|
+
|
29
|
+
template<typename IndexDest, typename IndexSrc>
|
30
|
+
EIGEN_DEVICE_FUNC
|
31
|
+
inline IndexDest convert_index(const IndexSrc& idx) {
|
32
|
+
// for sizeof(IndexDest)>=sizeof(IndexSrc) compilers should be able to optimize this away:
|
33
|
+
eigen_internal_assert(idx <= NumTraits<IndexDest>::highest() && "Index value to big for target type");
|
34
|
+
return IndexDest(idx);
|
35
|
+
}
|
36
|
+
|
37
|
+
|
38
|
+
// promote_scalar_arg is an helper used in operation between an expression and a scalar, like:
|
39
|
+
// expression * scalar
|
40
|
+
// Its role is to determine how the type T of the scalar operand should be promoted given the scalar type ExprScalar of the given expression.
|
41
|
+
// The IsSupported template parameter must be provided by the caller as: internal::has_ReturnType<ScalarBinaryOpTraits<ExprScalar,T,op> >::value using the proper order for ExprScalar and T.
|
42
|
+
// Then the logic is as follows:
|
43
|
+
// - if the operation is natively supported as defined by IsSupported, then the scalar type is not promoted, and T is returned.
|
44
|
+
// - otherwise, NumTraits<ExprScalar>::Literal is returned if T is implicitly convertible to NumTraits<ExprScalar>::Literal AND that this does not imply a float to integer conversion.
|
45
|
+
// - otherwise, ExprScalar is returned if T is implicitly convertible to ExprScalar AND that this does not imply a float to integer conversion.
|
46
|
+
// - In all other cases, the promoted type is not defined, and the respective operation is thus invalid and not available (SFINAE).
|
47
|
+
template<typename ExprScalar,typename T, bool IsSupported>
|
48
|
+
struct promote_scalar_arg;
|
49
|
+
|
50
|
+
template<typename S,typename T>
|
51
|
+
struct promote_scalar_arg<S,T,true>
|
52
|
+
{
|
53
|
+
typedef T type;
|
54
|
+
};
|
55
|
+
|
56
|
+
// Recursively check safe conversion to PromotedType, and then ExprScalar if they are different.
|
57
|
+
template<typename ExprScalar,typename T,typename PromotedType,
|
58
|
+
bool ConvertibleToLiteral = internal::is_convertible<T,PromotedType>::value,
|
59
|
+
bool IsSafe = NumTraits<T>::IsInteger || !NumTraits<PromotedType>::IsInteger>
|
60
|
+
struct promote_scalar_arg_unsupported;
|
61
|
+
|
62
|
+
// Start recursion with NumTraits<ExprScalar>::Literal
|
63
|
+
template<typename S,typename T>
|
64
|
+
struct promote_scalar_arg<S,T,false> : promote_scalar_arg_unsupported<S,T,typename NumTraits<S>::Literal> {};
|
65
|
+
|
66
|
+
// We found a match!
|
67
|
+
template<typename S,typename T, typename PromotedType>
|
68
|
+
struct promote_scalar_arg_unsupported<S,T,PromotedType,true,true>
|
69
|
+
{
|
70
|
+
typedef PromotedType type;
|
71
|
+
};
|
72
|
+
|
73
|
+
// No match, but no real-to-integer issues, and ExprScalar and current PromotedType are different,
|
74
|
+
// so let's try to promote to ExprScalar
|
75
|
+
template<typename ExprScalar,typename T, typename PromotedType>
|
76
|
+
struct promote_scalar_arg_unsupported<ExprScalar,T,PromotedType,false,true>
|
77
|
+
: promote_scalar_arg_unsupported<ExprScalar,T,ExprScalar>
|
78
|
+
{};
|
79
|
+
|
80
|
+
// Unsafe real-to-integer, let's stop.
|
81
|
+
template<typename S,typename T, typename PromotedType, bool ConvertibleToLiteral>
|
82
|
+
struct promote_scalar_arg_unsupported<S,T,PromotedType,ConvertibleToLiteral,false> {};
|
83
|
+
|
84
|
+
// T is not even convertible to ExprScalar, let's stop.
|
85
|
+
template<typename S,typename T>
|
86
|
+
struct promote_scalar_arg_unsupported<S,T,S,false,true> {};
|
87
|
+
|
88
|
+
//classes inheriting no_assignment_operator don't generate a default operator=.
|
89
|
+
class no_assignment_operator
|
90
|
+
{
|
91
|
+
private:
|
92
|
+
no_assignment_operator& operator=(const no_assignment_operator&);
|
93
|
+
};
|
94
|
+
|
95
|
+
/** \internal return the index type with the largest number of bits */
|
96
|
+
template<typename I1, typename I2>
|
97
|
+
struct promote_index_type
|
98
|
+
{
|
99
|
+
typedef typename conditional<(sizeof(I1)<sizeof(I2)), I2, I1>::type type;
|
100
|
+
};
|
101
|
+
|
102
|
+
/** \internal If the template parameter Value is Dynamic, this class is just a wrapper around a T variable that
|
103
|
+
* can be accessed using value() and setValue().
|
104
|
+
* Otherwise, this class is an empty structure and value() just returns the template parameter Value.
|
105
|
+
*/
|
106
|
+
template<typename T, int Value> class variable_if_dynamic
|
107
|
+
{
|
108
|
+
public:
|
109
|
+
EIGEN_EMPTY_STRUCT_CTOR(variable_if_dynamic)
|
110
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit variable_if_dynamic(T v) { EIGEN_ONLY_USED_FOR_DEBUG(v); eigen_assert(v == T(Value)); }
|
111
|
+
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T value() { return T(Value); }
|
112
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void setValue(T) {}
|
113
|
+
};
|
114
|
+
|
115
|
+
template<typename T> class variable_if_dynamic<T, Dynamic>
|
116
|
+
{
|
117
|
+
T m_value;
|
118
|
+
EIGEN_DEVICE_FUNC variable_if_dynamic() { eigen_assert(false); }
|
119
|
+
public:
|
120
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit variable_if_dynamic(T value) : m_value(value) {}
|
121
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T value() const { return m_value; }
|
122
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void setValue(T value) { m_value = value; }
|
123
|
+
};
|
124
|
+
|
125
|
+
/** \internal like variable_if_dynamic but for DynamicIndex
|
126
|
+
*/
|
127
|
+
template<typename T, int Value> class variable_if_dynamicindex
|
128
|
+
{
|
129
|
+
public:
|
130
|
+
EIGEN_EMPTY_STRUCT_CTOR(variable_if_dynamicindex)
|
131
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit variable_if_dynamicindex(T v) { EIGEN_ONLY_USED_FOR_DEBUG(v); eigen_assert(v == T(Value)); }
|
132
|
+
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T value() { return T(Value); }
|
133
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void setValue(T) {}
|
134
|
+
};
|
135
|
+
|
136
|
+
template<typename T> class variable_if_dynamicindex<T, DynamicIndex>
|
137
|
+
{
|
138
|
+
T m_value;
|
139
|
+
EIGEN_DEVICE_FUNC variable_if_dynamicindex() { eigen_assert(false); }
|
140
|
+
public:
|
141
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit variable_if_dynamicindex(T value) : m_value(value) {}
|
142
|
+
EIGEN_DEVICE_FUNC T EIGEN_STRONG_INLINE value() const { return m_value; }
|
143
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void setValue(T value) { m_value = value; }
|
144
|
+
};
|
145
|
+
|
146
|
+
template<typename T> struct functor_traits
|
147
|
+
{
|
148
|
+
enum
|
149
|
+
{
|
150
|
+
Cost = 10,
|
151
|
+
PacketAccess = false,
|
152
|
+
IsRepeatable = false
|
153
|
+
};
|
154
|
+
};
|
155
|
+
|
156
|
+
template<typename T> struct packet_traits;
|
157
|
+
|
158
|
+
template<typename T> struct unpacket_traits
|
159
|
+
{
|
160
|
+
typedef T type;
|
161
|
+
typedef T half;
|
162
|
+
enum
|
163
|
+
{
|
164
|
+
size = 1,
|
165
|
+
alignment = 1
|
166
|
+
};
|
167
|
+
};
|
168
|
+
|
169
|
+
template<int Size, typename PacketType,
|
170
|
+
bool Stop = Size==Dynamic || (Size%unpacket_traits<PacketType>::size)==0 || is_same<PacketType,typename unpacket_traits<PacketType>::half>::value>
|
171
|
+
struct find_best_packet_helper;
|
172
|
+
|
173
|
+
template< int Size, typename PacketType>
|
174
|
+
struct find_best_packet_helper<Size,PacketType,true>
|
175
|
+
{
|
176
|
+
typedef PacketType type;
|
177
|
+
};
|
178
|
+
|
179
|
+
template<int Size, typename PacketType>
|
180
|
+
struct find_best_packet_helper<Size,PacketType,false>
|
181
|
+
{
|
182
|
+
typedef typename find_best_packet_helper<Size,typename unpacket_traits<PacketType>::half>::type type;
|
183
|
+
};
|
184
|
+
|
185
|
+
template<typename T, int Size>
|
186
|
+
struct find_best_packet
|
187
|
+
{
|
188
|
+
typedef typename find_best_packet_helper<Size,typename packet_traits<T>::type>::type type;
|
189
|
+
};
|
190
|
+
|
191
|
+
#if EIGEN_MAX_STATIC_ALIGN_BYTES>0
|
192
|
+
template<int ArrayBytes, int AlignmentBytes,
|
193
|
+
bool Match = bool((ArrayBytes%AlignmentBytes)==0),
|
194
|
+
bool TryHalf = bool(EIGEN_MIN_ALIGN_BYTES<AlignmentBytes) >
|
195
|
+
struct compute_default_alignment_helper
|
196
|
+
{
|
197
|
+
enum { value = 0 };
|
198
|
+
};
|
199
|
+
|
200
|
+
template<int ArrayBytes, int AlignmentBytes, bool TryHalf>
|
201
|
+
struct compute_default_alignment_helper<ArrayBytes, AlignmentBytes, true, TryHalf> // Match
|
202
|
+
{
|
203
|
+
enum { value = AlignmentBytes };
|
204
|
+
};
|
205
|
+
|
206
|
+
template<int ArrayBytes, int AlignmentBytes>
|
207
|
+
struct compute_default_alignment_helper<ArrayBytes, AlignmentBytes, false, true> // Try-half
|
208
|
+
{
|
209
|
+
// current packet too large, try with an half-packet
|
210
|
+
enum { value = compute_default_alignment_helper<ArrayBytes, AlignmentBytes/2>::value };
|
211
|
+
};
|
212
|
+
#else
|
213
|
+
// If static alignment is disabled, no need to bother.
|
214
|
+
// This also avoids a division by zero in "bool Match = bool((ArrayBytes%AlignmentBytes)==0)"
|
215
|
+
template<int ArrayBytes, int AlignmentBytes>
|
216
|
+
struct compute_default_alignment_helper
|
217
|
+
{
|
218
|
+
enum { value = 0 };
|
219
|
+
};
|
220
|
+
#endif
|
221
|
+
|
222
|
+
template<typename T, int Size> struct compute_default_alignment {
|
223
|
+
enum { value = compute_default_alignment_helper<Size*sizeof(T),EIGEN_MAX_STATIC_ALIGN_BYTES>::value };
|
224
|
+
};
|
225
|
+
|
226
|
+
template<typename T> struct compute_default_alignment<T,Dynamic> {
|
227
|
+
enum { value = EIGEN_MAX_ALIGN_BYTES };
|
228
|
+
};
|
229
|
+
|
230
|
+
template<typename _Scalar, int _Rows, int _Cols,
|
231
|
+
int _Options = AutoAlign |
|
232
|
+
( (_Rows==1 && _Cols!=1) ? RowMajor
|
233
|
+
: (_Cols==1 && _Rows!=1) ? ColMajor
|
234
|
+
: EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION ),
|
235
|
+
int _MaxRows = _Rows,
|
236
|
+
int _MaxCols = _Cols
|
237
|
+
> class make_proper_matrix_type
|
238
|
+
{
|
239
|
+
enum {
|
240
|
+
IsColVector = _Cols==1 && _Rows!=1,
|
241
|
+
IsRowVector = _Rows==1 && _Cols!=1,
|
242
|
+
Options = IsColVector ? (_Options | ColMajor) & ~RowMajor
|
243
|
+
: IsRowVector ? (_Options | RowMajor) & ~ColMajor
|
244
|
+
: _Options
|
245
|
+
};
|
246
|
+
public:
|
247
|
+
typedef Matrix<_Scalar, _Rows, _Cols, Options, _MaxRows, _MaxCols> type;
|
248
|
+
};
|
249
|
+
|
250
|
+
template<typename Scalar, int Rows, int Cols, int Options, int MaxRows, int MaxCols>
|
251
|
+
class compute_matrix_flags
|
252
|
+
{
|
253
|
+
enum { row_major_bit = Options&RowMajor ? RowMajorBit : 0 };
|
254
|
+
public:
|
255
|
+
// FIXME currently we still have to handle DirectAccessBit at the expression level to handle DenseCoeffsBase<>
|
256
|
+
// and then propagate this information to the evaluator's flags.
|
257
|
+
// However, I (Gael) think that DirectAccessBit should only matter at the evaluation stage.
|
258
|
+
enum { ret = DirectAccessBit | LvalueBit | NestByRefBit | row_major_bit };
|
259
|
+
};
|
260
|
+
|
261
|
+
template<int _Rows, int _Cols> struct size_at_compile_time
|
262
|
+
{
|
263
|
+
enum { ret = (_Rows==Dynamic || _Cols==Dynamic) ? Dynamic : _Rows * _Cols };
|
264
|
+
};
|
265
|
+
|
266
|
+
template<typename XprType> struct size_of_xpr_at_compile_time
|
267
|
+
{
|
268
|
+
enum { ret = size_at_compile_time<traits<XprType>::RowsAtCompileTime,traits<XprType>::ColsAtCompileTime>::ret };
|
269
|
+
};
|
270
|
+
|
271
|
+
/* plain_matrix_type : the difference from eval is that plain_matrix_type is always a plain matrix type,
|
272
|
+
* whereas eval is a const reference in the case of a matrix
|
273
|
+
*/
|
274
|
+
|
275
|
+
template<typename T, typename StorageKind = typename traits<T>::StorageKind> struct plain_matrix_type;
|
276
|
+
template<typename T, typename BaseClassType, int Flags> struct plain_matrix_type_dense;
|
277
|
+
template<typename T> struct plain_matrix_type<T,Dense>
|
278
|
+
{
|
279
|
+
typedef typename plain_matrix_type_dense<T,typename traits<T>::XprKind, traits<T>::Flags>::type type;
|
280
|
+
};
|
281
|
+
template<typename T> struct plain_matrix_type<T,DiagonalShape>
|
282
|
+
{
|
283
|
+
typedef typename T::PlainObject type;
|
284
|
+
};
|
285
|
+
|
286
|
+
template<typename T, int Flags> struct plain_matrix_type_dense<T,MatrixXpr,Flags>
|
287
|
+
{
|
288
|
+
typedef Matrix<typename traits<T>::Scalar,
|
289
|
+
traits<T>::RowsAtCompileTime,
|
290
|
+
traits<T>::ColsAtCompileTime,
|
291
|
+
AutoAlign | (Flags&RowMajorBit ? RowMajor : ColMajor),
|
292
|
+
traits<T>::MaxRowsAtCompileTime,
|
293
|
+
traits<T>::MaxColsAtCompileTime
|
294
|
+
> type;
|
295
|
+
};
|
296
|
+
|
297
|
+
template<typename T, int Flags> struct plain_matrix_type_dense<T,ArrayXpr,Flags>
|
298
|
+
{
|
299
|
+
typedef Array<typename traits<T>::Scalar,
|
300
|
+
traits<T>::RowsAtCompileTime,
|
301
|
+
traits<T>::ColsAtCompileTime,
|
302
|
+
AutoAlign | (Flags&RowMajorBit ? RowMajor : ColMajor),
|
303
|
+
traits<T>::MaxRowsAtCompileTime,
|
304
|
+
traits<T>::MaxColsAtCompileTime
|
305
|
+
> type;
|
306
|
+
};
|
307
|
+
|
308
|
+
/* eval : the return type of eval(). For matrices, this is just a const reference
|
309
|
+
* in order to avoid a useless copy
|
310
|
+
*/
|
311
|
+
|
312
|
+
template<typename T, typename StorageKind = typename traits<T>::StorageKind> struct eval;
|
313
|
+
|
314
|
+
template<typename T> struct eval<T,Dense>
|
315
|
+
{
|
316
|
+
typedef typename plain_matrix_type<T>::type type;
|
317
|
+
// typedef typename T::PlainObject type;
|
318
|
+
// typedef T::Matrix<typename traits<T>::Scalar,
|
319
|
+
// traits<T>::RowsAtCompileTime,
|
320
|
+
// traits<T>::ColsAtCompileTime,
|
321
|
+
// AutoAlign | (traits<T>::Flags&RowMajorBit ? RowMajor : ColMajor),
|
322
|
+
// traits<T>::MaxRowsAtCompileTime,
|
323
|
+
// traits<T>::MaxColsAtCompileTime
|
324
|
+
// > type;
|
325
|
+
};
|
326
|
+
|
327
|
+
template<typename T> struct eval<T,DiagonalShape>
|
328
|
+
{
|
329
|
+
typedef typename plain_matrix_type<T>::type type;
|
330
|
+
};
|
331
|
+
|
332
|
+
// for matrices, no need to evaluate, just use a const reference to avoid a useless copy
|
333
|
+
template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
|
334
|
+
struct eval<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>, Dense>
|
335
|
+
{
|
336
|
+
typedef const Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>& type;
|
337
|
+
};
|
338
|
+
|
339
|
+
template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
|
340
|
+
struct eval<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>, Dense>
|
341
|
+
{
|
342
|
+
typedef const Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>& type;
|
343
|
+
};
|
344
|
+
|
345
|
+
|
346
|
+
/* similar to plain_matrix_type, but using the evaluator's Flags */
|
347
|
+
template<typename T, typename StorageKind = typename traits<T>::StorageKind> struct plain_object_eval;
|
348
|
+
|
349
|
+
template<typename T>
|
350
|
+
struct plain_object_eval<T,Dense>
|
351
|
+
{
|
352
|
+
typedef typename plain_matrix_type_dense<T,typename traits<T>::XprKind, evaluator<T>::Flags>::type type;
|
353
|
+
};
|
354
|
+
|
355
|
+
|
356
|
+
/* plain_matrix_type_column_major : same as plain_matrix_type but guaranteed to be column-major
|
357
|
+
*/
|
358
|
+
template<typename T> struct plain_matrix_type_column_major
|
359
|
+
{
|
360
|
+
enum { Rows = traits<T>::RowsAtCompileTime,
|
361
|
+
Cols = traits<T>::ColsAtCompileTime,
|
362
|
+
MaxRows = traits<T>::MaxRowsAtCompileTime,
|
363
|
+
MaxCols = traits<T>::MaxColsAtCompileTime
|
364
|
+
};
|
365
|
+
typedef Matrix<typename traits<T>::Scalar,
|
366
|
+
Rows,
|
367
|
+
Cols,
|
368
|
+
(MaxRows==1&&MaxCols!=1) ? RowMajor : ColMajor,
|
369
|
+
MaxRows,
|
370
|
+
MaxCols
|
371
|
+
> type;
|
372
|
+
};
|
373
|
+
|
374
|
+
/* plain_matrix_type_row_major : same as plain_matrix_type but guaranteed to be row-major
|
375
|
+
*/
|
376
|
+
template<typename T> struct plain_matrix_type_row_major
|
377
|
+
{
|
378
|
+
enum { Rows = traits<T>::RowsAtCompileTime,
|
379
|
+
Cols = traits<T>::ColsAtCompileTime,
|
380
|
+
MaxRows = traits<T>::MaxRowsAtCompileTime,
|
381
|
+
MaxCols = traits<T>::MaxColsAtCompileTime
|
382
|
+
};
|
383
|
+
typedef Matrix<typename traits<T>::Scalar,
|
384
|
+
Rows,
|
385
|
+
Cols,
|
386
|
+
(MaxCols==1&&MaxRows!=1) ? RowMajor : ColMajor,
|
387
|
+
MaxRows,
|
388
|
+
MaxCols
|
389
|
+
> type;
|
390
|
+
};
|
391
|
+
|
392
|
+
/** \internal The reference selector for template expressions. The idea is that we don't
|
393
|
+
* need to use references for expressions since they are light weight proxy
|
394
|
+
* objects which should generate no copying overhead. */
|
395
|
+
template <typename T>
|
396
|
+
struct ref_selector
|
397
|
+
{
|
398
|
+
typedef typename conditional<
|
399
|
+
bool(traits<T>::Flags & NestByRefBit),
|
400
|
+
T const&,
|
401
|
+
const T
|
402
|
+
>::type type;
|
403
|
+
|
404
|
+
typedef typename conditional<
|
405
|
+
bool(traits<T>::Flags & NestByRefBit),
|
406
|
+
T &,
|
407
|
+
T
|
408
|
+
>::type non_const_type;
|
409
|
+
};
|
410
|
+
|
411
|
+
/** \internal Adds the const qualifier on the value-type of T2 if and only if T1 is a const type */
|
412
|
+
template<typename T1, typename T2>
|
413
|
+
struct transfer_constness
|
414
|
+
{
|
415
|
+
typedef typename conditional<
|
416
|
+
bool(internal::is_const<T1>::value),
|
417
|
+
typename internal::add_const_on_value_type<T2>::type,
|
418
|
+
T2
|
419
|
+
>::type type;
|
420
|
+
};
|
421
|
+
|
422
|
+
|
423
|
+
// However, we still need a mechanism to detect whether an expression which is evaluated multiple time
|
424
|
+
// has to be evaluated into a temporary.
|
425
|
+
// That's the purpose of this new nested_eval helper:
|
426
|
+
/** \internal Determines how a given expression should be nested when evaluated multiple times.
|
427
|
+
* For example, when you do a * (b+c), Eigen will determine how the expression b+c should be
|
428
|
+
* evaluated into the bigger product expression. The choice is between nesting the expression b+c as-is, or
|
429
|
+
* evaluating that expression b+c into a temporary variable d, and nest d so that the resulting expression is
|
430
|
+
* a*d. Evaluating can be beneficial for example if every coefficient access in the resulting expression causes
|
431
|
+
* many coefficient accesses in the nested expressions -- as is the case with matrix product for example.
|
432
|
+
*
|
433
|
+
* \tparam T the type of the expression being nested.
|
434
|
+
* \tparam n the number of coefficient accesses in the nested expression for each coefficient access in the bigger expression.
|
435
|
+
* \tparam PlainObject the type of the temporary if needed.
|
436
|
+
*/
|
437
|
+
template<typename T, int n, typename PlainObject = typename plain_object_eval<T>::type> struct nested_eval
|
438
|
+
{
|
439
|
+
enum {
|
440
|
+
ScalarReadCost = NumTraits<typename traits<T>::Scalar>::ReadCost,
|
441
|
+
CoeffReadCost = evaluator<T>::CoeffReadCost, // NOTE What if an evaluator evaluate itself into a tempory?
|
442
|
+
// Then CoeffReadCost will be small (e.g., 1) but we still have to evaluate, especially if n>1.
|
443
|
+
// This situation is already taken care by the EvalBeforeNestingBit flag, which is turned ON
|
444
|
+
// for all evaluator creating a temporary. This flag is then propagated by the parent evaluators.
|
445
|
+
// Another solution could be to count the number of temps?
|
446
|
+
NAsInteger = n == Dynamic ? HugeCost : n,
|
447
|
+
CostEval = (NAsInteger+1) * ScalarReadCost + CoeffReadCost,
|
448
|
+
CostNoEval = NAsInteger * CoeffReadCost,
|
449
|
+
Evaluate = (int(evaluator<T>::Flags) & EvalBeforeNestingBit) || (int(CostEval) < int(CostNoEval))
|
450
|
+
};
|
451
|
+
|
452
|
+
typedef typename conditional<Evaluate, PlainObject, typename ref_selector<T>::type>::type type;
|
453
|
+
};
|
454
|
+
|
455
|
+
template<typename T>
|
456
|
+
EIGEN_DEVICE_FUNC
|
457
|
+
inline T* const_cast_ptr(const T* ptr)
|
458
|
+
{
|
459
|
+
return const_cast<T*>(ptr);
|
460
|
+
}
|
461
|
+
|
462
|
+
template<typename Derived, typename XprKind = typename traits<Derived>::XprKind>
|
463
|
+
struct dense_xpr_base
|
464
|
+
{
|
465
|
+
/* dense_xpr_base should only ever be used on dense expressions, thus falling either into the MatrixXpr or into the ArrayXpr cases */
|
466
|
+
};
|
467
|
+
|
468
|
+
template<typename Derived>
|
469
|
+
struct dense_xpr_base<Derived, MatrixXpr>
|
470
|
+
{
|
471
|
+
typedef MatrixBase<Derived> type;
|
472
|
+
};
|
473
|
+
|
474
|
+
template<typename Derived>
|
475
|
+
struct dense_xpr_base<Derived, ArrayXpr>
|
476
|
+
{
|
477
|
+
typedef ArrayBase<Derived> type;
|
478
|
+
};
|
479
|
+
|
480
|
+
template<typename Derived, typename XprKind = typename traits<Derived>::XprKind, typename StorageKind = typename traits<Derived>::StorageKind>
|
481
|
+
struct generic_xpr_base;
|
482
|
+
|
483
|
+
template<typename Derived, typename XprKind>
|
484
|
+
struct generic_xpr_base<Derived, XprKind, Dense>
|
485
|
+
{
|
486
|
+
typedef typename dense_xpr_base<Derived,XprKind>::type type;
|
487
|
+
};
|
488
|
+
|
489
|
+
template<typename XprType, typename CastType> struct cast_return_type
|
490
|
+
{
|
491
|
+
typedef typename XprType::Scalar CurrentScalarType;
|
492
|
+
typedef typename remove_all<CastType>::type _CastType;
|
493
|
+
typedef typename _CastType::Scalar NewScalarType;
|
494
|
+
typedef typename conditional<is_same<CurrentScalarType,NewScalarType>::value,
|
495
|
+
const XprType&,CastType>::type type;
|
496
|
+
};
|
497
|
+
|
498
|
+
template <typename A, typename B> struct promote_storage_type;
|
499
|
+
|
500
|
+
template <typename A> struct promote_storage_type<A,A>
|
501
|
+
{
|
502
|
+
typedef A ret;
|
503
|
+
};
|
504
|
+
template <typename A> struct promote_storage_type<A, const A>
|
505
|
+
{
|
506
|
+
typedef A ret;
|
507
|
+
};
|
508
|
+
template <typename A> struct promote_storage_type<const A, A>
|
509
|
+
{
|
510
|
+
typedef A ret;
|
511
|
+
};
|
512
|
+
|
513
|
+
/** \internal Specify the "storage kind" of applying a coefficient-wise
|
514
|
+
* binary operations between two expressions of kinds A and B respectively.
|
515
|
+
* The template parameter Functor permits to specialize the resulting storage kind wrt to
|
516
|
+
* the functor.
|
517
|
+
* The default rules are as follows:
|
518
|
+
* \code
|
519
|
+
* A op A -> A
|
520
|
+
* A op dense -> dense
|
521
|
+
* dense op B -> dense
|
522
|
+
* sparse op dense -> sparse
|
523
|
+
* dense op sparse -> sparse
|
524
|
+
* \endcode
|
525
|
+
*/
|
526
|
+
template <typename A, typename B, typename Functor> struct cwise_promote_storage_type;
|
527
|
+
|
528
|
+
template <typename A, typename Functor> struct cwise_promote_storage_type<A,A,Functor> { typedef A ret; };
|
529
|
+
template <typename Functor> struct cwise_promote_storage_type<Dense,Dense,Functor> { typedef Dense ret; };
|
530
|
+
template <typename A, typename Functor> struct cwise_promote_storage_type<A,Dense,Functor> { typedef Dense ret; };
|
531
|
+
template <typename B, typename Functor> struct cwise_promote_storage_type<Dense,B,Functor> { typedef Dense ret; };
|
532
|
+
template <typename Functor> struct cwise_promote_storage_type<Sparse,Dense,Functor> { typedef Sparse ret; };
|
533
|
+
template <typename Functor> struct cwise_promote_storage_type<Dense,Sparse,Functor> { typedef Sparse ret; };
|
534
|
+
|
535
|
+
template <typename LhsKind, typename RhsKind, int LhsOrder, int RhsOrder> struct cwise_promote_storage_order {
|
536
|
+
enum { value = LhsOrder };
|
537
|
+
};
|
538
|
+
|
539
|
+
template <typename LhsKind, int LhsOrder, int RhsOrder> struct cwise_promote_storage_order<LhsKind,Sparse,LhsOrder,RhsOrder> { enum { value = RhsOrder }; };
|
540
|
+
template <typename RhsKind, int LhsOrder, int RhsOrder> struct cwise_promote_storage_order<Sparse,RhsKind,LhsOrder,RhsOrder> { enum { value = LhsOrder }; };
|
541
|
+
template <int Order> struct cwise_promote_storage_order<Sparse,Sparse,Order,Order> { enum { value = Order }; };
|
542
|
+
|
543
|
+
|
544
|
+
/** \internal Specify the "storage kind" of multiplying an expression of kind A with kind B.
|
545
|
+
* The template parameter ProductTag permits to specialize the resulting storage kind wrt to
|
546
|
+
* some compile-time properties of the product: GemmProduct, GemvProduct, OuterProduct, InnerProduct.
|
547
|
+
* The default rules are as follows:
|
548
|
+
* \code
|
549
|
+
* K * K -> K
|
550
|
+
* dense * K -> dense
|
551
|
+
* K * dense -> dense
|
552
|
+
* diag * K -> K
|
553
|
+
* K * diag -> K
|
554
|
+
* Perm * K -> K
|
555
|
+
* K * Perm -> K
|
556
|
+
* \endcode
|
557
|
+
*/
|
558
|
+
template <typename A, typename B, int ProductTag> struct product_promote_storage_type;
|
559
|
+
|
560
|
+
template <typename A, int ProductTag> struct product_promote_storage_type<A, A, ProductTag> { typedef A ret;};
|
561
|
+
template <int ProductTag> struct product_promote_storage_type<Dense, Dense, ProductTag> { typedef Dense ret;};
|
562
|
+
template <typename A, int ProductTag> struct product_promote_storage_type<A, Dense, ProductTag> { typedef Dense ret; };
|
563
|
+
template <typename B, int ProductTag> struct product_promote_storage_type<Dense, B, ProductTag> { typedef Dense ret; };
|
564
|
+
|
565
|
+
template <typename A, int ProductTag> struct product_promote_storage_type<A, DiagonalShape, ProductTag> { typedef A ret; };
|
566
|
+
template <typename B, int ProductTag> struct product_promote_storage_type<DiagonalShape, B, ProductTag> { typedef B ret; };
|
567
|
+
template <int ProductTag> struct product_promote_storage_type<Dense, DiagonalShape, ProductTag> { typedef Dense ret; };
|
568
|
+
template <int ProductTag> struct product_promote_storage_type<DiagonalShape, Dense, ProductTag> { typedef Dense ret; };
|
569
|
+
|
570
|
+
template <typename A, int ProductTag> struct product_promote_storage_type<A, PermutationStorage, ProductTag> { typedef A ret; };
|
571
|
+
template <typename B, int ProductTag> struct product_promote_storage_type<PermutationStorage, B, ProductTag> { typedef B ret; };
|
572
|
+
template <int ProductTag> struct product_promote_storage_type<Dense, PermutationStorage, ProductTag> { typedef Dense ret; };
|
573
|
+
template <int ProductTag> struct product_promote_storage_type<PermutationStorage, Dense, ProductTag> { typedef Dense ret; };
|
574
|
+
|
575
|
+
/** \internal gives the plain matrix or array type to store a row/column/diagonal of a matrix type.
|
576
|
+
* \tparam Scalar optional parameter allowing to pass a different scalar type than the one of the MatrixType.
|
577
|
+
*/
|
578
|
+
template<typename ExpressionType, typename Scalar = typename ExpressionType::Scalar>
|
579
|
+
struct plain_row_type
|
580
|
+
{
|
581
|
+
typedef Matrix<Scalar, 1, ExpressionType::ColsAtCompileTime,
|
582
|
+
ExpressionType::PlainObject::Options | RowMajor, 1, ExpressionType::MaxColsAtCompileTime> MatrixRowType;
|
583
|
+
typedef Array<Scalar, 1, ExpressionType::ColsAtCompileTime,
|
584
|
+
ExpressionType::PlainObject::Options | RowMajor, 1, ExpressionType::MaxColsAtCompileTime> ArrayRowType;
|
585
|
+
|
586
|
+
typedef typename conditional<
|
587
|
+
is_same< typename traits<ExpressionType>::XprKind, MatrixXpr >::value,
|
588
|
+
MatrixRowType,
|
589
|
+
ArrayRowType
|
590
|
+
>::type type;
|
591
|
+
};
|
592
|
+
|
593
|
+
template<typename ExpressionType, typename Scalar = typename ExpressionType::Scalar>
|
594
|
+
struct plain_col_type
|
595
|
+
{
|
596
|
+
typedef Matrix<Scalar, ExpressionType::RowsAtCompileTime, 1,
|
597
|
+
ExpressionType::PlainObject::Options & ~RowMajor, ExpressionType::MaxRowsAtCompileTime, 1> MatrixColType;
|
598
|
+
typedef Array<Scalar, ExpressionType::RowsAtCompileTime, 1,
|
599
|
+
ExpressionType::PlainObject::Options & ~RowMajor, ExpressionType::MaxRowsAtCompileTime, 1> ArrayColType;
|
600
|
+
|
601
|
+
typedef typename conditional<
|
602
|
+
is_same< typename traits<ExpressionType>::XprKind, MatrixXpr >::value,
|
603
|
+
MatrixColType,
|
604
|
+
ArrayColType
|
605
|
+
>::type type;
|
606
|
+
};
|
607
|
+
|
608
|
+
template<typename ExpressionType, typename Scalar = typename ExpressionType::Scalar>
|
609
|
+
struct plain_diag_type
|
610
|
+
{
|
611
|
+
enum { diag_size = EIGEN_SIZE_MIN_PREFER_DYNAMIC(ExpressionType::RowsAtCompileTime, ExpressionType::ColsAtCompileTime),
|
612
|
+
max_diag_size = EIGEN_SIZE_MIN_PREFER_FIXED(ExpressionType::MaxRowsAtCompileTime, ExpressionType::MaxColsAtCompileTime)
|
613
|
+
};
|
614
|
+
typedef Matrix<Scalar, diag_size, 1, ExpressionType::PlainObject::Options & ~RowMajor, max_diag_size, 1> MatrixDiagType;
|
615
|
+
typedef Array<Scalar, diag_size, 1, ExpressionType::PlainObject::Options & ~RowMajor, max_diag_size, 1> ArrayDiagType;
|
616
|
+
|
617
|
+
typedef typename conditional<
|
618
|
+
is_same< typename traits<ExpressionType>::XprKind, MatrixXpr >::value,
|
619
|
+
MatrixDiagType,
|
620
|
+
ArrayDiagType
|
621
|
+
>::type type;
|
622
|
+
};
|
623
|
+
|
624
|
+
template<typename Expr,typename Scalar = typename Expr::Scalar>
|
625
|
+
struct plain_constant_type
|
626
|
+
{
|
627
|
+
enum { Options = (traits<Expr>::Flags&RowMajorBit)?RowMajor:0 };
|
628
|
+
|
629
|
+
typedef Array<Scalar, traits<Expr>::RowsAtCompileTime, traits<Expr>::ColsAtCompileTime,
|
630
|
+
Options, traits<Expr>::MaxRowsAtCompileTime,traits<Expr>::MaxColsAtCompileTime> array_type;
|
631
|
+
|
632
|
+
typedef Matrix<Scalar, traits<Expr>::RowsAtCompileTime, traits<Expr>::ColsAtCompileTime,
|
633
|
+
Options, traits<Expr>::MaxRowsAtCompileTime,traits<Expr>::MaxColsAtCompileTime> matrix_type;
|
634
|
+
|
635
|
+
typedef CwiseNullaryOp<scalar_constant_op<Scalar>, const typename conditional<is_same< typename traits<Expr>::XprKind, MatrixXpr >::value, matrix_type, array_type>::type > type;
|
636
|
+
};
|
637
|
+
|
638
|
+
template<typename ExpressionType>
|
639
|
+
struct is_lvalue
|
640
|
+
{
|
641
|
+
enum { value = (!bool(is_const<ExpressionType>::value)) &&
|
642
|
+
bool(traits<ExpressionType>::Flags & LvalueBit) };
|
643
|
+
};
|
644
|
+
|
645
|
+
template<typename T> struct is_diagonal
|
646
|
+
{ enum { ret = false }; };
|
647
|
+
|
648
|
+
template<typename T> struct is_diagonal<DiagonalBase<T> >
|
649
|
+
{ enum { ret = true }; };
|
650
|
+
|
651
|
+
template<typename T> struct is_diagonal<DiagonalWrapper<T> >
|
652
|
+
{ enum { ret = true }; };
|
653
|
+
|
654
|
+
template<typename T, int S> struct is_diagonal<DiagonalMatrix<T,S> >
|
655
|
+
{ enum { ret = true }; };
|
656
|
+
|
657
|
+
template<typename S1, typename S2> struct glue_shapes;
|
658
|
+
template<> struct glue_shapes<DenseShape,TriangularShape> { typedef TriangularShape type; };
|
659
|
+
|
660
|
+
template<typename T1, typename T2>
|
661
|
+
bool is_same_dense(const T1 &mat1, const T2 &mat2, typename enable_if<has_direct_access<T1>::ret&&has_direct_access<T2>::ret, T1>::type * = 0)
|
662
|
+
{
|
663
|
+
return (mat1.data()==mat2.data()) && (mat1.innerStride()==mat2.innerStride()) && (mat1.outerStride()==mat2.outerStride());
|
664
|
+
}
|
665
|
+
|
666
|
+
template<typename T1, typename T2>
|
667
|
+
bool is_same_dense(const T1 &, const T2 &, typename enable_if<!(has_direct_access<T1>::ret&&has_direct_access<T2>::ret), T1>::type * = 0)
|
668
|
+
{
|
669
|
+
return false;
|
670
|
+
}
|
671
|
+
|
672
|
+
// Internal helper defining the cost of a scalar division for the type T.
|
673
|
+
// The default heuristic can be specialized for each scalar type and architecture.
|
674
|
+
template<typename T,bool Vectorized=false,typename EnaleIf = void>
|
675
|
+
struct scalar_div_cost {
|
676
|
+
enum { value = 8*NumTraits<T>::MulCost };
|
677
|
+
};
|
678
|
+
|
679
|
+
template<typename T,bool Vectorized>
|
680
|
+
struct scalar_div_cost<std::complex<T>, Vectorized> {
|
681
|
+
enum { value = 2*scalar_div_cost<T>::value
|
682
|
+
+ 6*NumTraits<T>::MulCost
|
683
|
+
+ 3*NumTraits<T>::AddCost
|
684
|
+
};
|
685
|
+
};
|
686
|
+
|
687
|
+
|
688
|
+
template<bool Vectorized>
|
689
|
+
struct scalar_div_cost<signed long,Vectorized,typename conditional<sizeof(long)==8,void,false_type>::type> { enum { value = 24 }; };
|
690
|
+
template<bool Vectorized>
|
691
|
+
struct scalar_div_cost<unsigned long,Vectorized,typename conditional<sizeof(long)==8,void,false_type>::type> { enum { value = 21 }; };
|
692
|
+
|
693
|
+
|
694
|
+
#ifdef EIGEN_DEBUG_ASSIGN
|
695
|
+
std::string demangle_traversal(int t)
|
696
|
+
{
|
697
|
+
if(t==DefaultTraversal) return "DefaultTraversal";
|
698
|
+
if(t==LinearTraversal) return "LinearTraversal";
|
699
|
+
if(t==InnerVectorizedTraversal) return "InnerVectorizedTraversal";
|
700
|
+
if(t==LinearVectorizedTraversal) return "LinearVectorizedTraversal";
|
701
|
+
if(t==SliceVectorizedTraversal) return "SliceVectorizedTraversal";
|
702
|
+
return "?";
|
703
|
+
}
|
704
|
+
std::string demangle_unrolling(int t)
|
705
|
+
{
|
706
|
+
if(t==NoUnrolling) return "NoUnrolling";
|
707
|
+
if(t==InnerUnrolling) return "InnerUnrolling";
|
708
|
+
if(t==CompleteUnrolling) return "CompleteUnrolling";
|
709
|
+
return "?";
|
710
|
+
}
|
711
|
+
std::string demangle_flags(int f)
|
712
|
+
{
|
713
|
+
std::string res;
|
714
|
+
if(f&RowMajorBit) res += " | RowMajor";
|
715
|
+
if(f&PacketAccessBit) res += " | Packet";
|
716
|
+
if(f&LinearAccessBit) res += " | Linear";
|
717
|
+
if(f&LvalueBit) res += " | Lvalue";
|
718
|
+
if(f&DirectAccessBit) res += " | Direct";
|
719
|
+
if(f&NestByRefBit) res += " | NestByRef";
|
720
|
+
if(f&NoPreferredStorageOrderBit) res += " | NoPreferredStorageOrderBit";
|
721
|
+
|
722
|
+
return res;
|
723
|
+
}
|
724
|
+
#endif
|
725
|
+
|
726
|
+
} // end namespace internal
|
727
|
+
|
728
|
+
|
729
|
+
/** \class ScalarBinaryOpTraits
|
730
|
+
* \ingroup Core_Module
|
731
|
+
*
|
732
|
+
* \brief Determines whether the given binary operation of two numeric types is allowed and what the scalar return type is.
|
733
|
+
*
|
734
|
+
* This class permits to control the scalar return type of any binary operation performed on two different scalar types through (partial) template specializations.
|
735
|
+
*
|
736
|
+
* For instance, let \c U1, \c U2 and \c U3 be three user defined scalar types for which most operations between instances of \c U1 and \c U2 returns an \c U3.
|
737
|
+
* You can let %Eigen knows that by defining:
|
738
|
+
\code
|
739
|
+
template<typename BinaryOp>
|
740
|
+
struct ScalarBinaryOpTraits<U1,U2,BinaryOp> { typedef U3 ReturnType; };
|
741
|
+
template<typename BinaryOp>
|
742
|
+
struct ScalarBinaryOpTraits<U2,U1,BinaryOp> { typedef U3 ReturnType; };
|
743
|
+
\endcode
|
744
|
+
* You can then explicitly disable some particular operations to get more explicit error messages:
|
745
|
+
\code
|
746
|
+
template<>
|
747
|
+
struct ScalarBinaryOpTraits<U1,U2,internal::scalar_max_op<U1,U2> > {};
|
748
|
+
\endcode
|
749
|
+
* Or customize the return type for individual operation:
|
750
|
+
\code
|
751
|
+
template<>
|
752
|
+
struct ScalarBinaryOpTraits<U1,U2,internal::scalar_sum_op<U1,U2> > { typedef U1 ReturnType; };
|
753
|
+
\endcode
|
754
|
+
*
|
755
|
+
* By default, the following generic combinations are supported:
|
756
|
+
<table class="manual">
|
757
|
+
<tr><th>ScalarA</th><th>ScalarB</th><th>BinaryOp</th><th>ReturnType</th><th>Note</th></tr>
|
758
|
+
<tr ><td>\c T </td><td>\c T </td><td>\c * </td><td>\c T </td><td></td></tr>
|
759
|
+
<tr class="alt"><td>\c NumTraits<T>::Real </td><td>\c T </td><td>\c * </td><td>\c T </td><td>Only if \c NumTraits<T>::IsComplex </td></tr>
|
760
|
+
<tr ><td>\c T </td><td>\c NumTraits<T>::Real </td><td>\c * </td><td>\c T </td><td>Only if \c NumTraits<T>::IsComplex </td></tr>
|
761
|
+
</table>
|
762
|
+
*
|
763
|
+
* \sa CwiseBinaryOp
|
764
|
+
*/
|
765
|
+
template<typename ScalarA, typename ScalarB, typename BinaryOp=internal::scalar_product_op<ScalarA,ScalarB> >
|
766
|
+
struct ScalarBinaryOpTraits
|
767
|
+
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
768
|
+
// for backward compatibility, use the hints given by the (deprecated) internal::scalar_product_traits class.
|
769
|
+
: internal::scalar_product_traits<ScalarA,ScalarB>
|
770
|
+
#endif // EIGEN_PARSED_BY_DOXYGEN
|
771
|
+
{};
|
772
|
+
|
773
|
+
template<typename T, typename BinaryOp>
|
774
|
+
struct ScalarBinaryOpTraits<T,T,BinaryOp>
|
775
|
+
{
|
776
|
+
typedef T ReturnType;
|
777
|
+
};
|
778
|
+
|
779
|
+
template <typename T, typename BinaryOp>
|
780
|
+
struct ScalarBinaryOpTraits<T, typename NumTraits<typename internal::enable_if<NumTraits<T>::IsComplex,T>::type>::Real, BinaryOp>
|
781
|
+
{
|
782
|
+
typedef T ReturnType;
|
783
|
+
};
|
784
|
+
template <typename T, typename BinaryOp>
|
785
|
+
struct ScalarBinaryOpTraits<typename NumTraits<typename internal::enable_if<NumTraits<T>::IsComplex,T>::type>::Real, T, BinaryOp>
|
786
|
+
{
|
787
|
+
typedef T ReturnType;
|
788
|
+
};
|
789
|
+
|
790
|
+
// For Matrix * Permutation
|
791
|
+
template<typename T, typename BinaryOp>
|
792
|
+
struct ScalarBinaryOpTraits<T,void,BinaryOp>
|
793
|
+
{
|
794
|
+
typedef T ReturnType;
|
795
|
+
};
|
796
|
+
|
797
|
+
// For Permutation * Matrix
|
798
|
+
template<typename T, typename BinaryOp>
|
799
|
+
struct ScalarBinaryOpTraits<void,T,BinaryOp>
|
800
|
+
{
|
801
|
+
typedef T ReturnType;
|
802
|
+
};
|
803
|
+
|
804
|
+
// for Permutation*Permutation
|
805
|
+
template<typename BinaryOp>
|
806
|
+
struct ScalarBinaryOpTraits<void,void,BinaryOp>
|
807
|
+
{
|
808
|
+
typedef void ReturnType;
|
809
|
+
};
|
810
|
+
|
811
|
+
// We require Lhs and Rhs to have "compatible" scalar types.
|
812
|
+
// It is tempting to always allow mixing different types but remember that this is often impossible in the vectorized paths.
|
813
|
+
// So allowing mixing different types gives very unexpected errors when enabling vectorization, when the user tries to
|
814
|
+
// add together a float matrix and a double matrix.
|
815
|
+
#define EIGEN_CHECK_BINARY_COMPATIBILIY(BINOP,LHS,RHS) \
|
816
|
+
EIGEN_STATIC_ASSERT((Eigen::internal::has_ReturnType<ScalarBinaryOpTraits<LHS, RHS,BINOP> >::value), \
|
817
|
+
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
|
818
|
+
|
819
|
+
} // end namespace Eigen
|
820
|
+
|
821
|
+
#endif // EIGEN_XPRHELPER_H
|