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,381 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2012 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_REF_H
|
11
|
+
#define EIGEN_REF_H
|
12
|
+
|
13
|
+
namespace Eigen {
|
14
|
+
|
15
|
+
namespace internal {
|
16
|
+
|
17
|
+
template<typename _PlainObjectType, int _Options, typename _StrideType>
|
18
|
+
struct traits<Ref<_PlainObjectType, _Options, _StrideType> >
|
19
|
+
: public traits<Map<_PlainObjectType, _Options, _StrideType> >
|
20
|
+
{
|
21
|
+
typedef _PlainObjectType PlainObjectType;
|
22
|
+
typedef _StrideType StrideType;
|
23
|
+
enum {
|
24
|
+
Options = _Options,
|
25
|
+
Flags = traits<Map<_PlainObjectType, _Options, _StrideType> >::Flags | NestByRefBit,
|
26
|
+
Alignment = traits<Map<_PlainObjectType, _Options, _StrideType> >::Alignment
|
27
|
+
};
|
28
|
+
|
29
|
+
template<typename Derived> struct match {
|
30
|
+
enum {
|
31
|
+
IsVectorAtCompileTime = PlainObjectType::IsVectorAtCompileTime || Derived::IsVectorAtCompileTime,
|
32
|
+
HasDirectAccess = internal::has_direct_access<Derived>::ret,
|
33
|
+
StorageOrderMatch = IsVectorAtCompileTime || ((PlainObjectType::Flags&RowMajorBit)==(Derived::Flags&RowMajorBit)),
|
34
|
+
InnerStrideMatch = int(StrideType::InnerStrideAtCompileTime)==int(Dynamic)
|
35
|
+
|| int(StrideType::InnerStrideAtCompileTime)==int(Derived::InnerStrideAtCompileTime)
|
36
|
+
|| (int(StrideType::InnerStrideAtCompileTime)==0 && int(Derived::InnerStrideAtCompileTime)==1),
|
37
|
+
OuterStrideMatch = IsVectorAtCompileTime
|
38
|
+
|| int(StrideType::OuterStrideAtCompileTime)==int(Dynamic) || int(StrideType::OuterStrideAtCompileTime)==int(Derived::OuterStrideAtCompileTime),
|
39
|
+
// NOTE, this indirection of evaluator<Derived>::Alignment is needed
|
40
|
+
// to workaround a very strange bug in MSVC related to the instantiation
|
41
|
+
// of has_*ary_operator in evaluator<CwiseNullaryOp>.
|
42
|
+
// This line is surprisingly very sensitive. For instance, simply adding parenthesis
|
43
|
+
// as "DerivedAlignment = (int(evaluator<Derived>::Alignment))," will make MSVC fail...
|
44
|
+
DerivedAlignment = int(evaluator<Derived>::Alignment),
|
45
|
+
AlignmentMatch = (int(traits<PlainObjectType>::Alignment)==int(Unaligned)) || (DerivedAlignment >= int(Alignment)), // FIXME the first condition is not very clear, it should be replaced by the required alignment
|
46
|
+
ScalarTypeMatch = internal::is_same<typename PlainObjectType::Scalar, typename Derived::Scalar>::value,
|
47
|
+
MatchAtCompileTime = HasDirectAccess && StorageOrderMatch && InnerStrideMatch && OuterStrideMatch && AlignmentMatch && ScalarTypeMatch
|
48
|
+
};
|
49
|
+
typedef typename internal::conditional<MatchAtCompileTime,internal::true_type,internal::false_type>::type type;
|
50
|
+
};
|
51
|
+
|
52
|
+
};
|
53
|
+
|
54
|
+
template<typename Derived>
|
55
|
+
struct traits<RefBase<Derived> > : public traits<Derived> {};
|
56
|
+
|
57
|
+
}
|
58
|
+
|
59
|
+
template<typename Derived> class RefBase
|
60
|
+
: public MapBase<Derived>
|
61
|
+
{
|
62
|
+
typedef typename internal::traits<Derived>::PlainObjectType PlainObjectType;
|
63
|
+
typedef typename internal::traits<Derived>::StrideType StrideType;
|
64
|
+
|
65
|
+
public:
|
66
|
+
|
67
|
+
typedef MapBase<Derived> Base;
|
68
|
+
EIGEN_DENSE_PUBLIC_INTERFACE(RefBase)
|
69
|
+
|
70
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index innerStride() const
|
71
|
+
{
|
72
|
+
return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1;
|
73
|
+
}
|
74
|
+
|
75
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index outerStride() const
|
76
|
+
{
|
77
|
+
return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer()
|
78
|
+
: IsVectorAtCompileTime ? this->size()
|
79
|
+
: int(Flags)&RowMajorBit ? this->cols()
|
80
|
+
: this->rows();
|
81
|
+
}
|
82
|
+
|
83
|
+
EIGEN_DEVICE_FUNC RefBase()
|
84
|
+
: Base(0,RowsAtCompileTime==Dynamic?0:RowsAtCompileTime,ColsAtCompileTime==Dynamic?0:ColsAtCompileTime),
|
85
|
+
// Stride<> does not allow default ctor for Dynamic strides, so let' initialize it with dummy values:
|
86
|
+
m_stride(StrideType::OuterStrideAtCompileTime==Dynamic?0:StrideType::OuterStrideAtCompileTime,
|
87
|
+
StrideType::InnerStrideAtCompileTime==Dynamic?0:StrideType::InnerStrideAtCompileTime)
|
88
|
+
{}
|
89
|
+
|
90
|
+
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(RefBase)
|
91
|
+
|
92
|
+
protected:
|
93
|
+
|
94
|
+
typedef Stride<StrideType::OuterStrideAtCompileTime,StrideType::InnerStrideAtCompileTime> StrideBase;
|
95
|
+
|
96
|
+
// Resolves inner stride if default 0.
|
97
|
+
static EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index resolveInnerStride(Index inner) {
|
98
|
+
return inner == 0 ? 1 : inner;
|
99
|
+
}
|
100
|
+
|
101
|
+
// Resolves outer stride if default 0.
|
102
|
+
static EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index resolveOuterStride(Index inner, Index outer, Index rows, Index cols, bool isVectorAtCompileTime, bool isRowMajor) {
|
103
|
+
return outer == 0 ? isVectorAtCompileTime ? inner * rows * cols : isRowMajor ? inner * cols : inner * rows : outer;
|
104
|
+
}
|
105
|
+
|
106
|
+
// Returns true if construction is valid, false if there is a stride mismatch,
|
107
|
+
// and fails if there is a size mismatch.
|
108
|
+
template<typename Expression>
|
109
|
+
EIGEN_DEVICE_FUNC bool construct(Expression& expr)
|
110
|
+
{
|
111
|
+
// Check matrix sizes. If this is a compile-time vector, we do allow
|
112
|
+
// implicitly transposing.
|
113
|
+
EIGEN_STATIC_ASSERT(
|
114
|
+
EIGEN_PREDICATE_SAME_MATRIX_SIZE(PlainObjectType, Expression)
|
115
|
+
// If it is a vector, the transpose sizes might match.
|
116
|
+
|| ( PlainObjectType::IsVectorAtCompileTime
|
117
|
+
&& ((int(PlainObjectType::RowsAtCompileTime)==Eigen::Dynamic
|
118
|
+
|| int(Expression::ColsAtCompileTime)==Eigen::Dynamic
|
119
|
+
|| int(PlainObjectType::RowsAtCompileTime)==int(Expression::ColsAtCompileTime))
|
120
|
+
&& (int(PlainObjectType::ColsAtCompileTime)==Eigen::Dynamic
|
121
|
+
|| int(Expression::RowsAtCompileTime)==Eigen::Dynamic
|
122
|
+
|| int(PlainObjectType::ColsAtCompileTime)==int(Expression::RowsAtCompileTime)))),
|
123
|
+
YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES
|
124
|
+
)
|
125
|
+
|
126
|
+
// Determine runtime rows and columns.
|
127
|
+
Index rows = expr.rows();
|
128
|
+
Index cols = expr.cols();
|
129
|
+
if(PlainObjectType::RowsAtCompileTime==1)
|
130
|
+
{
|
131
|
+
eigen_assert(expr.rows()==1 || expr.cols()==1);
|
132
|
+
rows = 1;
|
133
|
+
cols = expr.size();
|
134
|
+
}
|
135
|
+
else if(PlainObjectType::ColsAtCompileTime==1)
|
136
|
+
{
|
137
|
+
eigen_assert(expr.rows()==1 || expr.cols()==1);
|
138
|
+
rows = expr.size();
|
139
|
+
cols = 1;
|
140
|
+
}
|
141
|
+
// Verify that the sizes are valid.
|
142
|
+
eigen_assert(
|
143
|
+
(PlainObjectType::RowsAtCompileTime == Dynamic) || (PlainObjectType::RowsAtCompileTime == rows));
|
144
|
+
eigen_assert(
|
145
|
+
(PlainObjectType::ColsAtCompileTime == Dynamic) || (PlainObjectType::ColsAtCompileTime == cols));
|
146
|
+
|
147
|
+
|
148
|
+
// If this is a vector, we might be transposing, which means that stride should swap.
|
149
|
+
const bool transpose = PlainObjectType::IsVectorAtCompileTime && (rows != expr.rows());
|
150
|
+
// If the storage format differs, we also need to swap the stride.
|
151
|
+
const bool row_major = ((PlainObjectType::Flags)&RowMajorBit) != 0;
|
152
|
+
const bool expr_row_major = (Expression::Flags&RowMajorBit) != 0;
|
153
|
+
const bool storage_differs = (row_major != expr_row_major);
|
154
|
+
|
155
|
+
const bool swap_stride = (transpose != storage_differs);
|
156
|
+
|
157
|
+
// Determine expr's actual strides, resolving any defaults if zero.
|
158
|
+
const Index expr_inner_actual = resolveInnerStride(expr.innerStride());
|
159
|
+
const Index expr_outer_actual = resolveOuterStride(expr_inner_actual,
|
160
|
+
expr.outerStride(),
|
161
|
+
expr.rows(),
|
162
|
+
expr.cols(),
|
163
|
+
Expression::IsVectorAtCompileTime != 0,
|
164
|
+
expr_row_major);
|
165
|
+
|
166
|
+
// If this is a column-major row vector or row-major column vector, the inner-stride
|
167
|
+
// is arbitrary, so set it to either the compile-time inner stride or 1.
|
168
|
+
const bool row_vector = (rows == 1);
|
169
|
+
const bool col_vector = (cols == 1);
|
170
|
+
const Index inner_stride =
|
171
|
+
( (!row_major && row_vector) || (row_major && col_vector) ) ?
|
172
|
+
( StrideType::InnerStrideAtCompileTime > 0 ? Index(StrideType::InnerStrideAtCompileTime) : 1)
|
173
|
+
: swap_stride ? expr_outer_actual : expr_inner_actual;
|
174
|
+
|
175
|
+
// If this is a column-major column vector or row-major row vector, the outer-stride
|
176
|
+
// is arbitrary, so set it to either the compile-time outer stride or vector size.
|
177
|
+
const Index outer_stride =
|
178
|
+
( (!row_major && col_vector) || (row_major && row_vector) ) ?
|
179
|
+
( StrideType::OuterStrideAtCompileTime > 0 ? Index(StrideType::OuterStrideAtCompileTime) : rows * cols * inner_stride)
|
180
|
+
: swap_stride ? expr_inner_actual : expr_outer_actual;
|
181
|
+
|
182
|
+
// Check if given inner/outer strides are compatible with compile-time strides.
|
183
|
+
const bool inner_valid = (StrideType::InnerStrideAtCompileTime == Dynamic)
|
184
|
+
|| (resolveInnerStride(Index(StrideType::InnerStrideAtCompileTime)) == inner_stride);
|
185
|
+
if (!inner_valid) {
|
186
|
+
return false;
|
187
|
+
}
|
188
|
+
|
189
|
+
const bool outer_valid = (StrideType::OuterStrideAtCompileTime == Dynamic)
|
190
|
+
|| (resolveOuterStride(
|
191
|
+
inner_stride,
|
192
|
+
Index(StrideType::OuterStrideAtCompileTime),
|
193
|
+
rows, cols, PlainObjectType::IsVectorAtCompileTime != 0,
|
194
|
+
row_major)
|
195
|
+
== outer_stride);
|
196
|
+
if (!outer_valid) {
|
197
|
+
return false;
|
198
|
+
}
|
199
|
+
|
200
|
+
::new (static_cast<Base*>(this)) Base(expr.data(), rows, cols);
|
201
|
+
::new (&m_stride) StrideBase(
|
202
|
+
(StrideType::OuterStrideAtCompileTime == 0) ? 0 : outer_stride,
|
203
|
+
(StrideType::InnerStrideAtCompileTime == 0) ? 0 : inner_stride );
|
204
|
+
return true;
|
205
|
+
}
|
206
|
+
|
207
|
+
StrideBase m_stride;
|
208
|
+
};
|
209
|
+
|
210
|
+
/** \class Ref
|
211
|
+
* \ingroup Core_Module
|
212
|
+
*
|
213
|
+
* \brief A matrix or vector expression mapping an existing expression
|
214
|
+
*
|
215
|
+
* \tparam PlainObjectType the equivalent matrix type of the mapped data
|
216
|
+
* \tparam Options specifies the pointer alignment in bytes. It can be: \c #Aligned128, , \c #Aligned64, \c #Aligned32, \c #Aligned16, \c #Aligned8 or \c #Unaligned.
|
217
|
+
* The default is \c #Unaligned.
|
218
|
+
* \tparam StrideType optionally specifies strides. By default, Ref implies a contiguous storage along the inner dimension (inner stride==1),
|
219
|
+
* but accepts a variable outer stride (leading dimension).
|
220
|
+
* This can be overridden by specifying strides.
|
221
|
+
* The type passed here must be a specialization of the Stride template, see examples below.
|
222
|
+
*
|
223
|
+
* This class provides a way to write non-template functions taking Eigen objects as parameters while limiting the number of copies.
|
224
|
+
* A Ref<> object can represent either a const expression or a l-value:
|
225
|
+
* \code
|
226
|
+
* // in-out argument:
|
227
|
+
* void foo1(Ref<VectorXf> x);
|
228
|
+
*
|
229
|
+
* // read-only const argument:
|
230
|
+
* void foo2(const Ref<const VectorXf>& x);
|
231
|
+
* \endcode
|
232
|
+
*
|
233
|
+
* In the in-out case, the input argument must satisfy the constraints of the actual Ref<> type, otherwise a compilation issue will be triggered.
|
234
|
+
* By default, a Ref<VectorXf> can reference any dense vector expression of float having a contiguous memory layout.
|
235
|
+
* Likewise, a Ref<MatrixXf> can reference any column-major dense matrix expression of float whose column's elements are contiguously stored with
|
236
|
+
* the possibility to have a constant space in-between each column, i.e. the inner stride must be equal to 1, but the outer stride (or leading dimension)
|
237
|
+
* can be greater than the number of rows.
|
238
|
+
*
|
239
|
+
* In the const case, if the input expression does not match the above requirement, then it is evaluated into a temporary before being passed to the function.
|
240
|
+
* Here are some examples:
|
241
|
+
* \code
|
242
|
+
* MatrixXf A;
|
243
|
+
* VectorXf a;
|
244
|
+
* foo1(a.head()); // OK
|
245
|
+
* foo1(A.col()); // OK
|
246
|
+
* foo1(A.row()); // Compilation error because here innerstride!=1
|
247
|
+
* foo2(A.row()); // Compilation error because A.row() is a 1xN object while foo2 is expecting a Nx1 object
|
248
|
+
* foo2(A.row().transpose()); // The row is copied into a contiguous temporary
|
249
|
+
* foo2(2*a); // The expression is evaluated into a temporary
|
250
|
+
* foo2(A.col().segment(2,4)); // No temporary
|
251
|
+
* \endcode
|
252
|
+
*
|
253
|
+
* The range of inputs that can be referenced without temporary can be enlarged using the last two template parameters.
|
254
|
+
* Here is an example accepting an innerstride!=1:
|
255
|
+
* \code
|
256
|
+
* // in-out argument:
|
257
|
+
* void foo3(Ref<VectorXf,0,InnerStride<> > x);
|
258
|
+
* foo3(A.row()); // OK
|
259
|
+
* \endcode
|
260
|
+
* The downside here is that the function foo3 might be significantly slower than foo1 because it won't be able to exploit vectorization, and will involve more
|
261
|
+
* expensive address computations even if the input is contiguously stored in memory. To overcome this issue, one might propose to overload internally calling a
|
262
|
+
* template function, e.g.:
|
263
|
+
* \code
|
264
|
+
* // in the .h:
|
265
|
+
* void foo(const Ref<MatrixXf>& A);
|
266
|
+
* void foo(const Ref<MatrixXf,0,Stride<> >& A);
|
267
|
+
*
|
268
|
+
* // in the .cpp:
|
269
|
+
* template<typename TypeOfA> void foo_impl(const TypeOfA& A) {
|
270
|
+
* ... // crazy code goes here
|
271
|
+
* }
|
272
|
+
* void foo(const Ref<MatrixXf>& A) { foo_impl(A); }
|
273
|
+
* void foo(const Ref<MatrixXf,0,Stride<> >& A) { foo_impl(A); }
|
274
|
+
* \endcode
|
275
|
+
*
|
276
|
+
* See also the following stackoverflow questions for further references:
|
277
|
+
* - <a href="http://stackoverflow.com/questions/21132538/correct-usage-of-the-eigenref-class">Correct usage of the Eigen::Ref<> class</a>
|
278
|
+
*
|
279
|
+
* \sa PlainObjectBase::Map(), \ref TopicStorageOrders
|
280
|
+
*/
|
281
|
+
template<typename PlainObjectType, int Options, typename StrideType> class Ref
|
282
|
+
: public RefBase<Ref<PlainObjectType, Options, StrideType> >
|
283
|
+
{
|
284
|
+
private:
|
285
|
+
typedef internal::traits<Ref> Traits;
|
286
|
+
template<typename Derived>
|
287
|
+
EIGEN_DEVICE_FUNC inline Ref(const PlainObjectBase<Derived>& expr,
|
288
|
+
typename internal::enable_if<bool(Traits::template match<Derived>::MatchAtCompileTime),Derived>::type* = 0);
|
289
|
+
public:
|
290
|
+
|
291
|
+
typedef RefBase<Ref> Base;
|
292
|
+
EIGEN_DENSE_PUBLIC_INTERFACE(Ref)
|
293
|
+
|
294
|
+
|
295
|
+
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
296
|
+
template<typename Derived>
|
297
|
+
EIGEN_DEVICE_FUNC inline Ref(PlainObjectBase<Derived>& expr,
|
298
|
+
typename internal::enable_if<bool(Traits::template match<Derived>::MatchAtCompileTime),Derived>::type* = 0)
|
299
|
+
{
|
300
|
+
EIGEN_STATIC_ASSERT(bool(Traits::template match<Derived>::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH);
|
301
|
+
// Construction must pass since we will not create temprary storage in the non-const case.
|
302
|
+
const bool success = Base::construct(expr.derived());
|
303
|
+
EIGEN_UNUSED_VARIABLE(success)
|
304
|
+
eigen_assert(success);
|
305
|
+
}
|
306
|
+
template<typename Derived>
|
307
|
+
EIGEN_DEVICE_FUNC inline Ref(const DenseBase<Derived>& expr,
|
308
|
+
typename internal::enable_if<bool(Traits::template match<Derived>::MatchAtCompileTime),Derived>::type* = 0)
|
309
|
+
#else
|
310
|
+
/** Implicit constructor from any dense expression */
|
311
|
+
template<typename Derived>
|
312
|
+
inline Ref(DenseBase<Derived>& expr)
|
313
|
+
#endif
|
314
|
+
{
|
315
|
+
EIGEN_STATIC_ASSERT(bool(internal::is_lvalue<Derived>::value), THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY);
|
316
|
+
EIGEN_STATIC_ASSERT(bool(Traits::template match<Derived>::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH);
|
317
|
+
EIGEN_STATIC_ASSERT(!Derived::IsPlainObjectBase,THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY);
|
318
|
+
// Construction must pass since we will not create temporary storage in the non-const case.
|
319
|
+
const bool success = Base::construct(expr.const_cast_derived());
|
320
|
+
EIGEN_UNUSED_VARIABLE(success)
|
321
|
+
eigen_assert(success);
|
322
|
+
}
|
323
|
+
|
324
|
+
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Ref)
|
325
|
+
|
326
|
+
};
|
327
|
+
|
328
|
+
// this is the const ref version
|
329
|
+
template<typename TPlainObjectType, int Options, typename StrideType> class Ref<const TPlainObjectType, Options, StrideType>
|
330
|
+
: public RefBase<Ref<const TPlainObjectType, Options, StrideType> >
|
331
|
+
{
|
332
|
+
typedef internal::traits<Ref> Traits;
|
333
|
+
public:
|
334
|
+
|
335
|
+
typedef RefBase<Ref> Base;
|
336
|
+
EIGEN_DENSE_PUBLIC_INTERFACE(Ref)
|
337
|
+
|
338
|
+
template<typename Derived>
|
339
|
+
EIGEN_DEVICE_FUNC inline Ref(const DenseBase<Derived>& expr,
|
340
|
+
typename internal::enable_if<bool(Traits::template match<Derived>::ScalarTypeMatch),Derived>::type* = 0)
|
341
|
+
{
|
342
|
+
// std::cout << match_helper<Derived>::HasDirectAccess << "," << match_helper<Derived>::OuterStrideMatch << "," << match_helper<Derived>::InnerStrideMatch << "\n";
|
343
|
+
// std::cout << int(StrideType::OuterStrideAtCompileTime) << " - " << int(Derived::OuterStrideAtCompileTime) << "\n";
|
344
|
+
// std::cout << int(StrideType::InnerStrideAtCompileTime) << " - " << int(Derived::InnerStrideAtCompileTime) << "\n";
|
345
|
+
construct(expr.derived(), typename Traits::template match<Derived>::type());
|
346
|
+
}
|
347
|
+
|
348
|
+
EIGEN_DEVICE_FUNC inline Ref(const Ref& other) : Base(other) {
|
349
|
+
// copy constructor shall not copy the m_object, to avoid unnecessary malloc and copy
|
350
|
+
}
|
351
|
+
|
352
|
+
template<typename OtherRef>
|
353
|
+
EIGEN_DEVICE_FUNC inline Ref(const RefBase<OtherRef>& other) {
|
354
|
+
construct(other.derived(), typename Traits::template match<OtherRef>::type());
|
355
|
+
}
|
356
|
+
|
357
|
+
protected:
|
358
|
+
|
359
|
+
template<typename Expression>
|
360
|
+
EIGEN_DEVICE_FUNC void construct(const Expression& expr,internal::true_type)
|
361
|
+
{
|
362
|
+
// Check if we can use the underlying expr's storage directly, otherwise call the copy version.
|
363
|
+
if (!Base::construct(expr)) {
|
364
|
+
construct(expr, internal::false_type());
|
365
|
+
}
|
366
|
+
}
|
367
|
+
|
368
|
+
template<typename Expression>
|
369
|
+
EIGEN_DEVICE_FUNC void construct(const Expression& expr, internal::false_type)
|
370
|
+
{
|
371
|
+
internal::call_assignment_no_alias(m_object,expr,internal::assign_op<Scalar,Scalar>());
|
372
|
+
Base::construct(m_object);
|
373
|
+
}
|
374
|
+
|
375
|
+
protected:
|
376
|
+
TPlainObjectType m_object;
|
377
|
+
};
|
378
|
+
|
379
|
+
} // end namespace Eigen
|
380
|
+
|
381
|
+
#endif // EIGEN_REF_H
|
@@ -0,0 +1,142 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
|
5
|
+
//
|
6
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
7
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
8
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
9
|
+
|
10
|
+
#ifndef EIGEN_REPLICATE_H
|
11
|
+
#define EIGEN_REPLICATE_H
|
12
|
+
|
13
|
+
namespace Eigen {
|
14
|
+
|
15
|
+
namespace internal {
|
16
|
+
template<typename MatrixType,int RowFactor,int ColFactor>
|
17
|
+
struct traits<Replicate<MatrixType,RowFactor,ColFactor> >
|
18
|
+
: traits<MatrixType>
|
19
|
+
{
|
20
|
+
typedef typename MatrixType::Scalar Scalar;
|
21
|
+
typedef typename traits<MatrixType>::StorageKind StorageKind;
|
22
|
+
typedef typename traits<MatrixType>::XprKind XprKind;
|
23
|
+
typedef typename ref_selector<MatrixType>::type MatrixTypeNested;
|
24
|
+
typedef typename remove_reference<MatrixTypeNested>::type _MatrixTypeNested;
|
25
|
+
enum {
|
26
|
+
RowsAtCompileTime = RowFactor==Dynamic || int(MatrixType::RowsAtCompileTime)==Dynamic
|
27
|
+
? Dynamic
|
28
|
+
: RowFactor * MatrixType::RowsAtCompileTime,
|
29
|
+
ColsAtCompileTime = ColFactor==Dynamic || int(MatrixType::ColsAtCompileTime)==Dynamic
|
30
|
+
? Dynamic
|
31
|
+
: ColFactor * MatrixType::ColsAtCompileTime,
|
32
|
+
//FIXME we don't propagate the max sizes !!!
|
33
|
+
MaxRowsAtCompileTime = RowsAtCompileTime,
|
34
|
+
MaxColsAtCompileTime = ColsAtCompileTime,
|
35
|
+
IsRowMajor = MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1 ? 1
|
36
|
+
: MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1 ? 0
|
37
|
+
: (MatrixType::Flags & RowMajorBit) ? 1 : 0,
|
38
|
+
|
39
|
+
// FIXME enable DirectAccess with negative strides?
|
40
|
+
Flags = IsRowMajor ? RowMajorBit : 0
|
41
|
+
};
|
42
|
+
};
|
43
|
+
}
|
44
|
+
|
45
|
+
/**
|
46
|
+
* \class Replicate
|
47
|
+
* \ingroup Core_Module
|
48
|
+
*
|
49
|
+
* \brief Expression of the multiple replication of a matrix or vector
|
50
|
+
*
|
51
|
+
* \tparam MatrixType the type of the object we are replicating
|
52
|
+
* \tparam RowFactor number of repetitions at compile time along the vertical direction, can be Dynamic.
|
53
|
+
* \tparam ColFactor number of repetitions at compile time along the horizontal direction, can be Dynamic.
|
54
|
+
*
|
55
|
+
* This class represents an expression of the multiple replication of a matrix or vector.
|
56
|
+
* It is the return type of DenseBase::replicate() and most of the time
|
57
|
+
* this is the only way it is used.
|
58
|
+
*
|
59
|
+
* \sa DenseBase::replicate()
|
60
|
+
*/
|
61
|
+
template<typename MatrixType,int RowFactor,int ColFactor> class Replicate
|
62
|
+
: public internal::dense_xpr_base< Replicate<MatrixType,RowFactor,ColFactor> >::type
|
63
|
+
{
|
64
|
+
typedef typename internal::traits<Replicate>::MatrixTypeNested MatrixTypeNested;
|
65
|
+
typedef typename internal::traits<Replicate>::_MatrixTypeNested _MatrixTypeNested;
|
66
|
+
public:
|
67
|
+
|
68
|
+
typedef typename internal::dense_xpr_base<Replicate>::type Base;
|
69
|
+
EIGEN_DENSE_PUBLIC_INTERFACE(Replicate)
|
70
|
+
typedef typename internal::remove_all<MatrixType>::type NestedExpression;
|
71
|
+
|
72
|
+
template<typename OriginalMatrixType>
|
73
|
+
EIGEN_DEVICE_FUNC
|
74
|
+
inline explicit Replicate(const OriginalMatrixType& matrix)
|
75
|
+
: m_matrix(matrix), m_rowFactor(RowFactor), m_colFactor(ColFactor)
|
76
|
+
{
|
77
|
+
EIGEN_STATIC_ASSERT((internal::is_same<typename internal::remove_const<MatrixType>::type,OriginalMatrixType>::value),
|
78
|
+
THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE)
|
79
|
+
eigen_assert(RowFactor!=Dynamic && ColFactor!=Dynamic);
|
80
|
+
}
|
81
|
+
|
82
|
+
template<typename OriginalMatrixType>
|
83
|
+
EIGEN_DEVICE_FUNC
|
84
|
+
inline Replicate(const OriginalMatrixType& matrix, Index rowFactor, Index colFactor)
|
85
|
+
: m_matrix(matrix), m_rowFactor(rowFactor), m_colFactor(colFactor)
|
86
|
+
{
|
87
|
+
EIGEN_STATIC_ASSERT((internal::is_same<typename internal::remove_const<MatrixType>::type,OriginalMatrixType>::value),
|
88
|
+
THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE)
|
89
|
+
}
|
90
|
+
|
91
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
92
|
+
inline Index rows() const { return m_matrix.rows() * m_rowFactor.value(); }
|
93
|
+
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
94
|
+
inline Index cols() const { return m_matrix.cols() * m_colFactor.value(); }
|
95
|
+
|
96
|
+
EIGEN_DEVICE_FUNC
|
97
|
+
const _MatrixTypeNested& nestedExpression() const
|
98
|
+
{
|
99
|
+
return m_matrix;
|
100
|
+
}
|
101
|
+
|
102
|
+
protected:
|
103
|
+
MatrixTypeNested m_matrix;
|
104
|
+
const internal::variable_if_dynamic<Index, RowFactor> m_rowFactor;
|
105
|
+
const internal::variable_if_dynamic<Index, ColFactor> m_colFactor;
|
106
|
+
};
|
107
|
+
|
108
|
+
/**
|
109
|
+
* \return an expression of the replication of \c *this
|
110
|
+
*
|
111
|
+
* Example: \include MatrixBase_replicate.cpp
|
112
|
+
* Output: \verbinclude MatrixBase_replicate.out
|
113
|
+
*
|
114
|
+
* \sa VectorwiseOp::replicate(), DenseBase::replicate(Index,Index), class Replicate
|
115
|
+
*/
|
116
|
+
template<typename Derived>
|
117
|
+
template<int RowFactor, int ColFactor>
|
118
|
+
EIGEN_DEVICE_FUNC const Replicate<Derived,RowFactor,ColFactor>
|
119
|
+
DenseBase<Derived>::replicate() const
|
120
|
+
{
|
121
|
+
return Replicate<Derived,RowFactor,ColFactor>(derived());
|
122
|
+
}
|
123
|
+
|
124
|
+
/**
|
125
|
+
* \return an expression of the replication of each column (or row) of \c *this
|
126
|
+
*
|
127
|
+
* Example: \include DirectionWise_replicate_int.cpp
|
128
|
+
* Output: \verbinclude DirectionWise_replicate_int.out
|
129
|
+
*
|
130
|
+
* \sa VectorwiseOp::replicate(), DenseBase::replicate(), class Replicate
|
131
|
+
*/
|
132
|
+
template<typename ExpressionType, int Direction>
|
133
|
+
EIGEN_DEVICE_FUNC const typename VectorwiseOp<ExpressionType,Direction>::ReplicateReturnType
|
134
|
+
VectorwiseOp<ExpressionType,Direction>::replicate(Index factor) const
|
135
|
+
{
|
136
|
+
return typename VectorwiseOp<ExpressionType,Direction>::ReplicateReturnType
|
137
|
+
(_expression(),Direction==Vertical?factor:1,Direction==Horizontal?factor:1);
|
138
|
+
}
|
139
|
+
|
140
|
+
} // end namespace Eigen
|
141
|
+
|
142
|
+
#endif // EIGEN_REPLICATE_H
|