ruby-eigen 0.0.9 → 0.0.10.pre1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +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,313 @@
|
|
|
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
|
+
// Copyright (C) 2007-2009 Benoit Jacob <jacob.benoit.1@gmail.com>
|
|
6
|
+
//
|
|
7
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
|
8
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
|
9
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
10
|
+
|
|
11
|
+
#ifndef EIGEN_DIAGONALMATRIX_H
|
|
12
|
+
#define EIGEN_DIAGONALMATRIX_H
|
|
13
|
+
|
|
14
|
+
namespace Eigen {
|
|
15
|
+
|
|
16
|
+
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
|
17
|
+
template<typename Derived>
|
|
18
|
+
class DiagonalBase : public EigenBase<Derived>
|
|
19
|
+
{
|
|
20
|
+
public:
|
|
21
|
+
typedef typename internal::traits<Derived>::DiagonalVectorType DiagonalVectorType;
|
|
22
|
+
typedef typename DiagonalVectorType::Scalar Scalar;
|
|
23
|
+
typedef typename DiagonalVectorType::RealScalar RealScalar;
|
|
24
|
+
typedef typename internal::traits<Derived>::StorageKind StorageKind;
|
|
25
|
+
typedef typename internal::traits<Derived>::Index Index;
|
|
26
|
+
|
|
27
|
+
enum {
|
|
28
|
+
RowsAtCompileTime = DiagonalVectorType::SizeAtCompileTime,
|
|
29
|
+
ColsAtCompileTime = DiagonalVectorType::SizeAtCompileTime,
|
|
30
|
+
MaxRowsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime,
|
|
31
|
+
MaxColsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime,
|
|
32
|
+
IsVectorAtCompileTime = 0,
|
|
33
|
+
Flags = 0
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
typedef Matrix<Scalar, RowsAtCompileTime, ColsAtCompileTime, 0, MaxRowsAtCompileTime, MaxColsAtCompileTime> DenseMatrixType;
|
|
37
|
+
typedef DenseMatrixType DenseType;
|
|
38
|
+
typedef DiagonalMatrix<Scalar,DiagonalVectorType::SizeAtCompileTime,DiagonalVectorType::MaxSizeAtCompileTime> PlainObject;
|
|
39
|
+
|
|
40
|
+
inline const Derived& derived() const { return *static_cast<const Derived*>(this); }
|
|
41
|
+
inline Derived& derived() { return *static_cast<Derived*>(this); }
|
|
42
|
+
|
|
43
|
+
DenseMatrixType toDenseMatrix() const { return derived(); }
|
|
44
|
+
template<typename DenseDerived>
|
|
45
|
+
void evalTo(MatrixBase<DenseDerived> &other) const;
|
|
46
|
+
template<typename DenseDerived>
|
|
47
|
+
void addTo(MatrixBase<DenseDerived> &other) const
|
|
48
|
+
{ other.diagonal() += diagonal(); }
|
|
49
|
+
template<typename DenseDerived>
|
|
50
|
+
void subTo(MatrixBase<DenseDerived> &other) const
|
|
51
|
+
{ other.diagonal() -= diagonal(); }
|
|
52
|
+
|
|
53
|
+
inline const DiagonalVectorType& diagonal() const { return derived().diagonal(); }
|
|
54
|
+
inline DiagonalVectorType& diagonal() { return derived().diagonal(); }
|
|
55
|
+
|
|
56
|
+
inline Index rows() const { return diagonal().size(); }
|
|
57
|
+
inline Index cols() const { return diagonal().size(); }
|
|
58
|
+
|
|
59
|
+
/** \returns the diagonal matrix product of \c *this by the matrix \a matrix.
|
|
60
|
+
*/
|
|
61
|
+
template<typename MatrixDerived>
|
|
62
|
+
const DiagonalProduct<MatrixDerived, Derived, OnTheLeft>
|
|
63
|
+
operator*(const MatrixBase<MatrixDerived> &matrix) const
|
|
64
|
+
{
|
|
65
|
+
return DiagonalProduct<MatrixDerived, Derived, OnTheLeft>(matrix.derived(), derived());
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
inline const DiagonalWrapper<const CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const DiagonalVectorType> >
|
|
69
|
+
inverse() const
|
|
70
|
+
{
|
|
71
|
+
return diagonal().cwiseInverse();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
inline const DiagonalWrapper<const CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, const DiagonalVectorType> >
|
|
75
|
+
operator*(const Scalar& scalar) const
|
|
76
|
+
{
|
|
77
|
+
return diagonal() * scalar;
|
|
78
|
+
}
|
|
79
|
+
friend inline const DiagonalWrapper<const CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, const DiagonalVectorType> >
|
|
80
|
+
operator*(const Scalar& scalar, const DiagonalBase& other)
|
|
81
|
+
{
|
|
82
|
+
return other.diagonal() * scalar;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
#ifdef EIGEN2_SUPPORT
|
|
86
|
+
template<typename OtherDerived>
|
|
87
|
+
bool isApprox(const DiagonalBase<OtherDerived>& other, typename NumTraits<Scalar>::Real precision = NumTraits<Scalar>::dummy_precision()) const
|
|
88
|
+
{
|
|
89
|
+
return diagonal().isApprox(other.diagonal(), precision);
|
|
90
|
+
}
|
|
91
|
+
template<typename OtherDerived>
|
|
92
|
+
bool isApprox(const MatrixBase<OtherDerived>& other, typename NumTraits<Scalar>::Real precision = NumTraits<Scalar>::dummy_precision()) const
|
|
93
|
+
{
|
|
94
|
+
return toDenseMatrix().isApprox(other, precision);
|
|
95
|
+
}
|
|
96
|
+
#endif
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
template<typename Derived>
|
|
100
|
+
template<typename DenseDerived>
|
|
101
|
+
void DiagonalBase<Derived>::evalTo(MatrixBase<DenseDerived> &other) const
|
|
102
|
+
{
|
|
103
|
+
other.setZero();
|
|
104
|
+
other.diagonal() = diagonal();
|
|
105
|
+
}
|
|
106
|
+
#endif
|
|
107
|
+
|
|
108
|
+
/** \class DiagonalMatrix
|
|
109
|
+
* \ingroup Core_Module
|
|
110
|
+
*
|
|
111
|
+
* \brief Represents a diagonal matrix with its storage
|
|
112
|
+
*
|
|
113
|
+
* \param _Scalar the type of coefficients
|
|
114
|
+
* \param SizeAtCompileTime the dimension of the matrix, or Dynamic
|
|
115
|
+
* \param MaxSizeAtCompileTime the dimension of the matrix, or Dynamic. This parameter is optional and defaults
|
|
116
|
+
* to SizeAtCompileTime. Most of the time, you do not need to specify it.
|
|
117
|
+
*
|
|
118
|
+
* \sa class DiagonalWrapper
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
namespace internal {
|
|
122
|
+
template<typename _Scalar, int SizeAtCompileTime, int MaxSizeAtCompileTime>
|
|
123
|
+
struct traits<DiagonalMatrix<_Scalar,SizeAtCompileTime,MaxSizeAtCompileTime> >
|
|
124
|
+
: traits<Matrix<_Scalar,SizeAtCompileTime,SizeAtCompileTime,0,MaxSizeAtCompileTime,MaxSizeAtCompileTime> >
|
|
125
|
+
{
|
|
126
|
+
typedef Matrix<_Scalar,SizeAtCompileTime,1,0,MaxSizeAtCompileTime,1> DiagonalVectorType;
|
|
127
|
+
typedef Dense StorageKind;
|
|
128
|
+
typedef DenseIndex Index;
|
|
129
|
+
enum {
|
|
130
|
+
Flags = LvalueBit
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
template<typename _Scalar, int SizeAtCompileTime, int MaxSizeAtCompileTime>
|
|
135
|
+
class DiagonalMatrix
|
|
136
|
+
: public DiagonalBase<DiagonalMatrix<_Scalar,SizeAtCompileTime,MaxSizeAtCompileTime> >
|
|
137
|
+
{
|
|
138
|
+
public:
|
|
139
|
+
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
|
140
|
+
typedef typename internal::traits<DiagonalMatrix>::DiagonalVectorType DiagonalVectorType;
|
|
141
|
+
typedef const DiagonalMatrix& Nested;
|
|
142
|
+
typedef _Scalar Scalar;
|
|
143
|
+
typedef typename internal::traits<DiagonalMatrix>::StorageKind StorageKind;
|
|
144
|
+
typedef typename internal::traits<DiagonalMatrix>::Index Index;
|
|
145
|
+
#endif
|
|
146
|
+
|
|
147
|
+
protected:
|
|
148
|
+
|
|
149
|
+
DiagonalVectorType m_diagonal;
|
|
150
|
+
|
|
151
|
+
public:
|
|
152
|
+
|
|
153
|
+
/** const version of diagonal(). */
|
|
154
|
+
inline const DiagonalVectorType& diagonal() const { return m_diagonal; }
|
|
155
|
+
/** \returns a reference to the stored vector of diagonal coefficients. */
|
|
156
|
+
inline DiagonalVectorType& diagonal() { return m_diagonal; }
|
|
157
|
+
|
|
158
|
+
/** Default constructor without initialization */
|
|
159
|
+
inline DiagonalMatrix() {}
|
|
160
|
+
|
|
161
|
+
/** Constructs a diagonal matrix with given dimension */
|
|
162
|
+
inline DiagonalMatrix(Index dim) : m_diagonal(dim) {}
|
|
163
|
+
|
|
164
|
+
/** 2D constructor. */
|
|
165
|
+
inline DiagonalMatrix(const Scalar& x, const Scalar& y) : m_diagonal(x,y) {}
|
|
166
|
+
|
|
167
|
+
/** 3D constructor. */
|
|
168
|
+
inline DiagonalMatrix(const Scalar& x, const Scalar& y, const Scalar& z) : m_diagonal(x,y,z) {}
|
|
169
|
+
|
|
170
|
+
/** Copy constructor. */
|
|
171
|
+
template<typename OtherDerived>
|
|
172
|
+
inline DiagonalMatrix(const DiagonalBase<OtherDerived>& other) : m_diagonal(other.diagonal()) {}
|
|
173
|
+
|
|
174
|
+
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
|
175
|
+
/** copy constructor. prevent a default copy constructor from hiding the other templated constructor */
|
|
176
|
+
inline DiagonalMatrix(const DiagonalMatrix& other) : m_diagonal(other.diagonal()) {}
|
|
177
|
+
#endif
|
|
178
|
+
|
|
179
|
+
/** generic constructor from expression of the diagonal coefficients */
|
|
180
|
+
template<typename OtherDerived>
|
|
181
|
+
explicit inline DiagonalMatrix(const MatrixBase<OtherDerived>& other) : m_diagonal(other)
|
|
182
|
+
{}
|
|
183
|
+
|
|
184
|
+
/** Copy operator. */
|
|
185
|
+
template<typename OtherDerived>
|
|
186
|
+
DiagonalMatrix& operator=(const DiagonalBase<OtherDerived>& other)
|
|
187
|
+
{
|
|
188
|
+
m_diagonal = other.diagonal();
|
|
189
|
+
return *this;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
|
193
|
+
/** This is a special case of the templated operator=. Its purpose is to
|
|
194
|
+
* prevent a default operator= from hiding the templated operator=.
|
|
195
|
+
*/
|
|
196
|
+
DiagonalMatrix& operator=(const DiagonalMatrix& other)
|
|
197
|
+
{
|
|
198
|
+
m_diagonal = other.diagonal();
|
|
199
|
+
return *this;
|
|
200
|
+
}
|
|
201
|
+
#endif
|
|
202
|
+
|
|
203
|
+
/** Resizes to given size. */
|
|
204
|
+
inline void resize(Index size) { m_diagonal.resize(size); }
|
|
205
|
+
/** Sets all coefficients to zero. */
|
|
206
|
+
inline void setZero() { m_diagonal.setZero(); }
|
|
207
|
+
/** Resizes and sets all coefficients to zero. */
|
|
208
|
+
inline void setZero(Index size) { m_diagonal.setZero(size); }
|
|
209
|
+
/** Sets this matrix to be the identity matrix of the current size. */
|
|
210
|
+
inline void setIdentity() { m_diagonal.setOnes(); }
|
|
211
|
+
/** Sets this matrix to be the identity matrix of the given size. */
|
|
212
|
+
inline void setIdentity(Index size) { m_diagonal.setOnes(size); }
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
/** \class DiagonalWrapper
|
|
216
|
+
* \ingroup Core_Module
|
|
217
|
+
*
|
|
218
|
+
* \brief Expression of a diagonal matrix
|
|
219
|
+
*
|
|
220
|
+
* \param _DiagonalVectorType the type of the vector of diagonal coefficients
|
|
221
|
+
*
|
|
222
|
+
* This class is an expression of a diagonal matrix, but not storing its own vector of diagonal coefficients,
|
|
223
|
+
* instead wrapping an existing vector expression. It is the return type of MatrixBase::asDiagonal()
|
|
224
|
+
* and most of the time this is the only way that it is used.
|
|
225
|
+
*
|
|
226
|
+
* \sa class DiagonalMatrix, class DiagonalBase, MatrixBase::asDiagonal()
|
|
227
|
+
*/
|
|
228
|
+
|
|
229
|
+
namespace internal {
|
|
230
|
+
template<typename _DiagonalVectorType>
|
|
231
|
+
struct traits<DiagonalWrapper<_DiagonalVectorType> >
|
|
232
|
+
{
|
|
233
|
+
typedef _DiagonalVectorType DiagonalVectorType;
|
|
234
|
+
typedef typename DiagonalVectorType::Scalar Scalar;
|
|
235
|
+
typedef typename DiagonalVectorType::Index Index;
|
|
236
|
+
typedef typename DiagonalVectorType::StorageKind StorageKind;
|
|
237
|
+
enum {
|
|
238
|
+
RowsAtCompileTime = DiagonalVectorType::SizeAtCompileTime,
|
|
239
|
+
ColsAtCompileTime = DiagonalVectorType::SizeAtCompileTime,
|
|
240
|
+
MaxRowsAtCompileTime = DiagonalVectorType::SizeAtCompileTime,
|
|
241
|
+
MaxColsAtCompileTime = DiagonalVectorType::SizeAtCompileTime,
|
|
242
|
+
Flags = traits<DiagonalVectorType>::Flags & LvalueBit
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
template<typename _DiagonalVectorType>
|
|
248
|
+
class DiagonalWrapper
|
|
249
|
+
: public DiagonalBase<DiagonalWrapper<_DiagonalVectorType> >, internal::no_assignment_operator
|
|
250
|
+
{
|
|
251
|
+
public:
|
|
252
|
+
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
|
253
|
+
typedef _DiagonalVectorType DiagonalVectorType;
|
|
254
|
+
typedef DiagonalWrapper Nested;
|
|
255
|
+
#endif
|
|
256
|
+
|
|
257
|
+
/** Constructor from expression of diagonal coefficients to wrap. */
|
|
258
|
+
inline DiagonalWrapper(DiagonalVectorType& a_diagonal) : m_diagonal(a_diagonal) {}
|
|
259
|
+
|
|
260
|
+
/** \returns a const reference to the wrapped expression of diagonal coefficients. */
|
|
261
|
+
const DiagonalVectorType& diagonal() const { return m_diagonal; }
|
|
262
|
+
|
|
263
|
+
protected:
|
|
264
|
+
typename DiagonalVectorType::Nested m_diagonal;
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
/** \returns a pseudo-expression of a diagonal matrix with *this as vector of diagonal coefficients
|
|
268
|
+
*
|
|
269
|
+
* \only_for_vectors
|
|
270
|
+
*
|
|
271
|
+
* Example: \include MatrixBase_asDiagonal.cpp
|
|
272
|
+
* Output: \verbinclude MatrixBase_asDiagonal.out
|
|
273
|
+
*
|
|
274
|
+
* \sa class DiagonalWrapper, class DiagonalMatrix, diagonal(), isDiagonal()
|
|
275
|
+
**/
|
|
276
|
+
template<typename Derived>
|
|
277
|
+
inline const DiagonalWrapper<const Derived>
|
|
278
|
+
MatrixBase<Derived>::asDiagonal() const
|
|
279
|
+
{
|
|
280
|
+
return derived();
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/** \returns true if *this is approximately equal to a diagonal matrix,
|
|
284
|
+
* within the precision given by \a prec.
|
|
285
|
+
*
|
|
286
|
+
* Example: \include MatrixBase_isDiagonal.cpp
|
|
287
|
+
* Output: \verbinclude MatrixBase_isDiagonal.out
|
|
288
|
+
*
|
|
289
|
+
* \sa asDiagonal()
|
|
290
|
+
*/
|
|
291
|
+
template<typename Derived>
|
|
292
|
+
bool MatrixBase<Derived>::isDiagonal(const RealScalar& prec) const
|
|
293
|
+
{
|
|
294
|
+
using std::abs;
|
|
295
|
+
if(cols() != rows()) return false;
|
|
296
|
+
RealScalar maxAbsOnDiagonal = static_cast<RealScalar>(-1);
|
|
297
|
+
for(Index j = 0; j < cols(); ++j)
|
|
298
|
+
{
|
|
299
|
+
RealScalar absOnDiagonal = abs(coeff(j,j));
|
|
300
|
+
if(absOnDiagonal > maxAbsOnDiagonal) maxAbsOnDiagonal = absOnDiagonal;
|
|
301
|
+
}
|
|
302
|
+
for(Index j = 0; j < cols(); ++j)
|
|
303
|
+
for(Index i = 0; i < j; ++i)
|
|
304
|
+
{
|
|
305
|
+
if(!internal::isMuchSmallerThan(coeff(i, j), maxAbsOnDiagonal, prec)) return false;
|
|
306
|
+
if(!internal::isMuchSmallerThan(coeff(j, i), maxAbsOnDiagonal, prec)) return false;
|
|
307
|
+
}
|
|
308
|
+
return true;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
} // end namespace Eigen
|
|
312
|
+
|
|
313
|
+
#endif // EIGEN_DIAGONALMATRIX_H
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
|
2
|
+
// for linear algebra.
|
|
3
|
+
//
|
|
4
|
+
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
|
|
5
|
+
// Copyright (C) 2007-2009 Benoit Jacob <jacob.benoit.1@gmail.com>
|
|
6
|
+
//
|
|
7
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
|
8
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
|
9
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
10
|
+
|
|
11
|
+
#ifndef EIGEN_DIAGONALPRODUCT_H
|
|
12
|
+
#define EIGEN_DIAGONALPRODUCT_H
|
|
13
|
+
|
|
14
|
+
namespace Eigen {
|
|
15
|
+
|
|
16
|
+
namespace internal {
|
|
17
|
+
template<typename MatrixType, typename DiagonalType, int ProductOrder>
|
|
18
|
+
struct traits<DiagonalProduct<MatrixType, DiagonalType, ProductOrder> >
|
|
19
|
+
: traits<MatrixType>
|
|
20
|
+
{
|
|
21
|
+
typedef typename scalar_product_traits<typename MatrixType::Scalar, typename DiagonalType::Scalar>::ReturnType Scalar;
|
|
22
|
+
enum {
|
|
23
|
+
RowsAtCompileTime = MatrixType::RowsAtCompileTime,
|
|
24
|
+
ColsAtCompileTime = MatrixType::ColsAtCompileTime,
|
|
25
|
+
MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
|
|
26
|
+
MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
|
|
27
|
+
|
|
28
|
+
_StorageOrder = MatrixType::Flags & RowMajorBit ? RowMajor : ColMajor,
|
|
29
|
+
_ScalarAccessOnDiag = !((int(_StorageOrder) == ColMajor && int(ProductOrder) == OnTheLeft)
|
|
30
|
+
||(int(_StorageOrder) == RowMajor && int(ProductOrder) == OnTheRight)),
|
|
31
|
+
_SameTypes = is_same<typename MatrixType::Scalar, typename DiagonalType::Scalar>::value,
|
|
32
|
+
// FIXME currently we need same types, but in the future the next rule should be the one
|
|
33
|
+
//_Vectorizable = bool(int(MatrixType::Flags)&PacketAccessBit) && ((!_PacketOnDiag) || (_SameTypes && bool(int(DiagonalType::DiagonalVectorType::Flags)&PacketAccessBit))),
|
|
34
|
+
_Vectorizable = bool(int(MatrixType::Flags)&PacketAccessBit) && _SameTypes && (_ScalarAccessOnDiag || (bool(int(DiagonalType::DiagonalVectorType::Flags)&PacketAccessBit))),
|
|
35
|
+
_LinearAccessMask = (RowsAtCompileTime==1 || ColsAtCompileTime==1) ? LinearAccessBit : 0,
|
|
36
|
+
|
|
37
|
+
Flags = ((HereditaryBits|_LinearAccessMask|AlignedBit) & (unsigned int)(MatrixType::Flags)) | (_Vectorizable ? PacketAccessBit : 0),//(int(MatrixType::Flags)&int(DiagonalType::DiagonalVectorType::Flags)&AlignedBit),
|
|
38
|
+
Cost0 = EIGEN_ADD_COST(NumTraits<Scalar>::MulCost, MatrixType::CoeffReadCost),
|
|
39
|
+
CoeffReadCost = EIGEN_ADD_COST(Cost0,DiagonalType::DiagonalVectorType::CoeffReadCost)
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
template<typename MatrixType, typename DiagonalType, int ProductOrder>
|
|
45
|
+
class DiagonalProduct : internal::no_assignment_operator,
|
|
46
|
+
public MatrixBase<DiagonalProduct<MatrixType, DiagonalType, ProductOrder> >
|
|
47
|
+
{
|
|
48
|
+
public:
|
|
49
|
+
|
|
50
|
+
typedef MatrixBase<DiagonalProduct> Base;
|
|
51
|
+
EIGEN_DENSE_PUBLIC_INTERFACE(DiagonalProduct)
|
|
52
|
+
|
|
53
|
+
inline DiagonalProduct(const MatrixType& matrix, const DiagonalType& diagonal)
|
|
54
|
+
: m_matrix(matrix), m_diagonal(diagonal)
|
|
55
|
+
{
|
|
56
|
+
eigen_assert(diagonal.diagonal().size() == (ProductOrder == OnTheLeft ? matrix.rows() : matrix.cols()));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
EIGEN_STRONG_INLINE Index rows() const { return m_matrix.rows(); }
|
|
60
|
+
EIGEN_STRONG_INLINE Index cols() const { return m_matrix.cols(); }
|
|
61
|
+
|
|
62
|
+
EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const
|
|
63
|
+
{
|
|
64
|
+
return m_diagonal.diagonal().coeff(ProductOrder == OnTheLeft ? row : col) * m_matrix.coeff(row, col);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
EIGEN_STRONG_INLINE const Scalar coeff(Index idx) const
|
|
68
|
+
{
|
|
69
|
+
enum {
|
|
70
|
+
StorageOrder = int(MatrixType::Flags) & RowMajorBit ? RowMajor : ColMajor
|
|
71
|
+
};
|
|
72
|
+
return coeff(int(StorageOrder)==ColMajor?idx:0,int(StorageOrder)==ColMajor?0:idx);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
template<int LoadMode>
|
|
76
|
+
EIGEN_STRONG_INLINE PacketScalar packet(Index row, Index col) const
|
|
77
|
+
{
|
|
78
|
+
enum {
|
|
79
|
+
StorageOrder = Flags & RowMajorBit ? RowMajor : ColMajor
|
|
80
|
+
};
|
|
81
|
+
const Index indexInDiagonalVector = ProductOrder == OnTheLeft ? row : col;
|
|
82
|
+
return packet_impl<LoadMode>(row,col,indexInDiagonalVector,typename internal::conditional<
|
|
83
|
+
((int(StorageOrder) == RowMajor && int(ProductOrder) == OnTheLeft)
|
|
84
|
+
||(int(StorageOrder) == ColMajor && int(ProductOrder) == OnTheRight)), internal::true_type, internal::false_type>::type());
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
template<int LoadMode>
|
|
88
|
+
EIGEN_STRONG_INLINE PacketScalar packet(Index idx) const
|
|
89
|
+
{
|
|
90
|
+
enum {
|
|
91
|
+
StorageOrder = int(MatrixType::Flags) & RowMajorBit ? RowMajor : ColMajor
|
|
92
|
+
};
|
|
93
|
+
return packet<LoadMode>(int(StorageOrder)==ColMajor?idx:0,int(StorageOrder)==ColMajor?0:idx);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
protected:
|
|
97
|
+
template<int LoadMode>
|
|
98
|
+
EIGEN_STRONG_INLINE PacketScalar packet_impl(Index row, Index col, Index id, internal::true_type) const
|
|
99
|
+
{
|
|
100
|
+
return internal::pmul(m_matrix.template packet<LoadMode>(row, col),
|
|
101
|
+
internal::pset1<PacketScalar>(m_diagonal.diagonal().coeff(id)));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
template<int LoadMode>
|
|
105
|
+
EIGEN_STRONG_INLINE PacketScalar packet_impl(Index row, Index col, Index id, internal::false_type) const
|
|
106
|
+
{
|
|
107
|
+
enum {
|
|
108
|
+
InnerSize = (MatrixType::Flags & RowMajorBit) ? MatrixType::ColsAtCompileTime : MatrixType::RowsAtCompileTime,
|
|
109
|
+
DiagonalVectorPacketLoadMode = (LoadMode == Aligned && (((InnerSize%16) == 0) || (int(DiagonalType::DiagonalVectorType::Flags)&AlignedBit)==AlignedBit) ? Aligned : Unaligned)
|
|
110
|
+
};
|
|
111
|
+
return internal::pmul(m_matrix.template packet<LoadMode>(row, col),
|
|
112
|
+
m_diagonal.diagonal().template packet<DiagonalVectorPacketLoadMode>(id));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
typename MatrixType::Nested m_matrix;
|
|
116
|
+
typename DiagonalType::Nested m_diagonal;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/** \returns the diagonal matrix product of \c *this by the diagonal matrix \a diagonal.
|
|
120
|
+
*/
|
|
121
|
+
template<typename Derived>
|
|
122
|
+
template<typename DiagonalDerived>
|
|
123
|
+
inline const DiagonalProduct<Derived, DiagonalDerived, OnTheRight>
|
|
124
|
+
MatrixBase<Derived>::operator*(const DiagonalBase<DiagonalDerived> &a_diagonal) const
|
|
125
|
+
{
|
|
126
|
+
return DiagonalProduct<Derived, DiagonalDerived, OnTheRight>(derived(), a_diagonal.derived());
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
} // end namespace Eigen
|
|
130
|
+
|
|
131
|
+
#endif // EIGEN_DIAGONALPRODUCT_H
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
|
2
|
+
// for linear algebra.
|
|
3
|
+
//
|
|
4
|
+
// Copyright (C) 2006-2008, 2010 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_DOT_H
|
|
11
|
+
#define EIGEN_DOT_H
|
|
12
|
+
|
|
13
|
+
namespace Eigen {
|
|
14
|
+
|
|
15
|
+
namespace internal {
|
|
16
|
+
|
|
17
|
+
// helper function for dot(). The problem is that if we put that in the body of dot(), then upon calling dot
|
|
18
|
+
// with mismatched types, the compiler emits errors about failing to instantiate cwiseProduct BEFORE
|
|
19
|
+
// looking at the static assertions. Thus this is a trick to get better compile errors.
|
|
20
|
+
template<typename T, typename U,
|
|
21
|
+
// the NeedToTranspose condition here is taken straight from Assign.h
|
|
22
|
+
bool NeedToTranspose = T::IsVectorAtCompileTime
|
|
23
|
+
&& U::IsVectorAtCompileTime
|
|
24
|
+
&& ((int(T::RowsAtCompileTime) == 1 && int(U::ColsAtCompileTime) == 1)
|
|
25
|
+
| // FIXME | instead of || to please GCC 4.4.0 stupid warning "suggest parentheses around &&".
|
|
26
|
+
// revert to || as soon as not needed anymore.
|
|
27
|
+
(int(T::ColsAtCompileTime) == 1 && int(U::RowsAtCompileTime) == 1))
|
|
28
|
+
>
|
|
29
|
+
struct dot_nocheck
|
|
30
|
+
{
|
|
31
|
+
typedef typename scalar_product_traits<typename traits<T>::Scalar,typename traits<U>::Scalar>::ReturnType ResScalar;
|
|
32
|
+
static inline ResScalar run(const MatrixBase<T>& a, const MatrixBase<U>& b)
|
|
33
|
+
{
|
|
34
|
+
return a.template binaryExpr<scalar_conj_product_op<typename traits<T>::Scalar,typename traits<U>::Scalar> >(b).sum();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
template<typename T, typename U>
|
|
39
|
+
struct dot_nocheck<T, U, true>
|
|
40
|
+
{
|
|
41
|
+
typedef typename scalar_product_traits<typename traits<T>::Scalar,typename traits<U>::Scalar>::ReturnType ResScalar;
|
|
42
|
+
static inline ResScalar run(const MatrixBase<T>& a, const MatrixBase<U>& b)
|
|
43
|
+
{
|
|
44
|
+
return a.transpose().template binaryExpr<scalar_conj_product_op<typename traits<T>::Scalar,typename traits<U>::Scalar> >(b).sum();
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
} // end namespace internal
|
|
49
|
+
|
|
50
|
+
/** \returns the dot product of *this with other.
|
|
51
|
+
*
|
|
52
|
+
* \only_for_vectors
|
|
53
|
+
*
|
|
54
|
+
* \note If the scalar type is complex numbers, then this function returns the hermitian
|
|
55
|
+
* (sesquilinear) dot product, conjugate-linear in the first variable and linear in the
|
|
56
|
+
* second variable.
|
|
57
|
+
*
|
|
58
|
+
* \sa squaredNorm(), norm()
|
|
59
|
+
*/
|
|
60
|
+
template<typename Derived>
|
|
61
|
+
template<typename OtherDerived>
|
|
62
|
+
typename internal::scalar_product_traits<typename internal::traits<Derived>::Scalar,typename internal::traits<OtherDerived>::Scalar>::ReturnType
|
|
63
|
+
MatrixBase<Derived>::dot(const MatrixBase<OtherDerived>& other) const
|
|
64
|
+
{
|
|
65
|
+
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
|
66
|
+
EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
|
|
67
|
+
EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived)
|
|
68
|
+
typedef internal::scalar_conj_product_op<Scalar,typename OtherDerived::Scalar> func;
|
|
69
|
+
EIGEN_CHECK_BINARY_COMPATIBILIY(func,Scalar,typename OtherDerived::Scalar);
|
|
70
|
+
|
|
71
|
+
eigen_assert(size() == other.size());
|
|
72
|
+
|
|
73
|
+
return internal::dot_nocheck<Derived,OtherDerived>::run(*this, other);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
#ifdef EIGEN2_SUPPORT
|
|
77
|
+
/** \returns the dot product of *this with other, with the Eigen2 convention that the dot product is linear in the first variable
|
|
78
|
+
* (conjugating the second variable). Of course this only makes a difference in the complex case.
|
|
79
|
+
*
|
|
80
|
+
* This method is only available in EIGEN2_SUPPORT mode.
|
|
81
|
+
*
|
|
82
|
+
* \only_for_vectors
|
|
83
|
+
*
|
|
84
|
+
* \sa dot()
|
|
85
|
+
*/
|
|
86
|
+
template<typename Derived>
|
|
87
|
+
template<typename OtherDerived>
|
|
88
|
+
typename internal::traits<Derived>::Scalar
|
|
89
|
+
MatrixBase<Derived>::eigen2_dot(const MatrixBase<OtherDerived>& other) const
|
|
90
|
+
{
|
|
91
|
+
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
|
92
|
+
EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
|
|
93
|
+
EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived)
|
|
94
|
+
EIGEN_STATIC_ASSERT((internal::is_same<Scalar, typename OtherDerived::Scalar>::value),
|
|
95
|
+
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
|
|
96
|
+
|
|
97
|
+
eigen_assert(size() == other.size());
|
|
98
|
+
|
|
99
|
+
return internal::dot_nocheck<OtherDerived,Derived>::run(other,*this);
|
|
100
|
+
}
|
|
101
|
+
#endif
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
//---------- implementation of L2 norm and related functions ----------
|
|
105
|
+
|
|
106
|
+
/** \returns, for vectors, the squared \em l2 norm of \c *this, and for matrices the Frobenius norm.
|
|
107
|
+
* In both cases, it consists in the sum of the square of all the matrix entries.
|
|
108
|
+
* For vectors, this is also equals to the dot product of \c *this with itself.
|
|
109
|
+
*
|
|
110
|
+
* \sa dot(), norm()
|
|
111
|
+
*/
|
|
112
|
+
template<typename Derived>
|
|
113
|
+
EIGEN_STRONG_INLINE typename NumTraits<typename internal::traits<Derived>::Scalar>::Real MatrixBase<Derived>::squaredNorm() const
|
|
114
|
+
{
|
|
115
|
+
return numext::real((*this).cwiseAbs2().sum());
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** \returns, for vectors, the \em l2 norm of \c *this, and for matrices the Frobenius norm.
|
|
119
|
+
* In both cases, it consists in the square root of the sum of the square of all the matrix entries.
|
|
120
|
+
* For vectors, this is also equals to the square root of the dot product of \c *this with itself.
|
|
121
|
+
*
|
|
122
|
+
* \sa dot(), squaredNorm()
|
|
123
|
+
*/
|
|
124
|
+
template<typename Derived>
|
|
125
|
+
inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real MatrixBase<Derived>::norm() const
|
|
126
|
+
{
|
|
127
|
+
using std::sqrt;
|
|
128
|
+
return sqrt(squaredNorm());
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** \returns an expression of the quotient of *this by its own norm.
|
|
132
|
+
*
|
|
133
|
+
* \only_for_vectors
|
|
134
|
+
*
|
|
135
|
+
* \sa norm(), normalize()
|
|
136
|
+
*/
|
|
137
|
+
template<typename Derived>
|
|
138
|
+
inline const typename MatrixBase<Derived>::PlainObject
|
|
139
|
+
MatrixBase<Derived>::normalized() const
|
|
140
|
+
{
|
|
141
|
+
typedef typename internal::nested<Derived>::type Nested;
|
|
142
|
+
typedef typename internal::remove_reference<Nested>::type _Nested;
|
|
143
|
+
_Nested n(derived());
|
|
144
|
+
return n / n.norm();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** Normalizes the vector, i.e. divides it by its own norm.
|
|
148
|
+
*
|
|
149
|
+
* \only_for_vectors
|
|
150
|
+
*
|
|
151
|
+
* \sa norm(), normalized()
|
|
152
|
+
*/
|
|
153
|
+
template<typename Derived>
|
|
154
|
+
inline void MatrixBase<Derived>::normalize()
|
|
155
|
+
{
|
|
156
|
+
*this /= norm();
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
//---------- implementation of other norms ----------
|
|
160
|
+
|
|
161
|
+
namespace internal {
|
|
162
|
+
|
|
163
|
+
template<typename Derived, int p>
|
|
164
|
+
struct lpNorm_selector
|
|
165
|
+
{
|
|
166
|
+
typedef typename NumTraits<typename traits<Derived>::Scalar>::Real RealScalar;
|
|
167
|
+
static inline RealScalar run(const MatrixBase<Derived>& m)
|
|
168
|
+
{
|
|
169
|
+
using std::pow;
|
|
170
|
+
return pow(m.cwiseAbs().array().pow(p).sum(), RealScalar(1)/p);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
template<typename Derived>
|
|
175
|
+
struct lpNorm_selector<Derived, 1>
|
|
176
|
+
{
|
|
177
|
+
static inline typename NumTraits<typename traits<Derived>::Scalar>::Real run(const MatrixBase<Derived>& m)
|
|
178
|
+
{
|
|
179
|
+
return m.cwiseAbs().sum();
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
template<typename Derived>
|
|
184
|
+
struct lpNorm_selector<Derived, 2>
|
|
185
|
+
{
|
|
186
|
+
static inline typename NumTraits<typename traits<Derived>::Scalar>::Real run(const MatrixBase<Derived>& m)
|
|
187
|
+
{
|
|
188
|
+
return m.norm();
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
template<typename Derived>
|
|
193
|
+
struct lpNorm_selector<Derived, Infinity>
|
|
194
|
+
{
|
|
195
|
+
static inline typename NumTraits<typename traits<Derived>::Scalar>::Real run(const MatrixBase<Derived>& m)
|
|
196
|
+
{
|
|
197
|
+
return m.cwiseAbs().maxCoeff();
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
} // end namespace internal
|
|
202
|
+
|
|
203
|
+
/** \returns the \f$ \ell^p \f$ norm of *this, that is, returns the p-th root of the sum of the p-th powers of the absolute values
|
|
204
|
+
* of the coefficients of *this. If \a p is the special value \a Eigen::Infinity, this function returns the \f$ \ell^\infty \f$
|
|
205
|
+
* norm, that is the maximum of the absolute values of the coefficients of *this.
|
|
206
|
+
*
|
|
207
|
+
* \sa norm()
|
|
208
|
+
*/
|
|
209
|
+
template<typename Derived>
|
|
210
|
+
template<int p>
|
|
211
|
+
inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
|
|
212
|
+
MatrixBase<Derived>::lpNorm() const
|
|
213
|
+
{
|
|
214
|
+
return internal::lpNorm_selector<Derived, p>::run(*this);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
//---------- implementation of isOrthogonal / isUnitary ----------
|
|
218
|
+
|
|
219
|
+
/** \returns true if *this is approximately orthogonal to \a other,
|
|
220
|
+
* within the precision given by \a prec.
|
|
221
|
+
*
|
|
222
|
+
* Example: \include MatrixBase_isOrthogonal.cpp
|
|
223
|
+
* Output: \verbinclude MatrixBase_isOrthogonal.out
|
|
224
|
+
*/
|
|
225
|
+
template<typename Derived>
|
|
226
|
+
template<typename OtherDerived>
|
|
227
|
+
bool MatrixBase<Derived>::isOrthogonal
|
|
228
|
+
(const MatrixBase<OtherDerived>& other, const RealScalar& prec) const
|
|
229
|
+
{
|
|
230
|
+
typename internal::nested<Derived,2>::type nested(derived());
|
|
231
|
+
typename internal::nested<OtherDerived,2>::type otherNested(other.derived());
|
|
232
|
+
return numext::abs2(nested.dot(otherNested)) <= prec * prec * nested.squaredNorm() * otherNested.squaredNorm();
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** \returns true if *this is approximately an unitary matrix,
|
|
236
|
+
* within the precision given by \a prec. In the case where the \a Scalar
|
|
237
|
+
* type is real numbers, a unitary matrix is an orthogonal matrix, whence the name.
|
|
238
|
+
*
|
|
239
|
+
* \note This can be used to check whether a family of vectors forms an orthonormal basis.
|
|
240
|
+
* Indeed, \c m.isUnitary() returns true if and only if the columns (equivalently, the rows) of m form an
|
|
241
|
+
* orthonormal basis.
|
|
242
|
+
*
|
|
243
|
+
* Example: \include MatrixBase_isUnitary.cpp
|
|
244
|
+
* Output: \verbinclude MatrixBase_isUnitary.out
|
|
245
|
+
*/
|
|
246
|
+
template<typename Derived>
|
|
247
|
+
bool MatrixBase<Derived>::isUnitary(const RealScalar& prec) const
|
|
248
|
+
{
|
|
249
|
+
typename Derived::Nested nested(derived());
|
|
250
|
+
for(Index i = 0; i < cols(); ++i)
|
|
251
|
+
{
|
|
252
|
+
if(!internal::isApprox(nested.col(i).squaredNorm(), static_cast<RealScalar>(1), prec))
|
|
253
|
+
return false;
|
|
254
|
+
for(Index j = 0; j < i; ++j)
|
|
255
|
+
if(!internal::isMuchSmallerThan(nested.col(i).dot(nested.col(j)), static_cast<Scalar>(1), prec))
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
return true;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
} // end namespace Eigen
|
|
262
|
+
|
|
263
|
+
#endif // EIGEN_DOT_H
|