tomoto 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,211 @@
|
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
|
2
|
+
// for linear algebra.
|
|
3
|
+
//
|
|
4
|
+
// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
|
|
5
|
+
// Copyright (C) 2009 Ricard Marxer <email@ricardmarxer.com>
|
|
6
|
+
// Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
|
|
7
|
+
//
|
|
8
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
|
9
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
|
10
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
11
|
+
|
|
12
|
+
#ifndef EIGEN_REVERSE_H
|
|
13
|
+
#define EIGEN_REVERSE_H
|
|
14
|
+
|
|
15
|
+
namespace Eigen {
|
|
16
|
+
|
|
17
|
+
namespace internal {
|
|
18
|
+
|
|
19
|
+
template<typename MatrixType, int Direction>
|
|
20
|
+
struct traits<Reverse<MatrixType, Direction> >
|
|
21
|
+
: traits<MatrixType>
|
|
22
|
+
{
|
|
23
|
+
typedef typename MatrixType::Scalar Scalar;
|
|
24
|
+
typedef typename traits<MatrixType>::StorageKind StorageKind;
|
|
25
|
+
typedef typename traits<MatrixType>::XprKind XprKind;
|
|
26
|
+
typedef typename ref_selector<MatrixType>::type MatrixTypeNested;
|
|
27
|
+
typedef typename remove_reference<MatrixTypeNested>::type _MatrixTypeNested;
|
|
28
|
+
enum {
|
|
29
|
+
RowsAtCompileTime = MatrixType::RowsAtCompileTime,
|
|
30
|
+
ColsAtCompileTime = MatrixType::ColsAtCompileTime,
|
|
31
|
+
MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
|
|
32
|
+
MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
|
|
33
|
+
Flags = _MatrixTypeNested::Flags & (RowMajorBit | LvalueBit)
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
template<typename PacketType, bool ReversePacket> struct reverse_packet_cond
|
|
38
|
+
{
|
|
39
|
+
static inline PacketType run(const PacketType& x) { return preverse(x); }
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
template<typename PacketType> struct reverse_packet_cond<PacketType,false>
|
|
43
|
+
{
|
|
44
|
+
static inline PacketType run(const PacketType& x) { return x; }
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
} // end namespace internal
|
|
48
|
+
|
|
49
|
+
/** \class Reverse
|
|
50
|
+
* \ingroup Core_Module
|
|
51
|
+
*
|
|
52
|
+
* \brief Expression of the reverse of a vector or matrix
|
|
53
|
+
*
|
|
54
|
+
* \tparam MatrixType the type of the object of which we are taking the reverse
|
|
55
|
+
* \tparam Direction defines the direction of the reverse operation, can be Vertical, Horizontal, or BothDirections
|
|
56
|
+
*
|
|
57
|
+
* This class represents an expression of the reverse of a vector.
|
|
58
|
+
* It is the return type of MatrixBase::reverse() and VectorwiseOp::reverse()
|
|
59
|
+
* and most of the time this is the only way it is used.
|
|
60
|
+
*
|
|
61
|
+
* \sa MatrixBase::reverse(), VectorwiseOp::reverse()
|
|
62
|
+
*/
|
|
63
|
+
template<typename MatrixType, int Direction> class Reverse
|
|
64
|
+
: public internal::dense_xpr_base< Reverse<MatrixType, Direction> >::type
|
|
65
|
+
{
|
|
66
|
+
public:
|
|
67
|
+
|
|
68
|
+
typedef typename internal::dense_xpr_base<Reverse>::type Base;
|
|
69
|
+
EIGEN_DENSE_PUBLIC_INTERFACE(Reverse)
|
|
70
|
+
typedef typename internal::remove_all<MatrixType>::type NestedExpression;
|
|
71
|
+
using Base::IsRowMajor;
|
|
72
|
+
|
|
73
|
+
protected:
|
|
74
|
+
enum {
|
|
75
|
+
PacketSize = internal::packet_traits<Scalar>::size,
|
|
76
|
+
IsColMajor = !IsRowMajor,
|
|
77
|
+
ReverseRow = (Direction == Vertical) || (Direction == BothDirections),
|
|
78
|
+
ReverseCol = (Direction == Horizontal) || (Direction == BothDirections),
|
|
79
|
+
OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1,
|
|
80
|
+
OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1,
|
|
81
|
+
ReversePacket = (Direction == BothDirections)
|
|
82
|
+
|| ((Direction == Vertical) && IsColMajor)
|
|
83
|
+
|| ((Direction == Horizontal) && IsRowMajor)
|
|
84
|
+
};
|
|
85
|
+
typedef internal::reverse_packet_cond<PacketScalar,ReversePacket> reverse_packet;
|
|
86
|
+
public:
|
|
87
|
+
|
|
88
|
+
EIGEN_DEVICE_FUNC explicit inline Reverse(const MatrixType& matrix) : m_matrix(matrix) { }
|
|
89
|
+
|
|
90
|
+
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Reverse)
|
|
91
|
+
|
|
92
|
+
EIGEN_DEVICE_FUNC inline Index rows() const { return m_matrix.rows(); }
|
|
93
|
+
EIGEN_DEVICE_FUNC inline Index cols() const { return m_matrix.cols(); }
|
|
94
|
+
|
|
95
|
+
EIGEN_DEVICE_FUNC inline Index innerStride() const
|
|
96
|
+
{
|
|
97
|
+
return -m_matrix.innerStride();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
EIGEN_DEVICE_FUNC const typename internal::remove_all<typename MatrixType::Nested>::type&
|
|
101
|
+
nestedExpression() const
|
|
102
|
+
{
|
|
103
|
+
return m_matrix;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
protected:
|
|
107
|
+
typename MatrixType::Nested m_matrix;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/** \returns an expression of the reverse of *this.
|
|
111
|
+
*
|
|
112
|
+
* Example: \include MatrixBase_reverse.cpp
|
|
113
|
+
* Output: \verbinclude MatrixBase_reverse.out
|
|
114
|
+
*
|
|
115
|
+
*/
|
|
116
|
+
template<typename Derived>
|
|
117
|
+
inline typename DenseBase<Derived>::ReverseReturnType
|
|
118
|
+
DenseBase<Derived>::reverse()
|
|
119
|
+
{
|
|
120
|
+
return ReverseReturnType(derived());
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
//reverse const overload moved DenseBase.h due to a CUDA compiler bug
|
|
125
|
+
|
|
126
|
+
/** This is the "in place" version of reverse: it reverses \c *this.
|
|
127
|
+
*
|
|
128
|
+
* In most cases it is probably better to simply use the reversed expression
|
|
129
|
+
* of a matrix. However, when reversing the matrix data itself is really needed,
|
|
130
|
+
* then this "in-place" version is probably the right choice because it provides
|
|
131
|
+
* the following additional benefits:
|
|
132
|
+
* - less error prone: doing the same operation with .reverse() requires special care:
|
|
133
|
+
* \code m = m.reverse().eval(); \endcode
|
|
134
|
+
* - this API enables reverse operations without the need for a temporary
|
|
135
|
+
* - it allows future optimizations (cache friendliness, etc.)
|
|
136
|
+
*
|
|
137
|
+
* \sa VectorwiseOp::reverseInPlace(), reverse() */
|
|
138
|
+
template<typename Derived>
|
|
139
|
+
inline void DenseBase<Derived>::reverseInPlace()
|
|
140
|
+
{
|
|
141
|
+
if(cols()>rows())
|
|
142
|
+
{
|
|
143
|
+
Index half = cols()/2;
|
|
144
|
+
leftCols(half).swap(rightCols(half).reverse());
|
|
145
|
+
if((cols()%2)==1)
|
|
146
|
+
{
|
|
147
|
+
Index half2 = rows()/2;
|
|
148
|
+
col(half).head(half2).swap(col(half).tail(half2).reverse());
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
else
|
|
152
|
+
{
|
|
153
|
+
Index half = rows()/2;
|
|
154
|
+
topRows(half).swap(bottomRows(half).reverse());
|
|
155
|
+
if((rows()%2)==1)
|
|
156
|
+
{
|
|
157
|
+
Index half2 = cols()/2;
|
|
158
|
+
row(half).head(half2).swap(row(half).tail(half2).reverse());
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
namespace internal {
|
|
164
|
+
|
|
165
|
+
template<int Direction>
|
|
166
|
+
struct vectorwise_reverse_inplace_impl;
|
|
167
|
+
|
|
168
|
+
template<>
|
|
169
|
+
struct vectorwise_reverse_inplace_impl<Vertical>
|
|
170
|
+
{
|
|
171
|
+
template<typename ExpressionType>
|
|
172
|
+
static void run(ExpressionType &xpr)
|
|
173
|
+
{
|
|
174
|
+
Index half = xpr.rows()/2;
|
|
175
|
+
xpr.topRows(half).swap(xpr.bottomRows(half).colwise().reverse());
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
template<>
|
|
180
|
+
struct vectorwise_reverse_inplace_impl<Horizontal>
|
|
181
|
+
{
|
|
182
|
+
template<typename ExpressionType>
|
|
183
|
+
static void run(ExpressionType &xpr)
|
|
184
|
+
{
|
|
185
|
+
Index half = xpr.cols()/2;
|
|
186
|
+
xpr.leftCols(half).swap(xpr.rightCols(half).rowwise().reverse());
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
} // end namespace internal
|
|
191
|
+
|
|
192
|
+
/** This is the "in place" version of VectorwiseOp::reverse: it reverses each column or row of \c *this.
|
|
193
|
+
*
|
|
194
|
+
* In most cases it is probably better to simply use the reversed expression
|
|
195
|
+
* of a matrix. However, when reversing the matrix data itself is really needed,
|
|
196
|
+
* then this "in-place" version is probably the right choice because it provides
|
|
197
|
+
* the following additional benefits:
|
|
198
|
+
* - less error prone: doing the same operation with .reverse() requires special care:
|
|
199
|
+
* \code m = m.reverse().eval(); \endcode
|
|
200
|
+
* - this API enables reverse operations without the need for a temporary
|
|
201
|
+
*
|
|
202
|
+
* \sa DenseBase::reverseInPlace(), reverse() */
|
|
203
|
+
template<typename ExpressionType, int Direction>
|
|
204
|
+
void VectorwiseOp<ExpressionType,Direction>::reverseInPlace()
|
|
205
|
+
{
|
|
206
|
+
internal::vectorwise_reverse_inplace_impl<Direction>::run(_expression().const_cast_derived());
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
} // end namespace Eigen
|
|
210
|
+
|
|
211
|
+
#endif // EIGEN_REVERSE_H
|
|
@@ -0,0 +1,162 @@
|
|
|
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_SELECT_H
|
|
11
|
+
#define EIGEN_SELECT_H
|
|
12
|
+
|
|
13
|
+
namespace Eigen {
|
|
14
|
+
|
|
15
|
+
/** \class Select
|
|
16
|
+
* \ingroup Core_Module
|
|
17
|
+
*
|
|
18
|
+
* \brief Expression of a coefficient wise version of the C++ ternary operator ?:
|
|
19
|
+
*
|
|
20
|
+
* \param ConditionMatrixType the type of the \em condition expression which must be a boolean matrix
|
|
21
|
+
* \param ThenMatrixType the type of the \em then expression
|
|
22
|
+
* \param ElseMatrixType the type of the \em else expression
|
|
23
|
+
*
|
|
24
|
+
* This class represents an expression of a coefficient wise version of the C++ ternary operator ?:.
|
|
25
|
+
* It is the return type of DenseBase::select() and most of the time this is the only way it is used.
|
|
26
|
+
*
|
|
27
|
+
* \sa DenseBase::select(const DenseBase<ThenDerived>&, const DenseBase<ElseDerived>&) const
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
namespace internal {
|
|
31
|
+
template<typename ConditionMatrixType, typename ThenMatrixType, typename ElseMatrixType>
|
|
32
|
+
struct traits<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >
|
|
33
|
+
: traits<ThenMatrixType>
|
|
34
|
+
{
|
|
35
|
+
typedef typename traits<ThenMatrixType>::Scalar Scalar;
|
|
36
|
+
typedef Dense StorageKind;
|
|
37
|
+
typedef typename traits<ThenMatrixType>::XprKind XprKind;
|
|
38
|
+
typedef typename ConditionMatrixType::Nested ConditionMatrixNested;
|
|
39
|
+
typedef typename ThenMatrixType::Nested ThenMatrixNested;
|
|
40
|
+
typedef typename ElseMatrixType::Nested ElseMatrixNested;
|
|
41
|
+
enum {
|
|
42
|
+
RowsAtCompileTime = ConditionMatrixType::RowsAtCompileTime,
|
|
43
|
+
ColsAtCompileTime = ConditionMatrixType::ColsAtCompileTime,
|
|
44
|
+
MaxRowsAtCompileTime = ConditionMatrixType::MaxRowsAtCompileTime,
|
|
45
|
+
MaxColsAtCompileTime = ConditionMatrixType::MaxColsAtCompileTime,
|
|
46
|
+
Flags = (unsigned int)ThenMatrixType::Flags & ElseMatrixType::Flags & RowMajorBit
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
template<typename ConditionMatrixType, typename ThenMatrixType, typename ElseMatrixType>
|
|
52
|
+
class Select : public internal::dense_xpr_base< Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >::type,
|
|
53
|
+
internal::no_assignment_operator
|
|
54
|
+
{
|
|
55
|
+
public:
|
|
56
|
+
|
|
57
|
+
typedef typename internal::dense_xpr_base<Select>::type Base;
|
|
58
|
+
EIGEN_DENSE_PUBLIC_INTERFACE(Select)
|
|
59
|
+
|
|
60
|
+
inline EIGEN_DEVICE_FUNC
|
|
61
|
+
Select(const ConditionMatrixType& a_conditionMatrix,
|
|
62
|
+
const ThenMatrixType& a_thenMatrix,
|
|
63
|
+
const ElseMatrixType& a_elseMatrix)
|
|
64
|
+
: m_condition(a_conditionMatrix), m_then(a_thenMatrix), m_else(a_elseMatrix)
|
|
65
|
+
{
|
|
66
|
+
eigen_assert(m_condition.rows() == m_then.rows() && m_condition.rows() == m_else.rows());
|
|
67
|
+
eigen_assert(m_condition.cols() == m_then.cols() && m_condition.cols() == m_else.cols());
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
inline EIGEN_DEVICE_FUNC Index rows() const { return m_condition.rows(); }
|
|
71
|
+
inline EIGEN_DEVICE_FUNC Index cols() const { return m_condition.cols(); }
|
|
72
|
+
|
|
73
|
+
inline EIGEN_DEVICE_FUNC
|
|
74
|
+
const Scalar coeff(Index i, Index j) const
|
|
75
|
+
{
|
|
76
|
+
if (m_condition.coeff(i,j))
|
|
77
|
+
return m_then.coeff(i,j);
|
|
78
|
+
else
|
|
79
|
+
return m_else.coeff(i,j);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
inline EIGEN_DEVICE_FUNC
|
|
83
|
+
const Scalar coeff(Index i) const
|
|
84
|
+
{
|
|
85
|
+
if (m_condition.coeff(i))
|
|
86
|
+
return m_then.coeff(i);
|
|
87
|
+
else
|
|
88
|
+
return m_else.coeff(i);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
inline EIGEN_DEVICE_FUNC const ConditionMatrixType& conditionMatrix() const
|
|
92
|
+
{
|
|
93
|
+
return m_condition;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
inline EIGEN_DEVICE_FUNC const ThenMatrixType& thenMatrix() const
|
|
97
|
+
{
|
|
98
|
+
return m_then;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
inline EIGEN_DEVICE_FUNC const ElseMatrixType& elseMatrix() const
|
|
102
|
+
{
|
|
103
|
+
return m_else;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
protected:
|
|
107
|
+
typename ConditionMatrixType::Nested m_condition;
|
|
108
|
+
typename ThenMatrixType::Nested m_then;
|
|
109
|
+
typename ElseMatrixType::Nested m_else;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
/** \returns a matrix where each coefficient (i,j) is equal to \a thenMatrix(i,j)
|
|
114
|
+
* if \c *this(i,j), and \a elseMatrix(i,j) otherwise.
|
|
115
|
+
*
|
|
116
|
+
* Example: \include MatrixBase_select.cpp
|
|
117
|
+
* Output: \verbinclude MatrixBase_select.out
|
|
118
|
+
*
|
|
119
|
+
* \sa class Select
|
|
120
|
+
*/
|
|
121
|
+
template<typename Derived>
|
|
122
|
+
template<typename ThenDerived,typename ElseDerived>
|
|
123
|
+
inline const Select<Derived,ThenDerived,ElseDerived>
|
|
124
|
+
DenseBase<Derived>::select(const DenseBase<ThenDerived>& thenMatrix,
|
|
125
|
+
const DenseBase<ElseDerived>& elseMatrix) const
|
|
126
|
+
{
|
|
127
|
+
return Select<Derived,ThenDerived,ElseDerived>(derived(), thenMatrix.derived(), elseMatrix.derived());
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Version of DenseBase::select(const DenseBase&, const DenseBase&) with
|
|
131
|
+
* the \em else expression being a scalar value.
|
|
132
|
+
*
|
|
133
|
+
* \sa DenseBase::select(const DenseBase<ThenDerived>&, const DenseBase<ElseDerived>&) const, class Select
|
|
134
|
+
*/
|
|
135
|
+
template<typename Derived>
|
|
136
|
+
template<typename ThenDerived>
|
|
137
|
+
inline const Select<Derived,ThenDerived, typename ThenDerived::ConstantReturnType>
|
|
138
|
+
DenseBase<Derived>::select(const DenseBase<ThenDerived>& thenMatrix,
|
|
139
|
+
const typename ThenDerived::Scalar& elseScalar) const
|
|
140
|
+
{
|
|
141
|
+
return Select<Derived,ThenDerived,typename ThenDerived::ConstantReturnType>(
|
|
142
|
+
derived(), thenMatrix.derived(), ThenDerived::Constant(rows(),cols(),elseScalar));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** Version of DenseBase::select(const DenseBase&, const DenseBase&) with
|
|
146
|
+
* the \em then expression being a scalar value.
|
|
147
|
+
*
|
|
148
|
+
* \sa DenseBase::select(const DenseBase<ThenDerived>&, const DenseBase<ElseDerived>&) const, class Select
|
|
149
|
+
*/
|
|
150
|
+
template<typename Derived>
|
|
151
|
+
template<typename ElseDerived>
|
|
152
|
+
inline const Select<Derived, typename ElseDerived::ConstantReturnType, ElseDerived >
|
|
153
|
+
DenseBase<Derived>::select(const typename ElseDerived::Scalar& thenScalar,
|
|
154
|
+
const DenseBase<ElseDerived>& elseMatrix) const
|
|
155
|
+
{
|
|
156
|
+
return Select<Derived,typename ElseDerived::ConstantReturnType,ElseDerived>(
|
|
157
|
+
derived(), ElseDerived::Constant(rows(),cols(),thenScalar), elseMatrix.derived());
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
} // end namespace Eigen
|
|
161
|
+
|
|
162
|
+
#endif // EIGEN_SELECT_H
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
|
2
|
+
// for linear algebra.
|
|
3
|
+
//
|
|
4
|
+
// Copyright (C) 2009 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_SELFADJOINTMATRIX_H
|
|
11
|
+
#define EIGEN_SELFADJOINTMATRIX_H
|
|
12
|
+
|
|
13
|
+
namespace Eigen {
|
|
14
|
+
|
|
15
|
+
/** \class SelfAdjointView
|
|
16
|
+
* \ingroup Core_Module
|
|
17
|
+
*
|
|
18
|
+
*
|
|
19
|
+
* \brief Expression of a selfadjoint matrix from a triangular part of a dense matrix
|
|
20
|
+
*
|
|
21
|
+
* \param MatrixType the type of the dense matrix storing the coefficients
|
|
22
|
+
* \param TriangularPart can be either \c #Lower or \c #Upper
|
|
23
|
+
*
|
|
24
|
+
* This class is an expression of a sefladjoint matrix from a triangular part of a matrix
|
|
25
|
+
* with given dense storage of the coefficients. It is the return type of MatrixBase::selfadjointView()
|
|
26
|
+
* and most of the time this is the only way that it is used.
|
|
27
|
+
*
|
|
28
|
+
* \sa class TriangularBase, MatrixBase::selfadjointView()
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
namespace internal {
|
|
32
|
+
template<typename MatrixType, unsigned int UpLo>
|
|
33
|
+
struct traits<SelfAdjointView<MatrixType, UpLo> > : traits<MatrixType>
|
|
34
|
+
{
|
|
35
|
+
typedef typename ref_selector<MatrixType>::non_const_type MatrixTypeNested;
|
|
36
|
+
typedef typename remove_all<MatrixTypeNested>::type MatrixTypeNestedCleaned;
|
|
37
|
+
typedef MatrixType ExpressionType;
|
|
38
|
+
typedef typename MatrixType::PlainObject FullMatrixType;
|
|
39
|
+
enum {
|
|
40
|
+
Mode = UpLo | SelfAdjoint,
|
|
41
|
+
FlagsLvalueBit = is_lvalue<MatrixType>::value ? LvalueBit : 0,
|
|
42
|
+
Flags = MatrixTypeNestedCleaned::Flags & (HereditaryBits|FlagsLvalueBit)
|
|
43
|
+
& (~(PacketAccessBit | DirectAccessBit | LinearAccessBit)) // FIXME these flags should be preserved
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
template<typename _MatrixType, unsigned int UpLo> class SelfAdjointView
|
|
50
|
+
: public TriangularBase<SelfAdjointView<_MatrixType, UpLo> >
|
|
51
|
+
{
|
|
52
|
+
public:
|
|
53
|
+
|
|
54
|
+
typedef _MatrixType MatrixType;
|
|
55
|
+
typedef TriangularBase<SelfAdjointView> Base;
|
|
56
|
+
typedef typename internal::traits<SelfAdjointView>::MatrixTypeNested MatrixTypeNested;
|
|
57
|
+
typedef typename internal::traits<SelfAdjointView>::MatrixTypeNestedCleaned MatrixTypeNestedCleaned;
|
|
58
|
+
typedef MatrixTypeNestedCleaned NestedExpression;
|
|
59
|
+
|
|
60
|
+
/** \brief The type of coefficients in this matrix */
|
|
61
|
+
typedef typename internal::traits<SelfAdjointView>::Scalar Scalar;
|
|
62
|
+
typedef typename MatrixType::StorageIndex StorageIndex;
|
|
63
|
+
typedef typename internal::remove_all<typename MatrixType::ConjugateReturnType>::type MatrixConjugateReturnType;
|
|
64
|
+
|
|
65
|
+
enum {
|
|
66
|
+
Mode = internal::traits<SelfAdjointView>::Mode,
|
|
67
|
+
Flags = internal::traits<SelfAdjointView>::Flags,
|
|
68
|
+
TransposeMode = ((Mode & Upper) ? Lower : 0) | ((Mode & Lower) ? Upper : 0)
|
|
69
|
+
};
|
|
70
|
+
typedef typename MatrixType::PlainObject PlainObject;
|
|
71
|
+
|
|
72
|
+
EIGEN_DEVICE_FUNC
|
|
73
|
+
explicit inline SelfAdjointView(MatrixType& matrix) : m_matrix(matrix)
|
|
74
|
+
{
|
|
75
|
+
EIGEN_STATIC_ASSERT(UpLo==Lower || UpLo==Upper,SELFADJOINTVIEW_ACCEPTS_UPPER_AND_LOWER_MODE_ONLY);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
EIGEN_DEVICE_FUNC
|
|
79
|
+
inline Index rows() const { return m_matrix.rows(); }
|
|
80
|
+
EIGEN_DEVICE_FUNC
|
|
81
|
+
inline Index cols() const { return m_matrix.cols(); }
|
|
82
|
+
EIGEN_DEVICE_FUNC
|
|
83
|
+
inline Index outerStride() const { return m_matrix.outerStride(); }
|
|
84
|
+
EIGEN_DEVICE_FUNC
|
|
85
|
+
inline Index innerStride() const { return m_matrix.innerStride(); }
|
|
86
|
+
|
|
87
|
+
/** \sa MatrixBase::coeff()
|
|
88
|
+
* \warning the coordinates must fit into the referenced triangular part
|
|
89
|
+
*/
|
|
90
|
+
EIGEN_DEVICE_FUNC
|
|
91
|
+
inline Scalar coeff(Index row, Index col) const
|
|
92
|
+
{
|
|
93
|
+
Base::check_coordinates_internal(row, col);
|
|
94
|
+
return m_matrix.coeff(row, col);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** \sa MatrixBase::coeffRef()
|
|
98
|
+
* \warning the coordinates must fit into the referenced triangular part
|
|
99
|
+
*/
|
|
100
|
+
EIGEN_DEVICE_FUNC
|
|
101
|
+
inline Scalar& coeffRef(Index row, Index col)
|
|
102
|
+
{
|
|
103
|
+
EIGEN_STATIC_ASSERT_LVALUE(SelfAdjointView);
|
|
104
|
+
Base::check_coordinates_internal(row, col);
|
|
105
|
+
return m_matrix.coeffRef(row, col);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** \internal */
|
|
109
|
+
EIGEN_DEVICE_FUNC
|
|
110
|
+
const MatrixTypeNestedCleaned& _expression() const { return m_matrix; }
|
|
111
|
+
|
|
112
|
+
EIGEN_DEVICE_FUNC
|
|
113
|
+
const MatrixTypeNestedCleaned& nestedExpression() const { return m_matrix; }
|
|
114
|
+
EIGEN_DEVICE_FUNC
|
|
115
|
+
MatrixTypeNestedCleaned& nestedExpression() { return m_matrix; }
|
|
116
|
+
|
|
117
|
+
/** Efficient triangular matrix times vector/matrix product */
|
|
118
|
+
template<typename OtherDerived>
|
|
119
|
+
EIGEN_DEVICE_FUNC
|
|
120
|
+
const Product<SelfAdjointView,OtherDerived>
|
|
121
|
+
operator*(const MatrixBase<OtherDerived>& rhs) const
|
|
122
|
+
{
|
|
123
|
+
return Product<SelfAdjointView,OtherDerived>(*this, rhs.derived());
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** Efficient vector/matrix times triangular matrix product */
|
|
127
|
+
template<typename OtherDerived> friend
|
|
128
|
+
EIGEN_DEVICE_FUNC
|
|
129
|
+
const Product<OtherDerived,SelfAdjointView>
|
|
130
|
+
operator*(const MatrixBase<OtherDerived>& lhs, const SelfAdjointView& rhs)
|
|
131
|
+
{
|
|
132
|
+
return Product<OtherDerived,SelfAdjointView>(lhs.derived(),rhs);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
friend EIGEN_DEVICE_FUNC
|
|
136
|
+
const SelfAdjointView<const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(Scalar,MatrixType,product),UpLo>
|
|
137
|
+
operator*(const Scalar& s, const SelfAdjointView& mat)
|
|
138
|
+
{
|
|
139
|
+
return (s*mat.nestedExpression()).template selfadjointView<UpLo>();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** Perform a symmetric rank 2 update of the selfadjoint matrix \c *this:
|
|
143
|
+
* \f$ this = this + \alpha u v^* + conj(\alpha) v u^* \f$
|
|
144
|
+
* \returns a reference to \c *this
|
|
145
|
+
*
|
|
146
|
+
* The vectors \a u and \c v \b must be column vectors, however they can be
|
|
147
|
+
* a adjoint expression without any overhead. Only the meaningful triangular
|
|
148
|
+
* part of the matrix is updated, the rest is left unchanged.
|
|
149
|
+
*
|
|
150
|
+
* \sa rankUpdate(const MatrixBase<DerivedU>&, Scalar)
|
|
151
|
+
*/
|
|
152
|
+
template<typename DerivedU, typename DerivedV>
|
|
153
|
+
EIGEN_DEVICE_FUNC
|
|
154
|
+
SelfAdjointView& rankUpdate(const MatrixBase<DerivedU>& u, const MatrixBase<DerivedV>& v, const Scalar& alpha = Scalar(1));
|
|
155
|
+
|
|
156
|
+
/** Perform a symmetric rank K update of the selfadjoint matrix \c *this:
|
|
157
|
+
* \f$ this = this + \alpha ( u u^* ) \f$ where \a u is a vector or matrix.
|
|
158
|
+
*
|
|
159
|
+
* \returns a reference to \c *this
|
|
160
|
+
*
|
|
161
|
+
* Note that to perform \f$ this = this + \alpha ( u^* u ) \f$ you can simply
|
|
162
|
+
* call this function with u.adjoint().
|
|
163
|
+
*
|
|
164
|
+
* \sa rankUpdate(const MatrixBase<DerivedU>&, const MatrixBase<DerivedV>&, Scalar)
|
|
165
|
+
*/
|
|
166
|
+
template<typename DerivedU>
|
|
167
|
+
EIGEN_DEVICE_FUNC
|
|
168
|
+
SelfAdjointView& rankUpdate(const MatrixBase<DerivedU>& u, const Scalar& alpha = Scalar(1));
|
|
169
|
+
|
|
170
|
+
/** \returns an expression of a triangular view extracted from the current selfadjoint view of a given triangular part
|
|
171
|
+
*
|
|
172
|
+
* The parameter \a TriMode can have the following values: \c #Upper, \c #StrictlyUpper, \c #UnitUpper,
|
|
173
|
+
* \c #Lower, \c #StrictlyLower, \c #UnitLower.
|
|
174
|
+
*
|
|
175
|
+
* If \c TriMode references the same triangular part than \c *this, then this method simply return a \c TriangularView of the nested expression,
|
|
176
|
+
* otherwise, the nested expression is first transposed, thus returning a \c TriangularView<Transpose<MatrixType>> object.
|
|
177
|
+
*
|
|
178
|
+
* \sa MatrixBase::triangularView(), class TriangularView
|
|
179
|
+
*/
|
|
180
|
+
template<unsigned int TriMode>
|
|
181
|
+
EIGEN_DEVICE_FUNC
|
|
182
|
+
typename internal::conditional<(TriMode&(Upper|Lower))==(UpLo&(Upper|Lower)),
|
|
183
|
+
TriangularView<MatrixType,TriMode>,
|
|
184
|
+
TriangularView<typename MatrixType::AdjointReturnType,TriMode> >::type
|
|
185
|
+
triangularView() const
|
|
186
|
+
{
|
|
187
|
+
typename internal::conditional<(TriMode&(Upper|Lower))==(UpLo&(Upper|Lower)), MatrixType&, typename MatrixType::ConstTransposeReturnType>::type tmp1(m_matrix);
|
|
188
|
+
typename internal::conditional<(TriMode&(Upper|Lower))==(UpLo&(Upper|Lower)), MatrixType&, typename MatrixType::AdjointReturnType>::type tmp2(tmp1);
|
|
189
|
+
return typename internal::conditional<(TriMode&(Upper|Lower))==(UpLo&(Upper|Lower)),
|
|
190
|
+
TriangularView<MatrixType,TriMode>,
|
|
191
|
+
TriangularView<typename MatrixType::AdjointReturnType,TriMode> >::type(tmp2);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
typedef SelfAdjointView<const MatrixConjugateReturnType,UpLo> ConjugateReturnType;
|
|
195
|
+
/** \sa MatrixBase::conjugate() const */
|
|
196
|
+
EIGEN_DEVICE_FUNC
|
|
197
|
+
inline const ConjugateReturnType conjugate() const
|
|
198
|
+
{ return ConjugateReturnType(m_matrix.conjugate()); }
|
|
199
|
+
|
|
200
|
+
typedef SelfAdjointView<const typename MatrixType::AdjointReturnType,TransposeMode> AdjointReturnType;
|
|
201
|
+
/** \sa MatrixBase::adjoint() const */
|
|
202
|
+
EIGEN_DEVICE_FUNC
|
|
203
|
+
inline const AdjointReturnType adjoint() const
|
|
204
|
+
{ return AdjointReturnType(m_matrix.adjoint()); }
|
|
205
|
+
|
|
206
|
+
typedef SelfAdjointView<typename MatrixType::TransposeReturnType,TransposeMode> TransposeReturnType;
|
|
207
|
+
/** \sa MatrixBase::transpose() */
|
|
208
|
+
EIGEN_DEVICE_FUNC
|
|
209
|
+
inline TransposeReturnType transpose()
|
|
210
|
+
{
|
|
211
|
+
EIGEN_STATIC_ASSERT_LVALUE(MatrixType)
|
|
212
|
+
typename MatrixType::TransposeReturnType tmp(m_matrix);
|
|
213
|
+
return TransposeReturnType(tmp);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
typedef SelfAdjointView<const typename MatrixType::ConstTransposeReturnType,TransposeMode> ConstTransposeReturnType;
|
|
217
|
+
/** \sa MatrixBase::transpose() const */
|
|
218
|
+
EIGEN_DEVICE_FUNC
|
|
219
|
+
inline const ConstTransposeReturnType transpose() const
|
|
220
|
+
{
|
|
221
|
+
return ConstTransposeReturnType(m_matrix.transpose());
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** \returns a const expression of the main diagonal of the matrix \c *this
|
|
225
|
+
*
|
|
226
|
+
* This method simply returns the diagonal of the nested expression, thus by-passing the SelfAdjointView decorator.
|
|
227
|
+
*
|
|
228
|
+
* \sa MatrixBase::diagonal(), class Diagonal */
|
|
229
|
+
EIGEN_DEVICE_FUNC
|
|
230
|
+
typename MatrixType::ConstDiagonalReturnType diagonal() const
|
|
231
|
+
{
|
|
232
|
+
return typename MatrixType::ConstDiagonalReturnType(m_matrix);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/////////// Cholesky module ///////////
|
|
236
|
+
|
|
237
|
+
const LLT<PlainObject, UpLo> llt() const;
|
|
238
|
+
const LDLT<PlainObject, UpLo> ldlt() const;
|
|
239
|
+
|
|
240
|
+
/////////// Eigenvalue module ///////////
|
|
241
|
+
|
|
242
|
+
/** Real part of #Scalar */
|
|
243
|
+
typedef typename NumTraits<Scalar>::Real RealScalar;
|
|
244
|
+
/** Return type of eigenvalues() */
|
|
245
|
+
typedef Matrix<RealScalar, internal::traits<MatrixType>::ColsAtCompileTime, 1> EigenvaluesReturnType;
|
|
246
|
+
|
|
247
|
+
EIGEN_DEVICE_FUNC
|
|
248
|
+
EigenvaluesReturnType eigenvalues() const;
|
|
249
|
+
EIGEN_DEVICE_FUNC
|
|
250
|
+
RealScalar operatorNorm() const;
|
|
251
|
+
|
|
252
|
+
protected:
|
|
253
|
+
MatrixTypeNested m_matrix;
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
// template<typename OtherDerived, typename MatrixType, unsigned int UpLo>
|
|
258
|
+
// internal::selfadjoint_matrix_product_returntype<OtherDerived,SelfAdjointView<MatrixType,UpLo> >
|
|
259
|
+
// operator*(const MatrixBase<OtherDerived>& lhs, const SelfAdjointView<MatrixType,UpLo>& rhs)
|
|
260
|
+
// {
|
|
261
|
+
// return internal::matrix_selfadjoint_product_returntype<OtherDerived,SelfAdjointView<MatrixType,UpLo> >(lhs.derived(),rhs);
|
|
262
|
+
// }
|
|
263
|
+
|
|
264
|
+
// selfadjoint to dense matrix
|
|
265
|
+
|
|
266
|
+
namespace internal {
|
|
267
|
+
|
|
268
|
+
// TODO currently a selfadjoint expression has the form SelfAdjointView<.,.>
|
|
269
|
+
// in the future selfadjoint-ness should be defined by the expression traits
|
|
270
|
+
// such that Transpose<SelfAdjointView<.,.> > is valid. (currently TriangularBase::transpose() is overloaded to make it work)
|
|
271
|
+
template<typename MatrixType, unsigned int Mode>
|
|
272
|
+
struct evaluator_traits<SelfAdjointView<MatrixType,Mode> >
|
|
273
|
+
{
|
|
274
|
+
typedef typename storage_kind_to_evaluator_kind<typename MatrixType::StorageKind>::Kind Kind;
|
|
275
|
+
typedef SelfAdjointShape Shape;
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
template<int UpLo, int SetOpposite, typename DstEvaluatorTypeT, typename SrcEvaluatorTypeT, typename Functor, int Version>
|
|
279
|
+
class triangular_dense_assignment_kernel<UpLo,SelfAdjoint,SetOpposite,DstEvaluatorTypeT,SrcEvaluatorTypeT,Functor,Version>
|
|
280
|
+
: public generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, Version>
|
|
281
|
+
{
|
|
282
|
+
protected:
|
|
283
|
+
typedef generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, Version> Base;
|
|
284
|
+
typedef typename Base::DstXprType DstXprType;
|
|
285
|
+
typedef typename Base::SrcXprType SrcXprType;
|
|
286
|
+
using Base::m_dst;
|
|
287
|
+
using Base::m_src;
|
|
288
|
+
using Base::m_functor;
|
|
289
|
+
public:
|
|
290
|
+
|
|
291
|
+
typedef typename Base::DstEvaluatorType DstEvaluatorType;
|
|
292
|
+
typedef typename Base::SrcEvaluatorType SrcEvaluatorType;
|
|
293
|
+
typedef typename Base::Scalar Scalar;
|
|
294
|
+
typedef typename Base::AssignmentTraits AssignmentTraits;
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
EIGEN_DEVICE_FUNC triangular_dense_assignment_kernel(DstEvaluatorType &dst, const SrcEvaluatorType &src, const Functor &func, DstXprType& dstExpr)
|
|
298
|
+
: Base(dst, src, func, dstExpr)
|
|
299
|
+
{}
|
|
300
|
+
|
|
301
|
+
EIGEN_DEVICE_FUNC void assignCoeff(Index row, Index col)
|
|
302
|
+
{
|
|
303
|
+
eigen_internal_assert(row!=col);
|
|
304
|
+
Scalar tmp = m_src.coeff(row,col);
|
|
305
|
+
m_functor.assignCoeff(m_dst.coeffRef(row,col), tmp);
|
|
306
|
+
m_functor.assignCoeff(m_dst.coeffRef(col,row), numext::conj(tmp));
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
EIGEN_DEVICE_FUNC void assignDiagonalCoeff(Index id)
|
|
310
|
+
{
|
|
311
|
+
Base::assignCoeff(id,id);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
EIGEN_DEVICE_FUNC void assignOppositeCoeff(Index, Index)
|
|
315
|
+
{ eigen_internal_assert(false && "should never be called"); }
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
} // end namespace internal
|
|
319
|
+
|
|
320
|
+
/***************************************************************************
|
|
321
|
+
* Implementation of MatrixBase methods
|
|
322
|
+
***************************************************************************/
|
|
323
|
+
|
|
324
|
+
/** This is the const version of MatrixBase::selfadjointView() */
|
|
325
|
+
template<typename Derived>
|
|
326
|
+
template<unsigned int UpLo>
|
|
327
|
+
typename MatrixBase<Derived>::template ConstSelfAdjointViewReturnType<UpLo>::Type
|
|
328
|
+
MatrixBase<Derived>::selfadjointView() const
|
|
329
|
+
{
|
|
330
|
+
return typename ConstSelfAdjointViewReturnType<UpLo>::Type(derived());
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/** \returns an expression of a symmetric/self-adjoint view extracted from the upper or lower triangular part of the current matrix
|
|
334
|
+
*
|
|
335
|
+
* The parameter \a UpLo can be either \c #Upper or \c #Lower
|
|
336
|
+
*
|
|
337
|
+
* Example: \include MatrixBase_selfadjointView.cpp
|
|
338
|
+
* Output: \verbinclude MatrixBase_selfadjointView.out
|
|
339
|
+
*
|
|
340
|
+
* \sa class SelfAdjointView
|
|
341
|
+
*/
|
|
342
|
+
template<typename Derived>
|
|
343
|
+
template<unsigned int UpLo>
|
|
344
|
+
typename MatrixBase<Derived>::template SelfAdjointViewReturnType<UpLo>::Type
|
|
345
|
+
MatrixBase<Derived>::selfadjointView()
|
|
346
|
+
{
|
|
347
|
+
return typename SelfAdjointViewReturnType<UpLo>::Type(derived());
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
} // end namespace Eigen
|
|
351
|
+
|
|
352
|
+
#endif // EIGEN_SELFADJOINTMATRIX_H
|