ruby-eigen 0.0.9 → 0.0.10.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +22 -0
- data/README.md +21 -0
- data/ext/eigen/eigen3/COPYING.BSD +26 -0
- data/ext/eigen/eigen3/COPYING.MPL2 +373 -0
- data/ext/eigen/eigen3/COPYING.README +18 -0
- data/ext/eigen/eigen3/Eigen/Array +11 -0
- data/ext/eigen/eigen3/Eigen/Cholesky +32 -0
- data/ext/eigen/eigen3/Eigen/CholmodSupport +45 -0
- data/ext/eigen/eigen3/Eigen/Core +376 -0
- data/ext/eigen/eigen3/Eigen/Dense +7 -0
- data/ext/eigen/eigen3/Eigen/Eigen +2 -0
- data/ext/eigen/eigen3/Eigen/Eigen2Support +95 -0
- data/ext/eigen/eigen3/Eigen/Eigenvalues +48 -0
- data/ext/eigen/eigen3/Eigen/Geometry +63 -0
- data/ext/eigen/eigen3/Eigen/Householder +23 -0
- data/ext/eigen/eigen3/Eigen/IterativeLinearSolvers +40 -0
- data/ext/eigen/eigen3/Eigen/Jacobi +26 -0
- data/ext/eigen/eigen3/Eigen/LU +41 -0
- data/ext/eigen/eigen3/Eigen/LeastSquares +32 -0
- data/ext/eigen/eigen3/Eigen/MetisSupport +28 -0
- data/ext/eigen/eigen3/Eigen/PaStiXSupport +46 -0
- data/ext/eigen/eigen3/Eigen/PardisoSupport +30 -0
- data/ext/eigen/eigen3/Eigen/QR +45 -0
- data/ext/eigen/eigen3/Eigen/QtAlignedMalloc +34 -0
- data/ext/eigen/eigen3/Eigen/SPQRSupport +29 -0
- data/ext/eigen/eigen3/Eigen/SVD +37 -0
- data/ext/eigen/eigen3/Eigen/Sparse +27 -0
- data/ext/eigen/eigen3/Eigen/SparseCore +64 -0
- data/ext/eigen/eigen3/Eigen/SparseLU +49 -0
- data/ext/eigen/eigen3/Eigen/SparseQR +33 -0
- data/ext/eigen/eigen3/Eigen/StdDeque +27 -0
- data/ext/eigen/eigen3/Eigen/StdList +26 -0
- data/ext/eigen/eigen3/Eigen/StdVector +27 -0
- data/ext/eigen/eigen3/Eigen/SuperLUSupport +59 -0
- data/ext/eigen/eigen3/Eigen/UmfPackSupport +36 -0
- data/ext/eigen/eigen3/Eigen/src/Cholesky/LDLT.h +611 -0
- data/ext/eigen/eigen3/Eigen/src/Cholesky/LLT.h +498 -0
- data/ext/eigen/eigen3/Eigen/src/Cholesky/LLT_MKL.h +102 -0
- data/ext/eigen/eigen3/Eigen/src/CholmodSupport/CholmodSupport.h +607 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Array.h +323 -0
- data/ext/eigen/eigen3/Eigen/src/Core/ArrayBase.h +226 -0
- data/ext/eigen/eigen3/Eigen/src/Core/ArrayWrapper.h +264 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Assign.h +590 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Assign_MKL.h +224 -0
- data/ext/eigen/eigen3/Eigen/src/Core/BandMatrix.h +334 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Block.h +406 -0
- data/ext/eigen/eigen3/Eigen/src/Core/BooleanRedux.h +154 -0
- data/ext/eigen/eigen3/Eigen/src/Core/CommaInitializer.h +154 -0
- data/ext/eigen/eigen3/Eigen/src/Core/CoreIterators.h +61 -0
- data/ext/eigen/eigen3/Eigen/src/Core/CwiseBinaryOp.h +230 -0
- data/ext/eigen/eigen3/Eigen/src/Core/CwiseNullaryOp.h +864 -0
- data/ext/eigen/eigen3/Eigen/src/Core/CwiseUnaryOp.h +126 -0
- data/ext/eigen/eigen3/Eigen/src/Core/CwiseUnaryView.h +139 -0
- data/ext/eigen/eigen3/Eigen/src/Core/DenseBase.h +521 -0
- data/ext/eigen/eigen3/Eigen/src/Core/DenseCoeffsBase.h +754 -0
- data/ext/eigen/eigen3/Eigen/src/Core/DenseStorage.h +434 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Diagonal.h +237 -0
- data/ext/eigen/eigen3/Eigen/src/Core/DiagonalMatrix.h +313 -0
- data/ext/eigen/eigen3/Eigen/src/Core/DiagonalProduct.h +131 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Dot.h +263 -0
- data/ext/eigen/eigen3/Eigen/src/Core/EigenBase.h +131 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Flagged.h +140 -0
- data/ext/eigen/eigen3/Eigen/src/Core/ForceAlignedAccess.h +146 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Functors.h +1026 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Fuzzy.h +150 -0
- data/ext/eigen/eigen3/Eigen/src/Core/GeneralProduct.h +635 -0
- data/ext/eigen/eigen3/Eigen/src/Core/GenericPacketMath.h +350 -0
- data/ext/eigen/eigen3/Eigen/src/Core/GlobalFunctions.h +92 -0
- data/ext/eigen/eigen3/Eigen/src/Core/IO.h +250 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Map.h +192 -0
- data/ext/eigen/eigen3/Eigen/src/Core/MapBase.h +247 -0
- data/ext/eigen/eigen3/Eigen/src/Core/MathFunctions.h +768 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Matrix.h +420 -0
- data/ext/eigen/eigen3/Eigen/src/Core/MatrixBase.h +563 -0
- data/ext/eigen/eigen3/Eigen/src/Core/NestByValue.h +111 -0
- data/ext/eigen/eigen3/Eigen/src/Core/NoAlias.h +134 -0
- data/ext/eigen/eigen3/Eigen/src/Core/NumTraits.h +150 -0
- data/ext/eigen/eigen3/Eigen/src/Core/PermutationMatrix.h +721 -0
- data/ext/eigen/eigen3/Eigen/src/Core/PlainObjectBase.h +822 -0
- data/ext/eigen/eigen3/Eigen/src/Core/ProductBase.h +290 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Random.h +152 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Redux.h +409 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Ref.h +278 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Replicate.h +177 -0
- data/ext/eigen/eigen3/Eigen/src/Core/ReturnByValue.h +99 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Reverse.h +224 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Select.h +162 -0
- data/ext/eigen/eigen3/Eigen/src/Core/SelfAdjointView.h +314 -0
- data/ext/eigen/eigen3/Eigen/src/Core/SelfCwiseBinaryOp.h +191 -0
- data/ext/eigen/eigen3/Eigen/src/Core/SolveTriangular.h +260 -0
- data/ext/eigen/eigen3/Eigen/src/Core/StableNorm.h +203 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Stride.h +108 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Swap.h +126 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Transpose.h +419 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Transpositions.h +436 -0
- data/ext/eigen/eigen3/Eigen/src/Core/TriangularMatrix.h +839 -0
- data/ext/eigen/eigen3/Eigen/src/Core/VectorBlock.h +95 -0
- data/ext/eigen/eigen3/Eigen/src/Core/VectorwiseOp.h +642 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Visitor.h +237 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/AltiVec/Complex.h +217 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/AltiVec/PacketMath.h +501 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/Default/Settings.h +49 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/NEON/Complex.h +253 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/NEON/PacketMath.h +420 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/SSE/Complex.h +442 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/SSE/MathFunctions.h +475 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/SSE/PacketMath.h +649 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/CoeffBasedProduct.h +476 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h +1341 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h +427 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +278 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_MKL.h +146 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix_MKL.h +118 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixVector.h +566 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixVector_MKL.h +131 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/Parallelizer.h +162 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +436 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix_MKL.h +295 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointMatrixVector.h +281 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointMatrixVector_MKL.h +114 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointProduct.h +123 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointRank2Update.h +93 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularMatrixMatrix.h +427 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularMatrixMatrix_MKL.h +309 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularMatrixVector.h +348 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularMatrixVector_MKL.h +247 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularSolverMatrix.h +332 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularSolverMatrix_MKL.h +155 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularSolverVector.h +139 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/BlasUtil.h +264 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/Constants.h +451 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/DisableStupidWarnings.h +40 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/ForwardDeclarations.h +302 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/MKL_support.h +158 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/Macros.h +451 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/Memory.h +977 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/Meta.h +243 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/NonMPL2.h +3 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/ReenableStupidWarnings.h +14 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/StaticAssert.h +208 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/XprHelper.h +469 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Block.h +126 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Cwise.h +192 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/CwiseOperators.h +298 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/AlignedBox.h +159 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/All.h +115 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/AngleAxis.h +214 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Hyperplane.h +254 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/ParametrizedLine.h +141 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Quaternion.h +495 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Rotation2D.h +145 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/RotationBase.h +123 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Scaling.h +167 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Transform.h +786 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Translation.h +184 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/LU.h +120 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Lazy.h +71 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/LeastSquares.h +169 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Macros.h +20 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/MathFunctions.h +57 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Memory.h +45 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Meta.h +75 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Minor.h +117 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/QR.h +67 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/SVD.h +637 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/TriangularSolver.h +42 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/VectorBlock.h +94 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/ComplexEigenSolver.h +341 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/ComplexSchur.h +456 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/ComplexSchur_MKL.h +94 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/EigenSolver.h +607 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +350 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +227 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/HessenbergDecomposition.h +373 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +160 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/RealQZ.h +624 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/RealSchur.h +525 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/RealSchur_MKL.h +83 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +801 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_MKL.h +92 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h +557 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/AlignedBox.h +392 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/AngleAxis.h +233 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/EulerAngles.h +104 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Homogeneous.h +307 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Hyperplane.h +280 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/OrthoMethods.h +218 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/ParametrizedLine.h +195 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Quaternion.h +776 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Rotation2D.h +160 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/RotationBase.h +206 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Scaling.h +166 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Transform.h +1455 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Translation.h +206 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Umeyama.h +177 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/arch/Geometry_SSE.h +115 -0
- data/ext/eigen/eigen3/Eigen/src/Householder/BlockHouseholder.h +68 -0
- data/ext/eigen/eigen3/Eigen/src/Householder/Householder.h +171 -0
- data/ext/eigen/eigen3/Eigen/src/Householder/HouseholderSequence.h +441 -0
- data/ext/eigen/eigen3/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +149 -0
- data/ext/eigen/eigen3/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +263 -0
- data/ext/eigen/eigen3/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +256 -0
- data/ext/eigen/eigen3/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +282 -0
- data/ext/eigen/eigen3/Eigen/src/Jacobi/Jacobi.h +433 -0
- data/ext/eigen/eigen3/Eigen/src/LU/Determinant.h +101 -0
- data/ext/eigen/eigen3/Eigen/src/LU/FullPivLU.h +751 -0
- data/ext/eigen/eigen3/Eigen/src/LU/Inverse.h +400 -0
- data/ext/eigen/eigen3/Eigen/src/LU/PartialPivLU.h +509 -0
- data/ext/eigen/eigen3/Eigen/src/LU/PartialPivLU_MKL.h +85 -0
- data/ext/eigen/eigen3/Eigen/src/LU/arch/Inverse_SSE.h +329 -0
- data/ext/eigen/eigen3/Eigen/src/MetisSupport/MetisSupport.h +137 -0
- data/ext/eigen/eigen3/Eigen/src/OrderingMethods/Amd.h +444 -0
- data/ext/eigen/eigen3/Eigen/src/OrderingMethods/Eigen_Colamd.h +1850 -0
- data/ext/eigen/eigen3/Eigen/src/PaStiXSupport/PaStiXSupport.h +721 -0
- data/ext/eigen/eigen3/Eigen/src/PardisoSupport/PardisoSupport.h +592 -0
- data/ext/eigen/eigen3/Eigen/src/QR/ColPivHouseholderQR.h +580 -0
- data/ext/eigen/eigen3/Eigen/src/QR/ColPivHouseholderQR_MKL.h +99 -0
- data/ext/eigen/eigen3/Eigen/src/QR/FullPivHouseholderQR.h +622 -0
- data/ext/eigen/eigen3/Eigen/src/QR/HouseholderQR.h +388 -0
- data/ext/eigen/eigen3/Eigen/src/QR/HouseholderQR_MKL.h +71 -0
- data/ext/eigen/eigen3/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +338 -0
- data/ext/eigen/eigen3/Eigen/src/SVD/JacobiSVD.h +976 -0
- data/ext/eigen/eigen3/Eigen/src/SVD/JacobiSVD_MKL.h +92 -0
- data/ext/eigen/eigen3/Eigen/src/SVD/UpperBidiagonalization.h +148 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCholesky/SimplicialCholesky.h +671 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +199 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/AmbiVector.h +373 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/CompressedStorage.h +233 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +245 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/MappedSparseMatrix.h +181 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseBlock.h +537 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseColEtree.h +206 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +325 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +163 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseDenseProduct.h +311 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseDiagonalProduct.h +196 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseDot.h +101 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseFuzzy.h +26 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseMatrix.h +1262 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseMatrixBase.h +461 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparsePermutation.h +148 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseProduct.h +188 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseRedux.h +45 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseSelfAdjointView.h +507 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +150 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseTranspose.h +63 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseTriangularView.h +179 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseUtil.h +172 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseVector.h +448 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseView.h +99 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/TriangularSolver.h +334 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU.h +806 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLUImpl.h +66 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_Memory.h +227 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_Structs.h +111 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +298 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_Utils.h +80 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_column_bmod.h +180 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_column_dfs.h +177 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +106 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +279 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +127 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +130 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_panel_bmod.h +223 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_panel_dfs.h +258 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_pivotL.h +137 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_pruneL.h +135 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_relax_snode.h +83 -0
- data/ext/eigen/eigen3/Eigen/src/SparseQR/SparseQR.h +714 -0
- data/ext/eigen/eigen3/Eigen/src/StlSupport/StdDeque.h +134 -0
- data/ext/eigen/eigen3/Eigen/src/StlSupport/StdList.h +114 -0
- data/ext/eigen/eigen3/Eigen/src/StlSupport/StdVector.h +126 -0
- data/ext/eigen/eigen3/Eigen/src/StlSupport/details.h +84 -0
- data/ext/eigen/eigen3/Eigen/src/SuperLUSupport/SuperLUSupport.h +1026 -0
- data/ext/eigen/eigen3/Eigen/src/UmfPackSupport/UmfPackSupport.h +474 -0
- data/ext/eigen/eigen3/Eigen/src/misc/Image.h +84 -0
- data/ext/eigen/eigen3/Eigen/src/misc/Kernel.h +81 -0
- data/ext/eigen/eigen3/Eigen/src/misc/Solve.h +76 -0
- data/ext/eigen/eigen3/Eigen/src/misc/SparseSolve.h +128 -0
- data/ext/eigen/eigen3/Eigen/src/misc/blas.h +658 -0
- data/ext/eigen/eigen3/Eigen/src/plugins/ArrayCwiseBinaryOps.h +253 -0
- data/ext/eigen/eigen3/Eigen/src/plugins/ArrayCwiseUnaryOps.h +187 -0
- data/ext/eigen/eigen3/Eigen/src/plugins/BlockMethods.h +935 -0
- data/ext/eigen/eigen3/Eigen/src/plugins/CommonCwiseBinaryOps.h +46 -0
- data/ext/eigen/eigen3/Eigen/src/plugins/CommonCwiseUnaryOps.h +172 -0
- data/ext/eigen/eigen3/Eigen/src/plugins/MatrixCwiseBinaryOps.h +143 -0
- data/ext/eigen/eigen3/Eigen/src/plugins/MatrixCwiseUnaryOps.h +52 -0
- data/ext/eigen/eigen3/signature_of_eigen3_matrix_library +1 -0
- data/ext/eigen/eigen_wrap.cxx +19420 -10396
- data/ext/eigen/extconf.rb +37 -2
- data/lib/eigen.rb +146 -3
- metadata +294 -7
@@ -0,0 +1,184 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2008 Gael Guennebaud <g.gael@free.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
|
+
// no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway
|
11
|
+
|
12
|
+
namespace Eigen {
|
13
|
+
|
14
|
+
/** \geometry_module \ingroup Geometry_Module
|
15
|
+
*
|
16
|
+
* \class Translation
|
17
|
+
*
|
18
|
+
* \brief Represents a translation transformation
|
19
|
+
*
|
20
|
+
* \param _Scalar the scalar type, i.e., the type of the coefficients.
|
21
|
+
* \param _Dim the dimension of the space, can be a compile time value or Dynamic
|
22
|
+
*
|
23
|
+
* \note This class is not aimed to be used to store a translation transformation,
|
24
|
+
* but rather to make easier the constructions and updates of Transform objects.
|
25
|
+
*
|
26
|
+
* \sa class Scaling, class Transform
|
27
|
+
*/
|
28
|
+
template<typename _Scalar, int _Dim>
|
29
|
+
class Translation
|
30
|
+
{
|
31
|
+
public:
|
32
|
+
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_Dim)
|
33
|
+
/** dimension of the space */
|
34
|
+
enum { Dim = _Dim };
|
35
|
+
/** the scalar type of the coefficients */
|
36
|
+
typedef _Scalar Scalar;
|
37
|
+
/** corresponding vector type */
|
38
|
+
typedef Matrix<Scalar,Dim,1> VectorType;
|
39
|
+
/** corresponding linear transformation matrix type */
|
40
|
+
typedef Matrix<Scalar,Dim,Dim> LinearMatrixType;
|
41
|
+
/** corresponding scaling transformation type */
|
42
|
+
typedef Scaling<Scalar,Dim> ScalingType;
|
43
|
+
/** corresponding affine transformation type */
|
44
|
+
typedef Transform<Scalar,Dim> TransformType;
|
45
|
+
|
46
|
+
protected:
|
47
|
+
|
48
|
+
VectorType m_coeffs;
|
49
|
+
|
50
|
+
public:
|
51
|
+
|
52
|
+
/** Default constructor without initialization. */
|
53
|
+
Translation() {}
|
54
|
+
/** */
|
55
|
+
inline Translation(const Scalar& sx, const Scalar& sy)
|
56
|
+
{
|
57
|
+
ei_assert(Dim==2);
|
58
|
+
m_coeffs.x() = sx;
|
59
|
+
m_coeffs.y() = sy;
|
60
|
+
}
|
61
|
+
/** */
|
62
|
+
inline Translation(const Scalar& sx, const Scalar& sy, const Scalar& sz)
|
63
|
+
{
|
64
|
+
ei_assert(Dim==3);
|
65
|
+
m_coeffs.x() = sx;
|
66
|
+
m_coeffs.y() = sy;
|
67
|
+
m_coeffs.z() = sz;
|
68
|
+
}
|
69
|
+
/** Constructs and initialize the scaling transformation from a vector of scaling coefficients */
|
70
|
+
explicit inline Translation(const VectorType& vector) : m_coeffs(vector) {}
|
71
|
+
|
72
|
+
const VectorType& vector() const { return m_coeffs; }
|
73
|
+
VectorType& vector() { return m_coeffs; }
|
74
|
+
|
75
|
+
/** Concatenates two translation */
|
76
|
+
inline Translation operator* (const Translation& other) const
|
77
|
+
{ return Translation(m_coeffs + other.m_coeffs); }
|
78
|
+
|
79
|
+
/** Concatenates a translation and a scaling */
|
80
|
+
inline TransformType operator* (const ScalingType& other) const;
|
81
|
+
|
82
|
+
/** Concatenates a translation and a linear transformation */
|
83
|
+
inline TransformType operator* (const LinearMatrixType& linear) const;
|
84
|
+
|
85
|
+
template<typename Derived>
|
86
|
+
inline TransformType operator*(const RotationBase<Derived,Dim>& r) const
|
87
|
+
{ return *this * r.toRotationMatrix(); }
|
88
|
+
|
89
|
+
/** Concatenates a linear transformation and a translation */
|
90
|
+
// its a nightmare to define a templated friend function outside its declaration
|
91
|
+
friend inline TransformType operator* (const LinearMatrixType& linear, const Translation& t)
|
92
|
+
{
|
93
|
+
TransformType res;
|
94
|
+
res.matrix().setZero();
|
95
|
+
res.linear() = linear;
|
96
|
+
res.translation() = linear * t.m_coeffs;
|
97
|
+
res.matrix().row(Dim).setZero();
|
98
|
+
res(Dim,Dim) = Scalar(1);
|
99
|
+
return res;
|
100
|
+
}
|
101
|
+
|
102
|
+
/** Concatenates a translation and an affine transformation */
|
103
|
+
inline TransformType operator* (const TransformType& t) const;
|
104
|
+
|
105
|
+
/** Applies translation to vector */
|
106
|
+
inline VectorType operator* (const VectorType& other) const
|
107
|
+
{ return m_coeffs + other; }
|
108
|
+
|
109
|
+
/** \returns the inverse translation (opposite) */
|
110
|
+
Translation inverse() const { return Translation(-m_coeffs); }
|
111
|
+
|
112
|
+
Translation& operator=(const Translation& other)
|
113
|
+
{
|
114
|
+
m_coeffs = other.m_coeffs;
|
115
|
+
return *this;
|
116
|
+
}
|
117
|
+
|
118
|
+
/** \returns \c *this with scalar type casted to \a NewScalarType
|
119
|
+
*
|
120
|
+
* Note that if \a NewScalarType is equal to the current scalar type of \c *this
|
121
|
+
* then this function smartly returns a const reference to \c *this.
|
122
|
+
*/
|
123
|
+
template<typename NewScalarType>
|
124
|
+
inline typename internal::cast_return_type<Translation,Translation<NewScalarType,Dim> >::type cast() const
|
125
|
+
{ return typename internal::cast_return_type<Translation,Translation<NewScalarType,Dim> >::type(*this); }
|
126
|
+
|
127
|
+
/** Copy constructor with scalar type conversion */
|
128
|
+
template<typename OtherScalarType>
|
129
|
+
inline explicit Translation(const Translation<OtherScalarType,Dim>& other)
|
130
|
+
{ m_coeffs = other.vector().template cast<Scalar>(); }
|
131
|
+
|
132
|
+
/** \returns \c true if \c *this is approximately equal to \a other, within the precision
|
133
|
+
* determined by \a prec.
|
134
|
+
*
|
135
|
+
* \sa MatrixBase::isApprox() */
|
136
|
+
bool isApprox(const Translation& other, typename NumTraits<Scalar>::Real prec = precision<Scalar>()) const
|
137
|
+
{ return m_coeffs.isApprox(other.m_coeffs, prec); }
|
138
|
+
|
139
|
+
};
|
140
|
+
|
141
|
+
/** \addtogroup Geometry_Module */
|
142
|
+
//@{
|
143
|
+
typedef Translation<float, 2> Translation2f;
|
144
|
+
typedef Translation<double,2> Translation2d;
|
145
|
+
typedef Translation<float, 3> Translation3f;
|
146
|
+
typedef Translation<double,3> Translation3d;
|
147
|
+
//@}
|
148
|
+
|
149
|
+
|
150
|
+
template<typename Scalar, int Dim>
|
151
|
+
inline typename Translation<Scalar,Dim>::TransformType
|
152
|
+
Translation<Scalar,Dim>::operator* (const ScalingType& other) const
|
153
|
+
{
|
154
|
+
TransformType res;
|
155
|
+
res.matrix().setZero();
|
156
|
+
res.linear().diagonal() = other.coeffs();
|
157
|
+
res.translation() = m_coeffs;
|
158
|
+
res(Dim,Dim) = Scalar(1);
|
159
|
+
return res;
|
160
|
+
}
|
161
|
+
|
162
|
+
template<typename Scalar, int Dim>
|
163
|
+
inline typename Translation<Scalar,Dim>::TransformType
|
164
|
+
Translation<Scalar,Dim>::operator* (const LinearMatrixType& linear) const
|
165
|
+
{
|
166
|
+
TransformType res;
|
167
|
+
res.matrix().setZero();
|
168
|
+
res.linear() = linear;
|
169
|
+
res.translation() = m_coeffs;
|
170
|
+
res.matrix().row(Dim).setZero();
|
171
|
+
res(Dim,Dim) = Scalar(1);
|
172
|
+
return res;
|
173
|
+
}
|
174
|
+
|
175
|
+
template<typename Scalar, int Dim>
|
176
|
+
inline typename Translation<Scalar,Dim>::TransformType
|
177
|
+
Translation<Scalar,Dim>::operator* (const TransformType& t) const
|
178
|
+
{
|
179
|
+
TransformType res = t;
|
180
|
+
res.pretranslate(m_coeffs);
|
181
|
+
return res;
|
182
|
+
}
|
183
|
+
|
184
|
+
} // end namespace Eigen
|
@@ -0,0 +1,120 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2011 Benoit Jacob <jacob.benoit.1@gmail.com>
|
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 EIGEN2_LU_H
|
11
|
+
#define EIGEN2_LU_H
|
12
|
+
|
13
|
+
namespace Eigen {
|
14
|
+
|
15
|
+
template<typename MatrixType>
|
16
|
+
class LU : public FullPivLU<MatrixType>
|
17
|
+
{
|
18
|
+
public:
|
19
|
+
|
20
|
+
typedef typename MatrixType::Scalar Scalar;
|
21
|
+
typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;
|
22
|
+
typedef Matrix<int, 1, MatrixType::ColsAtCompileTime, MatrixType::Options, 1, MatrixType::MaxColsAtCompileTime> IntRowVectorType;
|
23
|
+
typedef Matrix<int, MatrixType::RowsAtCompileTime, 1, MatrixType::Options, MatrixType::MaxRowsAtCompileTime, 1> IntColVectorType;
|
24
|
+
typedef Matrix<Scalar, 1, MatrixType::ColsAtCompileTime, MatrixType::Options, 1, MatrixType::MaxColsAtCompileTime> RowVectorType;
|
25
|
+
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1, MatrixType::Options, MatrixType::MaxRowsAtCompileTime, 1> ColVectorType;
|
26
|
+
|
27
|
+
typedef Matrix<typename MatrixType::Scalar,
|
28
|
+
MatrixType::ColsAtCompileTime, // the number of rows in the "kernel matrix" is the number of cols of the original matrix
|
29
|
+
// so that the product "matrix * kernel = zero" makes sense
|
30
|
+
Dynamic, // we don't know at compile-time the dimension of the kernel
|
31
|
+
MatrixType::Options,
|
32
|
+
MatrixType::MaxColsAtCompileTime, // see explanation for 2nd template parameter
|
33
|
+
MatrixType::MaxColsAtCompileTime // the kernel is a subspace of the domain space, whose dimension is the number
|
34
|
+
// of columns of the original matrix
|
35
|
+
> KernelResultType;
|
36
|
+
|
37
|
+
typedef Matrix<typename MatrixType::Scalar,
|
38
|
+
MatrixType::RowsAtCompileTime, // the image is a subspace of the destination space, whose dimension is the number
|
39
|
+
// of rows of the original matrix
|
40
|
+
Dynamic, // we don't know at compile time the dimension of the image (the rank)
|
41
|
+
MatrixType::Options,
|
42
|
+
MatrixType::MaxRowsAtCompileTime, // the image matrix will consist of columns from the original matrix,
|
43
|
+
MatrixType::MaxColsAtCompileTime // so it has the same number of rows and at most as many columns.
|
44
|
+
> ImageResultType;
|
45
|
+
|
46
|
+
typedef FullPivLU<MatrixType> Base;
|
47
|
+
|
48
|
+
template<typename T>
|
49
|
+
explicit LU(const T& t) : Base(t), m_originalMatrix(t) {}
|
50
|
+
|
51
|
+
template<typename OtherDerived, typename ResultType>
|
52
|
+
bool solve(const MatrixBase<OtherDerived>& b, ResultType *result) const
|
53
|
+
{
|
54
|
+
*result = static_cast<const Base*>(this)->solve(b);
|
55
|
+
return true;
|
56
|
+
}
|
57
|
+
|
58
|
+
template<typename ResultType>
|
59
|
+
inline void computeInverse(ResultType *result) const
|
60
|
+
{
|
61
|
+
solve(MatrixType::Identity(this->rows(), this->cols()), result);
|
62
|
+
}
|
63
|
+
|
64
|
+
template<typename KernelMatrixType>
|
65
|
+
void computeKernel(KernelMatrixType *result) const
|
66
|
+
{
|
67
|
+
*result = static_cast<const Base*>(this)->kernel();
|
68
|
+
}
|
69
|
+
|
70
|
+
template<typename ImageMatrixType>
|
71
|
+
void computeImage(ImageMatrixType *result) const
|
72
|
+
{
|
73
|
+
*result = static_cast<const Base*>(this)->image(m_originalMatrix);
|
74
|
+
}
|
75
|
+
|
76
|
+
const ImageResultType image() const
|
77
|
+
{
|
78
|
+
return static_cast<const Base*>(this)->image(m_originalMatrix);
|
79
|
+
}
|
80
|
+
|
81
|
+
const MatrixType& m_originalMatrix;
|
82
|
+
};
|
83
|
+
|
84
|
+
#if EIGEN2_SUPPORT_STAGE < STAGE20_RESOLVE_API_CONFLICTS
|
85
|
+
/** \lu_module
|
86
|
+
*
|
87
|
+
* Synonym of partialPivLu().
|
88
|
+
*
|
89
|
+
* \return the partial-pivoting LU decomposition of \c *this.
|
90
|
+
*
|
91
|
+
* \sa class PartialPivLU
|
92
|
+
*/
|
93
|
+
template<typename Derived>
|
94
|
+
inline const LU<typename MatrixBase<Derived>::PlainObject>
|
95
|
+
MatrixBase<Derived>::lu() const
|
96
|
+
{
|
97
|
+
return LU<PlainObject>(eval());
|
98
|
+
}
|
99
|
+
#endif
|
100
|
+
|
101
|
+
#ifdef EIGEN2_SUPPORT
|
102
|
+
/** \lu_module
|
103
|
+
*
|
104
|
+
* Synonym of partialPivLu().
|
105
|
+
*
|
106
|
+
* \return the partial-pivoting LU decomposition of \c *this.
|
107
|
+
*
|
108
|
+
* \sa class PartialPivLU
|
109
|
+
*/
|
110
|
+
template<typename Derived>
|
111
|
+
inline const LU<typename MatrixBase<Derived>::PlainObject>
|
112
|
+
MatrixBase<Derived>::eigen2_lu() const
|
113
|
+
{
|
114
|
+
return LU<PlainObject>(eval());
|
115
|
+
}
|
116
|
+
#endif
|
117
|
+
|
118
|
+
} // end namespace Eigen
|
119
|
+
|
120
|
+
#endif // EIGEN2_LU_H
|
@@ -0,0 +1,71 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>
|
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_LAZY_H
|
11
|
+
#define EIGEN_LAZY_H
|
12
|
+
|
13
|
+
namespace Eigen {
|
14
|
+
|
15
|
+
/** \deprecated it is only used by lazy() which is deprecated
|
16
|
+
*
|
17
|
+
* \returns an expression of *this with added flags
|
18
|
+
*
|
19
|
+
* Example: \include MatrixBase_marked.cpp
|
20
|
+
* Output: \verbinclude MatrixBase_marked.out
|
21
|
+
*
|
22
|
+
* \sa class Flagged, extract(), part()
|
23
|
+
*/
|
24
|
+
template<typename Derived>
|
25
|
+
template<unsigned int Added>
|
26
|
+
inline const Flagged<Derived, Added, 0>
|
27
|
+
MatrixBase<Derived>::marked() const
|
28
|
+
{
|
29
|
+
return derived();
|
30
|
+
}
|
31
|
+
|
32
|
+
/** \deprecated use MatrixBase::noalias()
|
33
|
+
*
|
34
|
+
* \returns an expression of *this with the EvalBeforeAssigningBit flag removed.
|
35
|
+
*
|
36
|
+
* Example: \include MatrixBase_lazy.cpp
|
37
|
+
* Output: \verbinclude MatrixBase_lazy.out
|
38
|
+
*
|
39
|
+
* \sa class Flagged, marked()
|
40
|
+
*/
|
41
|
+
template<typename Derived>
|
42
|
+
inline const Flagged<Derived, 0, EvalBeforeAssigningBit>
|
43
|
+
MatrixBase<Derived>::lazy() const
|
44
|
+
{
|
45
|
+
return derived();
|
46
|
+
}
|
47
|
+
|
48
|
+
|
49
|
+
/** \internal
|
50
|
+
* Overloaded to perform an efficient C += (A*B).lazy() */
|
51
|
+
template<typename Derived>
|
52
|
+
template<typename ProductDerived, typename Lhs, typename Rhs>
|
53
|
+
Derived& MatrixBase<Derived>::operator+=(const Flagged<ProductBase<ProductDerived, Lhs,Rhs>, 0,
|
54
|
+
EvalBeforeAssigningBit>& other)
|
55
|
+
{
|
56
|
+
other._expression().derived().addTo(derived()); return derived();
|
57
|
+
}
|
58
|
+
|
59
|
+
/** \internal
|
60
|
+
* Overloaded to perform an efficient C -= (A*B).lazy() */
|
61
|
+
template<typename Derived>
|
62
|
+
template<typename ProductDerived, typename Lhs, typename Rhs>
|
63
|
+
Derived& MatrixBase<Derived>::operator-=(const Flagged<ProductBase<ProductDerived, Lhs,Rhs>, 0,
|
64
|
+
EvalBeforeAssigningBit>& other)
|
65
|
+
{
|
66
|
+
other._expression().derived().subTo(derived()); return derived();
|
67
|
+
}
|
68
|
+
|
69
|
+
} // end namespace Eigen
|
70
|
+
|
71
|
+
#endif // EIGEN_LAZY_H
|
@@ -0,0 +1,169 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2006-2009 Benoit Jacob <jacob.benoit.1@gmail.com>
|
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 EIGEN2_LEASTSQUARES_H
|
11
|
+
#define EIGEN2_LEASTSQUARES_H
|
12
|
+
|
13
|
+
namespace Eigen {
|
14
|
+
|
15
|
+
/** \ingroup LeastSquares_Module
|
16
|
+
*
|
17
|
+
* \leastsquares_module
|
18
|
+
*
|
19
|
+
* For a set of points, this function tries to express
|
20
|
+
* one of the coords as a linear (affine) function of the other coords.
|
21
|
+
*
|
22
|
+
* This is best explained by an example. This function works in full
|
23
|
+
* generality, for points in a space of arbitrary dimension, and also over
|
24
|
+
* the complex numbers, but for this example we will work in dimension 3
|
25
|
+
* over the real numbers (doubles).
|
26
|
+
*
|
27
|
+
* So let us work with the following set of 5 points given by their
|
28
|
+
* \f$(x,y,z)\f$ coordinates:
|
29
|
+
* @code
|
30
|
+
Vector3d points[5];
|
31
|
+
points[0] = Vector3d( 3.02, 6.89, -4.32 );
|
32
|
+
points[1] = Vector3d( 2.01, 5.39, -3.79 );
|
33
|
+
points[2] = Vector3d( 2.41, 6.01, -4.01 );
|
34
|
+
points[3] = Vector3d( 2.09, 5.55, -3.86 );
|
35
|
+
points[4] = Vector3d( 2.58, 6.32, -4.10 );
|
36
|
+
* @endcode
|
37
|
+
* Suppose that we want to express the second coordinate (\f$y\f$) as a linear
|
38
|
+
* expression in \f$x\f$ and \f$z\f$, that is,
|
39
|
+
* \f[ y=ax+bz+c \f]
|
40
|
+
* for some constants \f$a,b,c\f$. Thus, we want to find the best possible
|
41
|
+
* constants \f$a,b,c\f$ so that the plane of equation \f$y=ax+bz+c\f$ fits
|
42
|
+
* best the five above points. To do that, call this function as follows:
|
43
|
+
* @code
|
44
|
+
Vector3d coeffs; // will store the coefficients a, b, c
|
45
|
+
linearRegression(
|
46
|
+
5,
|
47
|
+
&points,
|
48
|
+
&coeffs,
|
49
|
+
1 // the coord to express as a function of
|
50
|
+
// the other ones. 0 means x, 1 means y, 2 means z.
|
51
|
+
);
|
52
|
+
* @endcode
|
53
|
+
* Now the vector \a coeffs is approximately
|
54
|
+
* \f$( 0.495 , -1.927 , -2.906 )\f$.
|
55
|
+
* Thus, we get \f$a=0.495, b = -1.927, c = -2.906\f$. Let us check for
|
56
|
+
* instance how near points[0] is from the plane of equation \f$y=ax+bz+c\f$.
|
57
|
+
* Looking at the coords of points[0], we see that:
|
58
|
+
* \f[ax+bz+c = 0.495 * 3.02 + (-1.927) * (-4.32) + (-2.906) = 6.91.\f]
|
59
|
+
* On the other hand, we have \f$y=6.89\f$. We see that the values
|
60
|
+
* \f$6.91\f$ and \f$6.89\f$
|
61
|
+
* are near, so points[0] is very near the plane of equation \f$y=ax+bz+c\f$.
|
62
|
+
*
|
63
|
+
* Let's now describe precisely the parameters:
|
64
|
+
* @param numPoints the number of points
|
65
|
+
* @param points the array of pointers to the points on which to perform the linear regression
|
66
|
+
* @param result pointer to the vector in which to store the result.
|
67
|
+
This vector must be of the same type and size as the
|
68
|
+
data points. The meaning of its coords is as follows.
|
69
|
+
For brevity, let \f$n=Size\f$,
|
70
|
+
\f$r_i=result[i]\f$,
|
71
|
+
and \f$f=funcOfOthers\f$. Denote by
|
72
|
+
\f$x_0,\ldots,x_{n-1}\f$
|
73
|
+
the n coordinates in the n-dimensional space.
|
74
|
+
Then the resulting equation is:
|
75
|
+
\f[ x_f = r_0 x_0 + \cdots + r_{f-1}x_{f-1}
|
76
|
+
+ r_{f+1}x_{f+1} + \cdots + r_{n-1}x_{n-1} + r_n. \f]
|
77
|
+
* @param funcOfOthers Determines which coord to express as a function of the
|
78
|
+
others. Coords are numbered starting from 0, so that a
|
79
|
+
value of 0 means \f$x\f$, 1 means \f$y\f$,
|
80
|
+
2 means \f$z\f$, ...
|
81
|
+
*
|
82
|
+
* \sa fitHyperplane()
|
83
|
+
*/
|
84
|
+
template<typename VectorType>
|
85
|
+
void linearRegression(int numPoints,
|
86
|
+
VectorType **points,
|
87
|
+
VectorType *result,
|
88
|
+
int funcOfOthers )
|
89
|
+
{
|
90
|
+
typedef typename VectorType::Scalar Scalar;
|
91
|
+
typedef Hyperplane<Scalar, VectorType::SizeAtCompileTime> HyperplaneType;
|
92
|
+
const int size = points[0]->size();
|
93
|
+
result->resize(size);
|
94
|
+
HyperplaneType h(size);
|
95
|
+
fitHyperplane(numPoints, points, &h);
|
96
|
+
for(int i = 0; i < funcOfOthers; i++)
|
97
|
+
result->coeffRef(i) = - h.coeffs()[i] / h.coeffs()[funcOfOthers];
|
98
|
+
for(int i = funcOfOthers; i < size; i++)
|
99
|
+
result->coeffRef(i) = - h.coeffs()[i+1] / h.coeffs()[funcOfOthers];
|
100
|
+
}
|
101
|
+
|
102
|
+
/** \ingroup LeastSquares_Module
|
103
|
+
*
|
104
|
+
* \leastsquares_module
|
105
|
+
*
|
106
|
+
* This function is quite similar to linearRegression(), so we refer to the
|
107
|
+
* documentation of this function and only list here the differences.
|
108
|
+
*
|
109
|
+
* The main difference from linearRegression() is that this function doesn't
|
110
|
+
* take a \a funcOfOthers argument. Instead, it finds a general equation
|
111
|
+
* of the form
|
112
|
+
* \f[ r_0 x_0 + \cdots + r_{n-1}x_{n-1} + r_n = 0, \f]
|
113
|
+
* where \f$n=Size\f$, \f$r_i=retCoefficients[i]\f$, and we denote by
|
114
|
+
* \f$x_0,\ldots,x_{n-1}\f$ the n coordinates in the n-dimensional space.
|
115
|
+
*
|
116
|
+
* Thus, the vector \a retCoefficients has size \f$n+1\f$, which is another
|
117
|
+
* difference from linearRegression().
|
118
|
+
*
|
119
|
+
* In practice, this function performs an hyper-plane fit in a total least square sense
|
120
|
+
* via the following steps:
|
121
|
+
* 1 - center the data to the mean
|
122
|
+
* 2 - compute the covariance matrix
|
123
|
+
* 3 - pick the eigenvector corresponding to the smallest eigenvalue of the covariance matrix
|
124
|
+
* The ratio of the smallest eigenvalue and the second one gives us a hint about the relevance
|
125
|
+
* of the solution. This value is optionally returned in \a soundness.
|
126
|
+
*
|
127
|
+
* \sa linearRegression()
|
128
|
+
*/
|
129
|
+
template<typename VectorType, typename HyperplaneType>
|
130
|
+
void fitHyperplane(int numPoints,
|
131
|
+
VectorType **points,
|
132
|
+
HyperplaneType *result,
|
133
|
+
typename NumTraits<typename VectorType::Scalar>::Real* soundness = 0)
|
134
|
+
{
|
135
|
+
typedef typename VectorType::Scalar Scalar;
|
136
|
+
typedef Matrix<Scalar,VectorType::SizeAtCompileTime,VectorType::SizeAtCompileTime> CovMatrixType;
|
137
|
+
EIGEN_STATIC_ASSERT_VECTOR_ONLY(VectorType)
|
138
|
+
ei_assert(numPoints >= 1);
|
139
|
+
int size = points[0]->size();
|
140
|
+
ei_assert(size+1 == result->coeffs().size());
|
141
|
+
|
142
|
+
// compute the mean of the data
|
143
|
+
VectorType mean = VectorType::Zero(size);
|
144
|
+
for(int i = 0; i < numPoints; ++i)
|
145
|
+
mean += *(points[i]);
|
146
|
+
mean /= numPoints;
|
147
|
+
|
148
|
+
// compute the covariance matrix
|
149
|
+
CovMatrixType covMat = CovMatrixType::Zero(size, size);
|
150
|
+
for(int i = 0; i < numPoints; ++i)
|
151
|
+
{
|
152
|
+
VectorType diff = (*(points[i]) - mean).conjugate();
|
153
|
+
covMat += diff * diff.adjoint();
|
154
|
+
}
|
155
|
+
|
156
|
+
// now we just have to pick the eigen vector with smallest eigen value
|
157
|
+
SelfAdjointEigenSolver<CovMatrixType> eig(covMat);
|
158
|
+
result->normal() = eig.eigenvectors().col(0);
|
159
|
+
if (soundness)
|
160
|
+
*soundness = eig.eigenvalues().coeff(0)/eig.eigenvalues().coeff(1);
|
161
|
+
|
162
|
+
// let's compute the constant coefficient such that the
|
163
|
+
// plane pass trough the mean point:
|
164
|
+
result->offset() = - (result->normal().cwise()* mean).sum();
|
165
|
+
}
|
166
|
+
|
167
|
+
} // end namespace Eigen
|
168
|
+
|
169
|
+
#endif // EIGEN2_LEASTSQUARES_H
|