tomoto 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +8 -10
- data/ext/tomoto/ct.cpp +11 -11
- data/ext/tomoto/dmr.cpp +14 -13
- data/ext/tomoto/dt.cpp +14 -14
- data/ext/tomoto/extconf.rb +7 -5
- data/ext/tomoto/gdmr.cpp +7 -7
- data/ext/tomoto/hdp.cpp +9 -9
- data/ext/tomoto/hlda.cpp +13 -13
- data/ext/tomoto/hpa.cpp +5 -5
- data/ext/tomoto/lda.cpp +42 -39
- data/ext/tomoto/llda.cpp +6 -6
- data/ext/tomoto/mglda.cpp +15 -15
- data/ext/tomoto/pa.cpp +6 -6
- data/ext/tomoto/plda.cpp +6 -6
- data/ext/tomoto/slda.cpp +8 -8
- data/ext/tomoto/{ext.cpp → tomoto.cpp} +8 -8
- data/ext/tomoto/utils.h +16 -70
- data/lib/tomoto/version.rb +1 -1
- data/lib/tomoto.rb +5 -1
- data/vendor/EigenRand/EigenRand/Core.h +10 -10
- data/vendor/EigenRand/EigenRand/Dists/Basic.h +208 -9
- data/vendor/EigenRand/EigenRand/Dists/Discrete.h +52 -31
- data/vendor/EigenRand/EigenRand/Dists/GammaPoisson.h +9 -8
- data/vendor/EigenRand/EigenRand/Dists/NormalExp.h +28 -21
- data/vendor/EigenRand/EigenRand/EigenRand +11 -6
- data/vendor/EigenRand/EigenRand/Macro.h +13 -7
- data/vendor/EigenRand/EigenRand/MorePacketMath.h +348 -740
- data/vendor/EigenRand/EigenRand/MvDists/Multinomial.h +5 -3
- data/vendor/EigenRand/EigenRand/MvDists/MvNormal.h +9 -3
- data/vendor/EigenRand/EigenRand/PacketFilter.h +11 -253
- data/vendor/EigenRand/EigenRand/PacketRandomEngine.h +21 -47
- data/vendor/EigenRand/EigenRand/RandUtils.h +50 -344
- data/vendor/EigenRand/EigenRand/arch/AVX/MorePacketMath.h +619 -0
- data/vendor/EigenRand/EigenRand/arch/AVX/PacketFilter.h +149 -0
- data/vendor/EigenRand/EigenRand/arch/AVX/RandUtils.h +228 -0
- data/vendor/EigenRand/EigenRand/arch/NEON/MorePacketMath.h +473 -0
- data/vendor/EigenRand/EigenRand/arch/NEON/PacketFilter.h +142 -0
- data/vendor/EigenRand/EigenRand/arch/NEON/RandUtils.h +126 -0
- data/vendor/EigenRand/EigenRand/arch/SSE/MorePacketMath.h +501 -0
- data/vendor/EigenRand/EigenRand/arch/SSE/PacketFilter.h +133 -0
- data/vendor/EigenRand/EigenRand/arch/SSE/RandUtils.h +120 -0
- data/vendor/EigenRand/EigenRand/doc.h +24 -12
- data/vendor/EigenRand/README.md +57 -4
- data/vendor/eigen/COPYING.APACHE +203 -0
- data/vendor/eigen/COPYING.BSD +1 -1
- data/vendor/eigen/COPYING.MINPACK +51 -52
- data/vendor/eigen/Eigen/Cholesky +0 -1
- data/vendor/eigen/Eigen/Core +112 -265
- data/vendor/eigen/Eigen/Eigenvalues +2 -3
- data/vendor/eigen/Eigen/Geometry +5 -8
- data/vendor/eigen/Eigen/Householder +0 -1
- data/vendor/eigen/Eigen/Jacobi +0 -1
- data/vendor/eigen/Eigen/KLUSupport +41 -0
- data/vendor/eigen/Eigen/LU +2 -5
- data/vendor/eigen/Eigen/OrderingMethods +0 -3
- data/vendor/eigen/Eigen/PaStiXSupport +1 -0
- data/vendor/eigen/Eigen/PardisoSupport +0 -0
- data/vendor/eigen/Eigen/QR +2 -3
- data/vendor/eigen/Eigen/QtAlignedMalloc +0 -1
- data/vendor/eigen/Eigen/SVD +0 -1
- data/vendor/eigen/Eigen/Sparse +0 -2
- data/vendor/eigen/Eigen/SparseCholesky +0 -8
- data/vendor/eigen/Eigen/SparseLU +4 -0
- data/vendor/eigen/Eigen/SparseQR +0 -1
- data/vendor/eigen/Eigen/src/Cholesky/LDLT.h +42 -27
- data/vendor/eigen/Eigen/src/Cholesky/LLT.h +39 -23
- data/vendor/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +90 -47
- data/vendor/eigen/Eigen/src/Core/ArithmeticSequence.h +413 -0
- data/vendor/eigen/Eigen/src/Core/Array.h +99 -11
- data/vendor/eigen/Eigen/src/Core/ArrayBase.h +3 -3
- data/vendor/eigen/Eigen/src/Core/ArrayWrapper.h +21 -21
- data/vendor/eigen/Eigen/src/Core/Assign.h +1 -1
- data/vendor/eigen/Eigen/src/Core/AssignEvaluator.h +125 -50
- data/vendor/eigen/Eigen/src/Core/Assign_MKL.h +10 -10
- data/vendor/eigen/Eigen/src/Core/BandMatrix.h +16 -16
- data/vendor/eigen/Eigen/src/Core/Block.h +56 -60
- data/vendor/eigen/Eigen/src/Core/BooleanRedux.h +29 -31
- data/vendor/eigen/Eigen/src/Core/CommaInitializer.h +7 -3
- data/vendor/eigen/Eigen/src/Core/CoreEvaluators.h +325 -272
- data/vendor/eigen/Eigen/src/Core/CoreIterators.h +5 -0
- data/vendor/eigen/Eigen/src/Core/CwiseBinaryOp.h +21 -22
- data/vendor/eigen/Eigen/src/Core/CwiseNullaryOp.h +153 -18
- data/vendor/eigen/Eigen/src/Core/CwiseUnaryOp.h +6 -6
- data/vendor/eigen/Eigen/src/Core/CwiseUnaryView.h +14 -10
- data/vendor/eigen/Eigen/src/Core/DenseBase.h +132 -42
- data/vendor/eigen/Eigen/src/Core/DenseCoeffsBase.h +25 -21
- data/vendor/eigen/Eigen/src/Core/DenseStorage.h +153 -71
- data/vendor/eigen/Eigen/src/Core/Diagonal.h +21 -23
- data/vendor/eigen/Eigen/src/Core/DiagonalMatrix.h +50 -2
- data/vendor/eigen/Eigen/src/Core/DiagonalProduct.h +1 -1
- data/vendor/eigen/Eigen/src/Core/Dot.h +10 -10
- data/vendor/eigen/Eigen/src/Core/EigenBase.h +10 -9
- data/vendor/eigen/Eigen/src/Core/ForceAlignedAccess.h +8 -4
- data/vendor/eigen/Eigen/src/Core/Fuzzy.h +3 -3
- data/vendor/eigen/Eigen/src/Core/GeneralProduct.h +20 -10
- data/vendor/eigen/Eigen/src/Core/GenericPacketMath.h +599 -152
- data/vendor/eigen/Eigen/src/Core/GlobalFunctions.h +40 -33
- data/vendor/eigen/Eigen/src/Core/IO.h +40 -7
- data/vendor/eigen/Eigen/src/Core/IndexedView.h +237 -0
- data/vendor/eigen/Eigen/src/Core/Inverse.h +9 -10
- data/vendor/eigen/Eigen/src/Core/Map.h +7 -7
- data/vendor/eigen/Eigen/src/Core/MapBase.h +10 -3
- data/vendor/eigen/Eigen/src/Core/MathFunctions.h +767 -125
- data/vendor/eigen/Eigen/src/Core/MathFunctionsImpl.h +118 -19
- data/vendor/eigen/Eigen/src/Core/Matrix.h +131 -25
- data/vendor/eigen/Eigen/src/Core/MatrixBase.h +21 -3
- data/vendor/eigen/Eigen/src/Core/NestByValue.h +25 -50
- data/vendor/eigen/Eigen/src/Core/NoAlias.h +4 -3
- data/vendor/eigen/Eigen/src/Core/NumTraits.h +107 -20
- data/vendor/eigen/Eigen/src/Core/PartialReduxEvaluator.h +232 -0
- data/vendor/eigen/Eigen/src/Core/PermutationMatrix.h +3 -31
- data/vendor/eigen/Eigen/src/Core/PlainObjectBase.h +152 -59
- data/vendor/eigen/Eigen/src/Core/Product.h +30 -25
- data/vendor/eigen/Eigen/src/Core/ProductEvaluators.h +192 -125
- data/vendor/eigen/Eigen/src/Core/Random.h +37 -1
- data/vendor/eigen/Eigen/src/Core/Redux.h +180 -170
- data/vendor/eigen/Eigen/src/Core/Ref.h +121 -23
- data/vendor/eigen/Eigen/src/Core/Replicate.h +8 -8
- data/vendor/eigen/Eigen/src/Core/Reshaped.h +454 -0
- data/vendor/eigen/Eigen/src/Core/ReturnByValue.h +7 -5
- data/vendor/eigen/Eigen/src/Core/Reverse.h +18 -12
- data/vendor/eigen/Eigen/src/Core/Select.h +8 -6
- data/vendor/eigen/Eigen/src/Core/SelfAdjointView.h +33 -20
- data/vendor/eigen/Eigen/src/Core/Solve.h +14 -14
- data/vendor/eigen/Eigen/src/Core/SolveTriangular.h +16 -16
- data/vendor/eigen/Eigen/src/Core/SolverBase.h +41 -3
- data/vendor/eigen/Eigen/src/Core/StableNorm.h +100 -70
- data/vendor/eigen/Eigen/src/Core/StlIterators.h +463 -0
- data/vendor/eigen/Eigen/src/Core/Stride.h +9 -4
- data/vendor/eigen/Eigen/src/Core/Swap.h +5 -4
- data/vendor/eigen/Eigen/src/Core/Transpose.h +88 -27
- data/vendor/eigen/Eigen/src/Core/Transpositions.h +26 -47
- data/vendor/eigen/Eigen/src/Core/TriangularMatrix.h +93 -75
- data/vendor/eigen/Eigen/src/Core/VectorBlock.h +5 -5
- data/vendor/eigen/Eigen/src/Core/VectorwiseOp.h +159 -70
- data/vendor/eigen/Eigen/src/Core/Visitor.h +137 -29
- data/vendor/eigen/Eigen/src/Core/arch/AVX/Complex.h +50 -129
- data/vendor/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +126 -337
- data/vendor/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +1092 -155
- data/vendor/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +65 -1
- data/vendor/eigen/Eigen/src/Core/arch/AVX512/Complex.h +422 -0
- data/vendor/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +207 -236
- data/vendor/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +1482 -495
- data/vendor/eigen/Eigen/src/Core/arch/AVX512/TypeCasting.h +89 -0
- data/vendor/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +152 -165
- data/vendor/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +19 -251
- data/vendor/eigen/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +2937 -0
- data/vendor/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +221 -0
- data/vendor/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +629 -0
- data/vendor/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h +2042 -392
- data/vendor/eigen/Eigen/src/Core/arch/CUDA/Complex.h +235 -80
- data/vendor/eigen/Eigen/src/Core/arch/Default/BFloat16.h +700 -0
- data/vendor/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +102 -14
- data/vendor/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +1649 -0
- data/vendor/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +110 -0
- data/vendor/eigen/Eigen/src/Core/arch/Default/Half.h +942 -0
- data/vendor/eigen/Eigen/src/Core/arch/Default/Settings.h +1 -1
- data/vendor/eigen/Eigen/src/Core/arch/Default/TypeCasting.h +120 -0
- data/vendor/eigen/Eigen/src/Core/arch/{CUDA → GPU}/MathFunctions.h +16 -4
- data/vendor/eigen/Eigen/src/Core/arch/GPU/PacketMath.h +1685 -0
- data/vendor/eigen/Eigen/src/Core/arch/GPU/TypeCasting.h +80 -0
- data/vendor/eigen/Eigen/src/Core/arch/HIP/hcc/math_constants.h +23 -0
- data/vendor/eigen/Eigen/src/Core/arch/MSA/Complex.h +648 -0
- data/vendor/eigen/Eigen/src/Core/arch/MSA/MathFunctions.h +387 -0
- data/vendor/eigen/Eigen/src/Core/arch/MSA/PacketMath.h +1233 -0
- data/vendor/eigen/Eigen/src/Core/arch/NEON/Complex.h +313 -219
- data/vendor/eigen/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +183 -0
- data/vendor/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +54 -70
- data/vendor/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +4376 -549
- data/vendor/eigen/Eigen/src/Core/arch/NEON/TypeCasting.h +1419 -0
- data/vendor/eigen/Eigen/src/Core/arch/SSE/Complex.h +59 -179
- data/vendor/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +65 -428
- data/vendor/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +893 -283
- data/vendor/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +65 -0
- data/vendor/eigen/Eigen/src/Core/arch/SVE/MathFunctions.h +44 -0
- data/vendor/eigen/Eigen/src/Core/arch/SVE/PacketMath.h +752 -0
- data/vendor/eigen/Eigen/src/Core/arch/SVE/TypeCasting.h +49 -0
- data/vendor/eigen/Eigen/src/Core/arch/SYCL/InteropHeaders.h +232 -0
- data/vendor/eigen/Eigen/src/Core/arch/SYCL/MathFunctions.h +301 -0
- data/vendor/eigen/Eigen/src/Core/arch/SYCL/PacketMath.h +670 -0
- data/vendor/eigen/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h +694 -0
- data/vendor/eigen/Eigen/src/Core/arch/SYCL/TypeCasting.h +85 -0
- data/vendor/eigen/Eigen/src/Core/arch/ZVector/Complex.h +212 -183
- data/vendor/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +101 -5
- data/vendor/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +510 -395
- data/vendor/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +11 -2
- data/vendor/eigen/Eigen/src/Core/functors/BinaryFunctors.h +112 -46
- data/vendor/eigen/Eigen/src/Core/functors/NullaryFunctors.h +31 -30
- data/vendor/eigen/Eigen/src/Core/functors/StlFunctors.h +32 -2
- data/vendor/eigen/Eigen/src/Core/functors/UnaryFunctors.h +355 -16
- data/vendor/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +1075 -586
- data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +49 -24
- data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +41 -35
- data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +6 -6
- data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +4 -2
- data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +382 -483
- data/vendor/eigen/Eigen/src/Core/products/Parallelizer.h +22 -5
- data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +53 -30
- data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +16 -8
- data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +8 -6
- data/vendor/eigen/Eigen/src/Core/products/SelfadjointProduct.h +4 -4
- data/vendor/eigen/Eigen/src/Core/products/SelfadjointRank2Update.h +5 -4
- data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h +33 -27
- data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +14 -12
- data/vendor/eigen/Eigen/src/Core/products/TriangularSolverMatrix.h +36 -34
- data/vendor/eigen/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +8 -4
- data/vendor/eigen/Eigen/src/Core/products/TriangularSolverVector.h +13 -10
- data/vendor/eigen/Eigen/src/Core/util/BlasUtil.h +304 -119
- data/vendor/eigen/Eigen/src/Core/util/ConfigureVectorization.h +512 -0
- data/vendor/eigen/Eigen/src/Core/util/Constants.h +25 -9
- data/vendor/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +26 -3
- data/vendor/eigen/Eigen/src/Core/util/ForwardDeclarations.h +29 -9
- data/vendor/eigen/Eigen/src/Core/util/IndexedViewHelper.h +186 -0
- data/vendor/eigen/Eigen/src/Core/util/IntegralConstant.h +272 -0
- data/vendor/eigen/Eigen/src/Core/util/MKL_support.h +8 -1
- data/vendor/eigen/Eigen/src/Core/util/Macros.h +709 -246
- data/vendor/eigen/Eigen/src/Core/util/Memory.h +222 -52
- data/vendor/eigen/Eigen/src/Core/util/Meta.h +355 -77
- data/vendor/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h +5 -1
- data/vendor/eigen/Eigen/src/Core/util/ReshapedHelper.h +51 -0
- data/vendor/eigen/Eigen/src/Core/util/StaticAssert.h +8 -5
- data/vendor/eigen/Eigen/src/Core/util/SymbolicIndex.h +293 -0
- data/vendor/eigen/Eigen/src/Core/util/XprHelper.h +65 -30
- data/vendor/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h +1 -1
- data/vendor/eigen/Eigen/src/Eigenvalues/ComplexSchur.h +7 -4
- data/vendor/eigen/Eigen/src/Eigenvalues/EigenSolver.h +2 -2
- data/vendor/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +1 -1
- data/vendor/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h +2 -2
- data/vendor/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +2 -2
- data/vendor/eigen/Eigen/src/Eigenvalues/RealQZ.h +9 -6
- data/vendor/eigen/Eigen/src/Eigenvalues/RealSchur.h +21 -9
- data/vendor/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +77 -43
- data/vendor/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +20 -15
- data/vendor/eigen/Eigen/src/Geometry/AlignedBox.h +99 -5
- data/vendor/eigen/Eigen/src/Geometry/AngleAxis.h +4 -4
- data/vendor/eigen/Eigen/src/Geometry/EulerAngles.h +3 -3
- data/vendor/eigen/Eigen/src/Geometry/Homogeneous.h +15 -11
- data/vendor/eigen/Eigen/src/Geometry/Hyperplane.h +1 -1
- data/vendor/eigen/Eigen/src/Geometry/OrthoMethods.h +3 -2
- data/vendor/eigen/Eigen/src/Geometry/ParametrizedLine.h +39 -2
- data/vendor/eigen/Eigen/src/Geometry/Quaternion.h +70 -14
- data/vendor/eigen/Eigen/src/Geometry/Rotation2D.h +3 -3
- data/vendor/eigen/Eigen/src/Geometry/Scaling.h +23 -5
- data/vendor/eigen/Eigen/src/Geometry/Transform.h +88 -67
- data/vendor/eigen/Eigen/src/Geometry/Translation.h +6 -12
- data/vendor/eigen/Eigen/src/Geometry/Umeyama.h +1 -1
- data/vendor/eigen/Eigen/src/Geometry/arch/Geometry_SIMD.h +168 -0
- data/vendor/eigen/Eigen/src/Householder/BlockHouseholder.h +9 -2
- data/vendor/eigen/Eigen/src/Householder/Householder.h +8 -4
- data/vendor/eigen/Eigen/src/Householder/HouseholderSequence.h +123 -48
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +15 -15
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +7 -23
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +5 -22
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +41 -47
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +51 -60
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +70 -20
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +2 -20
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +11 -9
- data/vendor/eigen/Eigen/src/Jacobi/Jacobi.h +31 -10
- data/vendor/eigen/Eigen/src/KLUSupport/KLUSupport.h +358 -0
- data/vendor/eigen/Eigen/src/LU/Determinant.h +35 -19
- data/vendor/eigen/Eigen/src/LU/FullPivLU.h +29 -43
- data/vendor/eigen/Eigen/src/LU/InverseImpl.h +25 -8
- data/vendor/eigen/Eigen/src/LU/PartialPivLU.h +71 -58
- data/vendor/eigen/Eigen/src/LU/arch/InverseSize4.h +351 -0
- data/vendor/eigen/Eigen/src/OrderingMethods/Amd.h +7 -17
- data/vendor/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +297 -277
- data/vendor/eigen/Eigen/src/OrderingMethods/Ordering.h +6 -10
- data/vendor/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h +1 -1
- data/vendor/eigen/Eigen/src/PardisoSupport/PardisoSupport.h +9 -7
- data/vendor/eigen/Eigen/src/QR/ColPivHouseholderQR.h +41 -20
- data/vendor/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +100 -27
- data/vendor/eigen/Eigen/src/QR/FullPivHouseholderQR.h +59 -22
- data/vendor/eigen/Eigen/src/QR/HouseholderQR.h +48 -23
- data/vendor/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +25 -3
- data/vendor/eigen/Eigen/src/SVD/BDCSVD.h +183 -63
- data/vendor/eigen/Eigen/src/SVD/JacobiSVD.h +22 -14
- data/vendor/eigen/Eigen/src/SVD/SVDBase.h +83 -22
- data/vendor/eigen/Eigen/src/SVD/UpperBidiagonalization.h +3 -3
- data/vendor/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +17 -9
- data/vendor/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +12 -37
- data/vendor/eigen/Eigen/src/SparseCore/AmbiVector.h +3 -2
- data/vendor/eigen/Eigen/src/SparseCore/CompressedStorage.h +16 -0
- data/vendor/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +6 -6
- data/vendor/eigen/Eigen/src/SparseCore/SparseAssign.h +81 -27
- data/vendor/eigen/Eigen/src/SparseCore/SparseBlock.h +25 -57
- data/vendor/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +40 -11
- data/vendor/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +11 -15
- data/vendor/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +4 -2
- data/vendor/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +30 -8
- data/vendor/eigen/Eigen/src/SparseCore/SparseMatrix.h +126 -11
- data/vendor/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +5 -12
- data/vendor/eigen/Eigen/src/SparseCore/SparseProduct.h +13 -1
- data/vendor/eigen/Eigen/src/SparseCore/SparseRef.h +7 -7
- data/vendor/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h +5 -2
- data/vendor/eigen/Eigen/src/SparseCore/SparseUtil.h +8 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseVector.h +1 -1
- data/vendor/eigen/Eigen/src/SparseCore/SparseView.h +1 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU.h +162 -12
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_Memory.h +1 -1
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +76 -2
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +2 -2
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +1 -1
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_panel_bmod.h +1 -1
- data/vendor/eigen/Eigen/src/SparseQR/SparseQR.h +19 -6
- data/vendor/eigen/Eigen/src/StlSupport/StdDeque.h +2 -12
- data/vendor/eigen/Eigen/src/StlSupport/StdList.h +2 -2
- data/vendor/eigen/Eigen/src/StlSupport/StdVector.h +2 -2
- data/vendor/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h +6 -8
- data/vendor/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h +175 -39
- data/vendor/eigen/Eigen/src/misc/lapacke.h +5 -4
- data/vendor/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h +28 -2
- data/vendor/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +155 -11
- data/vendor/eigen/Eigen/src/plugins/BlockMethods.h +626 -242
- data/vendor/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.h +14 -0
- data/vendor/eigen/Eigen/src/plugins/IndexedViewMethods.h +262 -0
- data/vendor/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +4 -4
- data/vendor/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +10 -0
- data/vendor/eigen/Eigen/src/plugins/ReshapedMethods.h +149 -0
- data/vendor/eigen/README.md +2 -0
- data/vendor/eigen/bench/btl/README +1 -1
- data/vendor/eigen/bench/tensors/README +6 -7
- data/vendor/eigen/ci/README.md +56 -0
- data/vendor/eigen/demos/mix_eigen_and_c/README +1 -1
- data/vendor/eigen/unsupported/Eigen/CXX11/src/Tensor/README.md +213 -158
- data/vendor/eigen/unsupported/README.txt +1 -1
- data/vendor/tomotopy/README.kr.rst +78 -0
- data/vendor/tomotopy/README.rst +75 -0
- data/vendor/tomotopy/src/Labeling/FoRelevance.cpp +2 -2
- data/vendor/tomotopy/src/Labeling/Phraser.hpp +4 -4
- data/vendor/tomotopy/src/TopicModel/CTModel.hpp +7 -3
- data/vendor/tomotopy/src/TopicModel/DMRModel.hpp +7 -3
- data/vendor/tomotopy/src/TopicModel/DTModel.hpp +6 -3
- data/vendor/tomotopy/src/TopicModel/GDMRModel.hpp +2 -2
- data/vendor/tomotopy/src/TopicModel/HDP.h +1 -0
- data/vendor/tomotopy/src/TopicModel/HDPModel.hpp +57 -6
- data/vendor/tomotopy/src/TopicModel/HLDAModel.hpp +6 -3
- data/vendor/tomotopy/src/TopicModel/HPAModel.hpp +3 -2
- data/vendor/tomotopy/src/TopicModel/LDA.h +3 -3
- data/vendor/tomotopy/src/TopicModel/LDACVB0Model.hpp +5 -5
- data/vendor/tomotopy/src/TopicModel/LDAModel.hpp +50 -19
- data/vendor/tomotopy/src/TopicModel/LLDAModel.hpp +6 -2
- data/vendor/tomotopy/src/TopicModel/MGLDAModel.hpp +3 -2
- data/vendor/tomotopy/src/TopicModel/PAModel.hpp +1 -1
- data/vendor/tomotopy/src/TopicModel/PLDAModel.hpp +6 -2
- data/vendor/tomotopy/src/TopicModel/PT.h +3 -1
- data/vendor/tomotopy/src/TopicModel/PTModel.hpp +36 -3
- data/vendor/tomotopy/src/TopicModel/SLDAModel.hpp +6 -3
- data/vendor/tomotopy/src/TopicModel/TopicModel.hpp +55 -26
- data/vendor/tomotopy/src/Utils/AliasMethod.hpp +5 -4
- data/vendor/tomotopy/src/Utils/Dictionary.h +2 -2
- data/vendor/tomotopy/src/Utils/EigenAddonOps.hpp +36 -1
- data/vendor/tomotopy/src/Utils/MultiNormalDistribution.hpp +1 -1
- data/vendor/tomotopy/src/Utils/TruncMultiNormal.hpp +1 -1
- data/vendor/tomotopy/src/Utils/exception.h +6 -0
- data/vendor/tomotopy/src/Utils/math.h +2 -2
- data/vendor/tomotopy/src/Utils/sample.hpp +14 -12
- data/vendor/tomotopy/src/Utils/serializer.hpp +30 -5
- data/vendor/tomotopy/src/Utils/sse_gamma.h +0 -3
- metadata +64 -18
- data/vendor/eigen/Eigen/CMakeLists.txt +0 -19
- data/vendor/eigen/Eigen/src/Core/arch/CUDA/Half.h +0 -674
- data/vendor/eigen/Eigen/src/Core/arch/CUDA/PacketMath.h +0 -333
- data/vendor/eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h +0 -1124
- data/vendor/eigen/Eigen/src/Core/arch/CUDA/TypeCasting.h +0 -212
- data/vendor/eigen/Eigen/src/Geometry/arch/Geometry_SSE.h +0 -161
- data/vendor/eigen/Eigen/src/LU/arch/Inverse_SSE.h +0 -338
@@ -15,6 +15,7 @@ namespace Eigen {
|
|
15
15
|
namespace internal {
|
16
16
|
|
17
17
|
template<typename Derived>
|
18
|
+
EIGEN_DEVICE_FUNC
|
18
19
|
inline const typename Derived::Scalar bruteforce_det3_helper
|
19
20
|
(const MatrixBase<Derived>& matrix, int a, int b, int c)
|
20
21
|
{
|
@@ -22,14 +23,6 @@ inline const typename Derived::Scalar bruteforce_det3_helper
|
|
22
23
|
* (matrix.coeff(1,b) * matrix.coeff(2,c) - matrix.coeff(1,c) * matrix.coeff(2,b));
|
23
24
|
}
|
24
25
|
|
25
|
-
template<typename Derived>
|
26
|
-
const typename Derived::Scalar bruteforce_det4_helper
|
27
|
-
(const MatrixBase<Derived>& matrix, int j, int k, int m, int n)
|
28
|
-
{
|
29
|
-
return (matrix.coeff(j,0) * matrix.coeff(k,1) - matrix.coeff(k,0) * matrix.coeff(j,1))
|
30
|
-
* (matrix.coeff(m,2) * matrix.coeff(n,3) - matrix.coeff(n,2) * matrix.coeff(m,3));
|
31
|
-
}
|
32
|
-
|
33
26
|
template<typename Derived,
|
34
27
|
int DeterminantType = Derived::RowsAtCompileTime
|
35
28
|
> struct determinant_impl
|
@@ -44,7 +37,8 @@ template<typename Derived,
|
|
44
37
|
|
45
38
|
template<typename Derived> struct determinant_impl<Derived, 1>
|
46
39
|
{
|
47
|
-
static inline
|
40
|
+
static inline EIGEN_DEVICE_FUNC
|
41
|
+
typename traits<Derived>::Scalar run(const Derived& m)
|
48
42
|
{
|
49
43
|
return m.coeff(0,0);
|
50
44
|
}
|
@@ -52,7 +46,8 @@ template<typename Derived> struct determinant_impl<Derived, 1>
|
|
52
46
|
|
53
47
|
template<typename Derived> struct determinant_impl<Derived, 2>
|
54
48
|
{
|
55
|
-
static inline
|
49
|
+
static inline EIGEN_DEVICE_FUNC
|
50
|
+
typename traits<Derived>::Scalar run(const Derived& m)
|
56
51
|
{
|
57
52
|
return m.coeff(0,0) * m.coeff(1,1) - m.coeff(1,0) * m.coeff(0,1);
|
58
53
|
}
|
@@ -60,7 +55,8 @@ template<typename Derived> struct determinant_impl<Derived, 2>
|
|
60
55
|
|
61
56
|
template<typename Derived> struct determinant_impl<Derived, 3>
|
62
57
|
{
|
63
|
-
static inline
|
58
|
+
static inline EIGEN_DEVICE_FUNC
|
59
|
+
typename traits<Derived>::Scalar run(const Derived& m)
|
64
60
|
{
|
65
61
|
return bruteforce_det3_helper(m,0,1,2)
|
66
62
|
- bruteforce_det3_helper(m,1,0,2)
|
@@ -70,15 +66,34 @@ template<typename Derived> struct determinant_impl<Derived, 3>
|
|
70
66
|
|
71
67
|
template<typename Derived> struct determinant_impl<Derived, 4>
|
72
68
|
{
|
73
|
-
|
69
|
+
typedef typename traits<Derived>::Scalar Scalar;
|
70
|
+
static EIGEN_DEVICE_FUNC
|
71
|
+
Scalar run(const Derived& m)
|
72
|
+
{
|
73
|
+
Scalar d2_01 = det2(m, 0, 1);
|
74
|
+
Scalar d2_02 = det2(m, 0, 2);
|
75
|
+
Scalar d2_03 = det2(m, 0, 3);
|
76
|
+
Scalar d2_12 = det2(m, 1, 2);
|
77
|
+
Scalar d2_13 = det2(m, 1, 3);
|
78
|
+
Scalar d2_23 = det2(m, 2, 3);
|
79
|
+
Scalar d3_0 = det3(m, 1,d2_23, 2,d2_13, 3,d2_12);
|
80
|
+
Scalar d3_1 = det3(m, 0,d2_23, 2,d2_03, 3,d2_02);
|
81
|
+
Scalar d3_2 = det3(m, 0,d2_13, 1,d2_03, 3,d2_01);
|
82
|
+
Scalar d3_3 = det3(m, 0,d2_12, 1,d2_02, 2,d2_01);
|
83
|
+
return internal::pmadd(-m(0,3),d3_0, m(1,3)*d3_1) +
|
84
|
+
internal::pmadd(-m(2,3),d3_2, m(3,3)*d3_3);
|
85
|
+
}
|
86
|
+
protected:
|
87
|
+
static EIGEN_DEVICE_FUNC
|
88
|
+
Scalar det2(const Derived& m, Index i0, Index i1)
|
89
|
+
{
|
90
|
+
return m(i0,0) * m(i1,1) - m(i1,0) * m(i0,1);
|
91
|
+
}
|
92
|
+
|
93
|
+
static EIGEN_DEVICE_FUNC
|
94
|
+
Scalar det3(const Derived& m, Index i0, const Scalar& d0, Index i1, const Scalar& d1, Index i2, const Scalar& d2)
|
74
95
|
{
|
75
|
-
|
76
|
-
return bruteforce_det4_helper(m,0,1,2,3)
|
77
|
-
- bruteforce_det4_helper(m,0,2,1,3)
|
78
|
-
+ bruteforce_det4_helper(m,0,3,1,2)
|
79
|
-
+ bruteforce_det4_helper(m,1,2,0,3)
|
80
|
-
- bruteforce_det4_helper(m,1,3,0,2)
|
81
|
-
+ bruteforce_det4_helper(m,2,3,0,1);
|
96
|
+
return internal::pmadd(m(i0,2), d0, internal::pmadd(-m(i1,2), d1, m(i2,2)*d2));
|
82
97
|
}
|
83
98
|
};
|
84
99
|
|
@@ -89,6 +104,7 @@ template<typename Derived> struct determinant_impl<Derived, 4>
|
|
89
104
|
* \returns the determinant of this matrix
|
90
105
|
*/
|
91
106
|
template<typename Derived>
|
107
|
+
EIGEN_DEVICE_FUNC
|
92
108
|
inline typename internal::traits<Derived>::Scalar MatrixBase<Derived>::determinant() const
|
93
109
|
{
|
94
110
|
eigen_assert(rows() == cols());
|
@@ -18,6 +18,7 @@ template<typename _MatrixType> struct traits<FullPivLU<_MatrixType> >
|
|
18
18
|
{
|
19
19
|
typedef MatrixXpr XprKind;
|
20
20
|
typedef SolverStorage StorageKind;
|
21
|
+
typedef int StorageIndex;
|
21
22
|
enum { Flags = 0 };
|
22
23
|
};
|
23
24
|
|
@@ -48,12 +49,12 @@ template<typename _MatrixType> struct traits<FullPivLU<_MatrixType> >
|
|
48
49
|
* The data of the LU decomposition can be directly accessed through the methods matrixLU(),
|
49
50
|
* permutationP(), permutationQ().
|
50
51
|
*
|
51
|
-
* As an
|
52
|
+
* As an example, here is how the original matrix can be retrieved:
|
52
53
|
* \include class_FullPivLU.cpp
|
53
54
|
* Output: \verbinclude class_FullPivLU.out
|
54
55
|
*
|
55
56
|
* This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism.
|
56
|
-
*
|
57
|
+
*
|
57
58
|
* \sa MatrixBase::fullPivLu(), MatrixBase::determinant(), MatrixBase::inverse()
|
58
59
|
*/
|
59
60
|
template<typename _MatrixType> class FullPivLU
|
@@ -62,9 +63,9 @@ template<typename _MatrixType> class FullPivLU
|
|
62
63
|
public:
|
63
64
|
typedef _MatrixType MatrixType;
|
64
65
|
typedef SolverBase<FullPivLU> Base;
|
66
|
+
friend class SolverBase<FullPivLU>;
|
65
67
|
|
66
68
|
EIGEN_GENERIC_PUBLIC_INTERFACE(FullPivLU)
|
67
|
-
// FIXME StorageIndex defined in EIGEN_GENERIC_PUBLIC_INTERFACE should be int
|
68
69
|
enum {
|
69
70
|
MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
|
70
71
|
MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
|
@@ -218,6 +219,7 @@ template<typename _MatrixType> class FullPivLU
|
|
218
219
|
return internal::image_retval<FullPivLU>(*this, originalMatrix);
|
219
220
|
}
|
220
221
|
|
222
|
+
#ifdef EIGEN_PARSED_BY_DOXYGEN
|
221
223
|
/** \return a solution x to the equation Ax=b, where A is the matrix of which
|
222
224
|
* *this is the LU decomposition.
|
223
225
|
*
|
@@ -237,14 +239,10 @@ template<typename _MatrixType> class FullPivLU
|
|
237
239
|
*
|
238
240
|
* \sa TriangularView::solve(), kernel(), inverse()
|
239
241
|
*/
|
240
|
-
// FIXME this is a copy-paste of the base-class member to add the isInitialized assertion.
|
241
242
|
template<typename Rhs>
|
242
243
|
inline const Solve<FullPivLU, Rhs>
|
243
|
-
solve(const MatrixBase<Rhs>& b) const
|
244
|
-
|
245
|
-
eigen_assert(m_isInitialized && "LU is not initialized.");
|
246
|
-
return Solve<FullPivLU, Rhs>(*this, b.derived());
|
247
|
-
}
|
244
|
+
solve(const MatrixBase<Rhs>& b) const;
|
245
|
+
#endif
|
248
246
|
|
249
247
|
/** \returns an estimate of the reciprocal condition number of the matrix of which \c *this is
|
250
248
|
the LU decomposition.
|
@@ -320,7 +318,7 @@ template<typename _MatrixType> class FullPivLU
|
|
320
318
|
return m_usePrescribedThreshold ? m_prescribedThreshold
|
321
319
|
// this formula comes from experimenting (see "LU precision tuning" thread on the list)
|
322
320
|
// and turns out to be identical to Higham's formula used already in LDLt.
|
323
|
-
|
321
|
+
: NumTraits<Scalar>::epsilon() * RealScalar(m_lu.diagonalSize());
|
324
322
|
}
|
325
323
|
|
326
324
|
/** \returns the rank of the matrix of which *this is the LU decomposition.
|
@@ -406,16 +404,16 @@ template<typename _MatrixType> class FullPivLU
|
|
406
404
|
|
407
405
|
MatrixType reconstructedMatrix() const;
|
408
406
|
|
409
|
-
EIGEN_DEVICE_FUNC
|
410
|
-
|
407
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
408
|
+
inline Index rows() const EIGEN_NOEXCEPT { return m_lu.rows(); }
|
409
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
410
|
+
inline Index cols() const EIGEN_NOEXCEPT { return m_lu.cols(); }
|
411
411
|
|
412
412
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
413
413
|
template<typename RhsType, typename DstType>
|
414
|
-
EIGEN_DEVICE_FUNC
|
415
414
|
void _solve_impl(const RhsType &rhs, DstType &dst) const;
|
416
415
|
|
417
416
|
template<bool Conjugate, typename RhsType, typename DstType>
|
418
|
-
EIGEN_DEVICE_FUNC
|
419
417
|
void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const;
|
420
418
|
#endif
|
421
419
|
|
@@ -531,8 +529,8 @@ void FullPivLU<MatrixType>::computeInPlace()
|
|
531
529
|
m_nonzero_pivots = k;
|
532
530
|
for(Index i = k; i < size; ++i)
|
533
531
|
{
|
534
|
-
m_rowsTranspositions.coeffRef(i) = i;
|
535
|
-
m_colsTranspositions.coeffRef(i) = i;
|
532
|
+
m_rowsTranspositions.coeffRef(i) = internal::convert_index<StorageIndex>(i);
|
533
|
+
m_colsTranspositions.coeffRef(i) = internal::convert_index<StorageIndex>(i);
|
536
534
|
}
|
537
535
|
break;
|
538
536
|
}
|
@@ -543,8 +541,8 @@ void FullPivLU<MatrixType>::computeInPlace()
|
|
543
541
|
// Now that we've found the pivot, we need to apply the row/col swaps to
|
544
542
|
// bring it to the location (k,k).
|
545
543
|
|
546
|
-
m_rowsTranspositions.coeffRef(k) = row_of_biggest_in_corner;
|
547
|
-
m_colsTranspositions.coeffRef(k) = col_of_biggest_in_corner;
|
544
|
+
m_rowsTranspositions.coeffRef(k) = internal::convert_index<StorageIndex>(row_of_biggest_in_corner);
|
545
|
+
m_colsTranspositions.coeffRef(k) = internal::convert_index<StorageIndex>(col_of_biggest_in_corner);
|
548
546
|
if(k != row_of_biggest_in_corner) {
|
549
547
|
m_lu.row(k).swap(m_lu.row(row_of_biggest_in_corner));
|
550
548
|
++number_of_transpositions;
|
@@ -757,7 +755,6 @@ void FullPivLU<_MatrixType>::_solve_impl(const RhsType &rhs, DstType &dst) const
|
|
757
755
|
const Index rows = this->rows(),
|
758
756
|
cols = this->cols(),
|
759
757
|
nonzero_pivots = this->rank();
|
760
|
-
eigen_assert(rhs.rows() == rows);
|
761
758
|
const Index smalldim = (std::min)(rows, cols);
|
762
759
|
|
763
760
|
if(nonzero_pivots == 0)
|
@@ -807,7 +804,6 @@ void FullPivLU<_MatrixType>::_solve_impl_transposed(const RhsType &rhs, DstType
|
|
807
804
|
|
808
805
|
const Index rows = this->rows(), cols = this->cols(),
|
809
806
|
nonzero_pivots = this->rank();
|
810
|
-
eigen_assert(rhs.rows() == cols);
|
811
807
|
const Index smalldim = (std::min)(rows, cols);
|
812
808
|
|
813
809
|
if(nonzero_pivots == 0)
|
@@ -821,29 +817,19 @@ void FullPivLU<_MatrixType>::_solve_impl_transposed(const RhsType &rhs, DstType
|
|
821
817
|
// Step 1
|
822
818
|
c = permutationQ().inverse() * rhs;
|
823
819
|
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
m_lu.topLeftCorner(nonzero_pivots, nonzero_pivots)
|
838
|
-
.template triangularView<Upper>()
|
839
|
-
.transpose()
|
840
|
-
.solveInPlace(c.topRows(nonzero_pivots));
|
841
|
-
// Step 3
|
842
|
-
m_lu.topLeftCorner(smalldim, smalldim)
|
843
|
-
.template triangularView<UnitLower>()
|
844
|
-
.transpose()
|
845
|
-
.solveInPlace(c.topRows(smalldim));
|
846
|
-
}
|
820
|
+
// Step 2
|
821
|
+
m_lu.topLeftCorner(nonzero_pivots, nonzero_pivots)
|
822
|
+
.template triangularView<Upper>()
|
823
|
+
.transpose()
|
824
|
+
.template conjugateIf<Conjugate>()
|
825
|
+
.solveInPlace(c.topRows(nonzero_pivots));
|
826
|
+
|
827
|
+
// Step 3
|
828
|
+
m_lu.topLeftCorner(smalldim, smalldim)
|
829
|
+
.template triangularView<UnitLower>()
|
830
|
+
.transpose()
|
831
|
+
.template conjugateIf<Conjugate>()
|
832
|
+
.solveInPlace(c.topRows(smalldim));
|
847
833
|
|
848
834
|
// Step 4
|
849
835
|
PermutationPType invp = permutationP().inverse().eval();
|
@@ -77,10 +77,11 @@ inline void compute_inverse_size2_helper(
|
|
77
77
|
const MatrixType& matrix, const typename ResultType::Scalar& invdet,
|
78
78
|
ResultType& result)
|
79
79
|
{
|
80
|
+
typename ResultType::Scalar temp = matrix.coeff(0,0);
|
80
81
|
result.coeffRef(0,0) = matrix.coeff(1,1) * invdet;
|
81
82
|
result.coeffRef(1,0) = -matrix.coeff(1,0) * invdet;
|
82
83
|
result.coeffRef(0,1) = -matrix.coeff(0,1) * invdet;
|
83
|
-
result.coeffRef(1,1) =
|
84
|
+
result.coeffRef(1,1) = temp * invdet;
|
84
85
|
}
|
85
86
|
|
86
87
|
template<typename MatrixType, typename ResultType>
|
@@ -143,13 +144,18 @@ inline void compute_inverse_size3_helper(
|
|
143
144
|
const Matrix<typename ResultType::Scalar,3,1>& cofactors_col0,
|
144
145
|
ResultType& result)
|
145
146
|
{
|
146
|
-
|
147
|
-
|
148
|
-
|
147
|
+
// Compute cofactors in a way that avoids aliasing issues.
|
148
|
+
typedef typename ResultType::Scalar Scalar;
|
149
|
+
const Scalar c01 = cofactor_3x3<MatrixType,0,1>(matrix) * invdet;
|
150
|
+
const Scalar c11 = cofactor_3x3<MatrixType,1,1>(matrix) * invdet;
|
151
|
+
const Scalar c02 = cofactor_3x3<MatrixType,0,2>(matrix) * invdet;
|
149
152
|
result.coeffRef(1,2) = cofactor_3x3<MatrixType,2,1>(matrix) * invdet;
|
150
|
-
result.coeffRef(2,0) = cofactor_3x3<MatrixType,0,2>(matrix) * invdet;
|
151
153
|
result.coeffRef(2,1) = cofactor_3x3<MatrixType,1,2>(matrix) * invdet;
|
152
154
|
result.coeffRef(2,2) = cofactor_3x3<MatrixType,2,2>(matrix) * invdet;
|
155
|
+
result.coeffRef(1,0) = c01;
|
156
|
+
result.coeffRef(1,1) = c11;
|
157
|
+
result.coeffRef(2,0) = c02;
|
158
|
+
result.row(0) = cofactors_col0 * invdet;
|
153
159
|
}
|
154
160
|
|
155
161
|
template<typename MatrixType, typename ResultType>
|
@@ -181,14 +187,13 @@ struct compute_inverse_and_det_with_check<MatrixType, ResultType, 3>
|
|
181
187
|
bool& invertible
|
182
188
|
)
|
183
189
|
{
|
184
|
-
using std::abs;
|
185
190
|
typedef typename ResultType::Scalar Scalar;
|
186
191
|
Matrix<Scalar,3,1> cofactors_col0;
|
187
192
|
cofactors_col0.coeffRef(0) = cofactor_3x3<MatrixType,0,0>(matrix);
|
188
193
|
cofactors_col0.coeffRef(1) = cofactor_3x3<MatrixType,1,0>(matrix);
|
189
194
|
cofactors_col0.coeffRef(2) = cofactor_3x3<MatrixType,2,0>(matrix);
|
190
195
|
determinant = (cofactors_col0.cwiseProduct(matrix.col(0))).sum();
|
191
|
-
invertible = abs(determinant) > absDeterminantThreshold;
|
196
|
+
invertible = Eigen::numext::abs(determinant) > absDeterminantThreshold;
|
192
197
|
if(!invertible) return;
|
193
198
|
const Scalar invdet = Scalar(1) / determinant;
|
194
199
|
compute_inverse_size3_helper(matrix, invdet, cofactors_col0, inverse);
|
@@ -273,7 +278,13 @@ struct compute_inverse_and_det_with_check<MatrixType, ResultType, 4>
|
|
273
278
|
using std::abs;
|
274
279
|
determinant = matrix.determinant();
|
275
280
|
invertible = abs(determinant) > absDeterminantThreshold;
|
276
|
-
if(invertible
|
281
|
+
if(invertible && extract_data(matrix) != extract_data(inverse)) {
|
282
|
+
compute_inverse<MatrixType, ResultType>::run(matrix, inverse);
|
283
|
+
}
|
284
|
+
else if(invertible) {
|
285
|
+
MatrixType matrix_t = matrix;
|
286
|
+
compute_inverse<MatrixType, ResultType>::run(matrix_t, inverse);
|
287
|
+
}
|
277
288
|
}
|
278
289
|
};
|
279
290
|
|
@@ -290,6 +301,7 @@ template<typename DstXprType, typename XprType>
|
|
290
301
|
struct Assignment<DstXprType, Inverse<XprType>, internal::assign_op<typename DstXprType::Scalar,typename XprType::Scalar>, Dense2Dense>
|
291
302
|
{
|
292
303
|
typedef Inverse<XprType> SrcXprType;
|
304
|
+
EIGEN_DEVICE_FUNC
|
293
305
|
static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op<typename DstXprType::Scalar,typename XprType::Scalar> &)
|
294
306
|
{
|
295
307
|
Index dstRows = src.rows();
|
@@ -332,6 +344,7 @@ struct Assignment<DstXprType, Inverse<XprType>, internal::assign_op<typename Dst
|
|
332
344
|
* \sa computeInverseAndDetWithCheck()
|
333
345
|
*/
|
334
346
|
template<typename Derived>
|
347
|
+
EIGEN_DEVICE_FUNC
|
335
348
|
inline const Inverse<Derived> MatrixBase<Derived>::inverse() const
|
336
349
|
{
|
337
350
|
EIGEN_STATIC_ASSERT(!NumTraits<Scalar>::IsInteger,THIS_FUNCTION_IS_NOT_FOR_INTEGER_NUMERIC_TYPES)
|
@@ -345,6 +358,8 @@ inline const Inverse<Derived> MatrixBase<Derived>::inverse() const
|
|
345
358
|
*
|
346
359
|
* This is only for fixed-size square matrices of size up to 4x4.
|
347
360
|
*
|
361
|
+
* Notice that it will trigger a copy of input matrix when trying to do the inverse in place.
|
362
|
+
*
|
348
363
|
* \param inverse Reference to the matrix in which to store the inverse.
|
349
364
|
* \param determinant Reference to the variable in which to store the determinant.
|
350
365
|
* \param invertible Reference to the bool variable in which to store whether the matrix is invertible.
|
@@ -385,6 +400,8 @@ inline void MatrixBase<Derived>::computeInverseAndDetWithCheck(
|
|
385
400
|
*
|
386
401
|
* This is only for fixed-size square matrices of size up to 4x4.
|
387
402
|
*
|
403
|
+
* Notice that it will trigger a copy of input matrix when trying to do the inverse in place.
|
404
|
+
*
|
388
405
|
* \param inverse Reference to the matrix in which to store the inverse.
|
389
406
|
* \param invertible Reference to the bool variable in which to store whether the matrix is invertible.
|
390
407
|
* \param absDeterminantThreshold Optional parameter controlling the invertibility check.
|
@@ -19,6 +19,7 @@ template<typename _MatrixType> struct traits<PartialPivLU<_MatrixType> >
|
|
19
19
|
{
|
20
20
|
typedef MatrixXpr XprKind;
|
21
21
|
typedef SolverStorage StorageKind;
|
22
|
+
typedef int StorageIndex;
|
22
23
|
typedef traits<_MatrixType> BaseTraits;
|
23
24
|
enum {
|
24
25
|
Flags = BaseTraits::Flags & RowMajorBit,
|
@@ -69,7 +70,7 @@ struct enable_if_ref<Ref<T>,Derived> {
|
|
69
70
|
* The data of the LU decomposition can be directly accessed through the methods matrixLU(), permutationP().
|
70
71
|
*
|
71
72
|
* This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism.
|
72
|
-
*
|
73
|
+
*
|
73
74
|
* \sa MatrixBase::partialPivLu(), MatrixBase::determinant(), MatrixBase::inverse(), MatrixBase::computeInverse(), class FullPivLU
|
74
75
|
*/
|
75
76
|
template<typename _MatrixType> class PartialPivLU
|
@@ -79,8 +80,9 @@ template<typename _MatrixType> class PartialPivLU
|
|
79
80
|
|
80
81
|
typedef _MatrixType MatrixType;
|
81
82
|
typedef SolverBase<PartialPivLU> Base;
|
83
|
+
friend class SolverBase<PartialPivLU>;
|
84
|
+
|
82
85
|
EIGEN_GENERIC_PUBLIC_INTERFACE(PartialPivLU)
|
83
|
-
// FIXME StorageIndex defined in EIGEN_GENERIC_PUBLIC_INTERFACE should be int
|
84
86
|
enum {
|
85
87
|
MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
|
86
88
|
MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
|
@@ -152,6 +154,7 @@ template<typename _MatrixType> class PartialPivLU
|
|
152
154
|
return m_p;
|
153
155
|
}
|
154
156
|
|
157
|
+
#ifdef EIGEN_PARSED_BY_DOXYGEN
|
155
158
|
/** This method returns the solution x to the equation Ax=b, where A is the matrix of which
|
156
159
|
* *this is the LU decomposition.
|
157
160
|
*
|
@@ -169,14 +172,10 @@ template<typename _MatrixType> class PartialPivLU
|
|
169
172
|
*
|
170
173
|
* \sa TriangularView::solve(), inverse(), computeInverse()
|
171
174
|
*/
|
172
|
-
// FIXME this is a copy-paste of the base-class member to add the isInitialized assertion.
|
173
175
|
template<typename Rhs>
|
174
176
|
inline const Solve<PartialPivLU, Rhs>
|
175
|
-
solve(const MatrixBase<Rhs>& b) const
|
176
|
-
|
177
|
-
eigen_assert(m_isInitialized && "PartialPivLU is not initialized.");
|
178
|
-
return Solve<PartialPivLU, Rhs>(*this, b.derived());
|
179
|
-
}
|
177
|
+
solve(const MatrixBase<Rhs>& b) const;
|
178
|
+
#endif
|
180
179
|
|
181
180
|
/** \returns an estimate of the reciprocal condition number of the matrix of which \c *this is
|
182
181
|
the LU decomposition.
|
@@ -217,8 +216,8 @@ template<typename _MatrixType> class PartialPivLU
|
|
217
216
|
|
218
217
|
MatrixType reconstructedMatrix() const;
|
219
218
|
|
220
|
-
inline Index rows() const { return m_lu.rows(); }
|
221
|
-
inline Index cols() const { return m_lu.cols(); }
|
219
|
+
EIGEN_CONSTEXPR inline Index rows() const EIGEN_NOEXCEPT { return m_lu.rows(); }
|
220
|
+
EIGEN_CONSTEXPR inline Index cols() const EIGEN_NOEXCEPT { return m_lu.cols(); }
|
222
221
|
|
223
222
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
224
223
|
template<typename RhsType, typename DstType>
|
@@ -231,8 +230,6 @@ template<typename _MatrixType> class PartialPivLU
|
|
231
230
|
* Step 3: replace c by the solution x to Ux = c.
|
232
231
|
*/
|
233
232
|
|
234
|
-
eigen_assert(rhs.rows() == m_lu.rows());
|
235
|
-
|
236
233
|
// Step 1
|
237
234
|
dst = permutationP() * rhs;
|
238
235
|
|
@@ -246,26 +243,21 @@ template<typename _MatrixType> class PartialPivLU
|
|
246
243
|
template<bool Conjugate, typename RhsType, typename DstType>
|
247
244
|
EIGEN_DEVICE_FUNC
|
248
245
|
void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const {
|
249
|
-
/* The decomposition PA = LU can be rewritten as A =
|
246
|
+
/* The decomposition PA = LU can be rewritten as A^T = U^T L^T P.
|
250
247
|
* So we proceed as follows:
|
251
|
-
* Step 1: compute c =
|
252
|
-
* Step 2: replace c by the solution x to
|
253
|
-
* Step 3:
|
248
|
+
* Step 1: compute c as the solution to L^T c = b
|
249
|
+
* Step 2: replace c by the solution x to U^T x = c.
|
250
|
+
* Step 3: update c = P^-1 c.
|
254
251
|
*/
|
255
252
|
|
256
253
|
eigen_assert(rhs.rows() == m_lu.cols());
|
257
254
|
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
// Step 1
|
265
|
-
dst = m_lu.template triangularView<Upper>().transpose().solve(rhs);
|
266
|
-
// Step 2
|
267
|
-
m_lu.template triangularView<UnitLower>().transpose().solveInPlace(dst);
|
268
|
-
}
|
255
|
+
// Step 1
|
256
|
+
dst = m_lu.template triangularView<Upper>().transpose()
|
257
|
+
.template conjugateIf<Conjugate>().solve(rhs);
|
258
|
+
// Step 2
|
259
|
+
m_lu.template triangularView<UnitLower>().transpose()
|
260
|
+
.template conjugateIf<Conjugate>().solveInPlace(dst);
|
269
261
|
// Step 3
|
270
262
|
dst = permutationP().transpose() * dst;
|
271
263
|
}
|
@@ -339,17 +331,18 @@ PartialPivLU<MatrixType>::PartialPivLU(EigenBase<InputType>& matrix)
|
|
339
331
|
namespace internal {
|
340
332
|
|
341
333
|
/** \internal This is the blocked version of fullpivlu_unblocked() */
|
342
|
-
template<typename Scalar, int StorageOrder, typename PivIndex>
|
334
|
+
template<typename Scalar, int StorageOrder, typename PivIndex, int SizeAtCompileTime=Dynamic>
|
343
335
|
struct partial_lu_impl
|
344
336
|
{
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
//
|
349
|
-
|
350
|
-
|
351
|
-
typedef
|
352
|
-
typedef
|
337
|
+
static const int UnBlockedBound = 16;
|
338
|
+
static const bool UnBlockedAtCompileTime = SizeAtCompileTime!=Dynamic && SizeAtCompileTime<=UnBlockedBound;
|
339
|
+
static const int ActualSizeAtCompileTime = UnBlockedAtCompileTime ? SizeAtCompileTime : Dynamic;
|
340
|
+
// Remaining rows and columns at compile-time:
|
341
|
+
static const int RRows = SizeAtCompileTime==2 ? 1 : Dynamic;
|
342
|
+
static const int RCols = SizeAtCompileTime==2 ? 1 : Dynamic;
|
343
|
+
typedef Matrix<Scalar, ActualSizeAtCompileTime, ActualSizeAtCompileTime, StorageOrder> MatrixType;
|
344
|
+
typedef Ref<MatrixType> MatrixTypeRef;
|
345
|
+
typedef Ref<Matrix<Scalar, Dynamic, Dynamic, StorageOrder> > BlockType;
|
353
346
|
typedef typename MatrixType::RealScalar RealScalar;
|
354
347
|
|
355
348
|
/** \internal performs the LU decomposition in-place of the matrix \a lu
|
@@ -362,19 +355,22 @@ struct partial_lu_impl
|
|
362
355
|
*
|
363
356
|
* \returns The index of the first pivot which is exactly zero if any, or a negative number otherwise.
|
364
357
|
*/
|
365
|
-
static Index unblocked_lu(
|
358
|
+
static Index unblocked_lu(MatrixTypeRef& lu, PivIndex* row_transpositions, PivIndex& nb_transpositions)
|
366
359
|
{
|
367
360
|
typedef scalar_score_coeff_op<Scalar> Scoring;
|
368
361
|
typedef typename Scoring::result_type Score;
|
369
362
|
const Index rows = lu.rows();
|
370
363
|
const Index cols = lu.cols();
|
371
364
|
const Index size = (std::min)(rows,cols);
|
365
|
+
// For small compile-time matrices it is worth processing the last row separately:
|
366
|
+
// speedup: +100% for 2x2, +10% for others.
|
367
|
+
const Index endk = UnBlockedAtCompileTime ? size-1 : size;
|
372
368
|
nb_transpositions = 0;
|
373
369
|
Index first_zero_pivot = -1;
|
374
|
-
for(Index k = 0; k <
|
370
|
+
for(Index k = 0; k < endk; ++k)
|
375
371
|
{
|
376
|
-
|
377
|
-
|
372
|
+
int rrows = internal::convert_index<int>(rows-k-1);
|
373
|
+
int rcols = internal::convert_index<int>(cols-k-1);
|
378
374
|
|
379
375
|
Index row_of_biggest_in_col;
|
380
376
|
Score biggest_in_corner
|
@@ -391,9 +387,7 @@ struct partial_lu_impl
|
|
391
387
|
++nb_transpositions;
|
392
388
|
}
|
393
389
|
|
394
|
-
|
395
|
-
// overflow but not the actual quotient?
|
396
|
-
lu.col(k).tail(rrows) /= lu.coeff(k,k);
|
390
|
+
lu.col(k).tail(fix<RRows>(rrows)) /= lu.coeff(k,k);
|
397
391
|
}
|
398
392
|
else if(first_zero_pivot==-1)
|
399
393
|
{
|
@@ -403,8 +397,18 @@ struct partial_lu_impl
|
|
403
397
|
}
|
404
398
|
|
405
399
|
if(k<rows-1)
|
406
|
-
lu.bottomRightCorner(rrows,rcols).noalias() -= lu.col(k).tail(rrows) * lu.row(k).tail(rcols);
|
400
|
+
lu.bottomRightCorner(fix<RRows>(rrows),fix<RCols>(rcols)).noalias() -= lu.col(k).tail(fix<RRows>(rrows)) * lu.row(k).tail(fix<RCols>(rcols));
|
401
|
+
}
|
402
|
+
|
403
|
+
// special handling of the last entry
|
404
|
+
if(UnBlockedAtCompileTime)
|
405
|
+
{
|
406
|
+
Index k = endk;
|
407
|
+
row_transpositions[k] = PivIndex(k);
|
408
|
+
if (Scoring()(lu(k, k)) == Score(0) && first_zero_pivot == -1)
|
409
|
+
first_zero_pivot = k;
|
407
410
|
}
|
411
|
+
|
408
412
|
return first_zero_pivot;
|
409
413
|
}
|
410
414
|
|
@@ -420,18 +424,17 @@ struct partial_lu_impl
|
|
420
424
|
* \returns The index of the first pivot which is exactly zero if any, or a negative number otherwise.
|
421
425
|
*
|
422
426
|
* \note This very low level interface using pointers, etc. is to:
|
423
|
-
* 1 - reduce the number of
|
424
|
-
* 2 - avoid infinite recursion of the
|
427
|
+
* 1 - reduce the number of instantiations to the strict minimum
|
428
|
+
* 2 - avoid infinite recursion of the instantiations with Block<Block<Block<...> > >
|
425
429
|
*/
|
426
430
|
static Index blocked_lu(Index rows, Index cols, Scalar* lu_data, Index luStride, PivIndex* row_transpositions, PivIndex& nb_transpositions, Index maxBlockSize=256)
|
427
431
|
{
|
428
|
-
|
429
|
-
MatrixType lu(lu1,0,0,rows,cols);
|
432
|
+
MatrixTypeRef lu = MatrixType::Map(lu_data,rows, cols, OuterStride<>(luStride));
|
430
433
|
|
431
434
|
const Index size = (std::min)(rows,cols);
|
432
435
|
|
433
436
|
// if the matrix is too small, no blocking:
|
434
|
-
if(size<=
|
437
|
+
if(UnBlockedAtCompileTime || size<=UnBlockedBound)
|
435
438
|
{
|
436
439
|
return unblocked_lu(lu, row_transpositions, nb_transpositions);
|
437
440
|
}
|
@@ -457,12 +460,12 @@ struct partial_lu_impl
|
|
457
460
|
// A00 | A01 | A02
|
458
461
|
// lu = A_0 | A_1 | A_2 = A10 | A11 | A12
|
459
462
|
// A20 | A21 | A22
|
460
|
-
BlockType A_0(
|
461
|
-
BlockType A_2(
|
462
|
-
BlockType A11(
|
463
|
-
BlockType A12(
|
464
|
-
BlockType A21(
|
465
|
-
BlockType A22(
|
463
|
+
BlockType A_0 = lu.block(0,0,rows,k);
|
464
|
+
BlockType A_2 = lu.block(0,k+bs,rows,tsize);
|
465
|
+
BlockType A11 = lu.block(k,k,bs,bs);
|
466
|
+
BlockType A12 = lu.block(k,k+bs,bs,tsize);
|
467
|
+
BlockType A21 = lu.block(k+bs,k,trows,bs);
|
468
|
+
BlockType A22 = lu.block(k+bs,k+bs,trows,tsize);
|
466
469
|
|
467
470
|
PivIndex nb_transpositions_in_panel;
|
468
471
|
// recursively call the blocked LU algorithm on [A11^T A21^T]^T
|
@@ -501,11 +504,18 @@ struct partial_lu_impl
|
|
501
504
|
template<typename MatrixType, typename TranspositionType>
|
502
505
|
void partial_lu_inplace(MatrixType& lu, TranspositionType& row_transpositions, typename TranspositionType::StorageIndex& nb_transpositions)
|
503
506
|
{
|
507
|
+
// Special-case of zero matrix.
|
508
|
+
if (lu.rows() == 0 || lu.cols() == 0) {
|
509
|
+
nb_transpositions = 0;
|
510
|
+
return;
|
511
|
+
}
|
504
512
|
eigen_assert(lu.cols() == row_transpositions.size());
|
505
|
-
eigen_assert((&row_transpositions.coeffRef(1)-&row_transpositions.coeffRef(0)) == 1);
|
513
|
+
eigen_assert(row_transpositions.size() < 2 || (&row_transpositions.coeffRef(1)-&row_transpositions.coeffRef(0)) == 1);
|
506
514
|
|
507
515
|
partial_lu_impl
|
508
|
-
<typename MatrixType::Scalar, MatrixType::Flags&RowMajorBit?RowMajor:ColMajor,
|
516
|
+
< typename MatrixType::Scalar, MatrixType::Flags&RowMajorBit?RowMajor:ColMajor,
|
517
|
+
typename TranspositionType::StorageIndex,
|
518
|
+
EIGEN_SIZE_MIN_PREFER_FIXED(MatrixType::RowsAtCompileTime,MatrixType::ColsAtCompileTime)>
|
509
519
|
::blocked_lu(lu.rows(), lu.cols(), &lu.coeffRef(0,0), lu.outerStride(), &row_transpositions.coeffRef(0), nb_transpositions);
|
510
520
|
}
|
511
521
|
|
@@ -519,7 +529,10 @@ void PartialPivLU<MatrixType>::compute()
|
|
519
529
|
// the row permutation is stored as int indices, so just to be sure:
|
520
530
|
eigen_assert(m_lu.rows()<NumTraits<int>::highest());
|
521
531
|
|
522
|
-
|
532
|
+
if(m_lu.cols()>0)
|
533
|
+
m_l1_norm = m_lu.cwiseAbs().colwise().sum().maxCoeff();
|
534
|
+
else
|
535
|
+
m_l1_norm = RealScalar(0);
|
523
536
|
|
524
537
|
eigen_assert(m_lu.rows() == m_lu.cols() && "PartialPivLU is only for square (and moreover invertible) matrices");
|
525
538
|
const Index size = m_lu.rows();
|