umappp 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +25 -0
- data/README.md +110 -0
- data/ext/umappp/extconf.rb +25 -0
- data/ext/umappp/numo.hpp +867 -0
- data/ext/umappp/umappp.cpp +225 -0
- data/lib/umappp/version.rb +5 -0
- data/lib/umappp.rb +41 -0
- data/vendor/Eigen/Cholesky +45 -0
- data/vendor/Eigen/CholmodSupport +48 -0
- data/vendor/Eigen/Core +384 -0
- data/vendor/Eigen/Dense +7 -0
- data/vendor/Eigen/Eigen +2 -0
- data/vendor/Eigen/Eigenvalues +60 -0
- data/vendor/Eigen/Geometry +59 -0
- data/vendor/Eigen/Householder +29 -0
- data/vendor/Eigen/IterativeLinearSolvers +48 -0
- data/vendor/Eigen/Jacobi +32 -0
- data/vendor/Eigen/KLUSupport +41 -0
- data/vendor/Eigen/LU +47 -0
- data/vendor/Eigen/MetisSupport +35 -0
- data/vendor/Eigen/OrderingMethods +70 -0
- data/vendor/Eigen/PaStiXSupport +49 -0
- data/vendor/Eigen/PardisoSupport +35 -0
- data/vendor/Eigen/QR +50 -0
- data/vendor/Eigen/QtAlignedMalloc +39 -0
- data/vendor/Eigen/SPQRSupport +34 -0
- data/vendor/Eigen/SVD +50 -0
- data/vendor/Eigen/Sparse +34 -0
- data/vendor/Eigen/SparseCholesky +37 -0
- data/vendor/Eigen/SparseCore +69 -0
- data/vendor/Eigen/SparseLU +50 -0
- data/vendor/Eigen/SparseQR +36 -0
- data/vendor/Eigen/StdDeque +27 -0
- data/vendor/Eigen/StdList +26 -0
- data/vendor/Eigen/StdVector +27 -0
- data/vendor/Eigen/SuperLUSupport +64 -0
- data/vendor/Eigen/UmfPackSupport +40 -0
- data/vendor/Eigen/src/Cholesky/LDLT.h +688 -0
- data/vendor/Eigen/src/Cholesky/LLT.h +558 -0
- data/vendor/Eigen/src/Cholesky/LLT_LAPACKE.h +99 -0
- data/vendor/Eigen/src/CholmodSupport/CholmodSupport.h +682 -0
- data/vendor/Eigen/src/Core/ArithmeticSequence.h +413 -0
- data/vendor/Eigen/src/Core/Array.h +417 -0
- data/vendor/Eigen/src/Core/ArrayBase.h +226 -0
- data/vendor/Eigen/src/Core/ArrayWrapper.h +209 -0
- data/vendor/Eigen/src/Core/Assign.h +90 -0
- data/vendor/Eigen/src/Core/AssignEvaluator.h +1010 -0
- data/vendor/Eigen/src/Core/Assign_MKL.h +178 -0
- data/vendor/Eigen/src/Core/BandMatrix.h +353 -0
- data/vendor/Eigen/src/Core/Block.h +448 -0
- data/vendor/Eigen/src/Core/BooleanRedux.h +162 -0
- data/vendor/Eigen/src/Core/CommaInitializer.h +164 -0
- data/vendor/Eigen/src/Core/ConditionEstimator.h +175 -0
- data/vendor/Eigen/src/Core/CoreEvaluators.h +1741 -0
- data/vendor/Eigen/src/Core/CoreIterators.h +132 -0
- data/vendor/Eigen/src/Core/CwiseBinaryOp.h +183 -0
- data/vendor/Eigen/src/Core/CwiseNullaryOp.h +1001 -0
- data/vendor/Eigen/src/Core/CwiseTernaryOp.h +197 -0
- data/vendor/Eigen/src/Core/CwiseUnaryOp.h +103 -0
- data/vendor/Eigen/src/Core/CwiseUnaryView.h +132 -0
- data/vendor/Eigen/src/Core/DenseBase.h +701 -0
- data/vendor/Eigen/src/Core/DenseCoeffsBase.h +685 -0
- data/vendor/Eigen/src/Core/DenseStorage.h +652 -0
- data/vendor/Eigen/src/Core/Diagonal.h +258 -0
- data/vendor/Eigen/src/Core/DiagonalMatrix.h +391 -0
- data/vendor/Eigen/src/Core/DiagonalProduct.h +28 -0
- data/vendor/Eigen/src/Core/Dot.h +318 -0
- data/vendor/Eigen/src/Core/EigenBase.h +160 -0
- data/vendor/Eigen/src/Core/ForceAlignedAccess.h +150 -0
- data/vendor/Eigen/src/Core/Fuzzy.h +155 -0
- data/vendor/Eigen/src/Core/GeneralProduct.h +465 -0
- data/vendor/Eigen/src/Core/GenericPacketMath.h +1040 -0
- data/vendor/Eigen/src/Core/GlobalFunctions.h +194 -0
- data/vendor/Eigen/src/Core/IO.h +258 -0
- data/vendor/Eigen/src/Core/IndexedView.h +237 -0
- data/vendor/Eigen/src/Core/Inverse.h +117 -0
- data/vendor/Eigen/src/Core/Map.h +171 -0
- data/vendor/Eigen/src/Core/MapBase.h +310 -0
- data/vendor/Eigen/src/Core/MathFunctions.h +2057 -0
- data/vendor/Eigen/src/Core/MathFunctionsImpl.h +200 -0
- data/vendor/Eigen/src/Core/Matrix.h +565 -0
- data/vendor/Eigen/src/Core/MatrixBase.h +547 -0
- data/vendor/Eigen/src/Core/NestByValue.h +85 -0
- data/vendor/Eigen/src/Core/NoAlias.h +109 -0
- data/vendor/Eigen/src/Core/NumTraits.h +335 -0
- data/vendor/Eigen/src/Core/PartialReduxEvaluator.h +232 -0
- data/vendor/Eigen/src/Core/PermutationMatrix.h +605 -0
- data/vendor/Eigen/src/Core/PlainObjectBase.h +1128 -0
- data/vendor/Eigen/src/Core/Product.h +191 -0
- data/vendor/Eigen/src/Core/ProductEvaluators.h +1179 -0
- data/vendor/Eigen/src/Core/Random.h +218 -0
- data/vendor/Eigen/src/Core/Redux.h +515 -0
- data/vendor/Eigen/src/Core/Ref.h +381 -0
- data/vendor/Eigen/src/Core/Replicate.h +142 -0
- data/vendor/Eigen/src/Core/Reshaped.h +454 -0
- data/vendor/Eigen/src/Core/ReturnByValue.h +119 -0
- data/vendor/Eigen/src/Core/Reverse.h +217 -0
- data/vendor/Eigen/src/Core/Select.h +164 -0
- data/vendor/Eigen/src/Core/SelfAdjointView.h +365 -0
- data/vendor/Eigen/src/Core/SelfCwiseBinaryOp.h +47 -0
- data/vendor/Eigen/src/Core/Solve.h +188 -0
- data/vendor/Eigen/src/Core/SolveTriangular.h +235 -0
- data/vendor/Eigen/src/Core/SolverBase.h +168 -0
- data/vendor/Eigen/src/Core/StableNorm.h +251 -0
- data/vendor/Eigen/src/Core/StlIterators.h +463 -0
- data/vendor/Eigen/src/Core/Stride.h +116 -0
- data/vendor/Eigen/src/Core/Swap.h +68 -0
- data/vendor/Eigen/src/Core/Transpose.h +464 -0
- data/vendor/Eigen/src/Core/Transpositions.h +386 -0
- data/vendor/Eigen/src/Core/TriangularMatrix.h +1001 -0
- data/vendor/Eigen/src/Core/VectorBlock.h +96 -0
- data/vendor/Eigen/src/Core/VectorwiseOp.h +784 -0
- data/vendor/Eigen/src/Core/Visitor.h +381 -0
- data/vendor/Eigen/src/Core/arch/AVX/Complex.h +372 -0
- data/vendor/Eigen/src/Core/arch/AVX/MathFunctions.h +228 -0
- data/vendor/Eigen/src/Core/arch/AVX/PacketMath.h +1574 -0
- data/vendor/Eigen/src/Core/arch/AVX/TypeCasting.h +115 -0
- data/vendor/Eigen/src/Core/arch/AVX512/Complex.h +422 -0
- data/vendor/Eigen/src/Core/arch/AVX512/MathFunctions.h +362 -0
- data/vendor/Eigen/src/Core/arch/AVX512/PacketMath.h +2303 -0
- data/vendor/Eigen/src/Core/arch/AVX512/TypeCasting.h +89 -0
- data/vendor/Eigen/src/Core/arch/AltiVec/Complex.h +417 -0
- data/vendor/Eigen/src/Core/arch/AltiVec/MathFunctions.h +90 -0
- data/vendor/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +2937 -0
- data/vendor/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +221 -0
- data/vendor/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +629 -0
- data/vendor/Eigen/src/Core/arch/AltiVec/PacketMath.h +2711 -0
- data/vendor/Eigen/src/Core/arch/CUDA/Complex.h +258 -0
- data/vendor/Eigen/src/Core/arch/Default/BFloat16.h +700 -0
- data/vendor/Eigen/src/Core/arch/Default/ConjHelper.h +117 -0
- data/vendor/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +1649 -0
- data/vendor/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +110 -0
- data/vendor/Eigen/src/Core/arch/Default/Half.h +942 -0
- data/vendor/Eigen/src/Core/arch/Default/Settings.h +49 -0
- data/vendor/Eigen/src/Core/arch/Default/TypeCasting.h +120 -0
- data/vendor/Eigen/src/Core/arch/GPU/MathFunctions.h +103 -0
- data/vendor/Eigen/src/Core/arch/GPU/PacketMath.h +1685 -0
- data/vendor/Eigen/src/Core/arch/GPU/TypeCasting.h +80 -0
- data/vendor/Eigen/src/Core/arch/HIP/hcc/math_constants.h +23 -0
- data/vendor/Eigen/src/Core/arch/MSA/Complex.h +648 -0
- data/vendor/Eigen/src/Core/arch/MSA/MathFunctions.h +387 -0
- data/vendor/Eigen/src/Core/arch/MSA/PacketMath.h +1233 -0
- data/vendor/Eigen/src/Core/arch/NEON/Complex.h +584 -0
- data/vendor/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +183 -0
- data/vendor/Eigen/src/Core/arch/NEON/MathFunctions.h +75 -0
- data/vendor/Eigen/src/Core/arch/NEON/PacketMath.h +4587 -0
- data/vendor/Eigen/src/Core/arch/NEON/TypeCasting.h +1419 -0
- data/vendor/Eigen/src/Core/arch/SSE/Complex.h +351 -0
- data/vendor/Eigen/src/Core/arch/SSE/MathFunctions.h +199 -0
- data/vendor/Eigen/src/Core/arch/SSE/PacketMath.h +1505 -0
- data/vendor/Eigen/src/Core/arch/SSE/TypeCasting.h +142 -0
- data/vendor/Eigen/src/Core/arch/SVE/MathFunctions.h +44 -0
- data/vendor/Eigen/src/Core/arch/SVE/PacketMath.h +752 -0
- data/vendor/Eigen/src/Core/arch/SVE/TypeCasting.h +49 -0
- data/vendor/Eigen/src/Core/arch/SYCL/InteropHeaders.h +232 -0
- data/vendor/Eigen/src/Core/arch/SYCL/MathFunctions.h +301 -0
- data/vendor/Eigen/src/Core/arch/SYCL/PacketMath.h +670 -0
- data/vendor/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h +694 -0
- data/vendor/Eigen/src/Core/arch/SYCL/TypeCasting.h +85 -0
- data/vendor/Eigen/src/Core/arch/ZVector/Complex.h +426 -0
- data/vendor/Eigen/src/Core/arch/ZVector/MathFunctions.h +233 -0
- data/vendor/Eigen/src/Core/arch/ZVector/PacketMath.h +1060 -0
- data/vendor/Eigen/src/Core/functors/AssignmentFunctors.h +177 -0
- data/vendor/Eigen/src/Core/functors/BinaryFunctors.h +541 -0
- data/vendor/Eigen/src/Core/functors/NullaryFunctors.h +189 -0
- data/vendor/Eigen/src/Core/functors/StlFunctors.h +166 -0
- data/vendor/Eigen/src/Core/functors/TernaryFunctors.h +25 -0
- data/vendor/Eigen/src/Core/functors/UnaryFunctors.h +1131 -0
- data/vendor/Eigen/src/Core/products/GeneralBlockPanelKernel.h +2645 -0
- data/vendor/Eigen/src/Core/products/GeneralMatrixMatrix.h +517 -0
- data/vendor/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +317 -0
- data/vendor/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +145 -0
- data/vendor/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +124 -0
- data/vendor/Eigen/src/Core/products/GeneralMatrixVector.h +518 -0
- data/vendor/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +136 -0
- data/vendor/Eigen/src/Core/products/Parallelizer.h +180 -0
- data/vendor/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +544 -0
- data/vendor/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +295 -0
- data/vendor/Eigen/src/Core/products/SelfadjointMatrixVector.h +262 -0
- data/vendor/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h +118 -0
- data/vendor/Eigen/src/Core/products/SelfadjointProduct.h +133 -0
- data/vendor/Eigen/src/Core/products/SelfadjointRank2Update.h +94 -0
- data/vendor/Eigen/src/Core/products/TriangularMatrixMatrix.h +472 -0
- data/vendor/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +317 -0
- data/vendor/Eigen/src/Core/products/TriangularMatrixVector.h +350 -0
- data/vendor/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h +255 -0
- data/vendor/Eigen/src/Core/products/TriangularSolverMatrix.h +337 -0
- data/vendor/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +167 -0
- data/vendor/Eigen/src/Core/products/TriangularSolverVector.h +148 -0
- data/vendor/Eigen/src/Core/util/BlasUtil.h +583 -0
- data/vendor/Eigen/src/Core/util/ConfigureVectorization.h +512 -0
- data/vendor/Eigen/src/Core/util/Constants.h +563 -0
- data/vendor/Eigen/src/Core/util/DisableStupidWarnings.h +106 -0
- data/vendor/Eigen/src/Core/util/ForwardDeclarations.h +322 -0
- data/vendor/Eigen/src/Core/util/IndexedViewHelper.h +186 -0
- data/vendor/Eigen/src/Core/util/IntegralConstant.h +272 -0
- data/vendor/Eigen/src/Core/util/MKL_support.h +137 -0
- data/vendor/Eigen/src/Core/util/Macros.h +1464 -0
- data/vendor/Eigen/src/Core/util/Memory.h +1163 -0
- data/vendor/Eigen/src/Core/util/Meta.h +812 -0
- data/vendor/Eigen/src/Core/util/NonMPL2.h +3 -0
- data/vendor/Eigen/src/Core/util/ReenableStupidWarnings.h +31 -0
- data/vendor/Eigen/src/Core/util/ReshapedHelper.h +51 -0
- data/vendor/Eigen/src/Core/util/StaticAssert.h +221 -0
- data/vendor/Eigen/src/Core/util/SymbolicIndex.h +293 -0
- data/vendor/Eigen/src/Core/util/XprHelper.h +856 -0
- data/vendor/Eigen/src/Eigenvalues/ComplexEigenSolver.h +346 -0
- data/vendor/Eigen/src/Eigenvalues/ComplexSchur.h +462 -0
- data/vendor/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h +91 -0
- data/vendor/Eigen/src/Eigenvalues/EigenSolver.h +622 -0
- data/vendor/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +418 -0
- data/vendor/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +226 -0
- data/vendor/Eigen/src/Eigenvalues/HessenbergDecomposition.h +374 -0
- data/vendor/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +158 -0
- data/vendor/Eigen/src/Eigenvalues/RealQZ.h +657 -0
- data/vendor/Eigen/src/Eigenvalues/RealSchur.h +558 -0
- data/vendor/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +77 -0
- data/vendor/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +904 -0
- data/vendor/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +87 -0
- data/vendor/Eigen/src/Eigenvalues/Tridiagonalization.h +561 -0
- data/vendor/Eigen/src/Geometry/AlignedBox.h +486 -0
- data/vendor/Eigen/src/Geometry/AngleAxis.h +247 -0
- data/vendor/Eigen/src/Geometry/EulerAngles.h +114 -0
- data/vendor/Eigen/src/Geometry/Homogeneous.h +501 -0
- data/vendor/Eigen/src/Geometry/Hyperplane.h +282 -0
- data/vendor/Eigen/src/Geometry/OrthoMethods.h +235 -0
- data/vendor/Eigen/src/Geometry/ParametrizedLine.h +232 -0
- data/vendor/Eigen/src/Geometry/Quaternion.h +870 -0
- data/vendor/Eigen/src/Geometry/Rotation2D.h +199 -0
- data/vendor/Eigen/src/Geometry/RotationBase.h +206 -0
- data/vendor/Eigen/src/Geometry/Scaling.h +188 -0
- data/vendor/Eigen/src/Geometry/Transform.h +1563 -0
- data/vendor/Eigen/src/Geometry/Translation.h +202 -0
- data/vendor/Eigen/src/Geometry/Umeyama.h +166 -0
- data/vendor/Eigen/src/Geometry/arch/Geometry_SIMD.h +168 -0
- data/vendor/Eigen/src/Householder/BlockHouseholder.h +110 -0
- data/vendor/Eigen/src/Householder/Householder.h +176 -0
- data/vendor/Eigen/src/Householder/HouseholderSequence.h +545 -0
- data/vendor/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +226 -0
- data/vendor/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +212 -0
- data/vendor/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +229 -0
- data/vendor/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +394 -0
- data/vendor/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +453 -0
- data/vendor/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +444 -0
- data/vendor/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +198 -0
- data/vendor/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +117 -0
- data/vendor/Eigen/src/Jacobi/Jacobi.h +483 -0
- data/vendor/Eigen/src/KLUSupport/KLUSupport.h +358 -0
- data/vendor/Eigen/src/LU/Determinant.h +117 -0
- data/vendor/Eigen/src/LU/FullPivLU.h +877 -0
- data/vendor/Eigen/src/LU/InverseImpl.h +432 -0
- data/vendor/Eigen/src/LU/PartialPivLU.h +624 -0
- data/vendor/Eigen/src/LU/PartialPivLU_LAPACKE.h +83 -0
- data/vendor/Eigen/src/LU/arch/InverseSize4.h +351 -0
- data/vendor/Eigen/src/MetisSupport/MetisSupport.h +137 -0
- data/vendor/Eigen/src/OrderingMethods/Amd.h +435 -0
- data/vendor/Eigen/src/OrderingMethods/Eigen_Colamd.h +1863 -0
- data/vendor/Eigen/src/OrderingMethods/Ordering.h +153 -0
- data/vendor/Eigen/src/PaStiXSupport/PaStiXSupport.h +678 -0
- data/vendor/Eigen/src/PardisoSupport/PardisoSupport.h +545 -0
- data/vendor/Eigen/src/QR/ColPivHouseholderQR.h +674 -0
- data/vendor/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +97 -0
- data/vendor/Eigen/src/QR/CompleteOrthogonalDecomposition.h +635 -0
- data/vendor/Eigen/src/QR/FullPivHouseholderQR.h +713 -0
- data/vendor/Eigen/src/QR/HouseholderQR.h +434 -0
- data/vendor/Eigen/src/QR/HouseholderQR_LAPACKE.h +68 -0
- data/vendor/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +335 -0
- data/vendor/Eigen/src/SVD/BDCSVD.h +1366 -0
- data/vendor/Eigen/src/SVD/JacobiSVD.h +812 -0
- data/vendor/Eigen/src/SVD/JacobiSVD_LAPACKE.h +91 -0
- data/vendor/Eigen/src/SVD/SVDBase.h +376 -0
- data/vendor/Eigen/src/SVD/UpperBidiagonalization.h +414 -0
- data/vendor/Eigen/src/SparseCholesky/SimplicialCholesky.h +697 -0
- data/vendor/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +174 -0
- data/vendor/Eigen/src/SparseCore/AmbiVector.h +378 -0
- data/vendor/Eigen/src/SparseCore/CompressedStorage.h +274 -0
- data/vendor/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +352 -0
- data/vendor/Eigen/src/SparseCore/MappedSparseMatrix.h +67 -0
- data/vendor/Eigen/src/SparseCore/SparseAssign.h +270 -0
- data/vendor/Eigen/src/SparseCore/SparseBlock.h +571 -0
- data/vendor/Eigen/src/SparseCore/SparseColEtree.h +206 -0
- data/vendor/Eigen/src/SparseCore/SparseCompressedBase.h +370 -0
- data/vendor/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +722 -0
- data/vendor/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +150 -0
- data/vendor/Eigen/src/SparseCore/SparseDenseProduct.h +342 -0
- data/vendor/Eigen/src/SparseCore/SparseDiagonalProduct.h +138 -0
- data/vendor/Eigen/src/SparseCore/SparseDot.h +98 -0
- data/vendor/Eigen/src/SparseCore/SparseFuzzy.h +29 -0
- data/vendor/Eigen/src/SparseCore/SparseMap.h +305 -0
- data/vendor/Eigen/src/SparseCore/SparseMatrix.h +1518 -0
- data/vendor/Eigen/src/SparseCore/SparseMatrixBase.h +398 -0
- data/vendor/Eigen/src/SparseCore/SparsePermutation.h +178 -0
- data/vendor/Eigen/src/SparseCore/SparseProduct.h +181 -0
- data/vendor/Eigen/src/SparseCore/SparseRedux.h +49 -0
- data/vendor/Eigen/src/SparseCore/SparseRef.h +397 -0
- data/vendor/Eigen/src/SparseCore/SparseSelfAdjointView.h +659 -0
- data/vendor/Eigen/src/SparseCore/SparseSolverBase.h +124 -0
- data/vendor/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +198 -0
- data/vendor/Eigen/src/SparseCore/SparseTranspose.h +92 -0
- data/vendor/Eigen/src/SparseCore/SparseTriangularView.h +189 -0
- data/vendor/Eigen/src/SparseCore/SparseUtil.h +186 -0
- data/vendor/Eigen/src/SparseCore/SparseVector.h +478 -0
- data/vendor/Eigen/src/SparseCore/SparseView.h +254 -0
- data/vendor/Eigen/src/SparseCore/TriangularSolver.h +315 -0
- data/vendor/Eigen/src/SparseLU/SparseLU.h +923 -0
- data/vendor/Eigen/src/SparseLU/SparseLUImpl.h +66 -0
- data/vendor/Eigen/src/SparseLU/SparseLU_Memory.h +226 -0
- data/vendor/Eigen/src/SparseLU/SparseLU_Structs.h +110 -0
- data/vendor/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +375 -0
- data/vendor/Eigen/src/SparseLU/SparseLU_Utils.h +80 -0
- data/vendor/Eigen/src/SparseLU/SparseLU_column_bmod.h +181 -0
- data/vendor/Eigen/src/SparseLU/SparseLU_column_dfs.h +179 -0
- data/vendor/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +107 -0
- data/vendor/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +280 -0
- data/vendor/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +126 -0
- data/vendor/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +130 -0
- data/vendor/Eigen/src/SparseLU/SparseLU_panel_bmod.h +223 -0
- data/vendor/Eigen/src/SparseLU/SparseLU_panel_dfs.h +258 -0
- data/vendor/Eigen/src/SparseLU/SparseLU_pivotL.h +137 -0
- data/vendor/Eigen/src/SparseLU/SparseLU_pruneL.h +136 -0
- data/vendor/Eigen/src/SparseLU/SparseLU_relax_snode.h +83 -0
- data/vendor/Eigen/src/SparseQR/SparseQR.h +758 -0
- data/vendor/Eigen/src/StlSupport/StdDeque.h +116 -0
- data/vendor/Eigen/src/StlSupport/StdList.h +106 -0
- data/vendor/Eigen/src/StlSupport/StdVector.h +131 -0
- data/vendor/Eigen/src/StlSupport/details.h +84 -0
- data/vendor/Eigen/src/SuperLUSupport/SuperLUSupport.h +1025 -0
- data/vendor/Eigen/src/UmfPackSupport/UmfPackSupport.h +642 -0
- data/vendor/Eigen/src/misc/Image.h +82 -0
- data/vendor/Eigen/src/misc/Kernel.h +79 -0
- data/vendor/Eigen/src/misc/RealSvd2x2.h +55 -0
- data/vendor/Eigen/src/misc/blas.h +440 -0
- data/vendor/Eigen/src/misc/lapack.h +152 -0
- data/vendor/Eigen/src/misc/lapacke.h +16292 -0
- data/vendor/Eigen/src/misc/lapacke_mangling.h +17 -0
- data/vendor/Eigen/src/plugins/ArrayCwiseBinaryOps.h +358 -0
- data/vendor/Eigen/src/plugins/ArrayCwiseUnaryOps.h +696 -0
- data/vendor/Eigen/src/plugins/BlockMethods.h +1442 -0
- data/vendor/Eigen/src/plugins/CommonCwiseBinaryOps.h +115 -0
- data/vendor/Eigen/src/plugins/CommonCwiseUnaryOps.h +177 -0
- data/vendor/Eigen/src/plugins/IndexedViewMethods.h +262 -0
- data/vendor/Eigen/src/plugins/MatrixCwiseBinaryOps.h +152 -0
- data/vendor/Eigen/src/plugins/MatrixCwiseUnaryOps.h +95 -0
- data/vendor/Eigen/src/plugins/ReshapedMethods.h +149 -0
- data/vendor/aarand/aarand.hpp +114 -0
- data/vendor/annoy/annoylib.h +1495 -0
- data/vendor/annoy/kissrandom.h +120 -0
- data/vendor/annoy/mman.h +242 -0
- data/vendor/hnswlib/bruteforce.h +152 -0
- data/vendor/hnswlib/hnswalg.h +1192 -0
- data/vendor/hnswlib/hnswlib.h +108 -0
- data/vendor/hnswlib/space_ip.h +282 -0
- data/vendor/hnswlib/space_l2.h +281 -0
- data/vendor/hnswlib/visited_list_pool.h +79 -0
- data/vendor/irlba/irlba.hpp +575 -0
- data/vendor/irlba/lanczos.hpp +212 -0
- data/vendor/irlba/parallel.hpp +474 -0
- data/vendor/irlba/utils.hpp +224 -0
- data/vendor/irlba/wrappers.hpp +228 -0
- data/vendor/kmeans/Base.hpp +75 -0
- data/vendor/kmeans/Details.hpp +79 -0
- data/vendor/kmeans/HartiganWong.hpp +492 -0
- data/vendor/kmeans/InitializeKmeansPP.hpp +144 -0
- data/vendor/kmeans/InitializeNone.hpp +44 -0
- data/vendor/kmeans/InitializePCAPartition.hpp +309 -0
- data/vendor/kmeans/InitializeRandom.hpp +91 -0
- data/vendor/kmeans/Kmeans.hpp +161 -0
- data/vendor/kmeans/Lloyd.hpp +134 -0
- data/vendor/kmeans/MiniBatch.hpp +269 -0
- data/vendor/kmeans/QuickSearch.hpp +179 -0
- data/vendor/kmeans/compute_centroids.hpp +32 -0
- data/vendor/kmeans/compute_wcss.hpp +27 -0
- data/vendor/kmeans/is_edge_case.hpp +42 -0
- data/vendor/kmeans/random.hpp +55 -0
- data/vendor/knncolle/Annoy/Annoy.hpp +193 -0
- data/vendor/knncolle/BruteForce/BruteForce.hpp +120 -0
- data/vendor/knncolle/Hnsw/Hnsw.hpp +225 -0
- data/vendor/knncolle/Kmknn/Kmknn.hpp +286 -0
- data/vendor/knncolle/VpTree/VpTree.hpp +256 -0
- data/vendor/knncolle/knncolle.hpp +34 -0
- data/vendor/knncolle/utils/Base.hpp +100 -0
- data/vendor/knncolle/utils/NeighborQueue.hpp +94 -0
- data/vendor/knncolle/utils/distances.hpp +98 -0
- data/vendor/knncolle/utils/find_nearest_neighbors.hpp +112 -0
- data/vendor/powerit/PowerIterations.hpp +157 -0
- data/vendor/umappp/NeighborList.hpp +37 -0
- data/vendor/umappp/Umap.hpp +662 -0
- data/vendor/umappp/combine_neighbor_sets.hpp +95 -0
- data/vendor/umappp/find_ab.hpp +157 -0
- data/vendor/umappp/neighbor_similarities.hpp +136 -0
- data/vendor/umappp/optimize_layout.hpp +285 -0
- data/vendor/umappp/spectral_init.hpp +181 -0
- data/vendor/umappp/umappp.hpp +13 -0
- metadata +465 -0
@@ -0,0 +1,235 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2008-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_SOLVETRIANGULAR_H
|
11
|
+
#define EIGEN_SOLVETRIANGULAR_H
|
12
|
+
|
13
|
+
namespace Eigen {
|
14
|
+
|
15
|
+
namespace internal {
|
16
|
+
|
17
|
+
// Forward declarations:
|
18
|
+
// The following two routines are implemented in the products/TriangularSolver*.h files
|
19
|
+
template<typename LhsScalar, typename RhsScalar, typename Index, int Side, int Mode, bool Conjugate, int StorageOrder>
|
20
|
+
struct triangular_solve_vector;
|
21
|
+
|
22
|
+
template <typename Scalar, typename Index, int Side, int Mode, bool Conjugate, int TriStorageOrder, int OtherStorageOrder, int OtherInnerStride>
|
23
|
+
struct triangular_solve_matrix;
|
24
|
+
|
25
|
+
// small helper struct extracting some traits on the underlying solver operation
|
26
|
+
template<typename Lhs, typename Rhs, int Side>
|
27
|
+
class trsolve_traits
|
28
|
+
{
|
29
|
+
private:
|
30
|
+
enum {
|
31
|
+
RhsIsVectorAtCompileTime = (Side==OnTheLeft ? Rhs::ColsAtCompileTime : Rhs::RowsAtCompileTime)==1
|
32
|
+
};
|
33
|
+
public:
|
34
|
+
enum {
|
35
|
+
Unrolling = (RhsIsVectorAtCompileTime && Rhs::SizeAtCompileTime != Dynamic && Rhs::SizeAtCompileTime <= 8)
|
36
|
+
? CompleteUnrolling : NoUnrolling,
|
37
|
+
RhsVectors = RhsIsVectorAtCompileTime ? 1 : Dynamic
|
38
|
+
};
|
39
|
+
};
|
40
|
+
|
41
|
+
template<typename Lhs, typename Rhs,
|
42
|
+
int Side, // can be OnTheLeft/OnTheRight
|
43
|
+
int Mode, // can be Upper/Lower | UnitDiag
|
44
|
+
int Unrolling = trsolve_traits<Lhs,Rhs,Side>::Unrolling,
|
45
|
+
int RhsVectors = trsolve_traits<Lhs,Rhs,Side>::RhsVectors
|
46
|
+
>
|
47
|
+
struct triangular_solver_selector;
|
48
|
+
|
49
|
+
template<typename Lhs, typename Rhs, int Side, int Mode>
|
50
|
+
struct triangular_solver_selector<Lhs,Rhs,Side,Mode,NoUnrolling,1>
|
51
|
+
{
|
52
|
+
typedef typename Lhs::Scalar LhsScalar;
|
53
|
+
typedef typename Rhs::Scalar RhsScalar;
|
54
|
+
typedef blas_traits<Lhs> LhsProductTraits;
|
55
|
+
typedef typename LhsProductTraits::ExtractType ActualLhsType;
|
56
|
+
typedef Map<Matrix<RhsScalar,Dynamic,1>, Aligned> MappedRhs;
|
57
|
+
static EIGEN_DEVICE_FUNC void run(const Lhs& lhs, Rhs& rhs)
|
58
|
+
{
|
59
|
+
ActualLhsType actualLhs = LhsProductTraits::extract(lhs);
|
60
|
+
|
61
|
+
// FIXME find a way to allow an inner stride if packet_traits<Scalar>::size==1
|
62
|
+
|
63
|
+
bool useRhsDirectly = Rhs::InnerStrideAtCompileTime==1 || rhs.innerStride()==1;
|
64
|
+
|
65
|
+
ei_declare_aligned_stack_constructed_variable(RhsScalar,actualRhs,rhs.size(),
|
66
|
+
(useRhsDirectly ? rhs.data() : 0));
|
67
|
+
|
68
|
+
if(!useRhsDirectly)
|
69
|
+
MappedRhs(actualRhs,rhs.size()) = rhs;
|
70
|
+
|
71
|
+
triangular_solve_vector<LhsScalar, RhsScalar, Index, Side, Mode, LhsProductTraits::NeedToConjugate,
|
72
|
+
(int(Lhs::Flags) & RowMajorBit) ? RowMajor : ColMajor>
|
73
|
+
::run(actualLhs.cols(), actualLhs.data(), actualLhs.outerStride(), actualRhs);
|
74
|
+
|
75
|
+
if(!useRhsDirectly)
|
76
|
+
rhs = MappedRhs(actualRhs, rhs.size());
|
77
|
+
}
|
78
|
+
};
|
79
|
+
|
80
|
+
// the rhs is a matrix
|
81
|
+
template<typename Lhs, typename Rhs, int Side, int Mode>
|
82
|
+
struct triangular_solver_selector<Lhs,Rhs,Side,Mode,NoUnrolling,Dynamic>
|
83
|
+
{
|
84
|
+
typedef typename Rhs::Scalar Scalar;
|
85
|
+
typedef blas_traits<Lhs> LhsProductTraits;
|
86
|
+
typedef typename LhsProductTraits::DirectLinearAccessType ActualLhsType;
|
87
|
+
|
88
|
+
static EIGEN_DEVICE_FUNC void run(const Lhs& lhs, Rhs& rhs)
|
89
|
+
{
|
90
|
+
typename internal::add_const_on_value_type<ActualLhsType>::type actualLhs = LhsProductTraits::extract(lhs);
|
91
|
+
|
92
|
+
const Index size = lhs.rows();
|
93
|
+
const Index othersize = Side==OnTheLeft? rhs.cols() : rhs.rows();
|
94
|
+
|
95
|
+
typedef internal::gemm_blocking_space<(Rhs::Flags&RowMajorBit) ? RowMajor : ColMajor,Scalar,Scalar,
|
96
|
+
Rhs::MaxRowsAtCompileTime, Rhs::MaxColsAtCompileTime, Lhs::MaxRowsAtCompileTime,4> BlockingType;
|
97
|
+
|
98
|
+
BlockingType blocking(rhs.rows(), rhs.cols(), size, 1, false);
|
99
|
+
|
100
|
+
triangular_solve_matrix<Scalar,Index,Side,Mode,LhsProductTraits::NeedToConjugate,(int(Lhs::Flags) & RowMajorBit) ? RowMajor : ColMajor,
|
101
|
+
(Rhs::Flags&RowMajorBit) ? RowMajor : ColMajor, Rhs::InnerStrideAtCompileTime>
|
102
|
+
::run(size, othersize, &actualLhs.coeffRef(0,0), actualLhs.outerStride(), &rhs.coeffRef(0,0), rhs.innerStride(), rhs.outerStride(), blocking);
|
103
|
+
}
|
104
|
+
};
|
105
|
+
|
106
|
+
/***************************************************************************
|
107
|
+
* meta-unrolling implementation
|
108
|
+
***************************************************************************/
|
109
|
+
|
110
|
+
template<typename Lhs, typename Rhs, int Mode, int LoopIndex, int Size,
|
111
|
+
bool Stop = LoopIndex==Size>
|
112
|
+
struct triangular_solver_unroller;
|
113
|
+
|
114
|
+
template<typename Lhs, typename Rhs, int Mode, int LoopIndex, int Size>
|
115
|
+
struct triangular_solver_unroller<Lhs,Rhs,Mode,LoopIndex,Size,false> {
|
116
|
+
enum {
|
117
|
+
IsLower = ((Mode&Lower)==Lower),
|
118
|
+
DiagIndex = IsLower ? LoopIndex : Size - LoopIndex - 1,
|
119
|
+
StartIndex = IsLower ? 0 : DiagIndex+1
|
120
|
+
};
|
121
|
+
static EIGEN_DEVICE_FUNC void run(const Lhs& lhs, Rhs& rhs)
|
122
|
+
{
|
123
|
+
if (LoopIndex>0)
|
124
|
+
rhs.coeffRef(DiagIndex) -= lhs.row(DiagIndex).template segment<LoopIndex>(StartIndex).transpose()
|
125
|
+
.cwiseProduct(rhs.template segment<LoopIndex>(StartIndex)).sum();
|
126
|
+
|
127
|
+
if(!(Mode & UnitDiag))
|
128
|
+
rhs.coeffRef(DiagIndex) /= lhs.coeff(DiagIndex,DiagIndex);
|
129
|
+
|
130
|
+
triangular_solver_unroller<Lhs,Rhs,Mode,LoopIndex+1,Size>::run(lhs,rhs);
|
131
|
+
}
|
132
|
+
};
|
133
|
+
|
134
|
+
template<typename Lhs, typename Rhs, int Mode, int LoopIndex, int Size>
|
135
|
+
struct triangular_solver_unroller<Lhs,Rhs,Mode,LoopIndex,Size,true> {
|
136
|
+
static EIGEN_DEVICE_FUNC void run(const Lhs&, Rhs&) {}
|
137
|
+
};
|
138
|
+
|
139
|
+
template<typename Lhs, typename Rhs, int Mode>
|
140
|
+
struct triangular_solver_selector<Lhs,Rhs,OnTheLeft,Mode,CompleteUnrolling,1> {
|
141
|
+
static EIGEN_DEVICE_FUNC void run(const Lhs& lhs, Rhs& rhs)
|
142
|
+
{ triangular_solver_unroller<Lhs,Rhs,Mode,0,Rhs::SizeAtCompileTime>::run(lhs,rhs); }
|
143
|
+
};
|
144
|
+
|
145
|
+
template<typename Lhs, typename Rhs, int Mode>
|
146
|
+
struct triangular_solver_selector<Lhs,Rhs,OnTheRight,Mode,CompleteUnrolling,1> {
|
147
|
+
static EIGEN_DEVICE_FUNC void run(const Lhs& lhs, Rhs& rhs)
|
148
|
+
{
|
149
|
+
Transpose<const Lhs> trLhs(lhs);
|
150
|
+
Transpose<Rhs> trRhs(rhs);
|
151
|
+
|
152
|
+
triangular_solver_unroller<Transpose<const Lhs>,Transpose<Rhs>,
|
153
|
+
((Mode&Upper)==Upper ? Lower : Upper) | (Mode&UnitDiag),
|
154
|
+
0,Rhs::SizeAtCompileTime>::run(trLhs,trRhs);
|
155
|
+
}
|
156
|
+
};
|
157
|
+
|
158
|
+
} // end namespace internal
|
159
|
+
|
160
|
+
/***************************************************************************
|
161
|
+
* TriangularView methods
|
162
|
+
***************************************************************************/
|
163
|
+
|
164
|
+
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
165
|
+
template<typename MatrixType, unsigned int Mode>
|
166
|
+
template<int Side, typename OtherDerived>
|
167
|
+
EIGEN_DEVICE_FUNC void TriangularViewImpl<MatrixType,Mode,Dense>::solveInPlace(const MatrixBase<OtherDerived>& _other) const
|
168
|
+
{
|
169
|
+
OtherDerived& other = _other.const_cast_derived();
|
170
|
+
eigen_assert( derived().cols() == derived().rows() && ((Side==OnTheLeft && derived().cols() == other.rows()) || (Side==OnTheRight && derived().cols() == other.cols())) );
|
171
|
+
eigen_assert((!(int(Mode) & int(ZeroDiag))) && bool(int(Mode) & (int(Upper) | int(Lower))));
|
172
|
+
// If solving for a 0x0 matrix, nothing to do, simply return.
|
173
|
+
if (derived().cols() == 0)
|
174
|
+
return;
|
175
|
+
|
176
|
+
enum { copy = (internal::traits<OtherDerived>::Flags & RowMajorBit) && OtherDerived::IsVectorAtCompileTime && OtherDerived::SizeAtCompileTime!=1};
|
177
|
+
typedef typename internal::conditional<copy,
|
178
|
+
typename internal::plain_matrix_type_column_major<OtherDerived>::type, OtherDerived&>::type OtherCopy;
|
179
|
+
OtherCopy otherCopy(other);
|
180
|
+
|
181
|
+
internal::triangular_solver_selector<MatrixType, typename internal::remove_reference<OtherCopy>::type,
|
182
|
+
Side, Mode>::run(derived().nestedExpression(), otherCopy);
|
183
|
+
|
184
|
+
if (copy)
|
185
|
+
other = otherCopy;
|
186
|
+
}
|
187
|
+
|
188
|
+
template<typename Derived, unsigned int Mode>
|
189
|
+
template<int Side, typename Other>
|
190
|
+
const internal::triangular_solve_retval<Side,TriangularView<Derived,Mode>,Other>
|
191
|
+
TriangularViewImpl<Derived,Mode,Dense>::solve(const MatrixBase<Other>& other) const
|
192
|
+
{
|
193
|
+
return internal::triangular_solve_retval<Side,TriangularViewType,Other>(derived(), other.derived());
|
194
|
+
}
|
195
|
+
#endif
|
196
|
+
|
197
|
+
namespace internal {
|
198
|
+
|
199
|
+
|
200
|
+
template<int Side, typename TriangularType, typename Rhs>
|
201
|
+
struct traits<triangular_solve_retval<Side, TriangularType, Rhs> >
|
202
|
+
{
|
203
|
+
typedef typename internal::plain_matrix_type_column_major<Rhs>::type ReturnType;
|
204
|
+
};
|
205
|
+
|
206
|
+
template<int Side, typename TriangularType, typename Rhs> struct triangular_solve_retval
|
207
|
+
: public ReturnByValue<triangular_solve_retval<Side, TriangularType, Rhs> >
|
208
|
+
{
|
209
|
+
typedef typename remove_all<typename Rhs::Nested>::type RhsNestedCleaned;
|
210
|
+
typedef ReturnByValue<triangular_solve_retval> Base;
|
211
|
+
|
212
|
+
triangular_solve_retval(const TriangularType& tri, const Rhs& rhs)
|
213
|
+
: m_triangularMatrix(tri), m_rhs(rhs)
|
214
|
+
{}
|
215
|
+
|
216
|
+
inline EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_rhs.rows(); }
|
217
|
+
inline EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_rhs.cols(); }
|
218
|
+
|
219
|
+
template<typename Dest> inline void evalTo(Dest& dst) const
|
220
|
+
{
|
221
|
+
if(!is_same_dense(dst,m_rhs))
|
222
|
+
dst = m_rhs;
|
223
|
+
m_triangularMatrix.template solveInPlace<Side>(dst);
|
224
|
+
}
|
225
|
+
|
226
|
+
protected:
|
227
|
+
const TriangularType& m_triangularMatrix;
|
228
|
+
typename Rhs::Nested m_rhs;
|
229
|
+
};
|
230
|
+
|
231
|
+
} // namespace internal
|
232
|
+
|
233
|
+
} // end namespace Eigen
|
234
|
+
|
235
|
+
#endif // EIGEN_SOLVETRIANGULAR_H
|
@@ -0,0 +1,168 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2015 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_SOLVERBASE_H
|
11
|
+
#define EIGEN_SOLVERBASE_H
|
12
|
+
|
13
|
+
namespace Eigen {
|
14
|
+
|
15
|
+
namespace internal {
|
16
|
+
|
17
|
+
template<typename Derived>
|
18
|
+
struct solve_assertion {
|
19
|
+
template<bool Transpose_, typename Rhs>
|
20
|
+
static void run(const Derived& solver, const Rhs& b) { solver.template _check_solve_assertion<Transpose_>(b); }
|
21
|
+
};
|
22
|
+
|
23
|
+
template<typename Derived>
|
24
|
+
struct solve_assertion<Transpose<Derived> >
|
25
|
+
{
|
26
|
+
typedef Transpose<Derived> type;
|
27
|
+
|
28
|
+
template<bool Transpose_, typename Rhs>
|
29
|
+
static void run(const type& transpose, const Rhs& b)
|
30
|
+
{
|
31
|
+
internal::solve_assertion<typename internal::remove_all<Derived>::type>::template run<true>(transpose.nestedExpression(), b);
|
32
|
+
}
|
33
|
+
};
|
34
|
+
|
35
|
+
template<typename Scalar, typename Derived>
|
36
|
+
struct solve_assertion<CwiseUnaryOp<Eigen::internal::scalar_conjugate_op<Scalar>, const Transpose<Derived> > >
|
37
|
+
{
|
38
|
+
typedef CwiseUnaryOp<Eigen::internal::scalar_conjugate_op<Scalar>, const Transpose<Derived> > type;
|
39
|
+
|
40
|
+
template<bool Transpose_, typename Rhs>
|
41
|
+
static void run(const type& adjoint, const Rhs& b)
|
42
|
+
{
|
43
|
+
internal::solve_assertion<typename internal::remove_all<Transpose<Derived> >::type>::template run<true>(adjoint.nestedExpression(), b);
|
44
|
+
}
|
45
|
+
};
|
46
|
+
} // end namespace internal
|
47
|
+
|
48
|
+
/** \class SolverBase
|
49
|
+
* \brief A base class for matrix decomposition and solvers
|
50
|
+
*
|
51
|
+
* \tparam Derived the actual type of the decomposition/solver.
|
52
|
+
*
|
53
|
+
* Any matrix decomposition inheriting this base class provide the following API:
|
54
|
+
*
|
55
|
+
* \code
|
56
|
+
* MatrixType A, b, x;
|
57
|
+
* DecompositionType dec(A);
|
58
|
+
* x = dec.solve(b); // solve A * x = b
|
59
|
+
* x = dec.transpose().solve(b); // solve A^T * x = b
|
60
|
+
* x = dec.adjoint().solve(b); // solve A' * x = b
|
61
|
+
* \endcode
|
62
|
+
*
|
63
|
+
* \warning Currently, any other usage of transpose() and adjoint() are not supported and will produce compilation errors.
|
64
|
+
*
|
65
|
+
* \sa class PartialPivLU, class FullPivLU, class HouseholderQR, class ColPivHouseholderQR, class FullPivHouseholderQR, class CompleteOrthogonalDecomposition, class LLT, class LDLT, class SVDBase
|
66
|
+
*/
|
67
|
+
template<typename Derived>
|
68
|
+
class SolverBase : public EigenBase<Derived>
|
69
|
+
{
|
70
|
+
public:
|
71
|
+
|
72
|
+
typedef EigenBase<Derived> Base;
|
73
|
+
typedef typename internal::traits<Derived>::Scalar Scalar;
|
74
|
+
typedef Scalar CoeffReturnType;
|
75
|
+
|
76
|
+
template<typename Derived_>
|
77
|
+
friend struct internal::solve_assertion;
|
78
|
+
|
79
|
+
enum {
|
80
|
+
RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime,
|
81
|
+
ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,
|
82
|
+
SizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::RowsAtCompileTime,
|
83
|
+
internal::traits<Derived>::ColsAtCompileTime>::ret),
|
84
|
+
MaxRowsAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime,
|
85
|
+
MaxColsAtCompileTime = internal::traits<Derived>::MaxColsAtCompileTime,
|
86
|
+
MaxSizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::MaxRowsAtCompileTime,
|
87
|
+
internal::traits<Derived>::MaxColsAtCompileTime>::ret),
|
88
|
+
IsVectorAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime == 1
|
89
|
+
|| internal::traits<Derived>::MaxColsAtCompileTime == 1,
|
90
|
+
NumDimensions = int(MaxSizeAtCompileTime) == 1 ? 0 : bool(IsVectorAtCompileTime) ? 1 : 2
|
91
|
+
};
|
92
|
+
|
93
|
+
/** Default constructor */
|
94
|
+
SolverBase()
|
95
|
+
{}
|
96
|
+
|
97
|
+
~SolverBase()
|
98
|
+
{}
|
99
|
+
|
100
|
+
using Base::derived;
|
101
|
+
|
102
|
+
/** \returns an expression of the solution x of \f$ A x = b \f$ using the current decomposition of A.
|
103
|
+
*/
|
104
|
+
template<typename Rhs>
|
105
|
+
inline const Solve<Derived, Rhs>
|
106
|
+
solve(const MatrixBase<Rhs>& b) const
|
107
|
+
{
|
108
|
+
internal::solve_assertion<typename internal::remove_all<Derived>::type>::template run<false>(derived(), b);
|
109
|
+
return Solve<Derived, Rhs>(derived(), b.derived());
|
110
|
+
}
|
111
|
+
|
112
|
+
/** \internal the return type of transpose() */
|
113
|
+
typedef typename internal::add_const<Transpose<const Derived> >::type ConstTransposeReturnType;
|
114
|
+
/** \returns an expression of the transposed of the factored matrix.
|
115
|
+
*
|
116
|
+
* A typical usage is to solve for the transposed problem A^T x = b:
|
117
|
+
* \code x = dec.transpose().solve(b); \endcode
|
118
|
+
*
|
119
|
+
* \sa adjoint(), solve()
|
120
|
+
*/
|
121
|
+
inline ConstTransposeReturnType transpose() const
|
122
|
+
{
|
123
|
+
return ConstTransposeReturnType(derived());
|
124
|
+
}
|
125
|
+
|
126
|
+
/** \internal the return type of adjoint() */
|
127
|
+
typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
|
128
|
+
CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, ConstTransposeReturnType>,
|
129
|
+
ConstTransposeReturnType
|
130
|
+
>::type AdjointReturnType;
|
131
|
+
/** \returns an expression of the adjoint of the factored matrix
|
132
|
+
*
|
133
|
+
* A typical usage is to solve for the adjoint problem A' x = b:
|
134
|
+
* \code x = dec.adjoint().solve(b); \endcode
|
135
|
+
*
|
136
|
+
* For real scalar types, this function is equivalent to transpose().
|
137
|
+
*
|
138
|
+
* \sa transpose(), solve()
|
139
|
+
*/
|
140
|
+
inline AdjointReturnType adjoint() const
|
141
|
+
{
|
142
|
+
return AdjointReturnType(derived().transpose());
|
143
|
+
}
|
144
|
+
|
145
|
+
protected:
|
146
|
+
|
147
|
+
template<bool Transpose_, typename Rhs>
|
148
|
+
void _check_solve_assertion(const Rhs& b) const {
|
149
|
+
EIGEN_ONLY_USED_FOR_DEBUG(b);
|
150
|
+
eigen_assert(derived().m_isInitialized && "Solver is not initialized.");
|
151
|
+
eigen_assert((Transpose_?derived().cols():derived().rows())==b.rows() && "SolverBase::solve(): invalid number of rows of the right hand side matrix b");
|
152
|
+
}
|
153
|
+
};
|
154
|
+
|
155
|
+
namespace internal {
|
156
|
+
|
157
|
+
template<typename Derived>
|
158
|
+
struct generic_xpr_base<Derived, MatrixXpr, SolverStorage>
|
159
|
+
{
|
160
|
+
typedef SolverBase<Derived> type;
|
161
|
+
|
162
|
+
};
|
163
|
+
|
164
|
+
} // end namespace internal
|
165
|
+
|
166
|
+
} // end namespace Eigen
|
167
|
+
|
168
|
+
#endif // EIGEN_SOLVERBASE_H
|
@@ -0,0 +1,251 @@
|
|
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_STABLENORM_H
|
11
|
+
#define EIGEN_STABLENORM_H
|
12
|
+
|
13
|
+
namespace Eigen {
|
14
|
+
|
15
|
+
namespace internal {
|
16
|
+
|
17
|
+
template<typename ExpressionType, typename Scalar>
|
18
|
+
inline void stable_norm_kernel(const ExpressionType& bl, Scalar& ssq, Scalar& scale, Scalar& invScale)
|
19
|
+
{
|
20
|
+
Scalar maxCoeff = bl.cwiseAbs().maxCoeff();
|
21
|
+
|
22
|
+
if(maxCoeff>scale)
|
23
|
+
{
|
24
|
+
ssq = ssq * numext::abs2(scale/maxCoeff);
|
25
|
+
Scalar tmp = Scalar(1)/maxCoeff;
|
26
|
+
if(tmp > NumTraits<Scalar>::highest())
|
27
|
+
{
|
28
|
+
invScale = NumTraits<Scalar>::highest();
|
29
|
+
scale = Scalar(1)/invScale;
|
30
|
+
}
|
31
|
+
else if(maxCoeff>NumTraits<Scalar>::highest()) // we got a INF
|
32
|
+
{
|
33
|
+
invScale = Scalar(1);
|
34
|
+
scale = maxCoeff;
|
35
|
+
}
|
36
|
+
else
|
37
|
+
{
|
38
|
+
scale = maxCoeff;
|
39
|
+
invScale = tmp;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
else if(maxCoeff!=maxCoeff) // we got a NaN
|
43
|
+
{
|
44
|
+
scale = maxCoeff;
|
45
|
+
}
|
46
|
+
|
47
|
+
// TODO if the maxCoeff is much much smaller than the current scale,
|
48
|
+
// then we can neglect this sub vector
|
49
|
+
if(scale>Scalar(0)) // if scale==0, then bl is 0
|
50
|
+
ssq += (bl*invScale).squaredNorm();
|
51
|
+
}
|
52
|
+
|
53
|
+
template<typename VectorType, typename RealScalar>
|
54
|
+
void stable_norm_impl_inner_step(const VectorType &vec, RealScalar& ssq, RealScalar& scale, RealScalar& invScale)
|
55
|
+
{
|
56
|
+
typedef typename VectorType::Scalar Scalar;
|
57
|
+
const Index blockSize = 4096;
|
58
|
+
|
59
|
+
typedef typename internal::nested_eval<VectorType,2>::type VectorTypeCopy;
|
60
|
+
typedef typename internal::remove_all<VectorTypeCopy>::type VectorTypeCopyClean;
|
61
|
+
const VectorTypeCopy copy(vec);
|
62
|
+
|
63
|
+
enum {
|
64
|
+
CanAlign = ( (int(VectorTypeCopyClean::Flags)&DirectAccessBit)
|
65
|
+
|| (int(internal::evaluator<VectorTypeCopyClean>::Alignment)>0) // FIXME Alignment)>0 might not be enough
|
66
|
+
) && (blockSize*sizeof(Scalar)*2<EIGEN_STACK_ALLOCATION_LIMIT)
|
67
|
+
&& (EIGEN_MAX_STATIC_ALIGN_BYTES>0) // if we cannot allocate on the stack, then let's not bother about this optimization
|
68
|
+
};
|
69
|
+
typedef typename internal::conditional<CanAlign, Ref<const Matrix<Scalar,Dynamic,1,0,blockSize,1>, internal::evaluator<VectorTypeCopyClean>::Alignment>,
|
70
|
+
typename VectorTypeCopyClean::ConstSegmentReturnType>::type SegmentWrapper;
|
71
|
+
Index n = vec.size();
|
72
|
+
|
73
|
+
Index bi = internal::first_default_aligned(copy);
|
74
|
+
if (bi>0)
|
75
|
+
internal::stable_norm_kernel(copy.head(bi), ssq, scale, invScale);
|
76
|
+
for (; bi<n; bi+=blockSize)
|
77
|
+
internal::stable_norm_kernel(SegmentWrapper(copy.segment(bi,numext::mini(blockSize, n - bi))), ssq, scale, invScale);
|
78
|
+
}
|
79
|
+
|
80
|
+
template<typename VectorType>
|
81
|
+
typename VectorType::RealScalar
|
82
|
+
stable_norm_impl(const VectorType &vec, typename enable_if<VectorType::IsVectorAtCompileTime>::type* = 0 )
|
83
|
+
{
|
84
|
+
using std::sqrt;
|
85
|
+
using std::abs;
|
86
|
+
|
87
|
+
Index n = vec.size();
|
88
|
+
|
89
|
+
if(n==1)
|
90
|
+
return abs(vec.coeff(0));
|
91
|
+
|
92
|
+
typedef typename VectorType::RealScalar RealScalar;
|
93
|
+
RealScalar scale(0);
|
94
|
+
RealScalar invScale(1);
|
95
|
+
RealScalar ssq(0); // sum of squares
|
96
|
+
|
97
|
+
stable_norm_impl_inner_step(vec, ssq, scale, invScale);
|
98
|
+
|
99
|
+
return scale * sqrt(ssq);
|
100
|
+
}
|
101
|
+
|
102
|
+
template<typename MatrixType>
|
103
|
+
typename MatrixType::RealScalar
|
104
|
+
stable_norm_impl(const MatrixType &mat, typename enable_if<!MatrixType::IsVectorAtCompileTime>::type* = 0 )
|
105
|
+
{
|
106
|
+
using std::sqrt;
|
107
|
+
|
108
|
+
typedef typename MatrixType::RealScalar RealScalar;
|
109
|
+
RealScalar scale(0);
|
110
|
+
RealScalar invScale(1);
|
111
|
+
RealScalar ssq(0); // sum of squares
|
112
|
+
|
113
|
+
for(Index j=0; j<mat.outerSize(); ++j)
|
114
|
+
stable_norm_impl_inner_step(mat.innerVector(j), ssq, scale, invScale);
|
115
|
+
return scale * sqrt(ssq);
|
116
|
+
}
|
117
|
+
|
118
|
+
template<typename Derived>
|
119
|
+
inline typename NumTraits<typename traits<Derived>::Scalar>::Real
|
120
|
+
blueNorm_impl(const EigenBase<Derived>& _vec)
|
121
|
+
{
|
122
|
+
typedef typename Derived::RealScalar RealScalar;
|
123
|
+
using std::pow;
|
124
|
+
using std::sqrt;
|
125
|
+
using std::abs;
|
126
|
+
|
127
|
+
// This program calculates the machine-dependent constants
|
128
|
+
// bl, b2, slm, s2m, relerr overfl
|
129
|
+
// from the "basic" machine-dependent numbers
|
130
|
+
// nbig, ibeta, it, iemin, iemax, rbig.
|
131
|
+
// The following define the basic machine-dependent constants.
|
132
|
+
// For portability, the PORT subprograms "ilmaeh" and "rlmach"
|
133
|
+
// are used. For any specific computer, each of the assignment
|
134
|
+
// statements can be replaced
|
135
|
+
static const int ibeta = std::numeric_limits<RealScalar>::radix; // base for floating-point numbers
|
136
|
+
static const int it = NumTraits<RealScalar>::digits(); // number of base-beta digits in mantissa
|
137
|
+
static const int iemin = NumTraits<RealScalar>::min_exponent(); // minimum exponent
|
138
|
+
static const int iemax = NumTraits<RealScalar>::max_exponent(); // maximum exponent
|
139
|
+
static const RealScalar rbig = NumTraits<RealScalar>::highest(); // largest floating-point number
|
140
|
+
static const RealScalar b1 = RealScalar(pow(RealScalar(ibeta),RealScalar(-((1-iemin)/2)))); // lower boundary of midrange
|
141
|
+
static const RealScalar b2 = RealScalar(pow(RealScalar(ibeta),RealScalar((iemax + 1 - it)/2))); // upper boundary of midrange
|
142
|
+
static const RealScalar s1m = RealScalar(pow(RealScalar(ibeta),RealScalar((2-iemin)/2))); // scaling factor for lower range
|
143
|
+
static const RealScalar s2m = RealScalar(pow(RealScalar(ibeta),RealScalar(- ((iemax+it)/2)))); // scaling factor for upper range
|
144
|
+
static const RealScalar eps = RealScalar(pow(double(ibeta), 1-it));
|
145
|
+
static const RealScalar relerr = sqrt(eps); // tolerance for neglecting asml
|
146
|
+
|
147
|
+
const Derived& vec(_vec.derived());
|
148
|
+
Index n = vec.size();
|
149
|
+
RealScalar ab2 = b2 / RealScalar(n);
|
150
|
+
RealScalar asml = RealScalar(0);
|
151
|
+
RealScalar amed = RealScalar(0);
|
152
|
+
RealScalar abig = RealScalar(0);
|
153
|
+
|
154
|
+
for(Index j=0; j<vec.outerSize(); ++j)
|
155
|
+
{
|
156
|
+
for(typename Derived::InnerIterator iter(vec, j); iter; ++iter)
|
157
|
+
{
|
158
|
+
RealScalar ax = abs(iter.value());
|
159
|
+
if(ax > ab2) abig += numext::abs2(ax*s2m);
|
160
|
+
else if(ax < b1) asml += numext::abs2(ax*s1m);
|
161
|
+
else amed += numext::abs2(ax);
|
162
|
+
}
|
163
|
+
}
|
164
|
+
if(amed!=amed)
|
165
|
+
return amed; // we got a NaN
|
166
|
+
if(abig > RealScalar(0))
|
167
|
+
{
|
168
|
+
abig = sqrt(abig);
|
169
|
+
if(abig > rbig) // overflow, or *this contains INF values
|
170
|
+
return abig; // return INF
|
171
|
+
if(amed > RealScalar(0))
|
172
|
+
{
|
173
|
+
abig = abig/s2m;
|
174
|
+
amed = sqrt(amed);
|
175
|
+
}
|
176
|
+
else
|
177
|
+
return abig/s2m;
|
178
|
+
}
|
179
|
+
else if(asml > RealScalar(0))
|
180
|
+
{
|
181
|
+
if (amed > RealScalar(0))
|
182
|
+
{
|
183
|
+
abig = sqrt(amed);
|
184
|
+
amed = sqrt(asml) / s1m;
|
185
|
+
}
|
186
|
+
else
|
187
|
+
return sqrt(asml)/s1m;
|
188
|
+
}
|
189
|
+
else
|
190
|
+
return sqrt(amed);
|
191
|
+
asml = numext::mini(abig, amed);
|
192
|
+
abig = numext::maxi(abig, amed);
|
193
|
+
if(asml <= abig*relerr)
|
194
|
+
return abig;
|
195
|
+
else
|
196
|
+
return abig * sqrt(RealScalar(1) + numext::abs2(asml/abig));
|
197
|
+
}
|
198
|
+
|
199
|
+
} // end namespace internal
|
200
|
+
|
201
|
+
/** \returns the \em l2 norm of \c *this avoiding underflow and overflow.
|
202
|
+
* This version use a blockwise two passes algorithm:
|
203
|
+
* 1 - find the absolute largest coefficient \c s
|
204
|
+
* 2 - compute \f$ s \Vert \frac{*this}{s} \Vert \f$ in a standard way
|
205
|
+
*
|
206
|
+
* For architecture/scalar types supporting vectorization, this version
|
207
|
+
* is faster than blueNorm(). Otherwise the blueNorm() is much faster.
|
208
|
+
*
|
209
|
+
* \sa norm(), blueNorm(), hypotNorm()
|
210
|
+
*/
|
211
|
+
template<typename Derived>
|
212
|
+
inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
|
213
|
+
MatrixBase<Derived>::stableNorm() const
|
214
|
+
{
|
215
|
+
return internal::stable_norm_impl(derived());
|
216
|
+
}
|
217
|
+
|
218
|
+
/** \returns the \em l2 norm of \c *this using the Blue's algorithm.
|
219
|
+
* A Portable Fortran Program to Find the Euclidean Norm of a Vector,
|
220
|
+
* ACM TOMS, Vol 4, Issue 1, 1978.
|
221
|
+
*
|
222
|
+
* For architecture/scalar types without vectorization, this version
|
223
|
+
* is much faster than stableNorm(). Otherwise the stableNorm() is faster.
|
224
|
+
*
|
225
|
+
* \sa norm(), stableNorm(), hypotNorm()
|
226
|
+
*/
|
227
|
+
template<typename Derived>
|
228
|
+
inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
|
229
|
+
MatrixBase<Derived>::blueNorm() const
|
230
|
+
{
|
231
|
+
return internal::blueNorm_impl(*this);
|
232
|
+
}
|
233
|
+
|
234
|
+
/** \returns the \em l2 norm of \c *this avoiding undeflow and overflow.
|
235
|
+
* This version use a concatenation of hypot() calls, and it is very slow.
|
236
|
+
*
|
237
|
+
* \sa norm(), stableNorm()
|
238
|
+
*/
|
239
|
+
template<typename Derived>
|
240
|
+
inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
|
241
|
+
MatrixBase<Derived>::hypotNorm() const
|
242
|
+
{
|
243
|
+
if(size()==1)
|
244
|
+
return numext::abs(coeff(0,0));
|
245
|
+
else
|
246
|
+
return this->cwiseAbs().redux(internal::scalar_hypot_op<RealScalar>());
|
247
|
+
}
|
248
|
+
|
249
|
+
} // end namespace Eigen
|
250
|
+
|
251
|
+
#endif // EIGEN_STABLENORM_H
|