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,163 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2011, Intel Corporation. All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
5
|
+
are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
8
|
+
list of conditions and the following disclaimer.
|
9
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
11
|
+
and/or other materials provided with the distribution.
|
12
|
+
* Neither the name of Intel Corporation nor the names of its contributors may
|
13
|
+
be used to endorse or promote products derived from this software without
|
14
|
+
specific prior written permission.
|
15
|
+
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
17
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
19
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
20
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
21
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
22
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
23
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
24
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
25
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
26
|
+
|
27
|
+
********************************************************************************
|
28
|
+
* Content : Eigen bindings to BLAS F77
|
29
|
+
* Triangular matrix * matrix product functionality based on ?TRMM.
|
30
|
+
********************************************************************************
|
31
|
+
*/
|
32
|
+
|
33
|
+
#ifndef EIGEN_TRIANGULAR_SOLVER_MATRIX_BLAS_H
|
34
|
+
#define EIGEN_TRIANGULAR_SOLVER_MATRIX_BLAS_H
|
35
|
+
|
36
|
+
namespace Eigen {
|
37
|
+
|
38
|
+
namespace internal {
|
39
|
+
|
40
|
+
// implements LeftSide op(triangular)^-1 * general
|
41
|
+
#define EIGEN_BLAS_TRSM_L(EIGTYPE, BLASTYPE, BLASFUNC) \
|
42
|
+
template <typename Index, int Mode, bool Conjugate, int TriStorageOrder> \
|
43
|
+
struct triangular_solve_matrix<EIGTYPE,Index,OnTheLeft,Mode,Conjugate,TriStorageOrder,ColMajor> \
|
44
|
+
{ \
|
45
|
+
enum { \
|
46
|
+
IsLower = (Mode&Lower) == Lower, \
|
47
|
+
IsUnitDiag = (Mode&UnitDiag) ? 1 : 0, \
|
48
|
+
IsZeroDiag = (Mode&ZeroDiag) ? 1 : 0, \
|
49
|
+
conjA = ((TriStorageOrder==ColMajor) && Conjugate) ? 1 : 0 \
|
50
|
+
}; \
|
51
|
+
static void run( \
|
52
|
+
Index size, Index otherSize, \
|
53
|
+
const EIGTYPE* _tri, Index triStride, \
|
54
|
+
EIGTYPE* _other, Index otherStride, level3_blocking<EIGTYPE,EIGTYPE>& /*blocking*/) \
|
55
|
+
{ \
|
56
|
+
BlasIndex m = convert_index<BlasIndex>(size), n = convert_index<BlasIndex>(otherSize), lda, ldb; \
|
57
|
+
char side = 'L', uplo, diag='N', transa; \
|
58
|
+
/* Set alpha_ */ \
|
59
|
+
EIGTYPE alpha(1); \
|
60
|
+
ldb = convert_index<BlasIndex>(otherStride);\
|
61
|
+
\
|
62
|
+
const EIGTYPE *a; \
|
63
|
+
/* Set trans */ \
|
64
|
+
transa = (TriStorageOrder==RowMajor) ? ((Conjugate) ? 'C' : 'T') : 'N'; \
|
65
|
+
/* Set uplo */ \
|
66
|
+
uplo = IsLower ? 'L' : 'U'; \
|
67
|
+
if (TriStorageOrder==RowMajor) uplo = (uplo == 'L') ? 'U' : 'L'; \
|
68
|
+
/* Set a, lda */ \
|
69
|
+
typedef Matrix<EIGTYPE, Dynamic, Dynamic, TriStorageOrder> MatrixTri; \
|
70
|
+
Map<const MatrixTri, 0, OuterStride<> > tri(_tri,size,size,OuterStride<>(triStride)); \
|
71
|
+
MatrixTri a_tmp; \
|
72
|
+
\
|
73
|
+
if (conjA) { \
|
74
|
+
a_tmp = tri.conjugate(); \
|
75
|
+
a = a_tmp.data(); \
|
76
|
+
lda = convert_index<BlasIndex>(a_tmp.outerStride()); \
|
77
|
+
} else { \
|
78
|
+
a = _tri; \
|
79
|
+
lda = convert_index<BlasIndex>(triStride); \
|
80
|
+
} \
|
81
|
+
if (IsUnitDiag) diag='U'; \
|
82
|
+
/* call ?trsm*/ \
|
83
|
+
BLASFUNC(&side, &uplo, &transa, &diag, &m, &n, (const BLASTYPE*)&numext::real_ref(alpha), (const BLASTYPE*)a, &lda, (BLASTYPE*)_other, &ldb); \
|
84
|
+
} \
|
85
|
+
};
|
86
|
+
|
87
|
+
#ifdef EIGEN_USE_MKL
|
88
|
+
EIGEN_BLAS_TRSM_L(double, double, dtrsm)
|
89
|
+
EIGEN_BLAS_TRSM_L(dcomplex, MKL_Complex16, ztrsm)
|
90
|
+
EIGEN_BLAS_TRSM_L(float, float, strsm)
|
91
|
+
EIGEN_BLAS_TRSM_L(scomplex, MKL_Complex8, ctrsm)
|
92
|
+
#else
|
93
|
+
EIGEN_BLAS_TRSM_L(double, double, dtrsm_)
|
94
|
+
EIGEN_BLAS_TRSM_L(dcomplex, double, ztrsm_)
|
95
|
+
EIGEN_BLAS_TRSM_L(float, float, strsm_)
|
96
|
+
EIGEN_BLAS_TRSM_L(scomplex, float, ctrsm_)
|
97
|
+
#endif
|
98
|
+
|
99
|
+
// implements RightSide general * op(triangular)^-1
|
100
|
+
#define EIGEN_BLAS_TRSM_R(EIGTYPE, BLASTYPE, BLASFUNC) \
|
101
|
+
template <typename Index, int Mode, bool Conjugate, int TriStorageOrder> \
|
102
|
+
struct triangular_solve_matrix<EIGTYPE,Index,OnTheRight,Mode,Conjugate,TriStorageOrder,ColMajor> \
|
103
|
+
{ \
|
104
|
+
enum { \
|
105
|
+
IsLower = (Mode&Lower) == Lower, \
|
106
|
+
IsUnitDiag = (Mode&UnitDiag) ? 1 : 0, \
|
107
|
+
IsZeroDiag = (Mode&ZeroDiag) ? 1 : 0, \
|
108
|
+
conjA = ((TriStorageOrder==ColMajor) && Conjugate) ? 1 : 0 \
|
109
|
+
}; \
|
110
|
+
static void run( \
|
111
|
+
Index size, Index otherSize, \
|
112
|
+
const EIGTYPE* _tri, Index triStride, \
|
113
|
+
EIGTYPE* _other, Index otherStride, level3_blocking<EIGTYPE,EIGTYPE>& /*blocking*/) \
|
114
|
+
{ \
|
115
|
+
BlasIndex m = convert_index<BlasIndex>(otherSize), n = convert_index<BlasIndex>(size), lda, ldb; \
|
116
|
+
char side = 'R', uplo, diag='N', transa; \
|
117
|
+
/* Set alpha_ */ \
|
118
|
+
EIGTYPE alpha(1); \
|
119
|
+
ldb = convert_index<BlasIndex>(otherStride);\
|
120
|
+
\
|
121
|
+
const EIGTYPE *a; \
|
122
|
+
/* Set trans */ \
|
123
|
+
transa = (TriStorageOrder==RowMajor) ? ((Conjugate) ? 'C' : 'T') : 'N'; \
|
124
|
+
/* Set uplo */ \
|
125
|
+
uplo = IsLower ? 'L' : 'U'; \
|
126
|
+
if (TriStorageOrder==RowMajor) uplo = (uplo == 'L') ? 'U' : 'L'; \
|
127
|
+
/* Set a, lda */ \
|
128
|
+
typedef Matrix<EIGTYPE, Dynamic, Dynamic, TriStorageOrder> MatrixTri; \
|
129
|
+
Map<const MatrixTri, 0, OuterStride<> > tri(_tri,size,size,OuterStride<>(triStride)); \
|
130
|
+
MatrixTri a_tmp; \
|
131
|
+
\
|
132
|
+
if (conjA) { \
|
133
|
+
a_tmp = tri.conjugate(); \
|
134
|
+
a = a_tmp.data(); \
|
135
|
+
lda = convert_index<BlasIndex>(a_tmp.outerStride()); \
|
136
|
+
} else { \
|
137
|
+
a = _tri; \
|
138
|
+
lda = convert_index<BlasIndex>(triStride); \
|
139
|
+
} \
|
140
|
+
if (IsUnitDiag) diag='U'; \
|
141
|
+
/* call ?trsm*/ \
|
142
|
+
BLASFUNC(&side, &uplo, &transa, &diag, &m, &n, (const BLASTYPE*)&numext::real_ref(alpha), (const BLASTYPE*)a, &lda, (BLASTYPE*)_other, &ldb); \
|
143
|
+
/*std::cout << "TRMS_L specialization!\n";*/ \
|
144
|
+
} \
|
145
|
+
};
|
146
|
+
|
147
|
+
#ifdef EIGEN_USE_MKL
|
148
|
+
EIGEN_BLAS_TRSM_R(double, double, dtrsm)
|
149
|
+
EIGEN_BLAS_TRSM_R(dcomplex, MKL_Complex16, ztrsm)
|
150
|
+
EIGEN_BLAS_TRSM_R(float, float, strsm)
|
151
|
+
EIGEN_BLAS_TRSM_R(scomplex, MKL_Complex8, ctrsm)
|
152
|
+
#else
|
153
|
+
EIGEN_BLAS_TRSM_R(double, double, dtrsm_)
|
154
|
+
EIGEN_BLAS_TRSM_R(dcomplex, double, ztrsm_)
|
155
|
+
EIGEN_BLAS_TRSM_R(float, float, strsm_)
|
156
|
+
EIGEN_BLAS_TRSM_R(scomplex, float, ctrsm_)
|
157
|
+
#endif
|
158
|
+
|
159
|
+
} // end namespace internal
|
160
|
+
|
161
|
+
} // end namespace Eigen
|
162
|
+
|
163
|
+
#endif // EIGEN_TRIANGULAR_SOLVER_MATRIX_BLAS_H
|
@@ -0,0 +1,145 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
|
5
|
+
//
|
6
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
7
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
8
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
9
|
+
|
10
|
+
#ifndef EIGEN_TRIANGULAR_SOLVER_VECTOR_H
|
11
|
+
#define EIGEN_TRIANGULAR_SOLVER_VECTOR_H
|
12
|
+
|
13
|
+
namespace Eigen {
|
14
|
+
|
15
|
+
namespace internal {
|
16
|
+
|
17
|
+
template<typename LhsScalar, typename RhsScalar, typename Index, int Mode, bool Conjugate, int StorageOrder>
|
18
|
+
struct triangular_solve_vector<LhsScalar, RhsScalar, Index, OnTheRight, Mode, Conjugate, StorageOrder>
|
19
|
+
{
|
20
|
+
static void run(Index size, const LhsScalar* _lhs, Index lhsStride, RhsScalar* rhs)
|
21
|
+
{
|
22
|
+
triangular_solve_vector<LhsScalar,RhsScalar,Index,OnTheLeft,
|
23
|
+
((Mode&Upper)==Upper ? Lower : Upper) | (Mode&UnitDiag),
|
24
|
+
Conjugate,StorageOrder==RowMajor?ColMajor:RowMajor
|
25
|
+
>::run(size, _lhs, lhsStride, rhs);
|
26
|
+
}
|
27
|
+
};
|
28
|
+
|
29
|
+
// forward and backward substitution, row-major, rhs is a vector
|
30
|
+
template<typename LhsScalar, typename RhsScalar, typename Index, int Mode, bool Conjugate>
|
31
|
+
struct triangular_solve_vector<LhsScalar, RhsScalar, Index, OnTheLeft, Mode, Conjugate, RowMajor>
|
32
|
+
{
|
33
|
+
enum {
|
34
|
+
IsLower = ((Mode&Lower)==Lower)
|
35
|
+
};
|
36
|
+
static void run(Index size, const LhsScalar* _lhs, Index lhsStride, RhsScalar* rhs)
|
37
|
+
{
|
38
|
+
typedef Map<const Matrix<LhsScalar,Dynamic,Dynamic,RowMajor>, 0, OuterStride<> > LhsMap;
|
39
|
+
const LhsMap lhs(_lhs,size,size,OuterStride<>(lhsStride));
|
40
|
+
|
41
|
+
typedef const_blas_data_mapper<LhsScalar,Index,RowMajor> LhsMapper;
|
42
|
+
typedef const_blas_data_mapper<RhsScalar,Index,ColMajor> RhsMapper;
|
43
|
+
|
44
|
+
typename internal::conditional<
|
45
|
+
Conjugate,
|
46
|
+
const CwiseUnaryOp<typename internal::scalar_conjugate_op<LhsScalar>,LhsMap>,
|
47
|
+
const LhsMap&>
|
48
|
+
::type cjLhs(lhs);
|
49
|
+
static const Index PanelWidth = EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH;
|
50
|
+
for(Index pi=IsLower ? 0 : size;
|
51
|
+
IsLower ? pi<size : pi>0;
|
52
|
+
IsLower ? pi+=PanelWidth : pi-=PanelWidth)
|
53
|
+
{
|
54
|
+
Index actualPanelWidth = (std::min)(IsLower ? size - pi : pi, PanelWidth);
|
55
|
+
|
56
|
+
Index r = IsLower ? pi : size - pi; // remaining size
|
57
|
+
if (r > 0)
|
58
|
+
{
|
59
|
+
// let's directly call the low level product function because:
|
60
|
+
// 1 - it is faster to compile
|
61
|
+
// 2 - it is slighlty faster at runtime
|
62
|
+
Index startRow = IsLower ? pi : pi-actualPanelWidth;
|
63
|
+
Index startCol = IsLower ? 0 : pi;
|
64
|
+
|
65
|
+
general_matrix_vector_product<Index,LhsScalar,LhsMapper,RowMajor,Conjugate,RhsScalar,RhsMapper,false>::run(
|
66
|
+
actualPanelWidth, r,
|
67
|
+
LhsMapper(&lhs.coeffRef(startRow,startCol), lhsStride),
|
68
|
+
RhsMapper(rhs + startCol, 1),
|
69
|
+
rhs + startRow, 1,
|
70
|
+
RhsScalar(-1));
|
71
|
+
}
|
72
|
+
|
73
|
+
for(Index k=0; k<actualPanelWidth; ++k)
|
74
|
+
{
|
75
|
+
Index i = IsLower ? pi+k : pi-k-1;
|
76
|
+
Index s = IsLower ? pi : i+1;
|
77
|
+
if (k>0)
|
78
|
+
rhs[i] -= (cjLhs.row(i).segment(s,k).transpose().cwiseProduct(Map<const Matrix<RhsScalar,Dynamic,1> >(rhs+s,k))).sum();
|
79
|
+
|
80
|
+
if(!(Mode & UnitDiag))
|
81
|
+
rhs[i] /= cjLhs(i,i);
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
85
|
+
};
|
86
|
+
|
87
|
+
// forward and backward substitution, column-major, rhs is a vector
|
88
|
+
template<typename LhsScalar, typename RhsScalar, typename Index, int Mode, bool Conjugate>
|
89
|
+
struct triangular_solve_vector<LhsScalar, RhsScalar, Index, OnTheLeft, Mode, Conjugate, ColMajor>
|
90
|
+
{
|
91
|
+
enum {
|
92
|
+
IsLower = ((Mode&Lower)==Lower)
|
93
|
+
};
|
94
|
+
static void run(Index size, const LhsScalar* _lhs, Index lhsStride, RhsScalar* rhs)
|
95
|
+
{
|
96
|
+
typedef Map<const Matrix<LhsScalar,Dynamic,Dynamic,ColMajor>, 0, OuterStride<> > LhsMap;
|
97
|
+
const LhsMap lhs(_lhs,size,size,OuterStride<>(lhsStride));
|
98
|
+
typedef const_blas_data_mapper<LhsScalar,Index,ColMajor> LhsMapper;
|
99
|
+
typedef const_blas_data_mapper<RhsScalar,Index,ColMajor> RhsMapper;
|
100
|
+
typename internal::conditional<Conjugate,
|
101
|
+
const CwiseUnaryOp<typename internal::scalar_conjugate_op<LhsScalar>,LhsMap>,
|
102
|
+
const LhsMap&
|
103
|
+
>::type cjLhs(lhs);
|
104
|
+
static const Index PanelWidth = EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH;
|
105
|
+
|
106
|
+
for(Index pi=IsLower ? 0 : size;
|
107
|
+
IsLower ? pi<size : pi>0;
|
108
|
+
IsLower ? pi+=PanelWidth : pi-=PanelWidth)
|
109
|
+
{
|
110
|
+
Index actualPanelWidth = (std::min)(IsLower ? size - pi : pi, PanelWidth);
|
111
|
+
Index startBlock = IsLower ? pi : pi-actualPanelWidth;
|
112
|
+
Index endBlock = IsLower ? pi + actualPanelWidth : 0;
|
113
|
+
|
114
|
+
for(Index k=0; k<actualPanelWidth; ++k)
|
115
|
+
{
|
116
|
+
Index i = IsLower ? pi+k : pi-k-1;
|
117
|
+
if(!(Mode & UnitDiag))
|
118
|
+
rhs[i] /= cjLhs.coeff(i,i);
|
119
|
+
|
120
|
+
Index r = actualPanelWidth - k - 1; // remaining size
|
121
|
+
Index s = IsLower ? i+1 : i-r;
|
122
|
+
if (r>0)
|
123
|
+
Map<Matrix<RhsScalar,Dynamic,1> >(rhs+s,r) -= rhs[i] * cjLhs.col(i).segment(s,r);
|
124
|
+
}
|
125
|
+
Index r = IsLower ? size - endBlock : startBlock; // remaining size
|
126
|
+
if (r > 0)
|
127
|
+
{
|
128
|
+
// let's directly call the low level product function because:
|
129
|
+
// 1 - it is faster to compile
|
130
|
+
// 2 - it is slighlty faster at runtime
|
131
|
+
general_matrix_vector_product<Index,LhsScalar,LhsMapper,ColMajor,Conjugate,RhsScalar,RhsMapper,false>::run(
|
132
|
+
r, actualPanelWidth,
|
133
|
+
LhsMapper(&lhs.coeffRef(endBlock,startBlock), lhsStride),
|
134
|
+
RhsMapper(rhs+startBlock, 1),
|
135
|
+
rhs+endBlock, 1, RhsScalar(-1));
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
139
|
+
};
|
140
|
+
|
141
|
+
} // end namespace internal
|
142
|
+
|
143
|
+
} // end namespace Eigen
|
144
|
+
|
145
|
+
#endif // EIGEN_TRIANGULAR_SOLVER_VECTOR_H
|
@@ -0,0 +1,398 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
|
5
|
+
//
|
6
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
7
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
8
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
9
|
+
|
10
|
+
#ifndef EIGEN_BLASUTIL_H
|
11
|
+
#define EIGEN_BLASUTIL_H
|
12
|
+
|
13
|
+
// This file contains many lightweight helper classes used to
|
14
|
+
// implement and control fast level 2 and level 3 BLAS-like routines.
|
15
|
+
|
16
|
+
namespace Eigen {
|
17
|
+
|
18
|
+
namespace internal {
|
19
|
+
|
20
|
+
// forward declarations
|
21
|
+
template<typename LhsScalar, typename RhsScalar, typename Index, typename DataMapper, int mr, int nr, bool ConjugateLhs=false, bool ConjugateRhs=false>
|
22
|
+
struct gebp_kernel;
|
23
|
+
|
24
|
+
template<typename Scalar, typename Index, typename DataMapper, int nr, int StorageOrder, bool Conjugate = false, bool PanelMode=false>
|
25
|
+
struct gemm_pack_rhs;
|
26
|
+
|
27
|
+
template<typename Scalar, typename Index, typename DataMapper, int Pack1, int Pack2, int StorageOrder, bool Conjugate = false, bool PanelMode = false>
|
28
|
+
struct gemm_pack_lhs;
|
29
|
+
|
30
|
+
template<
|
31
|
+
typename Index,
|
32
|
+
typename LhsScalar, int LhsStorageOrder, bool ConjugateLhs,
|
33
|
+
typename RhsScalar, int RhsStorageOrder, bool ConjugateRhs,
|
34
|
+
int ResStorageOrder>
|
35
|
+
struct general_matrix_matrix_product;
|
36
|
+
|
37
|
+
template<typename Index,
|
38
|
+
typename LhsScalar, typename LhsMapper, int LhsStorageOrder, bool ConjugateLhs,
|
39
|
+
typename RhsScalar, typename RhsMapper, bool ConjugateRhs, int Version=Specialized>
|
40
|
+
struct general_matrix_vector_product;
|
41
|
+
|
42
|
+
|
43
|
+
template<bool Conjugate> struct conj_if;
|
44
|
+
|
45
|
+
template<> struct conj_if<true> {
|
46
|
+
template<typename T>
|
47
|
+
inline T operator()(const T& x) const { return numext::conj(x); }
|
48
|
+
template<typename T>
|
49
|
+
inline T pconj(const T& x) const { return internal::pconj(x); }
|
50
|
+
};
|
51
|
+
|
52
|
+
template<> struct conj_if<false> {
|
53
|
+
template<typename T>
|
54
|
+
inline const T& operator()(const T& x) const { return x; }
|
55
|
+
template<typename T>
|
56
|
+
inline const T& pconj(const T& x) const { return x; }
|
57
|
+
};
|
58
|
+
|
59
|
+
// Generic implementation for custom complex types.
|
60
|
+
template<typename LhsScalar, typename RhsScalar, bool ConjLhs, bool ConjRhs>
|
61
|
+
struct conj_helper
|
62
|
+
{
|
63
|
+
typedef typename ScalarBinaryOpTraits<LhsScalar,RhsScalar>::ReturnType Scalar;
|
64
|
+
|
65
|
+
EIGEN_STRONG_INLINE Scalar pmadd(const LhsScalar& x, const RhsScalar& y, const Scalar& c) const
|
66
|
+
{ return padd(c, pmul(x,y)); }
|
67
|
+
|
68
|
+
EIGEN_STRONG_INLINE Scalar pmul(const LhsScalar& x, const RhsScalar& y) const
|
69
|
+
{ return conj_if<ConjLhs>()(x) * conj_if<ConjRhs>()(y); }
|
70
|
+
};
|
71
|
+
|
72
|
+
template<typename Scalar> struct conj_helper<Scalar,Scalar,false,false>
|
73
|
+
{
|
74
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar pmadd(const Scalar& x, const Scalar& y, const Scalar& c) const { return internal::pmadd(x,y,c); }
|
75
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar pmul(const Scalar& x, const Scalar& y) const { return internal::pmul(x,y); }
|
76
|
+
};
|
77
|
+
|
78
|
+
template<typename RealScalar> struct conj_helper<std::complex<RealScalar>, std::complex<RealScalar>, false,true>
|
79
|
+
{
|
80
|
+
typedef std::complex<RealScalar> Scalar;
|
81
|
+
EIGEN_STRONG_INLINE Scalar pmadd(const Scalar& x, const Scalar& y, const Scalar& c) const
|
82
|
+
{ return c + pmul(x,y); }
|
83
|
+
|
84
|
+
EIGEN_STRONG_INLINE Scalar pmul(const Scalar& x, const Scalar& y) const
|
85
|
+
{ return Scalar(numext::real(x)*numext::real(y) + numext::imag(x)*numext::imag(y), numext::imag(x)*numext::real(y) - numext::real(x)*numext::imag(y)); }
|
86
|
+
};
|
87
|
+
|
88
|
+
template<typename RealScalar> struct conj_helper<std::complex<RealScalar>, std::complex<RealScalar>, true,false>
|
89
|
+
{
|
90
|
+
typedef std::complex<RealScalar> Scalar;
|
91
|
+
EIGEN_STRONG_INLINE Scalar pmadd(const Scalar& x, const Scalar& y, const Scalar& c) const
|
92
|
+
{ return c + pmul(x,y); }
|
93
|
+
|
94
|
+
EIGEN_STRONG_INLINE Scalar pmul(const Scalar& x, const Scalar& y) const
|
95
|
+
{ return Scalar(numext::real(x)*numext::real(y) + numext::imag(x)*numext::imag(y), numext::real(x)*numext::imag(y) - numext::imag(x)*numext::real(y)); }
|
96
|
+
};
|
97
|
+
|
98
|
+
template<typename RealScalar> struct conj_helper<std::complex<RealScalar>, std::complex<RealScalar>, true,true>
|
99
|
+
{
|
100
|
+
typedef std::complex<RealScalar> Scalar;
|
101
|
+
EIGEN_STRONG_INLINE Scalar pmadd(const Scalar& x, const Scalar& y, const Scalar& c) const
|
102
|
+
{ return c + pmul(x,y); }
|
103
|
+
|
104
|
+
EIGEN_STRONG_INLINE Scalar pmul(const Scalar& x, const Scalar& y) const
|
105
|
+
{ return Scalar(numext::real(x)*numext::real(y) - numext::imag(x)*numext::imag(y), - numext::real(x)*numext::imag(y) - numext::imag(x)*numext::real(y)); }
|
106
|
+
};
|
107
|
+
|
108
|
+
template<typename RealScalar,bool Conj> struct conj_helper<std::complex<RealScalar>, RealScalar, Conj,false>
|
109
|
+
{
|
110
|
+
typedef std::complex<RealScalar> Scalar;
|
111
|
+
EIGEN_STRONG_INLINE Scalar pmadd(const Scalar& x, const RealScalar& y, const Scalar& c) const
|
112
|
+
{ return padd(c, pmul(x,y)); }
|
113
|
+
EIGEN_STRONG_INLINE Scalar pmul(const Scalar& x, const RealScalar& y) const
|
114
|
+
{ return conj_if<Conj>()(x)*y; }
|
115
|
+
};
|
116
|
+
|
117
|
+
template<typename RealScalar,bool Conj> struct conj_helper<RealScalar, std::complex<RealScalar>, false,Conj>
|
118
|
+
{
|
119
|
+
typedef std::complex<RealScalar> Scalar;
|
120
|
+
EIGEN_STRONG_INLINE Scalar pmadd(const RealScalar& x, const Scalar& y, const Scalar& c) const
|
121
|
+
{ return padd(c, pmul(x,y)); }
|
122
|
+
EIGEN_STRONG_INLINE Scalar pmul(const RealScalar& x, const Scalar& y) const
|
123
|
+
{ return x*conj_if<Conj>()(y); }
|
124
|
+
};
|
125
|
+
|
126
|
+
template<typename From,typename To> struct get_factor {
|
127
|
+
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE To run(const From& x) { return To(x); }
|
128
|
+
};
|
129
|
+
|
130
|
+
template<typename Scalar> struct get_factor<Scalar,typename NumTraits<Scalar>::Real> {
|
131
|
+
EIGEN_DEVICE_FUNC
|
132
|
+
static EIGEN_STRONG_INLINE typename NumTraits<Scalar>::Real run(const Scalar& x) { return numext::real(x); }
|
133
|
+
};
|
134
|
+
|
135
|
+
|
136
|
+
template<typename Scalar, typename Index>
|
137
|
+
class BlasVectorMapper {
|
138
|
+
public:
|
139
|
+
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE BlasVectorMapper(Scalar *data) : m_data(data) {}
|
140
|
+
|
141
|
+
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Scalar operator()(Index i) const {
|
142
|
+
return m_data[i];
|
143
|
+
}
|
144
|
+
template <typename Packet, int AlignmentType>
|
145
|
+
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet load(Index i) const {
|
146
|
+
return ploadt<Packet, AlignmentType>(m_data + i);
|
147
|
+
}
|
148
|
+
|
149
|
+
template <typename Packet>
|
150
|
+
EIGEN_DEVICE_FUNC bool aligned(Index i) const {
|
151
|
+
return (UIntPtr(m_data+i)%sizeof(Packet))==0;
|
152
|
+
}
|
153
|
+
|
154
|
+
protected:
|
155
|
+
Scalar* m_data;
|
156
|
+
};
|
157
|
+
|
158
|
+
template<typename Scalar, typename Index, int AlignmentType>
|
159
|
+
class BlasLinearMapper {
|
160
|
+
public:
|
161
|
+
typedef typename packet_traits<Scalar>::type Packet;
|
162
|
+
typedef typename packet_traits<Scalar>::half HalfPacket;
|
163
|
+
|
164
|
+
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE BlasLinearMapper(Scalar *data) : m_data(data) {}
|
165
|
+
|
166
|
+
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void prefetch(int i) const {
|
167
|
+
internal::prefetch(&operator()(i));
|
168
|
+
}
|
169
|
+
|
170
|
+
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Scalar& operator()(Index i) const {
|
171
|
+
return m_data[i];
|
172
|
+
}
|
173
|
+
|
174
|
+
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet loadPacket(Index i) const {
|
175
|
+
return ploadt<Packet, AlignmentType>(m_data + i);
|
176
|
+
}
|
177
|
+
|
178
|
+
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE HalfPacket loadHalfPacket(Index i) const {
|
179
|
+
return ploadt<HalfPacket, AlignmentType>(m_data + i);
|
180
|
+
}
|
181
|
+
|
182
|
+
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void storePacket(Index i, const Packet &p) const {
|
183
|
+
pstoret<Scalar, Packet, AlignmentType>(m_data + i, p);
|
184
|
+
}
|
185
|
+
|
186
|
+
protected:
|
187
|
+
Scalar *m_data;
|
188
|
+
};
|
189
|
+
|
190
|
+
// Lightweight helper class to access matrix coefficients.
|
191
|
+
template<typename Scalar, typename Index, int StorageOrder, int AlignmentType = Unaligned>
|
192
|
+
class blas_data_mapper {
|
193
|
+
public:
|
194
|
+
typedef typename packet_traits<Scalar>::type Packet;
|
195
|
+
typedef typename packet_traits<Scalar>::half HalfPacket;
|
196
|
+
|
197
|
+
typedef BlasLinearMapper<Scalar, Index, AlignmentType> LinearMapper;
|
198
|
+
typedef BlasVectorMapper<Scalar, Index> VectorMapper;
|
199
|
+
|
200
|
+
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE blas_data_mapper(Scalar* data, Index stride) : m_data(data), m_stride(stride) {}
|
201
|
+
|
202
|
+
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE blas_data_mapper<Scalar, Index, StorageOrder, AlignmentType>
|
203
|
+
getSubMapper(Index i, Index j) const {
|
204
|
+
return blas_data_mapper<Scalar, Index, StorageOrder, AlignmentType>(&operator()(i, j), m_stride);
|
205
|
+
}
|
206
|
+
|
207
|
+
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE LinearMapper getLinearMapper(Index i, Index j) const {
|
208
|
+
return LinearMapper(&operator()(i, j));
|
209
|
+
}
|
210
|
+
|
211
|
+
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE VectorMapper getVectorMapper(Index i, Index j) const {
|
212
|
+
return VectorMapper(&operator()(i, j));
|
213
|
+
}
|
214
|
+
|
215
|
+
|
216
|
+
EIGEN_DEVICE_FUNC
|
217
|
+
EIGEN_ALWAYS_INLINE Scalar& operator()(Index i, Index j) const {
|
218
|
+
return m_data[StorageOrder==RowMajor ? j + i*m_stride : i + j*m_stride];
|
219
|
+
}
|
220
|
+
|
221
|
+
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet loadPacket(Index i, Index j) const {
|
222
|
+
return ploadt<Packet, AlignmentType>(&operator()(i, j));
|
223
|
+
}
|
224
|
+
|
225
|
+
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE HalfPacket loadHalfPacket(Index i, Index j) const {
|
226
|
+
return ploadt<HalfPacket, AlignmentType>(&operator()(i, j));
|
227
|
+
}
|
228
|
+
|
229
|
+
template<typename SubPacket>
|
230
|
+
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void scatterPacket(Index i, Index j, const SubPacket &p) const {
|
231
|
+
pscatter<Scalar, SubPacket>(&operator()(i, j), p, m_stride);
|
232
|
+
}
|
233
|
+
|
234
|
+
template<typename SubPacket>
|
235
|
+
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE SubPacket gatherPacket(Index i, Index j) const {
|
236
|
+
return pgather<Scalar, SubPacket>(&operator()(i, j), m_stride);
|
237
|
+
}
|
238
|
+
|
239
|
+
EIGEN_DEVICE_FUNC const Index stride() const { return m_stride; }
|
240
|
+
EIGEN_DEVICE_FUNC const Scalar* data() const { return m_data; }
|
241
|
+
|
242
|
+
EIGEN_DEVICE_FUNC Index firstAligned(Index size) const {
|
243
|
+
if (UIntPtr(m_data)%sizeof(Scalar)) {
|
244
|
+
return -1;
|
245
|
+
}
|
246
|
+
return internal::first_default_aligned(m_data, size);
|
247
|
+
}
|
248
|
+
|
249
|
+
protected:
|
250
|
+
Scalar* EIGEN_RESTRICT m_data;
|
251
|
+
const Index m_stride;
|
252
|
+
};
|
253
|
+
|
254
|
+
// lightweight helper class to access matrix coefficients (const version)
|
255
|
+
template<typename Scalar, typename Index, int StorageOrder>
|
256
|
+
class const_blas_data_mapper : public blas_data_mapper<const Scalar, Index, StorageOrder> {
|
257
|
+
public:
|
258
|
+
EIGEN_ALWAYS_INLINE const_blas_data_mapper(const Scalar *data, Index stride) : blas_data_mapper<const Scalar, Index, StorageOrder>(data, stride) {}
|
259
|
+
|
260
|
+
EIGEN_ALWAYS_INLINE const_blas_data_mapper<Scalar, Index, StorageOrder> getSubMapper(Index i, Index j) const {
|
261
|
+
return const_blas_data_mapper<Scalar, Index, StorageOrder>(&(this->operator()(i, j)), this->m_stride);
|
262
|
+
}
|
263
|
+
};
|
264
|
+
|
265
|
+
|
266
|
+
/* Helper class to analyze the factors of a Product expression.
|
267
|
+
* In particular it allows to pop out operator-, scalar multiples,
|
268
|
+
* and conjugate */
|
269
|
+
template<typename XprType> struct blas_traits
|
270
|
+
{
|
271
|
+
typedef typename traits<XprType>::Scalar Scalar;
|
272
|
+
typedef const XprType& ExtractType;
|
273
|
+
typedef XprType _ExtractType;
|
274
|
+
enum {
|
275
|
+
IsComplex = NumTraits<Scalar>::IsComplex,
|
276
|
+
IsTransposed = false,
|
277
|
+
NeedToConjugate = false,
|
278
|
+
HasUsableDirectAccess = ( (int(XprType::Flags)&DirectAccessBit)
|
279
|
+
&& ( bool(XprType::IsVectorAtCompileTime)
|
280
|
+
|| int(inner_stride_at_compile_time<XprType>::ret) == 1)
|
281
|
+
) ? 1 : 0
|
282
|
+
};
|
283
|
+
typedef typename conditional<bool(HasUsableDirectAccess),
|
284
|
+
ExtractType,
|
285
|
+
typename _ExtractType::PlainObject
|
286
|
+
>::type DirectLinearAccessType;
|
287
|
+
static inline ExtractType extract(const XprType& x) { return x; }
|
288
|
+
static inline const Scalar extractScalarFactor(const XprType&) { return Scalar(1); }
|
289
|
+
};
|
290
|
+
|
291
|
+
// pop conjugate
|
292
|
+
template<typename Scalar, typename NestedXpr>
|
293
|
+
struct blas_traits<CwiseUnaryOp<scalar_conjugate_op<Scalar>, NestedXpr> >
|
294
|
+
: blas_traits<NestedXpr>
|
295
|
+
{
|
296
|
+
typedef blas_traits<NestedXpr> Base;
|
297
|
+
typedef CwiseUnaryOp<scalar_conjugate_op<Scalar>, NestedXpr> XprType;
|
298
|
+
typedef typename Base::ExtractType ExtractType;
|
299
|
+
|
300
|
+
enum {
|
301
|
+
IsComplex = NumTraits<Scalar>::IsComplex,
|
302
|
+
NeedToConjugate = Base::NeedToConjugate ? 0 : IsComplex
|
303
|
+
};
|
304
|
+
static inline ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
|
305
|
+
static inline Scalar extractScalarFactor(const XprType& x) { return conj(Base::extractScalarFactor(x.nestedExpression())); }
|
306
|
+
};
|
307
|
+
|
308
|
+
// pop scalar multiple
|
309
|
+
template<typename Scalar, typename NestedXpr, typename Plain>
|
310
|
+
struct blas_traits<CwiseBinaryOp<scalar_product_op<Scalar>, const CwiseNullaryOp<scalar_constant_op<Scalar>,Plain>, NestedXpr> >
|
311
|
+
: blas_traits<NestedXpr>
|
312
|
+
{
|
313
|
+
typedef blas_traits<NestedXpr> Base;
|
314
|
+
typedef CwiseBinaryOp<scalar_product_op<Scalar>, const CwiseNullaryOp<scalar_constant_op<Scalar>,Plain>, NestedXpr> XprType;
|
315
|
+
typedef typename Base::ExtractType ExtractType;
|
316
|
+
static inline ExtractType extract(const XprType& x) { return Base::extract(x.rhs()); }
|
317
|
+
static inline Scalar extractScalarFactor(const XprType& x)
|
318
|
+
{ return x.lhs().functor().m_other * Base::extractScalarFactor(x.rhs()); }
|
319
|
+
};
|
320
|
+
template<typename Scalar, typename NestedXpr, typename Plain>
|
321
|
+
struct blas_traits<CwiseBinaryOp<scalar_product_op<Scalar>, NestedXpr, const CwiseNullaryOp<scalar_constant_op<Scalar>,Plain> > >
|
322
|
+
: blas_traits<NestedXpr>
|
323
|
+
{
|
324
|
+
typedef blas_traits<NestedXpr> Base;
|
325
|
+
typedef CwiseBinaryOp<scalar_product_op<Scalar>, NestedXpr, const CwiseNullaryOp<scalar_constant_op<Scalar>,Plain> > XprType;
|
326
|
+
typedef typename Base::ExtractType ExtractType;
|
327
|
+
static inline ExtractType extract(const XprType& x) { return Base::extract(x.lhs()); }
|
328
|
+
static inline Scalar extractScalarFactor(const XprType& x)
|
329
|
+
{ return Base::extractScalarFactor(x.lhs()) * x.rhs().functor().m_other; }
|
330
|
+
};
|
331
|
+
template<typename Scalar, typename Plain1, typename Plain2>
|
332
|
+
struct blas_traits<CwiseBinaryOp<scalar_product_op<Scalar>, const CwiseNullaryOp<scalar_constant_op<Scalar>,Plain1>,
|
333
|
+
const CwiseNullaryOp<scalar_constant_op<Scalar>,Plain2> > >
|
334
|
+
: blas_traits<CwiseNullaryOp<scalar_constant_op<Scalar>,Plain1> >
|
335
|
+
{};
|
336
|
+
|
337
|
+
// pop opposite
|
338
|
+
template<typename Scalar, typename NestedXpr>
|
339
|
+
struct blas_traits<CwiseUnaryOp<scalar_opposite_op<Scalar>, NestedXpr> >
|
340
|
+
: blas_traits<NestedXpr>
|
341
|
+
{
|
342
|
+
typedef blas_traits<NestedXpr> Base;
|
343
|
+
typedef CwiseUnaryOp<scalar_opposite_op<Scalar>, NestedXpr> XprType;
|
344
|
+
typedef typename Base::ExtractType ExtractType;
|
345
|
+
static inline ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
|
346
|
+
static inline Scalar extractScalarFactor(const XprType& x)
|
347
|
+
{ return - Base::extractScalarFactor(x.nestedExpression()); }
|
348
|
+
};
|
349
|
+
|
350
|
+
// pop/push transpose
|
351
|
+
template<typename NestedXpr>
|
352
|
+
struct blas_traits<Transpose<NestedXpr> >
|
353
|
+
: blas_traits<NestedXpr>
|
354
|
+
{
|
355
|
+
typedef typename NestedXpr::Scalar Scalar;
|
356
|
+
typedef blas_traits<NestedXpr> Base;
|
357
|
+
typedef Transpose<NestedXpr> XprType;
|
358
|
+
typedef Transpose<const typename Base::_ExtractType> ExtractType; // const to get rid of a compile error; anyway blas traits are only used on the RHS
|
359
|
+
typedef Transpose<const typename Base::_ExtractType> _ExtractType;
|
360
|
+
typedef typename conditional<bool(Base::HasUsableDirectAccess),
|
361
|
+
ExtractType,
|
362
|
+
typename ExtractType::PlainObject
|
363
|
+
>::type DirectLinearAccessType;
|
364
|
+
enum {
|
365
|
+
IsTransposed = Base::IsTransposed ? 0 : 1
|
366
|
+
};
|
367
|
+
static inline ExtractType extract(const XprType& x) { return ExtractType(Base::extract(x.nestedExpression())); }
|
368
|
+
static inline Scalar extractScalarFactor(const XprType& x) { return Base::extractScalarFactor(x.nestedExpression()); }
|
369
|
+
};
|
370
|
+
|
371
|
+
template<typename T>
|
372
|
+
struct blas_traits<const T>
|
373
|
+
: blas_traits<T>
|
374
|
+
{};
|
375
|
+
|
376
|
+
template<typename T, bool HasUsableDirectAccess=blas_traits<T>::HasUsableDirectAccess>
|
377
|
+
struct extract_data_selector {
|
378
|
+
static const typename T::Scalar* run(const T& m)
|
379
|
+
{
|
380
|
+
return blas_traits<T>::extract(m).data();
|
381
|
+
}
|
382
|
+
};
|
383
|
+
|
384
|
+
template<typename T>
|
385
|
+
struct extract_data_selector<T,false> {
|
386
|
+
static typename T::Scalar* run(const T&) { return 0; }
|
387
|
+
};
|
388
|
+
|
389
|
+
template<typename T> const typename T::Scalar* extract_data(const T& m)
|
390
|
+
{
|
391
|
+
return extract_data_selector<T>::run(m);
|
392
|
+
}
|
393
|
+
|
394
|
+
} // end namespace internal
|
395
|
+
|
396
|
+
} // end namespace Eigen
|
397
|
+
|
398
|
+
#endif // EIGEN_BLASUTIL_H
|