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,154 @@
|
|
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) 2006-2008 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_COMMAINITIALIZER_H
|
12
|
+
#define EIGEN_COMMAINITIALIZER_H
|
13
|
+
|
14
|
+
namespace Eigen {
|
15
|
+
|
16
|
+
/** \class CommaInitializer
|
17
|
+
* \ingroup Core_Module
|
18
|
+
*
|
19
|
+
* \brief Helper class used by the comma initializer operator
|
20
|
+
*
|
21
|
+
* This class is internally used to implement the comma initializer feature. It is
|
22
|
+
* the return type of MatrixBase::operator<<, and most of the time this is the only
|
23
|
+
* way it is used.
|
24
|
+
*
|
25
|
+
* \sa \ref MatrixBaseCommaInitRef "MatrixBase::operator<<", CommaInitializer::finished()
|
26
|
+
*/
|
27
|
+
template<typename XprType>
|
28
|
+
struct CommaInitializer
|
29
|
+
{
|
30
|
+
typedef typename XprType::Scalar Scalar;
|
31
|
+
typedef typename XprType::Index Index;
|
32
|
+
|
33
|
+
inline CommaInitializer(XprType& xpr, const Scalar& s)
|
34
|
+
: m_xpr(xpr), m_row(0), m_col(1), m_currentBlockRows(1)
|
35
|
+
{
|
36
|
+
m_xpr.coeffRef(0,0) = s;
|
37
|
+
}
|
38
|
+
|
39
|
+
template<typename OtherDerived>
|
40
|
+
inline CommaInitializer(XprType& xpr, const DenseBase<OtherDerived>& other)
|
41
|
+
: m_xpr(xpr), m_row(0), m_col(other.cols()), m_currentBlockRows(other.rows())
|
42
|
+
{
|
43
|
+
m_xpr.block(0, 0, other.rows(), other.cols()) = other;
|
44
|
+
}
|
45
|
+
|
46
|
+
/* Copy/Move constructor which transfers ownership. This is crucial in
|
47
|
+
* absence of return value optimization to avoid assertions during destruction. */
|
48
|
+
// FIXME in C++11 mode this could be replaced by a proper RValue constructor
|
49
|
+
inline CommaInitializer(const CommaInitializer& o)
|
50
|
+
: m_xpr(o.m_xpr), m_row(o.m_row), m_col(o.m_col), m_currentBlockRows(o.m_currentBlockRows) {
|
51
|
+
// Mark original object as finished. In absence of R-value references we need to const_cast:
|
52
|
+
const_cast<CommaInitializer&>(o).m_row = m_xpr.rows();
|
53
|
+
const_cast<CommaInitializer&>(o).m_col = m_xpr.cols();
|
54
|
+
const_cast<CommaInitializer&>(o).m_currentBlockRows = 0;
|
55
|
+
}
|
56
|
+
|
57
|
+
/* inserts a scalar value in the target matrix */
|
58
|
+
CommaInitializer& operator,(const Scalar& s)
|
59
|
+
{
|
60
|
+
if (m_col==m_xpr.cols())
|
61
|
+
{
|
62
|
+
m_row+=m_currentBlockRows;
|
63
|
+
m_col = 0;
|
64
|
+
m_currentBlockRows = 1;
|
65
|
+
eigen_assert(m_row<m_xpr.rows()
|
66
|
+
&& "Too many rows passed to comma initializer (operator<<)");
|
67
|
+
}
|
68
|
+
eigen_assert(m_col<m_xpr.cols()
|
69
|
+
&& "Too many coefficients passed to comma initializer (operator<<)");
|
70
|
+
eigen_assert(m_currentBlockRows==1);
|
71
|
+
m_xpr.coeffRef(m_row, m_col++) = s;
|
72
|
+
return *this;
|
73
|
+
}
|
74
|
+
|
75
|
+
/* inserts a matrix expression in the target matrix */
|
76
|
+
template<typename OtherDerived>
|
77
|
+
CommaInitializer& operator,(const DenseBase<OtherDerived>& other)
|
78
|
+
{
|
79
|
+
if(other.cols()==0 || other.rows()==0)
|
80
|
+
return *this;
|
81
|
+
if (m_col==m_xpr.cols())
|
82
|
+
{
|
83
|
+
m_row+=m_currentBlockRows;
|
84
|
+
m_col = 0;
|
85
|
+
m_currentBlockRows = other.rows();
|
86
|
+
eigen_assert(m_row+m_currentBlockRows<=m_xpr.rows()
|
87
|
+
&& "Too many rows passed to comma initializer (operator<<)");
|
88
|
+
}
|
89
|
+
eigen_assert(m_col<m_xpr.cols()
|
90
|
+
&& "Too many coefficients passed to comma initializer (operator<<)");
|
91
|
+
eigen_assert(m_currentBlockRows==other.rows());
|
92
|
+
if (OtherDerived::SizeAtCompileTime != Dynamic)
|
93
|
+
m_xpr.template block<OtherDerived::RowsAtCompileTime != Dynamic ? OtherDerived::RowsAtCompileTime : 1,
|
94
|
+
OtherDerived::ColsAtCompileTime != Dynamic ? OtherDerived::ColsAtCompileTime : 1>
|
95
|
+
(m_row, m_col) = other;
|
96
|
+
else
|
97
|
+
m_xpr.block(m_row, m_col, other.rows(), other.cols()) = other;
|
98
|
+
m_col += other.cols();
|
99
|
+
return *this;
|
100
|
+
}
|
101
|
+
|
102
|
+
inline ~CommaInitializer()
|
103
|
+
{
|
104
|
+
eigen_assert((m_row+m_currentBlockRows) == m_xpr.rows()
|
105
|
+
&& m_col == m_xpr.cols()
|
106
|
+
&& "Too few coefficients passed to comma initializer (operator<<)");
|
107
|
+
}
|
108
|
+
|
109
|
+
/** \returns the built matrix once all its coefficients have been set.
|
110
|
+
* Calling finished is 100% optional. Its purpose is to write expressions
|
111
|
+
* like this:
|
112
|
+
* \code
|
113
|
+
* quaternion.fromRotationMatrix((Matrix3f() << axis0, axis1, axis2).finished());
|
114
|
+
* \endcode
|
115
|
+
*/
|
116
|
+
inline XprType& finished() { return m_xpr; }
|
117
|
+
|
118
|
+
XprType& m_xpr; // target expression
|
119
|
+
Index m_row; // current row id
|
120
|
+
Index m_col; // current col id
|
121
|
+
Index m_currentBlockRows; // current block height
|
122
|
+
};
|
123
|
+
|
124
|
+
/** \anchor MatrixBaseCommaInitRef
|
125
|
+
* Convenient operator to set the coefficients of a matrix.
|
126
|
+
*
|
127
|
+
* The coefficients must be provided in a row major order and exactly match
|
128
|
+
* the size of the matrix. Otherwise an assertion is raised.
|
129
|
+
*
|
130
|
+
* Example: \include MatrixBase_set.cpp
|
131
|
+
* Output: \verbinclude MatrixBase_set.out
|
132
|
+
*
|
133
|
+
* \note According the c++ standard, the argument expressions of this comma initializer are evaluated in arbitrary order.
|
134
|
+
*
|
135
|
+
* \sa CommaInitializer::finished(), class CommaInitializer
|
136
|
+
*/
|
137
|
+
template<typename Derived>
|
138
|
+
inline CommaInitializer<Derived> DenseBase<Derived>::operator<< (const Scalar& s)
|
139
|
+
{
|
140
|
+
return CommaInitializer<Derived>(*static_cast<Derived*>(this), s);
|
141
|
+
}
|
142
|
+
|
143
|
+
/** \sa operator<<(const Scalar&) */
|
144
|
+
template<typename Derived>
|
145
|
+
template<typename OtherDerived>
|
146
|
+
inline CommaInitializer<Derived>
|
147
|
+
DenseBase<Derived>::operator<<(const DenseBase<OtherDerived>& other)
|
148
|
+
{
|
149
|
+
return CommaInitializer<Derived>(*static_cast<Derived *>(this), other);
|
150
|
+
}
|
151
|
+
|
152
|
+
} // end namespace Eigen
|
153
|
+
|
154
|
+
#endif // EIGEN_COMMAINITIALIZER_H
|
@@ -0,0 +1,61 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
|
5
|
+
//
|
6
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
7
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
8
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
9
|
+
|
10
|
+
#ifndef EIGEN_COREITERATORS_H
|
11
|
+
#define EIGEN_COREITERATORS_H
|
12
|
+
|
13
|
+
namespace Eigen {
|
14
|
+
|
15
|
+
/* This file contains the respective InnerIterator definition of the expressions defined in Eigen/Core
|
16
|
+
*/
|
17
|
+
|
18
|
+
/** \ingroup SparseCore_Module
|
19
|
+
* \class InnerIterator
|
20
|
+
* \brief An InnerIterator allows to loop over the element of a sparse (or dense) matrix or expression
|
21
|
+
*
|
22
|
+
* todo
|
23
|
+
*/
|
24
|
+
|
25
|
+
// generic version for dense matrix and expressions
|
26
|
+
template<typename Derived> class DenseBase<Derived>::InnerIterator
|
27
|
+
{
|
28
|
+
protected:
|
29
|
+
typedef typename Derived::Scalar Scalar;
|
30
|
+
typedef typename Derived::Index Index;
|
31
|
+
|
32
|
+
enum { IsRowMajor = (Derived::Flags&RowMajorBit)==RowMajorBit };
|
33
|
+
public:
|
34
|
+
EIGEN_STRONG_INLINE InnerIterator(const Derived& expr, Index outer)
|
35
|
+
: m_expression(expr), m_inner(0), m_outer(outer), m_end(expr.innerSize())
|
36
|
+
{}
|
37
|
+
|
38
|
+
EIGEN_STRONG_INLINE Scalar value() const
|
39
|
+
{
|
40
|
+
return (IsRowMajor) ? m_expression.coeff(m_outer, m_inner)
|
41
|
+
: m_expression.coeff(m_inner, m_outer);
|
42
|
+
}
|
43
|
+
|
44
|
+
EIGEN_STRONG_INLINE InnerIterator& operator++() { m_inner++; return *this; }
|
45
|
+
|
46
|
+
EIGEN_STRONG_INLINE Index index() const { return m_inner; }
|
47
|
+
inline Index row() const { return IsRowMajor ? m_outer : index(); }
|
48
|
+
inline Index col() const { return IsRowMajor ? index() : m_outer; }
|
49
|
+
|
50
|
+
EIGEN_STRONG_INLINE operator bool() const { return m_inner < m_end && m_inner>=0; }
|
51
|
+
|
52
|
+
protected:
|
53
|
+
const Derived& m_expression;
|
54
|
+
Index m_inner;
|
55
|
+
const Index m_outer;
|
56
|
+
const Index m_end;
|
57
|
+
};
|
58
|
+
|
59
|
+
} // end namespace Eigen
|
60
|
+
|
61
|
+
#endif // EIGEN_COREITERATORS_H
|
@@ -0,0 +1,230 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>
|
5
|
+
// Copyright (C) 2006-2008 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_CWISE_BINARY_OP_H
|
12
|
+
#define EIGEN_CWISE_BINARY_OP_H
|
13
|
+
|
14
|
+
namespace Eigen {
|
15
|
+
|
16
|
+
/** \class CwiseBinaryOp
|
17
|
+
* \ingroup Core_Module
|
18
|
+
*
|
19
|
+
* \brief Generic expression where a coefficient-wise binary operator is applied to two expressions
|
20
|
+
*
|
21
|
+
* \param BinaryOp template functor implementing the operator
|
22
|
+
* \param Lhs the type of the left-hand side
|
23
|
+
* \param Rhs the type of the right-hand side
|
24
|
+
*
|
25
|
+
* This class represents an expression where a coefficient-wise binary operator is applied to two expressions.
|
26
|
+
* It is the return type of binary operators, by which we mean only those binary operators where
|
27
|
+
* both the left-hand side and the right-hand side are Eigen expressions.
|
28
|
+
* For example, the return type of matrix1+matrix2 is a CwiseBinaryOp.
|
29
|
+
*
|
30
|
+
* Most of the time, this is the only way that it is used, so you typically don't have to name
|
31
|
+
* CwiseBinaryOp types explicitly.
|
32
|
+
*
|
33
|
+
* \sa MatrixBase::binaryExpr(const MatrixBase<OtherDerived> &,const CustomBinaryOp &) const, class CwiseUnaryOp, class CwiseNullaryOp
|
34
|
+
*/
|
35
|
+
|
36
|
+
namespace internal {
|
37
|
+
template<typename BinaryOp, typename Lhs, typename Rhs>
|
38
|
+
struct traits<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
|
39
|
+
{
|
40
|
+
// we must not inherit from traits<Lhs> since it has
|
41
|
+
// the potential to cause problems with MSVC
|
42
|
+
typedef typename remove_all<Lhs>::type Ancestor;
|
43
|
+
typedef typename traits<Ancestor>::XprKind XprKind;
|
44
|
+
enum {
|
45
|
+
RowsAtCompileTime = traits<Ancestor>::RowsAtCompileTime,
|
46
|
+
ColsAtCompileTime = traits<Ancestor>::ColsAtCompileTime,
|
47
|
+
MaxRowsAtCompileTime = traits<Ancestor>::MaxRowsAtCompileTime,
|
48
|
+
MaxColsAtCompileTime = traits<Ancestor>::MaxColsAtCompileTime
|
49
|
+
};
|
50
|
+
|
51
|
+
// even though we require Lhs and Rhs to have the same scalar type (see CwiseBinaryOp constructor),
|
52
|
+
// we still want to handle the case when the result type is different.
|
53
|
+
typedef typename result_of<
|
54
|
+
BinaryOp(
|
55
|
+
typename Lhs::Scalar,
|
56
|
+
typename Rhs::Scalar
|
57
|
+
)
|
58
|
+
>::type Scalar;
|
59
|
+
typedef typename promote_storage_type<typename traits<Lhs>::StorageKind,
|
60
|
+
typename traits<Rhs>::StorageKind>::ret StorageKind;
|
61
|
+
typedef typename promote_index_type<typename traits<Lhs>::Index,
|
62
|
+
typename traits<Rhs>::Index>::type Index;
|
63
|
+
typedef typename Lhs::Nested LhsNested;
|
64
|
+
typedef typename Rhs::Nested RhsNested;
|
65
|
+
typedef typename remove_reference<LhsNested>::type _LhsNested;
|
66
|
+
typedef typename remove_reference<RhsNested>::type _RhsNested;
|
67
|
+
enum {
|
68
|
+
LhsCoeffReadCost = _LhsNested::CoeffReadCost,
|
69
|
+
RhsCoeffReadCost = _RhsNested::CoeffReadCost,
|
70
|
+
LhsFlags = _LhsNested::Flags,
|
71
|
+
RhsFlags = _RhsNested::Flags,
|
72
|
+
SameType = is_same<typename _LhsNested::Scalar,typename _RhsNested::Scalar>::value,
|
73
|
+
StorageOrdersAgree = (int(Lhs::Flags)&RowMajorBit)==(int(Rhs::Flags)&RowMajorBit),
|
74
|
+
Flags0 = (int(LhsFlags) | int(RhsFlags)) & (
|
75
|
+
HereditaryBits
|
76
|
+
| (int(LhsFlags) & int(RhsFlags) &
|
77
|
+
( AlignedBit
|
78
|
+
| (StorageOrdersAgree ? LinearAccessBit : 0)
|
79
|
+
| (functor_traits<BinaryOp>::PacketAccess && StorageOrdersAgree && SameType ? PacketAccessBit : 0)
|
80
|
+
)
|
81
|
+
)
|
82
|
+
),
|
83
|
+
Flags = (Flags0 & ~RowMajorBit) | (LhsFlags & RowMajorBit),
|
84
|
+
Cost0 = EIGEN_ADD_COST(LhsCoeffReadCost,RhsCoeffReadCost),
|
85
|
+
CoeffReadCost = EIGEN_ADD_COST(Cost0,functor_traits<BinaryOp>::Cost)
|
86
|
+
};
|
87
|
+
};
|
88
|
+
} // end namespace internal
|
89
|
+
|
90
|
+
// we require Lhs and Rhs to have the same scalar type. Currently there is no example of a binary functor
|
91
|
+
// that would take two operands of different types. If there were such an example, then this check should be
|
92
|
+
// moved to the BinaryOp functors, on a per-case basis. This would however require a change in the BinaryOp functors, as
|
93
|
+
// currently they take only one typename Scalar template parameter.
|
94
|
+
// It is tempting to always allow mixing different types but remember that this is often impossible in the vectorized paths.
|
95
|
+
// So allowing mixing different types gives very unexpected errors when enabling vectorization, when the user tries to
|
96
|
+
// add together a float matrix and a double matrix.
|
97
|
+
#define EIGEN_CHECK_BINARY_COMPATIBILIY(BINOP,LHS,RHS) \
|
98
|
+
EIGEN_STATIC_ASSERT((internal::functor_is_product_like<BINOP>::ret \
|
99
|
+
? int(internal::scalar_product_traits<LHS, RHS>::Defined) \
|
100
|
+
: int(internal::is_same<LHS, RHS>::value)), \
|
101
|
+
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
|
102
|
+
|
103
|
+
template<typename BinaryOp, typename Lhs, typename Rhs, typename StorageKind>
|
104
|
+
class CwiseBinaryOpImpl;
|
105
|
+
|
106
|
+
template<typename BinaryOp, typename Lhs, typename Rhs>
|
107
|
+
class CwiseBinaryOp : internal::no_assignment_operator,
|
108
|
+
public CwiseBinaryOpImpl<
|
109
|
+
BinaryOp, Lhs, Rhs,
|
110
|
+
typename internal::promote_storage_type<typename internal::traits<Lhs>::StorageKind,
|
111
|
+
typename internal::traits<Rhs>::StorageKind>::ret>
|
112
|
+
{
|
113
|
+
public:
|
114
|
+
|
115
|
+
typedef typename CwiseBinaryOpImpl<
|
116
|
+
BinaryOp, Lhs, Rhs,
|
117
|
+
typename internal::promote_storage_type<typename internal::traits<Lhs>::StorageKind,
|
118
|
+
typename internal::traits<Rhs>::StorageKind>::ret>::Base Base;
|
119
|
+
EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseBinaryOp)
|
120
|
+
|
121
|
+
typedef typename internal::nested<Lhs>::type LhsNested;
|
122
|
+
typedef typename internal::nested<Rhs>::type RhsNested;
|
123
|
+
typedef typename internal::remove_reference<LhsNested>::type _LhsNested;
|
124
|
+
typedef typename internal::remove_reference<RhsNested>::type _RhsNested;
|
125
|
+
|
126
|
+
EIGEN_STRONG_INLINE CwiseBinaryOp(const Lhs& aLhs, const Rhs& aRhs, const BinaryOp& func = BinaryOp())
|
127
|
+
: m_lhs(aLhs), m_rhs(aRhs), m_functor(func)
|
128
|
+
{
|
129
|
+
EIGEN_CHECK_BINARY_COMPATIBILIY(BinaryOp,typename Lhs::Scalar,typename Rhs::Scalar);
|
130
|
+
// require the sizes to match
|
131
|
+
EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Lhs, Rhs)
|
132
|
+
eigen_assert(aLhs.rows() == aRhs.rows() && aLhs.cols() == aRhs.cols());
|
133
|
+
}
|
134
|
+
|
135
|
+
EIGEN_STRONG_INLINE Index rows() const {
|
136
|
+
// return the fixed size type if available to enable compile time optimizations
|
137
|
+
if (internal::traits<typename internal::remove_all<LhsNested>::type>::RowsAtCompileTime==Dynamic)
|
138
|
+
return m_rhs.rows();
|
139
|
+
else
|
140
|
+
return m_lhs.rows();
|
141
|
+
}
|
142
|
+
EIGEN_STRONG_INLINE Index cols() const {
|
143
|
+
// return the fixed size type if available to enable compile time optimizations
|
144
|
+
if (internal::traits<typename internal::remove_all<LhsNested>::type>::ColsAtCompileTime==Dynamic)
|
145
|
+
return m_rhs.cols();
|
146
|
+
else
|
147
|
+
return m_lhs.cols();
|
148
|
+
}
|
149
|
+
|
150
|
+
/** \returns the left hand side nested expression */
|
151
|
+
const _LhsNested& lhs() const { return m_lhs; }
|
152
|
+
/** \returns the right hand side nested expression */
|
153
|
+
const _RhsNested& rhs() const { return m_rhs; }
|
154
|
+
/** \returns the functor representing the binary operation */
|
155
|
+
const BinaryOp& functor() const { return m_functor; }
|
156
|
+
|
157
|
+
protected:
|
158
|
+
LhsNested m_lhs;
|
159
|
+
RhsNested m_rhs;
|
160
|
+
const BinaryOp m_functor;
|
161
|
+
};
|
162
|
+
|
163
|
+
template<typename BinaryOp, typename Lhs, typename Rhs>
|
164
|
+
class CwiseBinaryOpImpl<BinaryOp, Lhs, Rhs, Dense>
|
165
|
+
: public internal::dense_xpr_base<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >::type
|
166
|
+
{
|
167
|
+
typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> Derived;
|
168
|
+
public:
|
169
|
+
|
170
|
+
typedef typename internal::dense_xpr_base<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >::type Base;
|
171
|
+
EIGEN_DENSE_PUBLIC_INTERFACE( Derived )
|
172
|
+
|
173
|
+
EIGEN_STRONG_INLINE const Scalar coeff(Index rowId, Index colId) const
|
174
|
+
{
|
175
|
+
return derived().functor()(derived().lhs().coeff(rowId, colId),
|
176
|
+
derived().rhs().coeff(rowId, colId));
|
177
|
+
}
|
178
|
+
|
179
|
+
template<int LoadMode>
|
180
|
+
EIGEN_STRONG_INLINE PacketScalar packet(Index rowId, Index colId) const
|
181
|
+
{
|
182
|
+
return derived().functor().packetOp(derived().lhs().template packet<LoadMode>(rowId, colId),
|
183
|
+
derived().rhs().template packet<LoadMode>(rowId, colId));
|
184
|
+
}
|
185
|
+
|
186
|
+
EIGEN_STRONG_INLINE const Scalar coeff(Index index) const
|
187
|
+
{
|
188
|
+
return derived().functor()(derived().lhs().coeff(index),
|
189
|
+
derived().rhs().coeff(index));
|
190
|
+
}
|
191
|
+
|
192
|
+
template<int LoadMode>
|
193
|
+
EIGEN_STRONG_INLINE PacketScalar packet(Index index) const
|
194
|
+
{
|
195
|
+
return derived().functor().packetOp(derived().lhs().template packet<LoadMode>(index),
|
196
|
+
derived().rhs().template packet<LoadMode>(index));
|
197
|
+
}
|
198
|
+
};
|
199
|
+
|
200
|
+
/** replaces \c *this by \c *this - \a other.
|
201
|
+
*
|
202
|
+
* \returns a reference to \c *this
|
203
|
+
*/
|
204
|
+
template<typename Derived>
|
205
|
+
template<typename OtherDerived>
|
206
|
+
EIGEN_STRONG_INLINE Derived &
|
207
|
+
MatrixBase<Derived>::operator-=(const MatrixBase<OtherDerived> &other)
|
208
|
+
{
|
209
|
+
SelfCwiseBinaryOp<internal::scalar_difference_op<Scalar>, Derived, OtherDerived> tmp(derived());
|
210
|
+
tmp = other.derived();
|
211
|
+
return derived();
|
212
|
+
}
|
213
|
+
|
214
|
+
/** replaces \c *this by \c *this + \a other.
|
215
|
+
*
|
216
|
+
* \returns a reference to \c *this
|
217
|
+
*/
|
218
|
+
template<typename Derived>
|
219
|
+
template<typename OtherDerived>
|
220
|
+
EIGEN_STRONG_INLINE Derived &
|
221
|
+
MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other)
|
222
|
+
{
|
223
|
+
SelfCwiseBinaryOp<internal::scalar_sum_op<Scalar>, Derived, OtherDerived> tmp(derived());
|
224
|
+
tmp = other.derived();
|
225
|
+
return derived();
|
226
|
+
}
|
227
|
+
|
228
|
+
} // end namespace Eigen
|
229
|
+
|
230
|
+
#endif // EIGEN_CWISE_BINARY_OP_H
|
@@ -0,0 +1,864 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
|
5
|
+
//
|
6
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
7
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
8
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
9
|
+
|
10
|
+
#ifndef EIGEN_CWISE_NULLARY_OP_H
|
11
|
+
#define EIGEN_CWISE_NULLARY_OP_H
|
12
|
+
|
13
|
+
namespace Eigen {
|
14
|
+
|
15
|
+
/** \class CwiseNullaryOp
|
16
|
+
* \ingroup Core_Module
|
17
|
+
*
|
18
|
+
* \brief Generic expression of a matrix where all coefficients are defined by a functor
|
19
|
+
*
|
20
|
+
* \param NullaryOp template functor implementing the operator
|
21
|
+
* \param PlainObjectType the underlying plain matrix/array type
|
22
|
+
*
|
23
|
+
* This class represents an expression of a generic nullary operator.
|
24
|
+
* It is the return type of the Ones(), Zero(), Constant(), Identity() and Random() methods,
|
25
|
+
* and most of the time this is the only way it is used.
|
26
|
+
*
|
27
|
+
* However, if you want to write a function returning such an expression, you
|
28
|
+
* will need to use this class.
|
29
|
+
*
|
30
|
+
* \sa class CwiseUnaryOp, class CwiseBinaryOp, DenseBase::NullaryExpr()
|
31
|
+
*/
|
32
|
+
|
33
|
+
namespace internal {
|
34
|
+
template<typename NullaryOp, typename PlainObjectType>
|
35
|
+
struct traits<CwiseNullaryOp<NullaryOp, PlainObjectType> > : traits<PlainObjectType>
|
36
|
+
{
|
37
|
+
enum {
|
38
|
+
Flags = (traits<PlainObjectType>::Flags
|
39
|
+
& ( HereditaryBits
|
40
|
+
| (functor_has_linear_access<NullaryOp>::ret ? LinearAccessBit : 0)
|
41
|
+
| (functor_traits<NullaryOp>::PacketAccess ? PacketAccessBit : 0)))
|
42
|
+
| (functor_traits<NullaryOp>::IsRepeatable ? 0 : EvalBeforeNestingBit),
|
43
|
+
CoeffReadCost = functor_traits<NullaryOp>::Cost
|
44
|
+
};
|
45
|
+
};
|
46
|
+
}
|
47
|
+
|
48
|
+
template<typename NullaryOp, typename PlainObjectType>
|
49
|
+
class CwiseNullaryOp : internal::no_assignment_operator,
|
50
|
+
public internal::dense_xpr_base< CwiseNullaryOp<NullaryOp, PlainObjectType> >::type
|
51
|
+
{
|
52
|
+
public:
|
53
|
+
|
54
|
+
typedef typename internal::dense_xpr_base<CwiseNullaryOp>::type Base;
|
55
|
+
EIGEN_DENSE_PUBLIC_INTERFACE(CwiseNullaryOp)
|
56
|
+
|
57
|
+
CwiseNullaryOp(Index nbRows, Index nbCols, const NullaryOp& func = NullaryOp())
|
58
|
+
: m_rows(nbRows), m_cols(nbCols), m_functor(func)
|
59
|
+
{
|
60
|
+
eigen_assert(nbRows >= 0
|
61
|
+
&& (RowsAtCompileTime == Dynamic || RowsAtCompileTime == nbRows)
|
62
|
+
&& nbCols >= 0
|
63
|
+
&& (ColsAtCompileTime == Dynamic || ColsAtCompileTime == nbCols));
|
64
|
+
}
|
65
|
+
|
66
|
+
EIGEN_STRONG_INLINE Index rows() const { return m_rows.value(); }
|
67
|
+
EIGEN_STRONG_INLINE Index cols() const { return m_cols.value(); }
|
68
|
+
|
69
|
+
EIGEN_STRONG_INLINE const Scalar coeff(Index rowId, Index colId) const
|
70
|
+
{
|
71
|
+
return m_functor(rowId, colId);
|
72
|
+
}
|
73
|
+
|
74
|
+
template<int LoadMode>
|
75
|
+
EIGEN_STRONG_INLINE PacketScalar packet(Index rowId, Index colId) const
|
76
|
+
{
|
77
|
+
return m_functor.packetOp(rowId, colId);
|
78
|
+
}
|
79
|
+
|
80
|
+
EIGEN_STRONG_INLINE const Scalar coeff(Index index) const
|
81
|
+
{
|
82
|
+
return m_functor(index);
|
83
|
+
}
|
84
|
+
|
85
|
+
template<int LoadMode>
|
86
|
+
EIGEN_STRONG_INLINE PacketScalar packet(Index index) const
|
87
|
+
{
|
88
|
+
return m_functor.packetOp(index);
|
89
|
+
}
|
90
|
+
|
91
|
+
/** \returns the functor representing the nullary operation */
|
92
|
+
const NullaryOp& functor() const { return m_functor; }
|
93
|
+
|
94
|
+
protected:
|
95
|
+
const internal::variable_if_dynamic<Index, RowsAtCompileTime> m_rows;
|
96
|
+
const internal::variable_if_dynamic<Index, ColsAtCompileTime> m_cols;
|
97
|
+
const NullaryOp m_functor;
|
98
|
+
};
|
99
|
+
|
100
|
+
|
101
|
+
/** \returns an expression of a matrix defined by a custom functor \a func
|
102
|
+
*
|
103
|
+
* The parameters \a rows and \a cols are the number of rows and of columns of
|
104
|
+
* the returned matrix. Must be compatible with this MatrixBase type.
|
105
|
+
*
|
106
|
+
* This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
|
107
|
+
* it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used
|
108
|
+
* instead.
|
109
|
+
*
|
110
|
+
* The template parameter \a CustomNullaryOp is the type of the functor.
|
111
|
+
*
|
112
|
+
* \sa class CwiseNullaryOp
|
113
|
+
*/
|
114
|
+
template<typename Derived>
|
115
|
+
template<typename CustomNullaryOp>
|
116
|
+
EIGEN_STRONG_INLINE const CwiseNullaryOp<CustomNullaryOp, Derived>
|
117
|
+
DenseBase<Derived>::NullaryExpr(Index rows, Index cols, const CustomNullaryOp& func)
|
118
|
+
{
|
119
|
+
return CwiseNullaryOp<CustomNullaryOp, Derived>(rows, cols, func);
|
120
|
+
}
|
121
|
+
|
122
|
+
/** \returns an expression of a matrix defined by a custom functor \a func
|
123
|
+
*
|
124
|
+
* The parameter \a size is the size of the returned vector.
|
125
|
+
* Must be compatible with this MatrixBase type.
|
126
|
+
*
|
127
|
+
* \only_for_vectors
|
128
|
+
*
|
129
|
+
* This variant is meant to be used for dynamic-size vector types. For fixed-size types,
|
130
|
+
* it is redundant to pass \a size as argument, so Zero() should be used
|
131
|
+
* instead.
|
132
|
+
*
|
133
|
+
* The template parameter \a CustomNullaryOp is the type of the functor.
|
134
|
+
*
|
135
|
+
* \sa class CwiseNullaryOp
|
136
|
+
*/
|
137
|
+
template<typename Derived>
|
138
|
+
template<typename CustomNullaryOp>
|
139
|
+
EIGEN_STRONG_INLINE const CwiseNullaryOp<CustomNullaryOp, Derived>
|
140
|
+
DenseBase<Derived>::NullaryExpr(Index size, const CustomNullaryOp& func)
|
141
|
+
{
|
142
|
+
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
143
|
+
if(RowsAtCompileTime == 1) return CwiseNullaryOp<CustomNullaryOp, Derived>(1, size, func);
|
144
|
+
else return CwiseNullaryOp<CustomNullaryOp, Derived>(size, 1, func);
|
145
|
+
}
|
146
|
+
|
147
|
+
/** \returns an expression of a matrix defined by a custom functor \a func
|
148
|
+
*
|
149
|
+
* This variant is only for fixed-size DenseBase types. For dynamic-size types, you
|
150
|
+
* need to use the variants taking size arguments.
|
151
|
+
*
|
152
|
+
* The template parameter \a CustomNullaryOp is the type of the functor.
|
153
|
+
*
|
154
|
+
* \sa class CwiseNullaryOp
|
155
|
+
*/
|
156
|
+
template<typename Derived>
|
157
|
+
template<typename CustomNullaryOp>
|
158
|
+
EIGEN_STRONG_INLINE const CwiseNullaryOp<CustomNullaryOp, Derived>
|
159
|
+
DenseBase<Derived>::NullaryExpr(const CustomNullaryOp& func)
|
160
|
+
{
|
161
|
+
return CwiseNullaryOp<CustomNullaryOp, Derived>(RowsAtCompileTime, ColsAtCompileTime, func);
|
162
|
+
}
|
163
|
+
|
164
|
+
/** \returns an expression of a constant matrix of value \a value
|
165
|
+
*
|
166
|
+
* The parameters \a nbRows and \a nbCols are the number of rows and of columns of
|
167
|
+
* the returned matrix. Must be compatible with this DenseBase type.
|
168
|
+
*
|
169
|
+
* This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
|
170
|
+
* it is redundant to pass \a nbRows and \a nbCols as arguments, so Zero() should be used
|
171
|
+
* instead.
|
172
|
+
*
|
173
|
+
* The template parameter \a CustomNullaryOp is the type of the functor.
|
174
|
+
*
|
175
|
+
* \sa class CwiseNullaryOp
|
176
|
+
*/
|
177
|
+
template<typename Derived>
|
178
|
+
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
179
|
+
DenseBase<Derived>::Constant(Index nbRows, Index nbCols, const Scalar& value)
|
180
|
+
{
|
181
|
+
return DenseBase<Derived>::NullaryExpr(nbRows, nbCols, internal::scalar_constant_op<Scalar>(value));
|
182
|
+
}
|
183
|
+
|
184
|
+
/** \returns an expression of a constant matrix of value \a value
|
185
|
+
*
|
186
|
+
* The parameter \a size is the size of the returned vector.
|
187
|
+
* Must be compatible with this DenseBase type.
|
188
|
+
*
|
189
|
+
* \only_for_vectors
|
190
|
+
*
|
191
|
+
* This variant is meant to be used for dynamic-size vector types. For fixed-size types,
|
192
|
+
* it is redundant to pass \a size as argument, so Zero() should be used
|
193
|
+
* instead.
|
194
|
+
*
|
195
|
+
* The template parameter \a CustomNullaryOp is the type of the functor.
|
196
|
+
*
|
197
|
+
* \sa class CwiseNullaryOp
|
198
|
+
*/
|
199
|
+
template<typename Derived>
|
200
|
+
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
201
|
+
DenseBase<Derived>::Constant(Index size, const Scalar& value)
|
202
|
+
{
|
203
|
+
return DenseBase<Derived>::NullaryExpr(size, internal::scalar_constant_op<Scalar>(value));
|
204
|
+
}
|
205
|
+
|
206
|
+
/** \returns an expression of a constant matrix of value \a value
|
207
|
+
*
|
208
|
+
* This variant is only for fixed-size DenseBase types. For dynamic-size types, you
|
209
|
+
* need to use the variants taking size arguments.
|
210
|
+
*
|
211
|
+
* The template parameter \a CustomNullaryOp is the type of the functor.
|
212
|
+
*
|
213
|
+
* \sa class CwiseNullaryOp
|
214
|
+
*/
|
215
|
+
template<typename Derived>
|
216
|
+
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
217
|
+
DenseBase<Derived>::Constant(const Scalar& value)
|
218
|
+
{
|
219
|
+
EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
|
220
|
+
return DenseBase<Derived>::NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_constant_op<Scalar>(value));
|
221
|
+
}
|
222
|
+
|
223
|
+
/**
|
224
|
+
* \brief Sets a linearly space vector.
|
225
|
+
*
|
226
|
+
* The function generates 'size' equally spaced values in the closed interval [low,high].
|
227
|
+
* This particular version of LinSpaced() uses sequential access, i.e. vector access is
|
228
|
+
* assumed to be a(0), a(1), ..., a(size). This assumption allows for better vectorization
|
229
|
+
* and yields faster code than the random access version.
|
230
|
+
*
|
231
|
+
* When size is set to 1, a vector of length 1 containing 'high' is returned.
|
232
|
+
*
|
233
|
+
* \only_for_vectors
|
234
|
+
*
|
235
|
+
* Example: \include DenseBase_LinSpaced_seq.cpp
|
236
|
+
* Output: \verbinclude DenseBase_LinSpaced_seq.out
|
237
|
+
*
|
238
|
+
* \sa setLinSpaced(Index,const Scalar&,const Scalar&), LinSpaced(Index,Scalar,Scalar), CwiseNullaryOp
|
239
|
+
*/
|
240
|
+
template<typename Derived>
|
241
|
+
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::SequentialLinSpacedReturnType
|
242
|
+
DenseBase<Derived>::LinSpaced(Sequential_t, Index size, const Scalar& low, const Scalar& high)
|
243
|
+
{
|
244
|
+
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
245
|
+
return DenseBase<Derived>::NullaryExpr(size, internal::linspaced_op<Scalar,false>(low,high,size));
|
246
|
+
}
|
247
|
+
|
248
|
+
/**
|
249
|
+
* \copydoc DenseBase::LinSpaced(Sequential_t, Index, const Scalar&, const Scalar&)
|
250
|
+
* Special version for fixed size types which does not require the size parameter.
|
251
|
+
*/
|
252
|
+
template<typename Derived>
|
253
|
+
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::SequentialLinSpacedReturnType
|
254
|
+
DenseBase<Derived>::LinSpaced(Sequential_t, const Scalar& low, const Scalar& high)
|
255
|
+
{
|
256
|
+
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
257
|
+
EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
|
258
|
+
return DenseBase<Derived>::NullaryExpr(Derived::SizeAtCompileTime, internal::linspaced_op<Scalar,false>(low,high,Derived::SizeAtCompileTime));
|
259
|
+
}
|
260
|
+
|
261
|
+
/**
|
262
|
+
* \brief Sets a linearly space vector.
|
263
|
+
*
|
264
|
+
* The function generates 'size' equally spaced values in the closed interval [low,high].
|
265
|
+
* When size is set to 1, a vector of length 1 containing 'high' is returned.
|
266
|
+
*
|
267
|
+
* \only_for_vectors
|
268
|
+
*
|
269
|
+
* Example: \include DenseBase_LinSpaced.cpp
|
270
|
+
* Output: \verbinclude DenseBase_LinSpaced.out
|
271
|
+
*
|
272
|
+
* \sa setLinSpaced(Index,const Scalar&,const Scalar&), LinSpaced(Sequential_t,Index,const Scalar&,const Scalar&,Index), CwiseNullaryOp
|
273
|
+
*/
|
274
|
+
template<typename Derived>
|
275
|
+
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
|
276
|
+
DenseBase<Derived>::LinSpaced(Index size, const Scalar& low, const Scalar& high)
|
277
|
+
{
|
278
|
+
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
279
|
+
return DenseBase<Derived>::NullaryExpr(size, internal::linspaced_op<Scalar,true>(low,high,size));
|
280
|
+
}
|
281
|
+
|
282
|
+
/**
|
283
|
+
* \copydoc DenseBase::LinSpaced(Index, const Scalar&, const Scalar&)
|
284
|
+
* Special version for fixed size types which does not require the size parameter.
|
285
|
+
*/
|
286
|
+
template<typename Derived>
|
287
|
+
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
|
288
|
+
DenseBase<Derived>::LinSpaced(const Scalar& low, const Scalar& high)
|
289
|
+
{
|
290
|
+
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
291
|
+
EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
|
292
|
+
return DenseBase<Derived>::NullaryExpr(Derived::SizeAtCompileTime, internal::linspaced_op<Scalar,true>(low,high,Derived::SizeAtCompileTime));
|
293
|
+
}
|
294
|
+
|
295
|
+
/** \returns true if all coefficients in this matrix are approximately equal to \a val, to within precision \a prec */
|
296
|
+
template<typename Derived>
|
297
|
+
bool DenseBase<Derived>::isApproxToConstant
|
298
|
+
(const Scalar& val, const RealScalar& prec) const
|
299
|
+
{
|
300
|
+
for(Index j = 0; j < cols(); ++j)
|
301
|
+
for(Index i = 0; i < rows(); ++i)
|
302
|
+
if(!internal::isApprox(this->coeff(i, j), val, prec))
|
303
|
+
return false;
|
304
|
+
return true;
|
305
|
+
}
|
306
|
+
|
307
|
+
/** This is just an alias for isApproxToConstant().
|
308
|
+
*
|
309
|
+
* \returns true if all coefficients in this matrix are approximately equal to \a value, to within precision \a prec */
|
310
|
+
template<typename Derived>
|
311
|
+
bool DenseBase<Derived>::isConstant
|
312
|
+
(const Scalar& val, const RealScalar& prec) const
|
313
|
+
{
|
314
|
+
return isApproxToConstant(val, prec);
|
315
|
+
}
|
316
|
+
|
317
|
+
/** Alias for setConstant(): sets all coefficients in this expression to \a val.
|
318
|
+
*
|
319
|
+
* \sa setConstant(), Constant(), class CwiseNullaryOp
|
320
|
+
*/
|
321
|
+
template<typename Derived>
|
322
|
+
EIGEN_STRONG_INLINE void DenseBase<Derived>::fill(const Scalar& val)
|
323
|
+
{
|
324
|
+
setConstant(val);
|
325
|
+
}
|
326
|
+
|
327
|
+
/** Sets all coefficients in this expression to \a value.
|
328
|
+
*
|
329
|
+
* \sa fill(), setConstant(Index,const Scalar&), setConstant(Index,Index,const Scalar&), setZero(), setOnes(), Constant(), class CwiseNullaryOp, setZero(), setOnes()
|
330
|
+
*/
|
331
|
+
template<typename Derived>
|
332
|
+
EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setConstant(const Scalar& val)
|
333
|
+
{
|
334
|
+
return derived() = Constant(rows(), cols(), val);
|
335
|
+
}
|
336
|
+
|
337
|
+
/** Resizes to the given \a size, and sets all coefficients in this expression to the given \a value.
|
338
|
+
*
|
339
|
+
* \only_for_vectors
|
340
|
+
*
|
341
|
+
* Example: \include Matrix_setConstant_int.cpp
|
342
|
+
* Output: \verbinclude Matrix_setConstant_int.out
|
343
|
+
*
|
344
|
+
* \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&)
|
345
|
+
*/
|
346
|
+
template<typename Derived>
|
347
|
+
EIGEN_STRONG_INLINE Derived&
|
348
|
+
PlainObjectBase<Derived>::setConstant(Index size, const Scalar& val)
|
349
|
+
{
|
350
|
+
resize(size);
|
351
|
+
return setConstant(val);
|
352
|
+
}
|
353
|
+
|
354
|
+
/** Resizes to the given size, and sets all coefficients in this expression to the given \a value.
|
355
|
+
*
|
356
|
+
* \param nbRows the new number of rows
|
357
|
+
* \param nbCols the new number of columns
|
358
|
+
* \param val the value to which all coefficients are set
|
359
|
+
*
|
360
|
+
* Example: \include Matrix_setConstant_int_int.cpp
|
361
|
+
* Output: \verbinclude Matrix_setConstant_int_int.out
|
362
|
+
*
|
363
|
+
* \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&)
|
364
|
+
*/
|
365
|
+
template<typename Derived>
|
366
|
+
EIGEN_STRONG_INLINE Derived&
|
367
|
+
PlainObjectBase<Derived>::setConstant(Index nbRows, Index nbCols, const Scalar& val)
|
368
|
+
{
|
369
|
+
resize(nbRows, nbCols);
|
370
|
+
return setConstant(val);
|
371
|
+
}
|
372
|
+
|
373
|
+
/**
|
374
|
+
* \brief Sets a linearly space vector.
|
375
|
+
*
|
376
|
+
* The function generates 'size' equally spaced values in the closed interval [low,high].
|
377
|
+
* When size is set to 1, a vector of length 1 containing 'high' is returned.
|
378
|
+
*
|
379
|
+
* \only_for_vectors
|
380
|
+
*
|
381
|
+
* Example: \include DenseBase_setLinSpaced.cpp
|
382
|
+
* Output: \verbinclude DenseBase_setLinSpaced.out
|
383
|
+
*
|
384
|
+
* \sa CwiseNullaryOp
|
385
|
+
*/
|
386
|
+
template<typename Derived>
|
387
|
+
EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setLinSpaced(Index newSize, const Scalar& low, const Scalar& high)
|
388
|
+
{
|
389
|
+
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
390
|
+
return derived() = Derived::NullaryExpr(newSize, internal::linspaced_op<Scalar,false>(low,high,newSize));
|
391
|
+
}
|
392
|
+
|
393
|
+
/**
|
394
|
+
* \brief Sets a linearly space vector.
|
395
|
+
*
|
396
|
+
* The function fill *this with equally spaced values in the closed interval [low,high].
|
397
|
+
* When size is set to 1, a vector of length 1 containing 'high' is returned.
|
398
|
+
*
|
399
|
+
* \only_for_vectors
|
400
|
+
*
|
401
|
+
* \sa setLinSpaced(Index, const Scalar&, const Scalar&), CwiseNullaryOp
|
402
|
+
*/
|
403
|
+
template<typename Derived>
|
404
|
+
EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setLinSpaced(const Scalar& low, const Scalar& high)
|
405
|
+
{
|
406
|
+
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
407
|
+
return setLinSpaced(size(), low, high);
|
408
|
+
}
|
409
|
+
|
410
|
+
// zero:
|
411
|
+
|
412
|
+
/** \returns an expression of a zero matrix.
|
413
|
+
*
|
414
|
+
* The parameters \a rows and \a cols are the number of rows and of columns of
|
415
|
+
* the returned matrix. Must be compatible with this MatrixBase type.
|
416
|
+
*
|
417
|
+
* This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
|
418
|
+
* it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used
|
419
|
+
* instead.
|
420
|
+
*
|
421
|
+
* Example: \include MatrixBase_zero_int_int.cpp
|
422
|
+
* Output: \verbinclude MatrixBase_zero_int_int.out
|
423
|
+
*
|
424
|
+
* \sa Zero(), Zero(Index)
|
425
|
+
*/
|
426
|
+
template<typename Derived>
|
427
|
+
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
428
|
+
DenseBase<Derived>::Zero(Index nbRows, Index nbCols)
|
429
|
+
{
|
430
|
+
return Constant(nbRows, nbCols, Scalar(0));
|
431
|
+
}
|
432
|
+
|
433
|
+
/** \returns an expression of a zero vector.
|
434
|
+
*
|
435
|
+
* The parameter \a size is the size of the returned vector.
|
436
|
+
* Must be compatible with this MatrixBase type.
|
437
|
+
*
|
438
|
+
* \only_for_vectors
|
439
|
+
*
|
440
|
+
* This variant is meant to be used for dynamic-size vector types. For fixed-size types,
|
441
|
+
* it is redundant to pass \a size as argument, so Zero() should be used
|
442
|
+
* instead.
|
443
|
+
*
|
444
|
+
* Example: \include MatrixBase_zero_int.cpp
|
445
|
+
* Output: \verbinclude MatrixBase_zero_int.out
|
446
|
+
*
|
447
|
+
* \sa Zero(), Zero(Index,Index)
|
448
|
+
*/
|
449
|
+
template<typename Derived>
|
450
|
+
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
451
|
+
DenseBase<Derived>::Zero(Index size)
|
452
|
+
{
|
453
|
+
return Constant(size, Scalar(0));
|
454
|
+
}
|
455
|
+
|
456
|
+
/** \returns an expression of a fixed-size zero matrix or vector.
|
457
|
+
*
|
458
|
+
* This variant is only for fixed-size MatrixBase types. For dynamic-size types, you
|
459
|
+
* need to use the variants taking size arguments.
|
460
|
+
*
|
461
|
+
* Example: \include MatrixBase_zero.cpp
|
462
|
+
* Output: \verbinclude MatrixBase_zero.out
|
463
|
+
*
|
464
|
+
* \sa Zero(Index), Zero(Index,Index)
|
465
|
+
*/
|
466
|
+
template<typename Derived>
|
467
|
+
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
468
|
+
DenseBase<Derived>::Zero()
|
469
|
+
{
|
470
|
+
return Constant(Scalar(0));
|
471
|
+
}
|
472
|
+
|
473
|
+
/** \returns true if *this is approximately equal to the zero matrix,
|
474
|
+
* within the precision given by \a prec.
|
475
|
+
*
|
476
|
+
* Example: \include MatrixBase_isZero.cpp
|
477
|
+
* Output: \verbinclude MatrixBase_isZero.out
|
478
|
+
*
|
479
|
+
* \sa class CwiseNullaryOp, Zero()
|
480
|
+
*/
|
481
|
+
template<typename Derived>
|
482
|
+
bool DenseBase<Derived>::isZero(const RealScalar& prec) const
|
483
|
+
{
|
484
|
+
for(Index j = 0; j < cols(); ++j)
|
485
|
+
for(Index i = 0; i < rows(); ++i)
|
486
|
+
if(!internal::isMuchSmallerThan(this->coeff(i, j), static_cast<Scalar>(1), prec))
|
487
|
+
return false;
|
488
|
+
return true;
|
489
|
+
}
|
490
|
+
|
491
|
+
/** Sets all coefficients in this expression to zero.
|
492
|
+
*
|
493
|
+
* Example: \include MatrixBase_setZero.cpp
|
494
|
+
* Output: \verbinclude MatrixBase_setZero.out
|
495
|
+
*
|
496
|
+
* \sa class CwiseNullaryOp, Zero()
|
497
|
+
*/
|
498
|
+
template<typename Derived>
|
499
|
+
EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setZero()
|
500
|
+
{
|
501
|
+
return setConstant(Scalar(0));
|
502
|
+
}
|
503
|
+
|
504
|
+
/** Resizes to the given \a size, and sets all coefficients in this expression to zero.
|
505
|
+
*
|
506
|
+
* \only_for_vectors
|
507
|
+
*
|
508
|
+
* Example: \include Matrix_setZero_int.cpp
|
509
|
+
* Output: \verbinclude Matrix_setZero_int.out
|
510
|
+
*
|
511
|
+
* \sa DenseBase::setZero(), setZero(Index,Index), class CwiseNullaryOp, DenseBase::Zero()
|
512
|
+
*/
|
513
|
+
template<typename Derived>
|
514
|
+
EIGEN_STRONG_INLINE Derived&
|
515
|
+
PlainObjectBase<Derived>::setZero(Index newSize)
|
516
|
+
{
|
517
|
+
resize(newSize);
|
518
|
+
return setConstant(Scalar(0));
|
519
|
+
}
|
520
|
+
|
521
|
+
/** Resizes to the given size, and sets all coefficients in this expression to zero.
|
522
|
+
*
|
523
|
+
* \param nbRows the new number of rows
|
524
|
+
* \param nbCols the new number of columns
|
525
|
+
*
|
526
|
+
* Example: \include Matrix_setZero_int_int.cpp
|
527
|
+
* Output: \verbinclude Matrix_setZero_int_int.out
|
528
|
+
*
|
529
|
+
* \sa DenseBase::setZero(), setZero(Index), class CwiseNullaryOp, DenseBase::Zero()
|
530
|
+
*/
|
531
|
+
template<typename Derived>
|
532
|
+
EIGEN_STRONG_INLINE Derived&
|
533
|
+
PlainObjectBase<Derived>::setZero(Index nbRows, Index nbCols)
|
534
|
+
{
|
535
|
+
resize(nbRows, nbCols);
|
536
|
+
return setConstant(Scalar(0));
|
537
|
+
}
|
538
|
+
|
539
|
+
// ones:
|
540
|
+
|
541
|
+
/** \returns an expression of a matrix where all coefficients equal one.
|
542
|
+
*
|
543
|
+
* The parameters \a nbRows and \a nbCols are the number of rows and of columns of
|
544
|
+
* the returned matrix. Must be compatible with this MatrixBase type.
|
545
|
+
*
|
546
|
+
* This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
|
547
|
+
* it is redundant to pass \a rows and \a cols as arguments, so Ones() should be used
|
548
|
+
* instead.
|
549
|
+
*
|
550
|
+
* Example: \include MatrixBase_ones_int_int.cpp
|
551
|
+
* Output: \verbinclude MatrixBase_ones_int_int.out
|
552
|
+
*
|
553
|
+
* \sa Ones(), Ones(Index), isOnes(), class Ones
|
554
|
+
*/
|
555
|
+
template<typename Derived>
|
556
|
+
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
557
|
+
DenseBase<Derived>::Ones(Index nbRows, Index nbCols)
|
558
|
+
{
|
559
|
+
return Constant(nbRows, nbCols, Scalar(1));
|
560
|
+
}
|
561
|
+
|
562
|
+
/** \returns an expression of a vector where all coefficients equal one.
|
563
|
+
*
|
564
|
+
* The parameter \a newSize is the size of the returned vector.
|
565
|
+
* Must be compatible with this MatrixBase type.
|
566
|
+
*
|
567
|
+
* \only_for_vectors
|
568
|
+
*
|
569
|
+
* This variant is meant to be used for dynamic-size vector types. For fixed-size types,
|
570
|
+
* it is redundant to pass \a size as argument, so Ones() should be used
|
571
|
+
* instead.
|
572
|
+
*
|
573
|
+
* Example: \include MatrixBase_ones_int.cpp
|
574
|
+
* Output: \verbinclude MatrixBase_ones_int.out
|
575
|
+
*
|
576
|
+
* \sa Ones(), Ones(Index,Index), isOnes(), class Ones
|
577
|
+
*/
|
578
|
+
template<typename Derived>
|
579
|
+
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
580
|
+
DenseBase<Derived>::Ones(Index newSize)
|
581
|
+
{
|
582
|
+
return Constant(newSize, Scalar(1));
|
583
|
+
}
|
584
|
+
|
585
|
+
/** \returns an expression of a fixed-size matrix or vector where all coefficients equal one.
|
586
|
+
*
|
587
|
+
* This variant is only for fixed-size MatrixBase types. For dynamic-size types, you
|
588
|
+
* need to use the variants taking size arguments.
|
589
|
+
*
|
590
|
+
* Example: \include MatrixBase_ones.cpp
|
591
|
+
* Output: \verbinclude MatrixBase_ones.out
|
592
|
+
*
|
593
|
+
* \sa Ones(Index), Ones(Index,Index), isOnes(), class Ones
|
594
|
+
*/
|
595
|
+
template<typename Derived>
|
596
|
+
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
597
|
+
DenseBase<Derived>::Ones()
|
598
|
+
{
|
599
|
+
return Constant(Scalar(1));
|
600
|
+
}
|
601
|
+
|
602
|
+
/** \returns true if *this is approximately equal to the matrix where all coefficients
|
603
|
+
* are equal to 1, within the precision given by \a prec.
|
604
|
+
*
|
605
|
+
* Example: \include MatrixBase_isOnes.cpp
|
606
|
+
* Output: \verbinclude MatrixBase_isOnes.out
|
607
|
+
*
|
608
|
+
* \sa class CwiseNullaryOp, Ones()
|
609
|
+
*/
|
610
|
+
template<typename Derived>
|
611
|
+
bool DenseBase<Derived>::isOnes
|
612
|
+
(const RealScalar& prec) const
|
613
|
+
{
|
614
|
+
return isApproxToConstant(Scalar(1), prec);
|
615
|
+
}
|
616
|
+
|
617
|
+
/** Sets all coefficients in this expression to one.
|
618
|
+
*
|
619
|
+
* Example: \include MatrixBase_setOnes.cpp
|
620
|
+
* Output: \verbinclude MatrixBase_setOnes.out
|
621
|
+
*
|
622
|
+
* \sa class CwiseNullaryOp, Ones()
|
623
|
+
*/
|
624
|
+
template<typename Derived>
|
625
|
+
EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setOnes()
|
626
|
+
{
|
627
|
+
return setConstant(Scalar(1));
|
628
|
+
}
|
629
|
+
|
630
|
+
/** Resizes to the given \a newSize, and sets all coefficients in this expression to one.
|
631
|
+
*
|
632
|
+
* \only_for_vectors
|
633
|
+
*
|
634
|
+
* Example: \include Matrix_setOnes_int.cpp
|
635
|
+
* Output: \verbinclude Matrix_setOnes_int.out
|
636
|
+
*
|
637
|
+
* \sa MatrixBase::setOnes(), setOnes(Index,Index), class CwiseNullaryOp, MatrixBase::Ones()
|
638
|
+
*/
|
639
|
+
template<typename Derived>
|
640
|
+
EIGEN_STRONG_INLINE Derived&
|
641
|
+
PlainObjectBase<Derived>::setOnes(Index newSize)
|
642
|
+
{
|
643
|
+
resize(newSize);
|
644
|
+
return setConstant(Scalar(1));
|
645
|
+
}
|
646
|
+
|
647
|
+
/** Resizes to the given size, and sets all coefficients in this expression to one.
|
648
|
+
*
|
649
|
+
* \param nbRows the new number of rows
|
650
|
+
* \param nbCols the new number of columns
|
651
|
+
*
|
652
|
+
* Example: \include Matrix_setOnes_int_int.cpp
|
653
|
+
* Output: \verbinclude Matrix_setOnes_int_int.out
|
654
|
+
*
|
655
|
+
* \sa MatrixBase::setOnes(), setOnes(Index), class CwiseNullaryOp, MatrixBase::Ones()
|
656
|
+
*/
|
657
|
+
template<typename Derived>
|
658
|
+
EIGEN_STRONG_INLINE Derived&
|
659
|
+
PlainObjectBase<Derived>::setOnes(Index nbRows, Index nbCols)
|
660
|
+
{
|
661
|
+
resize(nbRows, nbCols);
|
662
|
+
return setConstant(Scalar(1));
|
663
|
+
}
|
664
|
+
|
665
|
+
// Identity:
|
666
|
+
|
667
|
+
/** \returns an expression of the identity matrix (not necessarily square).
|
668
|
+
*
|
669
|
+
* The parameters \a nbRows and \a nbCols are the number of rows and of columns of
|
670
|
+
* the returned matrix. Must be compatible with this MatrixBase type.
|
671
|
+
*
|
672
|
+
* This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
|
673
|
+
* it is redundant to pass \a rows and \a cols as arguments, so Identity() should be used
|
674
|
+
* instead.
|
675
|
+
*
|
676
|
+
* Example: \include MatrixBase_identity_int_int.cpp
|
677
|
+
* Output: \verbinclude MatrixBase_identity_int_int.out
|
678
|
+
*
|
679
|
+
* \sa Identity(), setIdentity(), isIdentity()
|
680
|
+
*/
|
681
|
+
template<typename Derived>
|
682
|
+
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::IdentityReturnType
|
683
|
+
MatrixBase<Derived>::Identity(Index nbRows, Index nbCols)
|
684
|
+
{
|
685
|
+
return DenseBase<Derived>::NullaryExpr(nbRows, nbCols, internal::scalar_identity_op<Scalar>());
|
686
|
+
}
|
687
|
+
|
688
|
+
/** \returns an expression of the identity matrix (not necessarily square).
|
689
|
+
*
|
690
|
+
* This variant is only for fixed-size MatrixBase types. For dynamic-size types, you
|
691
|
+
* need to use the variant taking size arguments.
|
692
|
+
*
|
693
|
+
* Example: \include MatrixBase_identity.cpp
|
694
|
+
* Output: \verbinclude MatrixBase_identity.out
|
695
|
+
*
|
696
|
+
* \sa Identity(Index,Index), setIdentity(), isIdentity()
|
697
|
+
*/
|
698
|
+
template<typename Derived>
|
699
|
+
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::IdentityReturnType
|
700
|
+
MatrixBase<Derived>::Identity()
|
701
|
+
{
|
702
|
+
EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
|
703
|
+
return MatrixBase<Derived>::NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_identity_op<Scalar>());
|
704
|
+
}
|
705
|
+
|
706
|
+
/** \returns true if *this is approximately equal to the identity matrix
|
707
|
+
* (not necessarily square),
|
708
|
+
* within the precision given by \a prec.
|
709
|
+
*
|
710
|
+
* Example: \include MatrixBase_isIdentity.cpp
|
711
|
+
* Output: \verbinclude MatrixBase_isIdentity.out
|
712
|
+
*
|
713
|
+
* \sa class CwiseNullaryOp, Identity(), Identity(Index,Index), setIdentity()
|
714
|
+
*/
|
715
|
+
template<typename Derived>
|
716
|
+
bool MatrixBase<Derived>::isIdentity
|
717
|
+
(const RealScalar& prec) const
|
718
|
+
{
|
719
|
+
for(Index j = 0; j < cols(); ++j)
|
720
|
+
{
|
721
|
+
for(Index i = 0; i < rows(); ++i)
|
722
|
+
{
|
723
|
+
if(i == j)
|
724
|
+
{
|
725
|
+
if(!internal::isApprox(this->coeff(i, j), static_cast<Scalar>(1), prec))
|
726
|
+
return false;
|
727
|
+
}
|
728
|
+
else
|
729
|
+
{
|
730
|
+
if(!internal::isMuchSmallerThan(this->coeff(i, j), static_cast<RealScalar>(1), prec))
|
731
|
+
return false;
|
732
|
+
}
|
733
|
+
}
|
734
|
+
}
|
735
|
+
return true;
|
736
|
+
}
|
737
|
+
|
738
|
+
namespace internal {
|
739
|
+
|
740
|
+
template<typename Derived, bool Big = (Derived::SizeAtCompileTime>=16)>
|
741
|
+
struct setIdentity_impl
|
742
|
+
{
|
743
|
+
static EIGEN_STRONG_INLINE Derived& run(Derived& m)
|
744
|
+
{
|
745
|
+
return m = Derived::Identity(m.rows(), m.cols());
|
746
|
+
}
|
747
|
+
};
|
748
|
+
|
749
|
+
template<typename Derived>
|
750
|
+
struct setIdentity_impl<Derived, true>
|
751
|
+
{
|
752
|
+
typedef typename Derived::Index Index;
|
753
|
+
static EIGEN_STRONG_INLINE Derived& run(Derived& m)
|
754
|
+
{
|
755
|
+
m.setZero();
|
756
|
+
const Index size = (std::min)(m.rows(), m.cols());
|
757
|
+
for(Index i = 0; i < size; ++i) m.coeffRef(i,i) = typename Derived::Scalar(1);
|
758
|
+
return m;
|
759
|
+
}
|
760
|
+
};
|
761
|
+
|
762
|
+
} // end namespace internal
|
763
|
+
|
764
|
+
/** Writes the identity expression (not necessarily square) into *this.
|
765
|
+
*
|
766
|
+
* Example: \include MatrixBase_setIdentity.cpp
|
767
|
+
* Output: \verbinclude MatrixBase_setIdentity.out
|
768
|
+
*
|
769
|
+
* \sa class CwiseNullaryOp, Identity(), Identity(Index,Index), isIdentity()
|
770
|
+
*/
|
771
|
+
template<typename Derived>
|
772
|
+
EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setIdentity()
|
773
|
+
{
|
774
|
+
return internal::setIdentity_impl<Derived>::run(derived());
|
775
|
+
}
|
776
|
+
|
777
|
+
/** \brief Resizes to the given size, and writes the identity expression (not necessarily square) into *this.
|
778
|
+
*
|
779
|
+
* \param nbRows the new number of rows
|
780
|
+
* \param nbCols the new number of columns
|
781
|
+
*
|
782
|
+
* Example: \include Matrix_setIdentity_int_int.cpp
|
783
|
+
* Output: \verbinclude Matrix_setIdentity_int_int.out
|
784
|
+
*
|
785
|
+
* \sa MatrixBase::setIdentity(), class CwiseNullaryOp, MatrixBase::Identity()
|
786
|
+
*/
|
787
|
+
template<typename Derived>
|
788
|
+
EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setIdentity(Index nbRows, Index nbCols)
|
789
|
+
{
|
790
|
+
derived().resize(nbRows, nbCols);
|
791
|
+
return setIdentity();
|
792
|
+
}
|
793
|
+
|
794
|
+
/** \returns an expression of the i-th unit (basis) vector.
|
795
|
+
*
|
796
|
+
* \only_for_vectors
|
797
|
+
*
|
798
|
+
* \sa MatrixBase::Unit(Index), MatrixBase::UnitX(), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
|
799
|
+
*/
|
800
|
+
template<typename Derived>
|
801
|
+
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::Unit(Index newSize, Index i)
|
802
|
+
{
|
803
|
+
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
804
|
+
return BasisReturnType(SquareMatrixType::Identity(newSize,newSize), i);
|
805
|
+
}
|
806
|
+
|
807
|
+
/** \returns an expression of the i-th unit (basis) vector.
|
808
|
+
*
|
809
|
+
* \only_for_vectors
|
810
|
+
*
|
811
|
+
* This variant is for fixed-size vector only.
|
812
|
+
*
|
813
|
+
* \sa MatrixBase::Unit(Index,Index), MatrixBase::UnitX(), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
|
814
|
+
*/
|
815
|
+
template<typename Derived>
|
816
|
+
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::Unit(Index i)
|
817
|
+
{
|
818
|
+
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
819
|
+
return BasisReturnType(SquareMatrixType::Identity(),i);
|
820
|
+
}
|
821
|
+
|
822
|
+
/** \returns an expression of the X axis unit vector (1{,0}^*)
|
823
|
+
*
|
824
|
+
* \only_for_vectors
|
825
|
+
*
|
826
|
+
* \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
|
827
|
+
*/
|
828
|
+
template<typename Derived>
|
829
|
+
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitX()
|
830
|
+
{ return Derived::Unit(0); }
|
831
|
+
|
832
|
+
/** \returns an expression of the Y axis unit vector (0,1{,0}^*)
|
833
|
+
*
|
834
|
+
* \only_for_vectors
|
835
|
+
*
|
836
|
+
* \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
|
837
|
+
*/
|
838
|
+
template<typename Derived>
|
839
|
+
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitY()
|
840
|
+
{ return Derived::Unit(1); }
|
841
|
+
|
842
|
+
/** \returns an expression of the Z axis unit vector (0,0,1{,0}^*)
|
843
|
+
*
|
844
|
+
* \only_for_vectors
|
845
|
+
*
|
846
|
+
* \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
|
847
|
+
*/
|
848
|
+
template<typename Derived>
|
849
|
+
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitZ()
|
850
|
+
{ return Derived::Unit(2); }
|
851
|
+
|
852
|
+
/** \returns an expression of the W axis unit vector (0,0,0,1)
|
853
|
+
*
|
854
|
+
* \only_for_vectors
|
855
|
+
*
|
856
|
+
* \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
|
857
|
+
*/
|
858
|
+
template<typename Derived>
|
859
|
+
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitW()
|
860
|
+
{ return Derived::Unit(3); }
|
861
|
+
|
862
|
+
} // end namespace Eigen
|
863
|
+
|
864
|
+
#endif // EIGEN_CWISE_NULLARY_OP_H
|