@smake/eigen 1.0.2 → 1.1.1
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.
- package/README.md +1 -1
- package/eigen/Eigen/AccelerateSupport +52 -0
- package/eigen/Eigen/Cholesky +18 -21
- package/eigen/Eigen/CholmodSupport +28 -28
- package/eigen/Eigen/Core +235 -326
- package/eigen/Eigen/Eigenvalues +16 -14
- package/eigen/Eigen/Geometry +21 -24
- package/eigen/Eigen/Householder +9 -8
- package/eigen/Eigen/IterativeLinearSolvers +8 -4
- package/eigen/Eigen/Jacobi +14 -14
- package/eigen/Eigen/KLUSupport +43 -0
- package/eigen/Eigen/LU +16 -20
- package/eigen/Eigen/MetisSupport +12 -12
- package/eigen/Eigen/OrderingMethods +54 -54
- package/eigen/Eigen/PaStiXSupport +23 -20
- package/eigen/Eigen/PardisoSupport +17 -14
- package/eigen/Eigen/QR +18 -21
- package/eigen/Eigen/QtAlignedMalloc +5 -13
- package/eigen/Eigen/SPQRSupport +21 -14
- package/eigen/Eigen/SVD +23 -18
- package/eigen/Eigen/Sparse +1 -4
- package/eigen/Eigen/SparseCholesky +18 -23
- package/eigen/Eigen/SparseCore +18 -17
- package/eigen/Eigen/SparseLU +12 -8
- package/eigen/Eigen/SparseQR +16 -14
- package/eigen/Eigen/StdDeque +5 -2
- package/eigen/Eigen/StdList +5 -2
- package/eigen/Eigen/StdVector +5 -2
- package/eigen/Eigen/SuperLUSupport +30 -24
- package/eigen/Eigen/ThreadPool +80 -0
- package/eigen/Eigen/UmfPackSupport +19 -17
- package/eigen/Eigen/Version +14 -0
- package/eigen/Eigen/src/AccelerateSupport/AccelerateSupport.h +423 -0
- package/eigen/Eigen/src/AccelerateSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Cholesky/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Cholesky/LDLT.h +377 -401
- package/eigen/Eigen/src/Cholesky/LLT.h +332 -360
- package/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h +81 -56
- package/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +620 -521
- package/eigen/Eigen/src/CholmodSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Core/ArithmeticSequence.h +239 -0
- package/eigen/Eigen/src/Core/Array.h +341 -294
- package/eigen/Eigen/src/Core/ArrayBase.h +190 -203
- package/eigen/Eigen/src/Core/ArrayWrapper.h +127 -171
- package/eigen/Eigen/src/Core/Assign.h +30 -40
- package/eigen/Eigen/src/Core/AssignEvaluator.h +711 -589
- package/eigen/Eigen/src/Core/Assign_MKL.h +130 -125
- package/eigen/Eigen/src/Core/BandMatrix.h +268 -283
- package/eigen/Eigen/src/Core/Block.h +375 -398
- package/eigen/Eigen/src/Core/CommaInitializer.h +86 -97
- package/eigen/Eigen/src/Core/ConditionEstimator.h +51 -53
- package/eigen/Eigen/src/Core/CoreEvaluators.h +1356 -1026
- package/eigen/Eigen/src/Core/CoreIterators.h +73 -59
- package/eigen/Eigen/src/Core/CwiseBinaryOp.h +114 -132
- package/eigen/Eigen/src/Core/CwiseNullaryOp.h +726 -617
- package/eigen/Eigen/src/Core/CwiseTernaryOp.h +77 -103
- package/eigen/Eigen/src/Core/CwiseUnaryOp.h +56 -68
- package/eigen/Eigen/src/Core/CwiseUnaryView.h +132 -95
- package/eigen/Eigen/src/Core/DenseBase.h +632 -571
- package/eigen/Eigen/src/Core/DenseCoeffsBase.h +511 -624
- package/eigen/Eigen/src/Core/DenseStorage.h +512 -509
- package/eigen/Eigen/src/Core/DeviceWrapper.h +153 -0
- package/eigen/Eigen/src/Core/Diagonal.h +169 -210
- package/eigen/Eigen/src/Core/DiagonalMatrix.h +351 -274
- package/eigen/Eigen/src/Core/DiagonalProduct.h +12 -10
- package/eigen/Eigen/src/Core/Dot.h +172 -222
- package/eigen/Eigen/src/Core/EigenBase.h +75 -85
- package/eigen/Eigen/src/Core/Fill.h +138 -0
- package/eigen/Eigen/src/Core/FindCoeff.h +464 -0
- package/eigen/Eigen/src/Core/ForceAlignedAccess.h +90 -109
- package/eigen/Eigen/src/Core/Fuzzy.h +82 -105
- package/eigen/Eigen/src/Core/GeneralProduct.h +327 -263
- package/eigen/Eigen/src/Core/GenericPacketMath.h +1472 -360
- package/eigen/Eigen/src/Core/GlobalFunctions.h +194 -151
- package/eigen/Eigen/src/Core/IO.h +147 -139
- package/eigen/Eigen/src/Core/IndexedView.h +321 -0
- package/eigen/Eigen/src/Core/InnerProduct.h +260 -0
- package/eigen/Eigen/src/Core/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Core/Inverse.h +56 -66
- package/eigen/Eigen/src/Core/Map.h +124 -142
- package/eigen/Eigen/src/Core/MapBase.h +256 -281
- package/eigen/Eigen/src/Core/MathFunctions.h +1620 -938
- package/eigen/Eigen/src/Core/MathFunctionsImpl.h +233 -71
- package/eigen/Eigen/src/Core/Matrix.h +491 -416
- package/eigen/Eigen/src/Core/MatrixBase.h +468 -453
- package/eigen/Eigen/src/Core/NestByValue.h +66 -85
- package/eigen/Eigen/src/Core/NoAlias.h +79 -85
- package/eigen/Eigen/src/Core/NumTraits.h +235 -148
- package/eigen/Eigen/src/Core/PartialReduxEvaluator.h +253 -0
- package/eigen/Eigen/src/Core/PermutationMatrix.h +461 -511
- package/eigen/Eigen/src/Core/PlainObjectBase.h +871 -894
- package/eigen/Eigen/src/Core/Product.h +260 -139
- package/eigen/Eigen/src/Core/ProductEvaluators.h +863 -714
- package/eigen/Eigen/src/Core/Random.h +161 -136
- package/eigen/Eigen/src/Core/RandomImpl.h +262 -0
- package/eigen/Eigen/src/Core/RealView.h +250 -0
- package/eigen/Eigen/src/Core/Redux.h +366 -336
- package/eigen/Eigen/src/Core/Ref.h +308 -209
- package/eigen/Eigen/src/Core/Replicate.h +94 -106
- package/eigen/Eigen/src/Core/Reshaped.h +398 -0
- package/eigen/Eigen/src/Core/ReturnByValue.h +49 -55
- package/eigen/Eigen/src/Core/Reverse.h +136 -145
- package/eigen/Eigen/src/Core/Select.h +70 -140
- package/eigen/Eigen/src/Core/SelfAdjointView.h +262 -285
- package/eigen/Eigen/src/Core/SelfCwiseBinaryOp.h +23 -20
- package/eigen/Eigen/src/Core/SkewSymmetricMatrix3.h +382 -0
- package/eigen/Eigen/src/Core/Solve.h +97 -111
- package/eigen/Eigen/src/Core/SolveTriangular.h +131 -129
- package/eigen/Eigen/src/Core/SolverBase.h +138 -101
- package/eigen/Eigen/src/Core/StableNorm.h +156 -160
- package/eigen/Eigen/src/Core/StlIterators.h +619 -0
- package/eigen/Eigen/src/Core/Stride.h +91 -88
- package/eigen/Eigen/src/Core/Swap.h +70 -38
- package/eigen/Eigen/src/Core/Transpose.h +295 -273
- package/eigen/Eigen/src/Core/Transpositions.h +272 -317
- package/eigen/Eigen/src/Core/TriangularMatrix.h +670 -755
- package/eigen/Eigen/src/Core/VectorBlock.h +59 -72
- package/eigen/Eigen/src/Core/VectorwiseOp.h +668 -630
- package/eigen/Eigen/src/Core/Visitor.h +480 -216
- package/eigen/Eigen/src/Core/arch/AVX/Complex.h +407 -293
- package/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +79 -388
- package/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +2935 -491
- package/eigen/Eigen/src/Core/arch/AVX/Reductions.h +353 -0
- package/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +279 -22
- package/eigen/Eigen/src/Core/arch/AVX512/Complex.h +472 -0
- package/eigen/Eigen/src/Core/arch/AVX512/GemmKernel.h +1245 -0
- package/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +85 -333
- package/eigen/Eigen/src/Core/arch/AVX512/MathFunctionsFP16.h +75 -0
- package/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +2490 -649
- package/eigen/Eigen/src/Core/arch/AVX512/PacketMathFP16.h +1413 -0
- package/eigen/Eigen/src/Core/arch/AVX512/Reductions.h +297 -0
- package/eigen/Eigen/src/Core/arch/AVX512/TrsmKernel.h +1167 -0
- package/eigen/Eigen/src/Core/arch/AVX512/TrsmUnrolls.inc +1219 -0
- package/eigen/Eigen/src/Core/arch/AVX512/TypeCasting.h +277 -0
- package/eigen/Eigen/src/Core/arch/AVX512/TypeCastingFP16.h +130 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +521 -298
- package/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +39 -280
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +3686 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +205 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +901 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMAbfloat16.h +742 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixVectorProduct.inc +2818 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h +3391 -723
- package/eigen/Eigen/src/Core/arch/AltiVec/TypeCasting.h +153 -0
- package/eigen/Eigen/src/Core/arch/Default/BFloat16.h +866 -0
- package/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +113 -14
- package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +2634 -0
- package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +227 -0
- package/eigen/Eigen/src/Core/arch/Default/Half.h +1091 -0
- package/eigen/Eigen/src/Core/arch/Default/Settings.h +11 -13
- package/eigen/Eigen/src/Core/arch/GPU/Complex.h +244 -0
- package/eigen/Eigen/src/Core/arch/GPU/MathFunctions.h +104 -0
- package/eigen/Eigen/src/Core/arch/GPU/PacketMath.h +1712 -0
- package/eigen/Eigen/src/Core/arch/GPU/Tuple.h +268 -0
- package/eigen/Eigen/src/Core/arch/GPU/TypeCasting.h +77 -0
- package/eigen/Eigen/src/Core/arch/HIP/hcc/math_constants.h +23 -0
- package/eigen/Eigen/src/Core/arch/HVX/PacketMath.h +1088 -0
- package/eigen/Eigen/src/Core/arch/LSX/Complex.h +520 -0
- package/eigen/Eigen/src/Core/arch/LSX/GeneralBlockPanelKernel.h +23 -0
- package/eigen/Eigen/src/Core/arch/LSX/MathFunctions.h +43 -0
- package/eigen/Eigen/src/Core/arch/LSX/PacketMath.h +2866 -0
- package/eigen/Eigen/src/Core/arch/LSX/TypeCasting.h +526 -0
- package/eigen/Eigen/src/Core/arch/MSA/Complex.h +620 -0
- package/eigen/Eigen/src/Core/arch/MSA/MathFunctions.h +379 -0
- package/eigen/Eigen/src/Core/arch/MSA/PacketMath.h +1237 -0
- package/eigen/Eigen/src/Core/arch/NEON/Complex.h +531 -289
- package/eigen/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +243 -0
- package/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +50 -73
- package/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +5915 -579
- package/eigen/Eigen/src/Core/arch/NEON/TypeCasting.h +1642 -0
- package/eigen/Eigen/src/Core/arch/NEON/UnaryFunctors.h +57 -0
- package/eigen/Eigen/src/Core/arch/SSE/Complex.h +366 -334
- package/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +40 -514
- package/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +2164 -675
- package/eigen/Eigen/src/Core/arch/SSE/Reductions.h +324 -0
- package/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +188 -35
- package/eigen/Eigen/src/Core/arch/SVE/MathFunctions.h +48 -0
- package/eigen/Eigen/src/Core/arch/SVE/PacketMath.h +674 -0
- package/eigen/Eigen/src/Core/arch/SVE/TypeCasting.h +52 -0
- package/eigen/Eigen/src/Core/arch/SYCL/InteropHeaders.h +227 -0
- package/eigen/Eigen/src/Core/arch/SYCL/MathFunctions.h +303 -0
- package/eigen/Eigen/src/Core/arch/SYCL/PacketMath.h +576 -0
- package/eigen/Eigen/src/Core/arch/SYCL/TypeCasting.h +83 -0
- package/eigen/Eigen/src/Core/arch/ZVector/Complex.h +434 -261
- package/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +160 -53
- package/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +1073 -605
- package/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +123 -117
- package/eigen/Eigen/src/Core/functors/BinaryFunctors.h +594 -322
- package/eigen/Eigen/src/Core/functors/NullaryFunctors.h +204 -118
- package/eigen/Eigen/src/Core/functors/StlFunctors.h +110 -97
- package/eigen/Eigen/src/Core/functors/TernaryFunctors.h +34 -7
- package/eigen/Eigen/src/Core/functors/UnaryFunctors.h +1158 -530
- package/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +2329 -1333
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +328 -364
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +191 -178
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +85 -82
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +154 -73
- package/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +396 -542
- package/eigen/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +80 -77
- package/eigen/Eigen/src/Core/products/Parallelizer.h +208 -92
- package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +331 -375
- package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +206 -224
- package/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +139 -146
- package/eigen/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h +58 -61
- package/eigen/Eigen/src/Core/products/SelfadjointProduct.h +71 -71
- package/eigen/Eigen/src/Core/products/SelfadjointRank2Update.h +48 -46
- package/eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h +294 -369
- package/eigen/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +246 -238
- package/eigen/Eigen/src/Core/products/TriangularMatrixVector.h +244 -247
- package/eigen/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h +212 -192
- package/eigen/Eigen/src/Core/products/TriangularSolverMatrix.h +328 -275
- package/eigen/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +108 -109
- package/eigen/Eigen/src/Core/products/TriangularSolverVector.h +70 -93
- package/eigen/Eigen/src/Core/util/Assert.h +158 -0
- package/eigen/Eigen/src/Core/util/BlasUtil.h +413 -290
- package/eigen/Eigen/src/Core/util/ConfigureVectorization.h +543 -0
- package/eigen/Eigen/src/Core/util/Constants.h +314 -263
- package/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +130 -78
- package/eigen/Eigen/src/Core/util/EmulateArray.h +270 -0
- package/eigen/Eigen/src/Core/util/ForwardDeclarations.h +450 -224
- package/eigen/Eigen/src/Core/util/GpuHipCudaDefines.inc +101 -0
- package/eigen/Eigen/src/Core/util/GpuHipCudaUndefines.inc +45 -0
- package/eigen/Eigen/src/Core/util/IndexedViewHelper.h +487 -0
- package/eigen/Eigen/src/Core/util/IntegralConstant.h +279 -0
- package/eigen/Eigen/src/Core/util/MKL_support.h +39 -30
- package/eigen/Eigen/src/Core/util/Macros.h +939 -646
- package/eigen/Eigen/src/Core/util/MaxSizeVector.h +139 -0
- package/eigen/Eigen/src/Core/util/Memory.h +1042 -650
- package/eigen/Eigen/src/Core/util/Meta.h +618 -426
- package/eigen/Eigen/src/Core/util/MoreMeta.h +638 -0
- package/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h +32 -19
- package/eigen/Eigen/src/Core/util/ReshapedHelper.h +51 -0
- package/eigen/Eigen/src/Core/util/Serializer.h +209 -0
- package/eigen/Eigen/src/Core/util/StaticAssert.h +51 -164
- package/eigen/Eigen/src/Core/util/SymbolicIndex.h +445 -0
- package/eigen/Eigen/src/Core/util/XprHelper.h +793 -538
- package/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h +246 -277
- package/eigen/Eigen/src/Eigenvalues/ComplexSchur.h +299 -319
- package/eigen/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h +52 -48
- package/eigen/Eigen/src/Eigenvalues/EigenSolver.h +413 -456
- package/eigen/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +309 -325
- package/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +157 -171
- package/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h +292 -310
- package/eigen/Eigen/src/Eigenvalues/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +91 -107
- package/eigen/Eigen/src/Eigenvalues/RealQZ.h +539 -606
- package/eigen/Eigen/src/Eigenvalues/RealSchur.h +348 -382
- package/eigen/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +41 -35
- package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +579 -600
- package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +47 -44
- package/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +434 -461
- package/eigen/Eigen/src/Geometry/AlignedBox.h +307 -214
- package/eigen/Eigen/src/Geometry/AngleAxis.h +135 -137
- package/eigen/Eigen/src/Geometry/EulerAngles.h +163 -74
- package/eigen/Eigen/src/Geometry/Homogeneous.h +289 -333
- package/eigen/Eigen/src/Geometry/Hyperplane.h +152 -161
- package/eigen/Eigen/src/Geometry/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Geometry/OrthoMethods.h +168 -145
- package/eigen/Eigen/src/Geometry/ParametrizedLine.h +141 -104
- package/eigen/Eigen/src/Geometry/Quaternion.h +595 -497
- package/eigen/Eigen/src/Geometry/Rotation2D.h +110 -108
- package/eigen/Eigen/src/Geometry/RotationBase.h +148 -145
- package/eigen/Eigen/src/Geometry/Scaling.h +115 -90
- package/eigen/Eigen/src/Geometry/Transform.h +896 -953
- package/eigen/Eigen/src/Geometry/Translation.h +100 -98
- package/eigen/Eigen/src/Geometry/Umeyama.h +79 -84
- package/eigen/Eigen/src/Geometry/arch/Geometry_SIMD.h +154 -0
- package/eigen/Eigen/src/Householder/BlockHouseholder.h +54 -42
- package/eigen/Eigen/src/Householder/Householder.h +104 -122
- package/eigen/Eigen/src/Householder/HouseholderSequence.h +416 -382
- package/eigen/Eigen/src/Householder/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +153 -166
- package/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +127 -138
- package/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +95 -124
- package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +269 -267
- package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +246 -259
- package/eigen/Eigen/src/IterativeLinearSolvers/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +218 -217
- package/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +80 -103
- package/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +59 -63
- package/eigen/Eigen/src/Jacobi/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Jacobi/Jacobi.h +256 -291
- package/eigen/Eigen/src/KLUSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/KLUSupport/KLUSupport.h +339 -0
- package/eigen/Eigen/src/LU/Determinant.h +60 -63
- package/eigen/Eigen/src/LU/FullPivLU.h +561 -626
- package/eigen/Eigen/src/LU/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/LU/InverseImpl.h +213 -275
- package/eigen/Eigen/src/LU/PartialPivLU.h +407 -435
- package/eigen/Eigen/src/LU/PartialPivLU_LAPACKE.h +54 -40
- package/eigen/Eigen/src/LU/arch/InverseSize4.h +353 -0
- package/eigen/Eigen/src/MetisSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/MetisSupport/MetisSupport.h +81 -93
- package/eigen/Eigen/src/OrderingMethods/Amd.h +250 -282
- package/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +950 -1103
- package/eigen/Eigen/src/OrderingMethods/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/OrderingMethods/Ordering.h +111 -122
- package/eigen/Eigen/src/PaStiXSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h +524 -570
- package/eigen/Eigen/src/PardisoSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/PardisoSupport/PardisoSupport.h +385 -429
- package/eigen/Eigen/src/QR/ColPivHouseholderQR.h +494 -473
- package/eigen/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +120 -56
- package/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +223 -137
- package/eigen/Eigen/src/QR/FullPivHouseholderQR.h +517 -460
- package/eigen/Eigen/src/QR/HouseholderQR.h +412 -278
- package/eigen/Eigen/src/QR/HouseholderQR_LAPACKE.h +32 -23
- package/eigen/Eigen/src/QR/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SPQRSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +263 -261
- package/eigen/Eigen/src/SVD/BDCSVD.h +872 -679
- package/eigen/Eigen/src/SVD/BDCSVD_LAPACKE.h +174 -0
- package/eigen/Eigen/src/SVD/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SVD/JacobiSVD.h +585 -543
- package/eigen/Eigen/src/SVD/JacobiSVD_LAPACKE.h +85 -49
- package/eigen/Eigen/src/SVD/SVDBase.h +281 -160
- package/eigen/Eigen/src/SVD/UpperBidiagonalization.h +202 -237
- package/eigen/Eigen/src/SparseCholesky/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +769 -590
- package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +318 -129
- package/eigen/Eigen/src/SparseCore/AmbiVector.h +202 -251
- package/eigen/Eigen/src/SparseCore/CompressedStorage.h +184 -236
- package/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +140 -184
- package/eigen/Eigen/src/SparseCore/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SparseCore/SparseAssign.h +174 -111
- package/eigen/Eigen/src/SparseCore/SparseBlock.h +408 -477
- package/eigen/Eigen/src/SparseCore/SparseColEtree.h +100 -112
- package/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +531 -280
- package/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +559 -347
- package/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +100 -108
- package/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +185 -191
- package/eigen/Eigen/src/SparseCore/SparseDiagonalProduct.h +71 -71
- package/eigen/Eigen/src/SparseCore/SparseDot.h +49 -47
- package/eigen/Eigen/src/SparseCore/SparseFuzzy.h +13 -11
- package/eigen/Eigen/src/SparseCore/SparseMap.h +243 -253
- package/eigen/Eigen/src/SparseCore/SparseMatrix.h +1614 -1142
- package/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +403 -357
- package/eigen/Eigen/src/SparseCore/SparsePermutation.h +186 -115
- package/eigen/Eigen/src/SparseCore/SparseProduct.h +100 -91
- package/eigen/Eigen/src/SparseCore/SparseRedux.h +22 -24
- package/eigen/Eigen/src/SparseCore/SparseRef.h +268 -295
- package/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h +371 -414
- package/eigen/Eigen/src/SparseCore/SparseSolverBase.h +78 -87
- package/eigen/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +81 -95
- package/eigen/Eigen/src/SparseCore/SparseTranspose.h +62 -71
- package/eigen/Eigen/src/SparseCore/SparseTriangularView.h +132 -144
- package/eigen/Eigen/src/SparseCore/SparseUtil.h +146 -115
- package/eigen/Eigen/src/SparseCore/SparseVector.h +426 -372
- package/eigen/Eigen/src/SparseCore/SparseView.h +164 -193
- package/eigen/Eigen/src/SparseCore/TriangularSolver.h +129 -170
- package/eigen/Eigen/src/SparseLU/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SparseLU/SparseLU.h +814 -618
- package/eigen/Eigen/src/SparseLU/SparseLUImpl.h +61 -48
- package/eigen/Eigen/src/SparseLU/SparseLU_Memory.h +102 -118
- package/eigen/Eigen/src/SparseLU/SparseLU_Structs.h +38 -35
- package/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +273 -255
- package/eigen/Eigen/src/SparseLU/SparseLU_Utils.h +44 -49
- package/eigen/Eigen/src/SparseLU/SparseLU_column_bmod.h +104 -108
- package/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +90 -101
- package/eigen/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +57 -58
- package/eigen/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +43 -55
- package/eigen/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +74 -71
- package/eigen/Eigen/src/SparseLU/SparseLU_panel_bmod.h +125 -133
- package/eigen/Eigen/src/SparseLU/SparseLU_panel_dfs.h +136 -159
- package/eigen/Eigen/src/SparseLU/SparseLU_pivotL.h +51 -52
- package/eigen/Eigen/src/SparseLU/SparseLU_pruneL.h +67 -73
- package/eigen/Eigen/src/SparseLU/SparseLU_relax_snode.h +24 -26
- package/eigen/Eigen/src/SparseQR/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SparseQR/SparseQR.h +451 -490
- package/eigen/Eigen/src/StlSupport/StdDeque.h +28 -105
- package/eigen/Eigen/src/StlSupport/StdList.h +28 -84
- package/eigen/Eigen/src/StlSupport/StdVector.h +28 -108
- package/eigen/Eigen/src/StlSupport/details.h +48 -50
- package/eigen/Eigen/src/SuperLUSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h +634 -732
- package/eigen/Eigen/src/ThreadPool/Barrier.h +70 -0
- package/eigen/Eigen/src/ThreadPool/CoreThreadPoolDevice.h +336 -0
- package/eigen/Eigen/src/ThreadPool/EventCount.h +241 -0
- package/eigen/Eigen/src/ThreadPool/ForkJoin.h +140 -0
- package/eigen/Eigen/src/ThreadPool/InternalHeaderCheck.h +4 -0
- package/eigen/Eigen/src/ThreadPool/NonBlockingThreadPool.h +587 -0
- package/eigen/Eigen/src/ThreadPool/RunQueue.h +230 -0
- package/eigen/Eigen/src/ThreadPool/ThreadCancel.h +21 -0
- package/eigen/Eigen/src/ThreadPool/ThreadEnvironment.h +43 -0
- package/eigen/Eigen/src/ThreadPool/ThreadLocal.h +289 -0
- package/eigen/Eigen/src/ThreadPool/ThreadPoolInterface.h +50 -0
- package/eigen/Eigen/src/ThreadPool/ThreadYield.h +16 -0
- package/eigen/Eigen/src/UmfPackSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h +480 -380
- package/eigen/Eigen/src/misc/Image.h +41 -43
- package/eigen/Eigen/src/misc/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/misc/Kernel.h +39 -41
- package/eigen/Eigen/src/misc/RealSvd2x2.h +19 -21
- package/eigen/Eigen/src/misc/blas.h +83 -426
- package/eigen/Eigen/src/misc/lapacke.h +9976 -16182
- package/eigen/Eigen/src/misc/lapacke_helpers.h +163 -0
- package/eigen/Eigen/src/misc/lapacke_mangling.h +4 -5
- package/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.inc +344 -0
- package/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.inc +544 -0
- package/eigen/Eigen/src/plugins/BlockMethods.inc +1370 -0
- package/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.inc +116 -0
- package/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.inc +167 -0
- package/eigen/Eigen/src/plugins/IndexedViewMethods.inc +192 -0
- package/eigen/Eigen/src/plugins/InternalHeaderCheck.inc +3 -0
- package/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.inc +331 -0
- package/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.inc +118 -0
- package/eigen/Eigen/src/plugins/ReshapedMethods.inc +133 -0
- package/lib/LibEigen.d.ts +4 -0
- package/lib/LibEigen.js +14 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +7 -3
- package/package.json +2 -10
- package/eigen/Eigen/CMakeLists.txt +0 -19
- package/eigen/Eigen/src/Core/BooleanRedux.h +0 -164
- package/eigen/Eigen/src/Core/arch/CUDA/Complex.h +0 -103
- package/eigen/Eigen/src/Core/arch/CUDA/Half.h +0 -675
- package/eigen/Eigen/src/Core/arch/CUDA/MathFunctions.h +0 -91
- package/eigen/Eigen/src/Core/arch/CUDA/PacketMath.h +0 -333
- package/eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h +0 -1124
- package/eigen/Eigen/src/Core/arch/CUDA/TypeCasting.h +0 -212
- package/eigen/Eigen/src/Core/util/NonMPL2.h +0 -3
- package/eigen/Eigen/src/Geometry/arch/Geometry_SSE.h +0 -161
- package/eigen/Eigen/src/LU/arch/Inverse_SSE.h +0 -338
- package/eigen/Eigen/src/SparseCore/MappedSparseMatrix.h +0 -67
- package/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +0 -280
- package/eigen/Eigen/src/misc/lapack.h +0 -152
- package/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h +0 -332
- package/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +0 -552
- package/eigen/Eigen/src/plugins/BlockMethods.h +0 -1058
- package/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.h +0 -115
- package/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.h +0 -163
- package/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +0 -152
- package/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +0 -85
- package/lib/eigen.d.ts +0 -2
- package/lib/eigen.js +0 -15
|
@@ -11,687 +11,615 @@
|
|
|
11
11
|
#ifndef EIGEN_TRIANGULARMATRIX_H
|
|
12
12
|
#define EIGEN_TRIANGULARMATRIX_H
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
// IWYU pragma: private
|
|
15
|
+
#include "./InternalHeaderCheck.h"
|
|
16
|
+
|
|
17
|
+
namespace Eigen {
|
|
15
18
|
|
|
16
19
|
namespace internal {
|
|
17
|
-
|
|
18
|
-
template<int Side, typename TriangularType, typename Rhs>
|
|
19
|
-
|
|
20
|
+
|
|
21
|
+
template <int Side, typename TriangularType, typename Rhs>
|
|
22
|
+
struct triangular_solve_retval;
|
|
23
|
+
|
|
20
24
|
}
|
|
21
25
|
|
|
22
26
|
/** \class TriangularBase
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
template<typename Derived>
|
|
28
|
-
{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
MaxColsAtCompileTime = internal::traits<Derived>::MaxColsAtCompileTime,
|
|
37
|
-
|
|
38
|
-
SizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::RowsAtCompileTime,
|
|
39
|
-
internal::traits<Derived>::ColsAtCompileTime>::ret),
|
|
40
|
-
/**< This is equal to the number of coefficients, i.e. the number of
|
|
41
|
-
* rows times the number of columns, or to \a Dynamic if this is not
|
|
42
|
-
* known at compile-time. \sa RowsAtCompileTime, ColsAtCompileTime */
|
|
43
|
-
|
|
44
|
-
MaxSizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::MaxRowsAtCompileTime,
|
|
45
|
-
internal::traits<Derived>::MaxColsAtCompileTime>::ret)
|
|
46
|
-
|
|
47
|
-
};
|
|
48
|
-
typedef typename internal::traits<Derived>::Scalar Scalar;
|
|
49
|
-
typedef typename internal::traits<Derived>::StorageKind StorageKind;
|
|
50
|
-
typedef typename internal::traits<Derived>::StorageIndex StorageIndex;
|
|
51
|
-
typedef typename internal::traits<Derived>::FullMatrixType DenseMatrixType;
|
|
52
|
-
typedef DenseMatrixType DenseType;
|
|
53
|
-
typedef Derived const& Nested;
|
|
54
|
-
|
|
55
|
-
EIGEN_DEVICE_FUNC
|
|
56
|
-
inline TriangularBase() { eigen_assert(!((Mode&UnitDiag) && (Mode&ZeroDiag))); }
|
|
57
|
-
|
|
58
|
-
EIGEN_DEVICE_FUNC
|
|
59
|
-
inline Index rows() const { return derived().rows(); }
|
|
60
|
-
EIGEN_DEVICE_FUNC
|
|
61
|
-
inline Index cols() const { return derived().cols(); }
|
|
62
|
-
EIGEN_DEVICE_FUNC
|
|
63
|
-
inline Index outerStride() const { return derived().outerStride(); }
|
|
64
|
-
EIGEN_DEVICE_FUNC
|
|
65
|
-
inline Index innerStride() const { return derived().innerStride(); }
|
|
66
|
-
|
|
67
|
-
// dummy resize function
|
|
68
|
-
void resize(Index rows, Index cols)
|
|
69
|
-
{
|
|
70
|
-
EIGEN_UNUSED_VARIABLE(rows);
|
|
71
|
-
EIGEN_UNUSED_VARIABLE(cols);
|
|
72
|
-
eigen_assert(rows==this->rows() && cols==this->cols());
|
|
73
|
-
}
|
|
27
|
+
* \ingroup Core_Module
|
|
28
|
+
*
|
|
29
|
+
* \brief Base class for triangular part in a matrix
|
|
30
|
+
*/
|
|
31
|
+
template <typename Derived>
|
|
32
|
+
class TriangularBase : public EigenBase<Derived> {
|
|
33
|
+
public:
|
|
34
|
+
enum {
|
|
35
|
+
Mode = internal::traits<Derived>::Mode,
|
|
36
|
+
RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime,
|
|
37
|
+
ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,
|
|
38
|
+
MaxRowsAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime,
|
|
39
|
+
MaxColsAtCompileTime = internal::traits<Derived>::MaxColsAtCompileTime,
|
|
74
40
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
/** \see MatrixBase::copyCoeff(row,col)
|
|
81
|
-
*/
|
|
82
|
-
template<typename Other>
|
|
83
|
-
EIGEN_DEVICE_FUNC
|
|
84
|
-
EIGEN_STRONG_INLINE void copyCoeff(Index row, Index col, Other& other)
|
|
85
|
-
{
|
|
86
|
-
derived().coeffRef(row, col) = other.coeff(row, col);
|
|
87
|
-
}
|
|
41
|
+
SizeAtCompileTime = (internal::size_of_xpr_at_compile_time<Derived>::ret),
|
|
42
|
+
/**< This is equal to the number of coefficients, i.e. the number of
|
|
43
|
+
* rows times the number of columns, or to \a Dynamic if this is not
|
|
44
|
+
* known at compile-time. \sa RowsAtCompileTime, ColsAtCompileTime */
|
|
88
45
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
{
|
|
92
|
-
check_coordinates(row, col);
|
|
93
|
-
return coeff(row,col);
|
|
94
|
-
}
|
|
95
|
-
EIGEN_DEVICE_FUNC
|
|
96
|
-
inline Scalar& operator()(Index row, Index col)
|
|
97
|
-
{
|
|
98
|
-
check_coordinates(row, col);
|
|
99
|
-
return coeffRef(row,col);
|
|
100
|
-
}
|
|
46
|
+
MaxSizeAtCompileTime = internal::size_at_compile_time(internal::traits<Derived>::MaxRowsAtCompileTime,
|
|
47
|
+
internal::traits<Derived>::MaxColsAtCompileTime)
|
|
101
48
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
EIGEN_DEVICE_FUNC
|
|
114
|
-
void evalToLazy(MatrixBase<DenseDerived> &other) const;
|
|
115
|
-
|
|
116
|
-
EIGEN_DEVICE_FUNC
|
|
117
|
-
DenseMatrixType toDenseMatrix() const
|
|
118
|
-
{
|
|
119
|
-
DenseMatrixType res(rows(), cols());
|
|
120
|
-
evalToLazy(res);
|
|
121
|
-
return res;
|
|
122
|
-
}
|
|
49
|
+
};
|
|
50
|
+
typedef typename internal::traits<Derived>::Scalar Scalar;
|
|
51
|
+
typedef typename internal::traits<Derived>::StorageKind StorageKind;
|
|
52
|
+
typedef typename internal::traits<Derived>::StorageIndex StorageIndex;
|
|
53
|
+
typedef typename internal::traits<Derived>::FullMatrixType DenseMatrixType;
|
|
54
|
+
typedef DenseMatrixType DenseType;
|
|
55
|
+
typedef Derived const& Nested;
|
|
56
|
+
|
|
57
|
+
EIGEN_DEVICE_FUNC inline TriangularBase() {
|
|
58
|
+
eigen_assert(!((int(Mode) & int(UnitDiag)) && (int(Mode) & int(ZeroDiag))));
|
|
59
|
+
}
|
|
123
60
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
EIGEN_ONLY_USED_FOR_DEBUG(row);
|
|
129
|
-
EIGEN_ONLY_USED_FOR_DEBUG(col);
|
|
130
|
-
eigen_assert(col>=0 && col<cols() && row>=0 && row<rows());
|
|
131
|
-
const int mode = int(Mode) & ~SelfAdjoint;
|
|
132
|
-
EIGEN_ONLY_USED_FOR_DEBUG(mode);
|
|
133
|
-
eigen_assert((mode==Upper && col>=row)
|
|
134
|
-
|| (mode==Lower && col<=row)
|
|
135
|
-
|| ((mode==StrictlyUpper || mode==UnitUpper) && col>row)
|
|
136
|
-
|| ((mode==StrictlyLower || mode==UnitLower) && col<row));
|
|
137
|
-
}
|
|
61
|
+
EIGEN_DEVICE_FUNC constexpr Index rows() const noexcept { return derived().rows(); }
|
|
62
|
+
EIGEN_DEVICE_FUNC constexpr Index cols() const noexcept { return derived().cols(); }
|
|
63
|
+
EIGEN_DEVICE_FUNC constexpr Index outerStride() const noexcept { return derived().outerStride(); }
|
|
64
|
+
EIGEN_DEVICE_FUNC constexpr Index innerStride() const noexcept { return derived().innerStride(); }
|
|
138
65
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
66
|
+
// dummy resize function
|
|
67
|
+
EIGEN_DEVICE_FUNC void resize(Index rows, Index cols) {
|
|
68
|
+
EIGEN_UNUSED_VARIABLE(rows);
|
|
69
|
+
EIGEN_UNUSED_VARIABLE(cols);
|
|
70
|
+
eigen_assert(rows == this->rows() && cols == this->cols());
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
EIGEN_DEVICE_FUNC inline Scalar coeff(Index row, Index col) const { return derived().coeff(row, col); }
|
|
74
|
+
EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index row, Index col) { return derived().coeffRef(row, col); }
|
|
75
|
+
|
|
76
|
+
/** \see MatrixBase::copyCoeff(row,col)
|
|
77
|
+
*/
|
|
78
|
+
template <typename Other>
|
|
79
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void copyCoeff(Index row, Index col, Other& other) {
|
|
80
|
+
derived().coeffRef(row, col) = other.coeff(row, col);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
EIGEN_DEVICE_FUNC inline Scalar operator()(Index row, Index col) const {
|
|
84
|
+
check_coordinates(row, col);
|
|
85
|
+
return coeff(row, col);
|
|
86
|
+
}
|
|
87
|
+
EIGEN_DEVICE_FUNC inline Scalar& operator()(Index row, Index col) {
|
|
88
|
+
check_coordinates(row, col);
|
|
89
|
+
return coeffRef(row, col);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
|
93
|
+
EIGEN_DEVICE_FUNC inline const Derived& derived() const { return *static_cast<const Derived*>(this); }
|
|
94
|
+
EIGEN_DEVICE_FUNC inline Derived& derived() { return *static_cast<Derived*>(this); }
|
|
95
|
+
#endif // not EIGEN_PARSED_BY_DOXYGEN
|
|
96
|
+
|
|
97
|
+
template <typename DenseDerived>
|
|
98
|
+
EIGEN_DEVICE_FUNC void evalTo(MatrixBase<DenseDerived>& other) const;
|
|
99
|
+
template <typename DenseDerived>
|
|
100
|
+
EIGEN_DEVICE_FUNC void evalToLazy(MatrixBase<DenseDerived>& other) const;
|
|
101
|
+
|
|
102
|
+
EIGEN_DEVICE_FUNC DenseMatrixType toDenseMatrix() const {
|
|
103
|
+
DenseMatrixType res(rows(), cols());
|
|
104
|
+
evalToLazy(res);
|
|
105
|
+
return res;
|
|
106
|
+
}
|
|
147
107
|
|
|
108
|
+
protected:
|
|
109
|
+
void check_coordinates(Index row, Index col) const {
|
|
110
|
+
EIGEN_ONLY_USED_FOR_DEBUG(row);
|
|
111
|
+
EIGEN_ONLY_USED_FOR_DEBUG(col);
|
|
112
|
+
eigen_assert(col >= 0 && col < cols() && row >= 0 && row < rows());
|
|
113
|
+
const int mode = int(Mode) & ~SelfAdjoint;
|
|
114
|
+
EIGEN_ONLY_USED_FOR_DEBUG(mode);
|
|
115
|
+
eigen_assert((mode == Upper && col >= row) || (mode == Lower && col <= row) ||
|
|
116
|
+
((mode == StrictlyUpper || mode == UnitUpper) && col > row) ||
|
|
117
|
+
((mode == StrictlyLower || mode == UnitLower) && col < row));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
#ifdef EIGEN_INTERNAL_DEBUGGING
|
|
121
|
+
void check_coordinates_internal(Index row, Index col) const { check_coordinates(row, col); }
|
|
122
|
+
#else
|
|
123
|
+
void check_coordinates_internal(Index, Index) const {}
|
|
124
|
+
#endif
|
|
148
125
|
};
|
|
149
126
|
|
|
150
127
|
/** \class TriangularView
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
128
|
+
* \ingroup Core_Module
|
|
129
|
+
*
|
|
130
|
+
* \brief Expression of a triangular part in a matrix
|
|
131
|
+
*
|
|
132
|
+
* \tparam MatrixType the type of the object in which we are taking the triangular part
|
|
133
|
+
* \tparam Mode the kind of triangular matrix expression to construct. Can be #Upper,
|
|
134
|
+
* #Lower, #UnitUpper, #UnitLower, #StrictlyUpper, or #StrictlyLower.
|
|
135
|
+
* This is in fact a bit field; it must have either #Upper or #Lower,
|
|
136
|
+
* and additionally it may have #UnitDiag or #ZeroDiag or neither.
|
|
137
|
+
*
|
|
138
|
+
* This class represents a triangular part of a matrix, not necessarily square. Strictly speaking, for rectangular
|
|
139
|
+
* matrices one should speak of "trapezoid" parts. This class is the return type
|
|
140
|
+
* of MatrixBase::triangularView() and SparseMatrixBase::triangularView(), and most of the time this is the only way it
|
|
141
|
+
* is used.
|
|
142
|
+
*
|
|
143
|
+
* \sa MatrixBase::triangularView()
|
|
144
|
+
*/
|
|
167
145
|
namespace internal {
|
|
168
|
-
template<typename MatrixType, unsigned int
|
|
169
|
-
struct traits<TriangularView<MatrixType,
|
|
170
|
-
{
|
|
146
|
+
template <typename MatrixType, unsigned int Mode_>
|
|
147
|
+
struct traits<TriangularView<MatrixType, Mode_>> : traits<MatrixType> {
|
|
171
148
|
typedef typename ref_selector<MatrixType>::non_const_type MatrixTypeNested;
|
|
172
|
-
typedef
|
|
173
|
-
typedef
|
|
149
|
+
typedef std::remove_reference_t<MatrixTypeNested> MatrixTypeNestedNonRef;
|
|
150
|
+
typedef remove_all_t<MatrixTypeNested> MatrixTypeNestedCleaned;
|
|
174
151
|
typedef typename MatrixType::PlainObject FullMatrixType;
|
|
175
152
|
typedef MatrixType ExpressionType;
|
|
176
153
|
enum {
|
|
177
|
-
Mode =
|
|
154
|
+
Mode = Mode_,
|
|
178
155
|
FlagsLvalueBit = is_lvalue<MatrixType>::value ? LvalueBit : 0,
|
|
179
|
-
Flags = (MatrixTypeNestedCleaned::Flags & (HereditaryBits | FlagsLvalueBit) &
|
|
156
|
+
Flags = (MatrixTypeNestedCleaned::Flags & (HereditaryBits | FlagsLvalueBit) &
|
|
157
|
+
(~(PacketAccessBit | DirectAccessBit | LinearAccessBit)))
|
|
180
158
|
};
|
|
181
159
|
};
|
|
182
|
-
}
|
|
160
|
+
} // namespace internal
|
|
183
161
|
|
|
184
|
-
template<typename
|
|
185
|
-
|
|
186
|
-
template<typename _MatrixType, unsigned int _Mode> class TriangularView
|
|
187
|
-
: public TriangularViewImpl<_MatrixType, _Mode, typename internal::traits<_MatrixType>::StorageKind >
|
|
188
|
-
{
|
|
189
|
-
public:
|
|
190
|
-
|
|
191
|
-
typedef TriangularViewImpl<_MatrixType, _Mode, typename internal::traits<_MatrixType>::StorageKind > Base;
|
|
192
|
-
typedef typename internal::traits<TriangularView>::Scalar Scalar;
|
|
193
|
-
typedef _MatrixType MatrixType;
|
|
194
|
-
|
|
195
|
-
protected:
|
|
196
|
-
typedef typename internal::traits<TriangularView>::MatrixTypeNested MatrixTypeNested;
|
|
197
|
-
typedef typename internal::traits<TriangularView>::MatrixTypeNestedNonRef MatrixTypeNestedNonRef;
|
|
198
|
-
|
|
199
|
-
typedef typename internal::remove_all<typename MatrixType::ConjugateReturnType>::type MatrixConjugateReturnType;
|
|
200
|
-
|
|
201
|
-
public:
|
|
202
|
-
|
|
203
|
-
typedef typename internal::traits<TriangularView>::StorageKind StorageKind;
|
|
204
|
-
typedef typename internal::traits<TriangularView>::MatrixTypeNestedCleaned NestedExpression;
|
|
205
|
-
|
|
206
|
-
enum {
|
|
207
|
-
Mode = _Mode,
|
|
208
|
-
Flags = internal::traits<TriangularView>::Flags,
|
|
209
|
-
TransposeMode = (Mode & Upper ? Lower : 0)
|
|
210
|
-
| (Mode & Lower ? Upper : 0)
|
|
211
|
-
| (Mode & (UnitDiag))
|
|
212
|
-
| (Mode & (ZeroDiag)),
|
|
213
|
-
IsVectorAtCompileTime = false
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
EIGEN_DEVICE_FUNC
|
|
217
|
-
explicit inline TriangularView(MatrixType& matrix) : m_matrix(matrix)
|
|
218
|
-
{}
|
|
219
|
-
|
|
220
|
-
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(TriangularView)
|
|
221
|
-
|
|
222
|
-
/** \copydoc EigenBase::rows() */
|
|
223
|
-
EIGEN_DEVICE_FUNC
|
|
224
|
-
inline Index rows() const { return m_matrix.rows(); }
|
|
225
|
-
/** \copydoc EigenBase::cols() */
|
|
226
|
-
EIGEN_DEVICE_FUNC
|
|
227
|
-
inline Index cols() const { return m_matrix.cols(); }
|
|
228
|
-
|
|
229
|
-
/** \returns a const reference to the nested expression */
|
|
230
|
-
EIGEN_DEVICE_FUNC
|
|
231
|
-
const NestedExpression& nestedExpression() const { return m_matrix; }
|
|
232
|
-
|
|
233
|
-
/** \returns a reference to the nested expression */
|
|
234
|
-
EIGEN_DEVICE_FUNC
|
|
235
|
-
NestedExpression& nestedExpression() { return m_matrix; }
|
|
236
|
-
|
|
237
|
-
typedef TriangularView<const MatrixConjugateReturnType,Mode> ConjugateReturnType;
|
|
238
|
-
/** \sa MatrixBase::conjugate() const */
|
|
239
|
-
EIGEN_DEVICE_FUNC
|
|
240
|
-
inline const ConjugateReturnType conjugate() const
|
|
241
|
-
{ return ConjugateReturnType(m_matrix.conjugate()); }
|
|
242
|
-
|
|
243
|
-
typedef TriangularView<const typename MatrixType::AdjointReturnType,TransposeMode> AdjointReturnType;
|
|
244
|
-
/** \sa MatrixBase::adjoint() const */
|
|
245
|
-
EIGEN_DEVICE_FUNC
|
|
246
|
-
inline const AdjointReturnType adjoint() const
|
|
247
|
-
{ return AdjointReturnType(m_matrix.adjoint()); }
|
|
248
|
-
|
|
249
|
-
typedef TriangularView<typename MatrixType::TransposeReturnType,TransposeMode> TransposeReturnType;
|
|
250
|
-
/** \sa MatrixBase::transpose() */
|
|
251
|
-
EIGEN_DEVICE_FUNC
|
|
252
|
-
inline TransposeReturnType transpose()
|
|
253
|
-
{
|
|
254
|
-
EIGEN_STATIC_ASSERT_LVALUE(MatrixType)
|
|
255
|
-
typename MatrixType::TransposeReturnType tmp(m_matrix);
|
|
256
|
-
return TransposeReturnType(tmp);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
typedef TriangularView<const typename MatrixType::ConstTransposeReturnType,TransposeMode> ConstTransposeReturnType;
|
|
260
|
-
/** \sa MatrixBase::transpose() const */
|
|
261
|
-
EIGEN_DEVICE_FUNC
|
|
262
|
-
inline const ConstTransposeReturnType transpose() const
|
|
263
|
-
{
|
|
264
|
-
return ConstTransposeReturnType(m_matrix.transpose());
|
|
265
|
-
}
|
|
162
|
+
template <typename MatrixType_, unsigned int Mode_, typename StorageKind>
|
|
163
|
+
class TriangularViewImpl;
|
|
266
164
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
#if EIGEN_COMP_MSVC
|
|
275
|
-
template<int Side, typename Other>
|
|
276
|
-
EIGEN_DEVICE_FUNC
|
|
277
|
-
inline const internal::triangular_solve_retval<Side,TriangularView, Other>
|
|
278
|
-
solve(const MatrixBase<Other>& other) const
|
|
279
|
-
{ return Base::template solve<Side>(other); }
|
|
280
|
-
#else
|
|
281
|
-
using Base::solve;
|
|
282
|
-
#endif
|
|
283
|
-
|
|
284
|
-
/** \returns a selfadjoint view of the referenced triangular part which must be either \c #Upper or \c #Lower.
|
|
285
|
-
*
|
|
286
|
-
* This is a shortcut for \code this->nestedExpression().selfadjointView<(*this)::Mode>() \endcode
|
|
287
|
-
* \sa MatrixBase::selfadjointView() */
|
|
288
|
-
EIGEN_DEVICE_FUNC
|
|
289
|
-
SelfAdjointView<MatrixTypeNestedNonRef,Mode> selfadjointView()
|
|
290
|
-
{
|
|
291
|
-
EIGEN_STATIC_ASSERT((Mode&(UnitDiag|ZeroDiag))==0,PROGRAMMING_ERROR);
|
|
292
|
-
return SelfAdjointView<MatrixTypeNestedNonRef,Mode>(m_matrix);
|
|
293
|
-
}
|
|
165
|
+
template <typename MatrixType_, unsigned int Mode_>
|
|
166
|
+
class TriangularView
|
|
167
|
+
: public TriangularViewImpl<MatrixType_, Mode_, typename internal::traits<MatrixType_>::StorageKind> {
|
|
168
|
+
public:
|
|
169
|
+
typedef TriangularViewImpl<MatrixType_, Mode_, typename internal::traits<MatrixType_>::StorageKind> Base;
|
|
170
|
+
typedef typename internal::traits<TriangularView>::Scalar Scalar;
|
|
171
|
+
typedef MatrixType_ MatrixType;
|
|
294
172
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
{
|
|
299
|
-
EIGEN_STATIC_ASSERT((Mode&(UnitDiag|ZeroDiag))==0,PROGRAMMING_ERROR);
|
|
300
|
-
return SelfAdjointView<MatrixTypeNestedNonRef,Mode>(m_matrix);
|
|
301
|
-
}
|
|
173
|
+
protected:
|
|
174
|
+
typedef typename internal::traits<TriangularView>::MatrixTypeNested MatrixTypeNested;
|
|
175
|
+
typedef typename internal::traits<TriangularView>::MatrixTypeNestedNonRef MatrixTypeNestedNonRef;
|
|
302
176
|
|
|
177
|
+
typedef internal::remove_all_t<typename MatrixType::ConjugateReturnType> MatrixConjugateReturnType;
|
|
178
|
+
typedef TriangularView<std::add_const_t<MatrixType>, Mode_> ConstTriangularView;
|
|
303
179
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
Scalar determinant() const
|
|
308
|
-
{
|
|
309
|
-
if (Mode & UnitDiag)
|
|
310
|
-
return 1;
|
|
311
|
-
else if (Mode & ZeroDiag)
|
|
312
|
-
return 0;
|
|
313
|
-
else
|
|
314
|
-
return m_matrix.diagonal().prod();
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
protected:
|
|
180
|
+
public:
|
|
181
|
+
typedef typename internal::traits<TriangularView>::StorageKind StorageKind;
|
|
182
|
+
typedef typename internal::traits<TriangularView>::MatrixTypeNestedCleaned NestedExpression;
|
|
318
183
|
|
|
319
|
-
|
|
184
|
+
enum {
|
|
185
|
+
Mode = Mode_,
|
|
186
|
+
Flags = internal::traits<TriangularView>::Flags,
|
|
187
|
+
TransposeMode = (int(Mode) & int(Upper) ? Lower : 0) | (int(Mode) & int(Lower) ? Upper : 0) |
|
|
188
|
+
(int(Mode) & int(UnitDiag)) | (int(Mode) & int(ZeroDiag)),
|
|
189
|
+
IsVectorAtCompileTime = false
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
EIGEN_DEVICE_FUNC explicit inline TriangularView(MatrixType& matrix) : m_matrix(matrix) {}
|
|
193
|
+
|
|
194
|
+
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(TriangularView)
|
|
195
|
+
|
|
196
|
+
/** \copydoc EigenBase::rows() */
|
|
197
|
+
EIGEN_DEVICE_FUNC constexpr Index rows() const noexcept { return m_matrix.rows(); }
|
|
198
|
+
/** \copydoc EigenBase::cols() */
|
|
199
|
+
EIGEN_DEVICE_FUNC constexpr Index cols() const noexcept { return m_matrix.cols(); }
|
|
200
|
+
|
|
201
|
+
/** \returns a const reference to the nested expression */
|
|
202
|
+
EIGEN_DEVICE_FUNC const NestedExpression& nestedExpression() const { return m_matrix; }
|
|
203
|
+
|
|
204
|
+
/** \returns a reference to the nested expression */
|
|
205
|
+
EIGEN_DEVICE_FUNC NestedExpression& nestedExpression() { return m_matrix; }
|
|
206
|
+
|
|
207
|
+
typedef TriangularView<const MatrixConjugateReturnType, Mode> ConjugateReturnType;
|
|
208
|
+
/** \sa MatrixBase::conjugate() const */
|
|
209
|
+
EIGEN_DEVICE_FUNC inline const ConjugateReturnType conjugate() const {
|
|
210
|
+
return ConjugateReturnType(m_matrix.conjugate());
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** \returns an expression of the complex conjugate of \c *this if Cond==true,
|
|
214
|
+
* returns \c *this otherwise.
|
|
215
|
+
*/
|
|
216
|
+
template <bool Cond>
|
|
217
|
+
EIGEN_DEVICE_FUNC inline std::conditional_t<Cond, ConjugateReturnType, ConstTriangularView> conjugateIf() const {
|
|
218
|
+
typedef std::conditional_t<Cond, ConjugateReturnType, ConstTriangularView> ReturnType;
|
|
219
|
+
return ReturnType(m_matrix.template conjugateIf<Cond>());
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
typedef TriangularView<const typename MatrixType::AdjointReturnType, TransposeMode> AdjointReturnType;
|
|
223
|
+
/** \sa MatrixBase::adjoint() const */
|
|
224
|
+
EIGEN_DEVICE_FUNC inline const AdjointReturnType adjoint() const { return AdjointReturnType(m_matrix.adjoint()); }
|
|
225
|
+
|
|
226
|
+
typedef TriangularView<typename MatrixType::TransposeReturnType, TransposeMode> TransposeReturnType;
|
|
227
|
+
/** \sa MatrixBase::transpose() */
|
|
228
|
+
template <class Dummy = int>
|
|
229
|
+
EIGEN_DEVICE_FUNC inline TransposeReturnType transpose(
|
|
230
|
+
std::enable_if_t<Eigen::internal::is_lvalue<MatrixType>::value, Dummy*> = nullptr) {
|
|
231
|
+
typename MatrixType::TransposeReturnType tmp(m_matrix);
|
|
232
|
+
return TransposeReturnType(tmp);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
typedef TriangularView<const typename MatrixType::ConstTransposeReturnType, TransposeMode> ConstTransposeReturnType;
|
|
236
|
+
/** \sa MatrixBase::transpose() const */
|
|
237
|
+
EIGEN_DEVICE_FUNC inline const ConstTransposeReturnType transpose() const {
|
|
238
|
+
return ConstTransposeReturnType(m_matrix.transpose());
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
template <typename Other>
|
|
242
|
+
EIGEN_DEVICE_FUNC inline const Solve<TriangularView, Other> solve(const MatrixBase<Other>& other) const {
|
|
243
|
+
return Solve<TriangularView, Other>(*this, other.derived());
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// workaround MSVC ICE
|
|
247
|
+
#if EIGEN_COMP_MSVC
|
|
248
|
+
template <int Side, typename Other>
|
|
249
|
+
EIGEN_DEVICE_FUNC inline const internal::triangular_solve_retval<Side, TriangularView, Other> solve(
|
|
250
|
+
const MatrixBase<Other>& other) const {
|
|
251
|
+
return Base::template solve<Side>(other);
|
|
252
|
+
}
|
|
253
|
+
#else
|
|
254
|
+
using Base::solve;
|
|
255
|
+
#endif
|
|
256
|
+
|
|
257
|
+
/** \returns a selfadjoint view of the referenced triangular part which must be either \c #Upper or \c #Lower.
|
|
258
|
+
*
|
|
259
|
+
* This is a shortcut for \code this->nestedExpression().selfadjointView<(*this)::Mode>() \endcode
|
|
260
|
+
* \sa MatrixBase::selfadjointView() */
|
|
261
|
+
EIGEN_DEVICE_FUNC SelfAdjointView<MatrixTypeNestedNonRef, Mode> selfadjointView() {
|
|
262
|
+
EIGEN_STATIC_ASSERT((Mode & (UnitDiag | ZeroDiag)) == 0, PROGRAMMING_ERROR);
|
|
263
|
+
return SelfAdjointView<MatrixTypeNestedNonRef, Mode>(m_matrix);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** This is the const version of selfadjointView() */
|
|
267
|
+
EIGEN_DEVICE_FUNC const SelfAdjointView<MatrixTypeNestedNonRef, Mode> selfadjointView() const {
|
|
268
|
+
EIGEN_STATIC_ASSERT((Mode & (UnitDiag | ZeroDiag)) == 0, PROGRAMMING_ERROR);
|
|
269
|
+
return SelfAdjointView<MatrixTypeNestedNonRef, Mode>(m_matrix);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/** \returns the determinant of the triangular matrix
|
|
273
|
+
* \sa MatrixBase::determinant() */
|
|
274
|
+
EIGEN_DEVICE_FUNC Scalar determinant() const {
|
|
275
|
+
if (Mode & UnitDiag)
|
|
276
|
+
return 1;
|
|
277
|
+
else if (Mode & ZeroDiag)
|
|
278
|
+
return 0;
|
|
279
|
+
else
|
|
280
|
+
return m_matrix.diagonal().prod();
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
protected:
|
|
284
|
+
MatrixTypeNested m_matrix;
|
|
320
285
|
};
|
|
321
286
|
|
|
322
287
|
/** \ingroup Core_Module
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
template<typename
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
template<typename Other>
|
|
373
|
-
EIGEN_DEVICE_FUNC
|
|
374
|
-
TriangularViewType& operator-=(const DenseBase<Other>& other) {
|
|
375
|
-
internal::call_assignment_no_alias(derived(), other.derived(), internal::sub_assign_op<Scalar,typename Other::Scalar>());
|
|
376
|
-
return derived();
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
/** \sa MatrixBase::operator*=() */
|
|
380
|
-
EIGEN_DEVICE_FUNC
|
|
381
|
-
TriangularViewType& operator*=(const typename internal::traits<MatrixType>::Scalar& other) { return *this = derived().nestedExpression() * other; }
|
|
382
|
-
/** \sa DenseBase::operator/=() */
|
|
383
|
-
EIGEN_DEVICE_FUNC
|
|
384
|
-
TriangularViewType& operator/=(const typename internal::traits<MatrixType>::Scalar& other) { return *this = derived().nestedExpression() / other; }
|
|
385
|
-
|
|
386
|
-
/** \sa MatrixBase::fill() */
|
|
387
|
-
EIGEN_DEVICE_FUNC
|
|
388
|
-
void fill(const Scalar& value) { setConstant(value); }
|
|
389
|
-
/** \sa MatrixBase::setConstant() */
|
|
390
|
-
EIGEN_DEVICE_FUNC
|
|
391
|
-
TriangularViewType& setConstant(const Scalar& value)
|
|
392
|
-
{ return *this = MatrixType::Constant(derived().rows(), derived().cols(), value); }
|
|
393
|
-
/** \sa MatrixBase::setZero() */
|
|
394
|
-
EIGEN_DEVICE_FUNC
|
|
395
|
-
TriangularViewType& setZero() { return setConstant(Scalar(0)); }
|
|
396
|
-
/** \sa MatrixBase::setOnes() */
|
|
397
|
-
EIGEN_DEVICE_FUNC
|
|
398
|
-
TriangularViewType& setOnes() { return setConstant(Scalar(1)); }
|
|
399
|
-
|
|
400
|
-
/** \sa MatrixBase::coeff()
|
|
401
|
-
* \warning the coordinates must fit into the referenced triangular part
|
|
402
|
-
*/
|
|
403
|
-
EIGEN_DEVICE_FUNC
|
|
404
|
-
inline Scalar coeff(Index row, Index col) const
|
|
405
|
-
{
|
|
406
|
-
Base::check_coordinates_internal(row, col);
|
|
407
|
-
return derived().nestedExpression().coeff(row, col);
|
|
408
|
-
}
|
|
288
|
+
*
|
|
289
|
+
* \brief Base class for a triangular part in a \b dense matrix
|
|
290
|
+
*
|
|
291
|
+
* This class is an abstract base class of class TriangularView, and objects of type TriangularViewImpl cannot be
|
|
292
|
+
* instantiated. It extends class TriangularView with additional methods which available for dense expressions only.
|
|
293
|
+
*
|
|
294
|
+
* \sa class TriangularView, MatrixBase::triangularView()
|
|
295
|
+
*/
|
|
296
|
+
template <typename MatrixType_, unsigned int Mode_>
|
|
297
|
+
class TriangularViewImpl<MatrixType_, Mode_, Dense> : public TriangularBase<TriangularView<MatrixType_, Mode_>> {
|
|
298
|
+
public:
|
|
299
|
+
typedef TriangularView<MatrixType_, Mode_> TriangularViewType;
|
|
300
|
+
|
|
301
|
+
typedef TriangularBase<TriangularViewType> Base;
|
|
302
|
+
typedef typename internal::traits<TriangularViewType>::Scalar Scalar;
|
|
303
|
+
|
|
304
|
+
typedef MatrixType_ MatrixType;
|
|
305
|
+
typedef typename MatrixType::PlainObject DenseMatrixType;
|
|
306
|
+
typedef DenseMatrixType PlainObject;
|
|
307
|
+
|
|
308
|
+
public:
|
|
309
|
+
using Base::derived;
|
|
310
|
+
using Base::evalToLazy;
|
|
311
|
+
|
|
312
|
+
typedef typename internal::traits<TriangularViewType>::StorageKind StorageKind;
|
|
313
|
+
|
|
314
|
+
enum { Mode = Mode_, Flags = internal::traits<TriangularViewType>::Flags };
|
|
315
|
+
|
|
316
|
+
/** \returns the outer-stride of the underlying dense matrix
|
|
317
|
+
* \sa DenseCoeffsBase::outerStride() */
|
|
318
|
+
EIGEN_DEVICE_FUNC inline Index outerStride() const { return derived().nestedExpression().outerStride(); }
|
|
319
|
+
/** \returns the inner-stride of the underlying dense matrix
|
|
320
|
+
* \sa DenseCoeffsBase::innerStride() */
|
|
321
|
+
EIGEN_DEVICE_FUNC inline Index innerStride() const { return derived().nestedExpression().innerStride(); }
|
|
322
|
+
|
|
323
|
+
/** \sa MatrixBase::operator+=() */
|
|
324
|
+
template <typename Other>
|
|
325
|
+
EIGEN_DEVICE_FUNC TriangularViewType& operator+=(const DenseBase<Other>& other) {
|
|
326
|
+
internal::call_assignment_no_alias(derived(), other.derived(),
|
|
327
|
+
internal::add_assign_op<Scalar, typename Other::Scalar>());
|
|
328
|
+
return derived();
|
|
329
|
+
}
|
|
330
|
+
/** \sa MatrixBase::operator-=() */
|
|
331
|
+
template <typename Other>
|
|
332
|
+
EIGEN_DEVICE_FUNC TriangularViewType& operator-=(const DenseBase<Other>& other) {
|
|
333
|
+
internal::call_assignment_no_alias(derived(), other.derived(),
|
|
334
|
+
internal::sub_assign_op<Scalar, typename Other::Scalar>());
|
|
335
|
+
return derived();
|
|
336
|
+
}
|
|
409
337
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
338
|
+
/** \sa MatrixBase::operator*=() */
|
|
339
|
+
EIGEN_DEVICE_FUNC TriangularViewType& operator*=(const typename internal::traits<MatrixType>::Scalar& other) {
|
|
340
|
+
return *this = derived().nestedExpression() * other;
|
|
341
|
+
}
|
|
342
|
+
/** \sa DenseBase::operator/=() */
|
|
343
|
+
EIGEN_DEVICE_FUNC TriangularViewType& operator/=(const typename internal::traits<MatrixType>::Scalar& other) {
|
|
344
|
+
return *this = derived().nestedExpression() / other;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/** \sa MatrixBase::fill() */
|
|
348
|
+
EIGEN_DEVICE_FUNC void fill(const Scalar& value) { setConstant(value); }
|
|
349
|
+
/** \sa MatrixBase::setConstant() */
|
|
350
|
+
EIGEN_DEVICE_FUNC TriangularViewType& setConstant(const Scalar& value) {
|
|
351
|
+
return *this = MatrixType::Constant(derived().rows(), derived().cols(), value);
|
|
352
|
+
}
|
|
353
|
+
/** \sa MatrixBase::setZero() */
|
|
354
|
+
EIGEN_DEVICE_FUNC TriangularViewType& setZero() { return setConstant(Scalar(0)); }
|
|
355
|
+
/** \sa MatrixBase::setOnes() */
|
|
356
|
+
EIGEN_DEVICE_FUNC TriangularViewType& setOnes() { return setConstant(Scalar(1)); }
|
|
357
|
+
|
|
358
|
+
/** \sa MatrixBase::coeff()
|
|
359
|
+
* \warning the coordinates must fit into the referenced triangular part
|
|
360
|
+
*/
|
|
361
|
+
EIGEN_DEVICE_FUNC inline Scalar coeff(Index row, Index col) const {
|
|
362
|
+
Base::check_coordinates_internal(row, col);
|
|
363
|
+
return derived().nestedExpression().coeff(row, col);
|
|
364
|
+
}
|
|
420
365
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
366
|
+
/** \sa MatrixBase::coeffRef()
|
|
367
|
+
* \warning the coordinates must fit into the referenced triangular part
|
|
368
|
+
*/
|
|
369
|
+
EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index row, Index col) {
|
|
370
|
+
EIGEN_STATIC_ASSERT_LVALUE(TriangularViewType);
|
|
371
|
+
Base::check_coordinates_internal(row, col);
|
|
372
|
+
return derived().nestedExpression().coeffRef(row, col);
|
|
373
|
+
}
|
|
425
374
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
375
|
+
/** Assigns a triangular matrix to a triangular part of a dense matrix */
|
|
376
|
+
template <typename OtherDerived>
|
|
377
|
+
EIGEN_DEVICE_FUNC TriangularViewType& operator=(const TriangularBase<OtherDerived>& other);
|
|
378
|
+
|
|
379
|
+
/** Shortcut for\code *this = other.other.triangularView<(*this)::Mode>() \endcode */
|
|
380
|
+
template <typename OtherDerived>
|
|
381
|
+
EIGEN_DEVICE_FUNC TriangularViewType& operator=(const MatrixBase<OtherDerived>& other);
|
|
430
382
|
|
|
431
383
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
EIGEN_DEVICE_FUNC
|
|
444
|
-
void lazyAssign(const MatrixBase<OtherDerived>& other);
|
|
384
|
+
EIGEN_DEVICE_FUNC TriangularViewType& operator=(const TriangularViewImpl& other) {
|
|
385
|
+
return *this = other.derived().nestedExpression();
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
template <typename OtherDerived>
|
|
389
|
+
/** \deprecated */
|
|
390
|
+
EIGEN_DEPRECATED EIGEN_DEVICE_FUNC void lazyAssign(const TriangularBase<OtherDerived>& other);
|
|
391
|
+
|
|
392
|
+
template <typename OtherDerived>
|
|
393
|
+
/** \deprecated */
|
|
394
|
+
EIGEN_DEPRECATED EIGEN_DEVICE_FUNC void lazyAssign(const MatrixBase<OtherDerived>& other);
|
|
445
395
|
#endif
|
|
446
396
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
return Product<TriangularViewType,OtherDerived>(derived(), rhs.derived());
|
|
454
|
-
}
|
|
397
|
+
/** Efficient triangular matrix times vector/matrix product */
|
|
398
|
+
template <typename OtherDerived>
|
|
399
|
+
EIGEN_DEVICE_FUNC const Product<TriangularViewType, OtherDerived> operator*(
|
|
400
|
+
const MatrixBase<OtherDerived>& rhs) const {
|
|
401
|
+
return Product<TriangularViewType, OtherDerived>(derived(), rhs.derived());
|
|
402
|
+
}
|
|
455
403
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
return Product<OtherDerived,TriangularViewType>(lhs.derived(),rhs.derived());
|
|
463
|
-
}
|
|
404
|
+
/** Efficient vector/matrix times triangular matrix product */
|
|
405
|
+
template <typename OtherDerived>
|
|
406
|
+
friend EIGEN_DEVICE_FUNC const Product<OtherDerived, TriangularViewType> operator*(
|
|
407
|
+
const MatrixBase<OtherDerived>& lhs, const TriangularViewImpl& rhs) {
|
|
408
|
+
return Product<OtherDerived, TriangularViewType>(lhs.derived(), rhs.derived());
|
|
409
|
+
}
|
|
464
410
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
template<typename OtherDerived>
|
|
513
|
-
EIGEN_DEVICE_FUNC
|
|
411
|
+
/** \returns the product of the inverse of \c *this with \a other, \a *this being triangular.
|
|
412
|
+
*
|
|
413
|
+
* This function computes the inverse-matrix matrix product inverse(\c *this) * \a other if
|
|
414
|
+
* \a Side==OnTheLeft (the default), or the right-inverse-multiply \a other * inverse(\c *this) if
|
|
415
|
+
* \a Side==OnTheRight.
|
|
416
|
+
*
|
|
417
|
+
* Note that the template parameter \c Side can be omitted, in which case \c Side==OnTheLeft
|
|
418
|
+
*
|
|
419
|
+
* The matrix \c *this must be triangular and invertible (i.e., all the coefficients of the
|
|
420
|
+
* diagonal must be non zero). It works as a forward (resp. backward) substitution if \c *this
|
|
421
|
+
* is an upper (resp. lower) triangular matrix.
|
|
422
|
+
*
|
|
423
|
+
* Example: \include Triangular_solve.cpp
|
|
424
|
+
* Output: \verbinclude Triangular_solve.out
|
|
425
|
+
*
|
|
426
|
+
* This function returns an expression of the inverse-multiply and can works in-place if it is assigned
|
|
427
|
+
* to the same matrix or vector \a other.
|
|
428
|
+
*
|
|
429
|
+
* For users coming from BLAS, this function (and more specifically solveInPlace()) offer
|
|
430
|
+
* all the operations supported by the \c *TRSV and \c *TRSM BLAS routines.
|
|
431
|
+
*
|
|
432
|
+
* \sa TriangularView::solveInPlace()
|
|
433
|
+
*/
|
|
434
|
+
template <int Side, typename Other>
|
|
435
|
+
inline const internal::triangular_solve_retval<Side, TriangularViewType, Other> solve(
|
|
436
|
+
const MatrixBase<Other>& other) const;
|
|
437
|
+
|
|
438
|
+
/** "in-place" version of TriangularView::solve() where the result is written in \a other
|
|
439
|
+
*
|
|
440
|
+
* \warning The parameter is only marked 'const' to make the C++ compiler accept a temporary expression here.
|
|
441
|
+
* This function will const_cast it, so constness isn't honored here.
|
|
442
|
+
*
|
|
443
|
+
* Note that the template parameter \c Side can be omitted, in which case \c Side==OnTheLeft
|
|
444
|
+
*
|
|
445
|
+
* See TriangularView:solve() for the details.
|
|
446
|
+
*/
|
|
447
|
+
template <int Side, typename OtherDerived>
|
|
448
|
+
EIGEN_DEVICE_FUNC void solveInPlace(const MatrixBase<OtherDerived>& other) const;
|
|
449
|
+
|
|
450
|
+
template <typename OtherDerived>
|
|
451
|
+
EIGEN_DEVICE_FUNC void solveInPlace(const MatrixBase<OtherDerived>& other) const {
|
|
452
|
+
return solveInPlace<OnTheLeft>(other);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/** Swaps the coefficients of the common triangular parts of two matrices */
|
|
456
|
+
template <typename OtherDerived>
|
|
457
|
+
EIGEN_DEVICE_FUNC
|
|
514
458
|
#ifdef EIGEN_PARSED_BY_DOXYGEN
|
|
515
|
-
|
|
459
|
+
void
|
|
460
|
+
swap(TriangularBase<OtherDerived>& other)
|
|
516
461
|
#else
|
|
517
|
-
|
|
462
|
+
void
|
|
463
|
+
swap(TriangularBase<OtherDerived> const& other)
|
|
518
464
|
#endif
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
465
|
+
{
|
|
466
|
+
EIGEN_STATIC_ASSERT_LVALUE(OtherDerived);
|
|
467
|
+
call_assignment(derived(), other.const_cast_derived(), internal::swap_assign_op<Scalar>());
|
|
468
|
+
}
|
|
523
469
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
call_assignment(derived(), other.const_cast_derived(), internal::swap_assign_op<Scalar>());
|
|
532
|
-
}
|
|
470
|
+
/** Shortcut for \code (*this).swap(other.triangularView<(*this)::Mode>()) \endcode */
|
|
471
|
+
template <typename OtherDerived>
|
|
472
|
+
/** \deprecated */
|
|
473
|
+
EIGEN_DEPRECATED EIGEN_DEVICE_FUNC void swap(MatrixBase<OtherDerived> const& other) {
|
|
474
|
+
EIGEN_STATIC_ASSERT_LVALUE(OtherDerived);
|
|
475
|
+
call_assignment(derived(), other.const_cast_derived(), internal::swap_assign_op<Scalar>());
|
|
476
|
+
}
|
|
533
477
|
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
this->solveInPlace(dst);
|
|
540
|
-
}
|
|
478
|
+
template <typename RhsType, typename DstType>
|
|
479
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _solve_impl(const RhsType& rhs, DstType& dst) const {
|
|
480
|
+
if (!internal::is_same_dense(dst, rhs)) dst = rhs;
|
|
481
|
+
this->solveInPlace(dst);
|
|
482
|
+
}
|
|
541
483
|
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
protected:
|
|
546
|
-
EIGEN_DEFAULT_COPY_CONSTRUCTOR(TriangularViewImpl)
|
|
547
|
-
EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(TriangularViewImpl)
|
|
484
|
+
template <typename ProductType>
|
|
485
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TriangularViewType& _assignProduct(const ProductType& prod, const Scalar& alpha,
|
|
486
|
+
bool beta);
|
|
548
487
|
|
|
488
|
+
protected:
|
|
489
|
+
EIGEN_DEFAULT_COPY_CONSTRUCTOR(TriangularViewImpl)
|
|
490
|
+
EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(TriangularViewImpl)
|
|
549
491
|
};
|
|
550
492
|
|
|
551
493
|
/***************************************************************************
|
|
552
|
-
* Implementation of triangular evaluation/assignment
|
|
553
|
-
***************************************************************************/
|
|
494
|
+
* Implementation of triangular evaluation/assignment
|
|
495
|
+
***************************************************************************/
|
|
554
496
|
|
|
555
497
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
|
556
498
|
// FIXME should we keep that possibility
|
|
557
|
-
template<typename MatrixType, unsigned int Mode>
|
|
558
|
-
template<typename OtherDerived>
|
|
559
|
-
inline TriangularView<MatrixType, Mode>&
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
499
|
+
template <typename MatrixType, unsigned int Mode>
|
|
500
|
+
template <typename OtherDerived>
|
|
501
|
+
EIGEN_DEVICE_FUNC inline TriangularView<MatrixType, Mode>& TriangularViewImpl<MatrixType, Mode, Dense>::operator=(
|
|
502
|
+
const MatrixBase<OtherDerived>& other) {
|
|
503
|
+
internal::call_assignment_no_alias(derived(), other.derived(),
|
|
504
|
+
internal::assign_op<Scalar, typename OtherDerived::Scalar>());
|
|
563
505
|
return derived();
|
|
564
506
|
}
|
|
565
507
|
|
|
566
508
|
// FIXME should we keep that possibility
|
|
567
|
-
template<typename MatrixType, unsigned int Mode>
|
|
568
|
-
template<typename OtherDerived>
|
|
569
|
-
void TriangularViewImpl<MatrixType, Mode, Dense>::lazyAssign(const MatrixBase<OtherDerived>& other)
|
|
570
|
-
{
|
|
509
|
+
template <typename MatrixType, unsigned int Mode>
|
|
510
|
+
template <typename OtherDerived>
|
|
511
|
+
EIGEN_DEVICE_FUNC void TriangularViewImpl<MatrixType, Mode, Dense>::lazyAssign(const MatrixBase<OtherDerived>& other) {
|
|
571
512
|
internal::call_assignment_no_alias(derived(), other.template triangularView<Mode>());
|
|
572
513
|
}
|
|
573
514
|
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
inline TriangularView<MatrixType, Mode>&
|
|
579
|
-
TriangularViewImpl<MatrixType, Mode, Dense>::operator=(const TriangularBase<OtherDerived>& other)
|
|
580
|
-
{
|
|
515
|
+
template <typename MatrixType, unsigned int Mode>
|
|
516
|
+
template <typename OtherDerived>
|
|
517
|
+
EIGEN_DEVICE_FUNC inline TriangularView<MatrixType, Mode>& TriangularViewImpl<MatrixType, Mode, Dense>::operator=(
|
|
518
|
+
const TriangularBase<OtherDerived>& other) {
|
|
581
519
|
eigen_assert(Mode == int(OtherDerived::Mode));
|
|
582
520
|
internal::call_assignment(derived(), other.derived());
|
|
583
521
|
return derived();
|
|
584
522
|
}
|
|
585
523
|
|
|
586
|
-
template<typename MatrixType, unsigned int Mode>
|
|
587
|
-
template<typename OtherDerived>
|
|
588
|
-
void TriangularViewImpl<MatrixType, Mode, Dense>::lazyAssign(
|
|
589
|
-
{
|
|
524
|
+
template <typename MatrixType, unsigned int Mode>
|
|
525
|
+
template <typename OtherDerived>
|
|
526
|
+
EIGEN_DEVICE_FUNC void TriangularViewImpl<MatrixType, Mode, Dense>::lazyAssign(
|
|
527
|
+
const TriangularBase<OtherDerived>& other) {
|
|
590
528
|
eigen_assert(Mode == int(OtherDerived::Mode));
|
|
591
529
|
internal::call_assignment_no_alias(derived(), other.derived());
|
|
592
530
|
}
|
|
593
531
|
#endif
|
|
594
532
|
|
|
595
533
|
/***************************************************************************
|
|
596
|
-
* Implementation of TriangularBase methods
|
|
597
|
-
***************************************************************************/
|
|
534
|
+
* Implementation of TriangularBase methods
|
|
535
|
+
***************************************************************************/
|
|
598
536
|
|
|
599
537
|
/** Assigns a triangular or selfadjoint matrix to a dense matrix.
|
|
600
|
-
|
|
601
|
-
template<typename Derived>
|
|
602
|
-
template<typename DenseDerived>
|
|
603
|
-
void TriangularBase<Derived>::evalTo(MatrixBase<DenseDerived
|
|
604
|
-
{
|
|
538
|
+
* If the matrix is triangular, the opposite part is set to zero. */
|
|
539
|
+
template <typename Derived>
|
|
540
|
+
template <typename DenseDerived>
|
|
541
|
+
EIGEN_DEVICE_FUNC void TriangularBase<Derived>::evalTo(MatrixBase<DenseDerived>& other) const {
|
|
605
542
|
evalToLazy(other.derived());
|
|
606
543
|
}
|
|
607
544
|
|
|
608
545
|
/***************************************************************************
|
|
609
|
-
* Implementation of TriangularView methods
|
|
610
|
-
***************************************************************************/
|
|
546
|
+
* Implementation of TriangularView methods
|
|
547
|
+
***************************************************************************/
|
|
611
548
|
|
|
612
549
|
/***************************************************************************
|
|
613
|
-
* Implementation of MatrixBase methods
|
|
614
|
-
***************************************************************************/
|
|
550
|
+
* Implementation of MatrixBase methods
|
|
551
|
+
***************************************************************************/
|
|
615
552
|
|
|
616
553
|
/**
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
template<typename Derived>
|
|
628
|
-
template<unsigned int Mode>
|
|
629
|
-
typename MatrixBase<Derived>::template TriangularViewReturnType<Mode>::Type
|
|
630
|
-
MatrixBase<Derived>::triangularView()
|
|
631
|
-
{
|
|
554
|
+
* \returns an expression of a triangular view extracted from the current matrix
|
|
555
|
+
*
|
|
556
|
+
* The parameter \a Mode can have the following values: \c #Upper, \c #StrictlyUpper, \c #UnitUpper,
|
|
557
|
+
* \c #Lower, \c #StrictlyLower, \c #UnitLower.
|
|
558
|
+
*
|
|
559
|
+
* Example: \include MatrixBase_triangularView.cpp
|
|
560
|
+
* Output: \verbinclude MatrixBase_triangularView.out
|
|
561
|
+
*
|
|
562
|
+
* \sa class TriangularView
|
|
563
|
+
*/
|
|
564
|
+
template <typename Derived>
|
|
565
|
+
template <unsigned int Mode>
|
|
566
|
+
EIGEN_DEVICE_FUNC typename MatrixBase<Derived>::template TriangularViewReturnType<Mode>::Type
|
|
567
|
+
MatrixBase<Derived>::triangularView() {
|
|
632
568
|
return typename TriangularViewReturnType<Mode>::Type(derived());
|
|
633
569
|
}
|
|
634
570
|
|
|
635
571
|
/** This is the const version of MatrixBase::triangularView() */
|
|
636
|
-
template<typename Derived>
|
|
637
|
-
template<unsigned int Mode>
|
|
638
|
-
typename MatrixBase<Derived>::template ConstTriangularViewReturnType<Mode>::Type
|
|
639
|
-
MatrixBase<Derived>::triangularView() const
|
|
640
|
-
{
|
|
572
|
+
template <typename Derived>
|
|
573
|
+
template <unsigned int Mode>
|
|
574
|
+
EIGEN_DEVICE_FUNC typename MatrixBase<Derived>::template ConstTriangularViewReturnType<Mode>::Type
|
|
575
|
+
MatrixBase<Derived>::triangularView() const {
|
|
641
576
|
return typename ConstTriangularViewReturnType<Mode>::Type(derived());
|
|
642
577
|
}
|
|
643
578
|
|
|
644
579
|
/** \returns true if *this is approximately equal to an upper triangular matrix,
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
template<typename Derived>
|
|
650
|
-
bool MatrixBase<Derived>::isUpperTriangular(const RealScalar& prec) const
|
|
651
|
-
{
|
|
580
|
+
* within the precision given by \a prec.
|
|
581
|
+
*
|
|
582
|
+
* \sa isLowerTriangular()
|
|
583
|
+
*/
|
|
584
|
+
template <typename Derived>
|
|
585
|
+
bool MatrixBase<Derived>::isUpperTriangular(const RealScalar& prec) const {
|
|
652
586
|
RealScalar maxAbsOnUpperPart = static_cast<RealScalar>(-1);
|
|
653
|
-
for(Index j = 0; j < cols(); ++j)
|
|
654
|
-
|
|
655
|
-
Index
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
RealScalar absValue = numext::abs(coeff(i,j));
|
|
659
|
-
if(absValue > maxAbsOnUpperPart) maxAbsOnUpperPart = absValue;
|
|
587
|
+
for (Index j = 0; j < cols(); ++j) {
|
|
588
|
+
Index maxi = numext::mini(j, rows() - 1);
|
|
589
|
+
for (Index i = 0; i <= maxi; ++i) {
|
|
590
|
+
RealScalar absValue = numext::abs(coeff(i, j));
|
|
591
|
+
if (absValue > maxAbsOnUpperPart) maxAbsOnUpperPart = absValue;
|
|
660
592
|
}
|
|
661
593
|
}
|
|
662
594
|
RealScalar threshold = maxAbsOnUpperPart * prec;
|
|
663
|
-
for(Index j = 0; j < cols(); ++j)
|
|
664
|
-
for(Index i = j+1; i < rows(); ++i)
|
|
665
|
-
if(numext::abs(coeff(i, j)) > threshold) return false;
|
|
595
|
+
for (Index j = 0; j < cols(); ++j)
|
|
596
|
+
for (Index i = j + 1; i < rows(); ++i)
|
|
597
|
+
if (numext::abs(coeff(i, j)) > threshold) return false;
|
|
666
598
|
return true;
|
|
667
599
|
}
|
|
668
600
|
|
|
669
601
|
/** \returns true if *this is approximately equal to a lower triangular matrix,
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
template<typename Derived>
|
|
675
|
-
bool MatrixBase<Derived>::isLowerTriangular(const RealScalar& prec) const
|
|
676
|
-
{
|
|
602
|
+
* within the precision given by \a prec.
|
|
603
|
+
*
|
|
604
|
+
* \sa isUpperTriangular()
|
|
605
|
+
*/
|
|
606
|
+
template <typename Derived>
|
|
607
|
+
bool MatrixBase<Derived>::isLowerTriangular(const RealScalar& prec) const {
|
|
677
608
|
RealScalar maxAbsOnLowerPart = static_cast<RealScalar>(-1);
|
|
678
|
-
for(Index j = 0; j < cols(); ++j)
|
|
679
|
-
for(Index i = j; i < rows(); ++i)
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
if(absValue > maxAbsOnLowerPart) maxAbsOnLowerPart = absValue;
|
|
609
|
+
for (Index j = 0; j < cols(); ++j)
|
|
610
|
+
for (Index i = j; i < rows(); ++i) {
|
|
611
|
+
RealScalar absValue = numext::abs(coeff(i, j));
|
|
612
|
+
if (absValue > maxAbsOnLowerPart) maxAbsOnLowerPart = absValue;
|
|
683
613
|
}
|
|
684
614
|
RealScalar threshold = maxAbsOnLowerPart * prec;
|
|
685
|
-
for(Index j = 1; j < cols(); ++j)
|
|
686
|
-
|
|
687
|
-
Index
|
|
688
|
-
|
|
689
|
-
if(numext::abs(coeff(i, j)) > threshold) return false;
|
|
615
|
+
for (Index j = 1; j < cols(); ++j) {
|
|
616
|
+
Index maxi = numext::mini(j, rows() - 1);
|
|
617
|
+
for (Index i = 0; i < maxi; ++i)
|
|
618
|
+
if (numext::abs(coeff(i, j)) > threshold) return false;
|
|
690
619
|
}
|
|
691
620
|
return true;
|
|
692
621
|
}
|
|
693
622
|
|
|
694
|
-
|
|
695
623
|
/***************************************************************************
|
|
696
624
|
****************************************************************************
|
|
697
625
|
* Evaluators and Assignment of triangular expressions
|
|
@@ -700,91 +628,85 @@ bool MatrixBase<Derived>::isLowerTriangular(const RealScalar& prec) const
|
|
|
700
628
|
|
|
701
629
|
namespace internal {
|
|
702
630
|
|
|
703
|
-
|
|
704
631
|
// TODO currently a triangular expression has the form TriangularView<.,.>
|
|
705
632
|
// in the future triangular-ness should be defined by the expression traits
|
|
706
|
-
// such that Transpose<TriangularView<.,.> > is valid. (currently TriangularBase::transpose() is overloaded to make
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
{
|
|
633
|
+
// such that Transpose<TriangularView<.,.> > is valid. (currently TriangularBase::transpose() is overloaded to make
|
|
634
|
+
// it work)
|
|
635
|
+
template <typename MatrixType, unsigned int Mode>
|
|
636
|
+
struct evaluator_traits<TriangularView<MatrixType, Mode>> {
|
|
710
637
|
typedef typename storage_kind_to_evaluator_kind<typename MatrixType::StorageKind>::Kind Kind;
|
|
711
638
|
typedef typename glue_shapes<typename evaluator_traits<MatrixType>::Shape, TriangularShape>::type Shape;
|
|
712
639
|
};
|
|
713
640
|
|
|
714
|
-
template<typename MatrixType, unsigned int Mode>
|
|
715
|
-
struct unary_evaluator<TriangularView<MatrixType,Mode>, IndexBased>
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
typedef evaluator<typename internal::remove_all<MatrixType>::type> Base;
|
|
720
|
-
unary_evaluator(const XprType &xpr) : Base(xpr.nestedExpression()) {}
|
|
641
|
+
template <typename MatrixType, unsigned int Mode>
|
|
642
|
+
struct unary_evaluator<TriangularView<MatrixType, Mode>, IndexBased> : evaluator<internal::remove_all_t<MatrixType>> {
|
|
643
|
+
typedef TriangularView<MatrixType, Mode> XprType;
|
|
644
|
+
typedef evaluator<internal::remove_all_t<MatrixType>> Base;
|
|
645
|
+
EIGEN_DEVICE_FUNC unary_evaluator(const XprType& xpr) : Base(xpr.nestedExpression()) {}
|
|
721
646
|
};
|
|
722
647
|
|
|
723
648
|
// Additional assignment kinds:
|
|
724
|
-
struct Triangular2Triangular
|
|
725
|
-
struct Triangular2Dense
|
|
726
|
-
struct Dense2Triangular
|
|
649
|
+
struct Triangular2Triangular {};
|
|
650
|
+
struct Triangular2Dense {};
|
|
651
|
+
struct Dense2Triangular {};
|
|
727
652
|
|
|
653
|
+
template <typename Kernel, unsigned int Mode, int UnrollCount, bool ClearOpposite>
|
|
654
|
+
struct triangular_assignment_loop;
|
|
728
655
|
|
|
729
|
-
template<typename Kernel, unsigned int Mode, int UnrollCount, bool ClearOpposite> struct triangular_assignment_loop;
|
|
730
|
-
|
|
731
|
-
|
|
732
656
|
/** \internal Specialization of the dense assignment kernel for triangular matrices.
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
template<int UpLo, int Mode, int SetOpposite, typename DstEvaluatorTypeT, typename SrcEvaluatorTypeT, typename Functor,
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
657
|
+
* The main difference is that the triangular, diagonal, and opposite parts are processed through three different
|
|
658
|
+
* functions. \tparam UpLo must be either Lower or Upper \tparam Mode must be either 0, UnitDiag, ZeroDiag, or
|
|
659
|
+
* SelfAdjoint
|
|
660
|
+
*/
|
|
661
|
+
template <int UpLo, int Mode, int SetOpposite, typename DstEvaluatorTypeT, typename SrcEvaluatorTypeT, typename Functor,
|
|
662
|
+
int Version = Specialized>
|
|
663
|
+
class triangular_dense_assignment_kernel
|
|
664
|
+
: public generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, Version> {
|
|
665
|
+
protected:
|
|
741
666
|
typedef generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, Version> Base;
|
|
742
667
|
typedef typename Base::DstXprType DstXprType;
|
|
743
668
|
typedef typename Base::SrcXprType SrcXprType;
|
|
744
669
|
using Base::m_dst;
|
|
745
|
-
using Base::m_src;
|
|
746
670
|
using Base::m_functor;
|
|
747
|
-
|
|
748
|
-
|
|
671
|
+
using Base::m_src;
|
|
672
|
+
|
|
673
|
+
public:
|
|
749
674
|
typedef typename Base::DstEvaluatorType DstEvaluatorType;
|
|
750
675
|
typedef typename Base::SrcEvaluatorType SrcEvaluatorType;
|
|
751
676
|
typedef typename Base::Scalar Scalar;
|
|
752
677
|
typedef typename Base::AssignmentTraits AssignmentTraits;
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
678
|
+
|
|
679
|
+
EIGEN_DEVICE_FUNC triangular_dense_assignment_kernel(DstEvaluatorType& dst, const SrcEvaluatorType& src,
|
|
680
|
+
const Functor& func, DstXprType& dstExpr)
|
|
681
|
+
: Base(dst, src, func, dstExpr) {}
|
|
682
|
+
|
|
759
683
|
#ifdef EIGEN_INTERNAL_DEBUGGING
|
|
760
|
-
EIGEN_DEVICE_FUNC void assignCoeff(Index row, Index col)
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
Base::assignCoeff(row,col);
|
|
684
|
+
EIGEN_DEVICE_FUNC void assignCoeff(Index row, Index col) {
|
|
685
|
+
eigen_internal_assert(row != col);
|
|
686
|
+
Base::assignCoeff(row, col);
|
|
764
687
|
}
|
|
765
688
|
#else
|
|
766
689
|
using Base::assignCoeff;
|
|
767
690
|
#endif
|
|
768
|
-
|
|
769
|
-
EIGEN_DEVICE_FUNC void assignDiagonalCoeff(Index id)
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
else if(Mode==ZeroDiag && SetOpposite)
|
|
773
|
-
|
|
691
|
+
|
|
692
|
+
EIGEN_DEVICE_FUNC void assignDiagonalCoeff(Index id) {
|
|
693
|
+
if (Mode == UnitDiag && SetOpposite)
|
|
694
|
+
m_functor.assignCoeff(m_dst.coeffRef(id, id), Scalar(1));
|
|
695
|
+
else if (Mode == ZeroDiag && SetOpposite)
|
|
696
|
+
m_functor.assignCoeff(m_dst.coeffRef(id, id), Scalar(0));
|
|
697
|
+
else if (Mode == 0)
|
|
698
|
+
Base::assignCoeff(id, id);
|
|
774
699
|
}
|
|
775
|
-
|
|
776
|
-
EIGEN_DEVICE_FUNC void assignOppositeCoeff(Index row, Index col)
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
if(SetOpposite)
|
|
780
|
-
m_functor.assignCoeff(m_dst.coeffRef(row,col), Scalar(0));
|
|
700
|
+
|
|
701
|
+
EIGEN_DEVICE_FUNC void assignOppositeCoeff(Index row, Index col) {
|
|
702
|
+
eigen_internal_assert(row != col);
|
|
703
|
+
if (SetOpposite) m_functor.assignCoeff(m_dst.coeffRef(row, col), Scalar(0));
|
|
781
704
|
}
|
|
782
705
|
};
|
|
783
706
|
|
|
784
|
-
template<int Mode, bool SetOpposite, typename DstXprType, typename SrcXprType, typename Functor>
|
|
785
|
-
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
|
786
|
-
|
|
787
|
-
{
|
|
707
|
+
template <int Mode, bool SetOpposite, typename DstXprType, typename SrcXprType, typename Functor>
|
|
708
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_triangular_assignment_loop(DstXprType& dst, const SrcXprType& src,
|
|
709
|
+
const Functor& func) {
|
|
788
710
|
typedef evaluator<DstXprType> DstEvaluatorType;
|
|
789
711
|
typedef evaluator<SrcXprType> SrcEvaluatorType;
|
|
790
712
|
|
|
@@ -792,194 +714,187 @@ void call_triangular_assignment_loop(DstXprType& dst, const SrcXprType& src, con
|
|
|
792
714
|
|
|
793
715
|
Index dstRows = src.rows();
|
|
794
716
|
Index dstCols = src.cols();
|
|
795
|
-
if((dst.rows()!=dstRows) || (dst.cols()!=dstCols))
|
|
796
|
-
dst.resize(dstRows, dstCols);
|
|
717
|
+
if ((dst.rows() != dstRows) || (dst.cols() != dstCols)) dst.resize(dstRows, dstCols);
|
|
797
718
|
DstEvaluatorType dstEvaluator(dst);
|
|
798
|
-
|
|
799
|
-
typedef triangular_dense_assignment_kernel<
|
|
800
|
-
|
|
719
|
+
|
|
720
|
+
typedef triangular_dense_assignment_kernel<Mode&(Lower | Upper), Mode&(UnitDiag | ZeroDiag | SelfAdjoint),
|
|
721
|
+
SetOpposite, DstEvaluatorType, SrcEvaluatorType, Functor>
|
|
722
|
+
Kernel;
|
|
801
723
|
Kernel kernel(dstEvaluator, srcEvaluator, func, dst.const_cast_derived());
|
|
802
|
-
|
|
724
|
+
|
|
803
725
|
enum {
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
triangular_assignment_loop<Kernel, Mode, unroll ? int(DstXprType::SizeAtCompileTime) : Dynamic, SetOpposite>::run(kernel);
|
|
810
|
-
}
|
|
726
|
+
unroll = DstXprType::SizeAtCompileTime != Dynamic && SrcEvaluatorType::CoeffReadCost < HugeCost &&
|
|
727
|
+
DstXprType::SizeAtCompileTime *
|
|
728
|
+
(int(DstEvaluatorType::CoeffReadCost) + int(SrcEvaluatorType::CoeffReadCost)) / 2 <=
|
|
729
|
+
EIGEN_UNROLLING_LIMIT
|
|
730
|
+
};
|
|
811
731
|
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
void call_triangular_assignment_loop(DstXprType& dst, const SrcXprType& src)
|
|
815
|
-
{
|
|
816
|
-
call_triangular_assignment_loop<Mode,SetOpposite>(dst, src, internal::assign_op<typename DstXprType::Scalar,typename SrcXprType::Scalar>());
|
|
732
|
+
triangular_assignment_loop<Kernel, Mode, unroll ? int(DstXprType::SizeAtCompileTime) : Dynamic, SetOpposite>::run(
|
|
733
|
+
kernel);
|
|
817
734
|
}
|
|
818
735
|
|
|
819
|
-
template
|
|
820
|
-
|
|
821
|
-
|
|
736
|
+
template <int Mode, bool SetOpposite, typename DstXprType, typename SrcXprType>
|
|
737
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_triangular_assignment_loop(DstXprType& dst, const SrcXprType& src) {
|
|
738
|
+
call_triangular_assignment_loop<Mode, SetOpposite>(
|
|
739
|
+
dst, src, internal::assign_op<typename DstXprType::Scalar, typename SrcXprType::Scalar>());
|
|
740
|
+
}
|
|
822
741
|
|
|
742
|
+
template <>
|
|
743
|
+
struct AssignmentKind<TriangularShape, TriangularShape> {
|
|
744
|
+
typedef Triangular2Triangular Kind;
|
|
745
|
+
};
|
|
746
|
+
template <>
|
|
747
|
+
struct AssignmentKind<DenseShape, TriangularShape> {
|
|
748
|
+
typedef Triangular2Dense Kind;
|
|
749
|
+
};
|
|
750
|
+
template <>
|
|
751
|
+
struct AssignmentKind<TriangularShape, DenseShape> {
|
|
752
|
+
typedef Dense2Triangular Kind;
|
|
753
|
+
};
|
|
823
754
|
|
|
824
|
-
template<
|
|
825
|
-
struct Assignment<DstXprType, SrcXprType, Functor, Triangular2Triangular>
|
|
826
|
-
{
|
|
827
|
-
EIGEN_DEVICE_FUNC static void run(DstXprType &dst, const SrcXprType &src, const Functor &func)
|
|
828
|
-
{
|
|
755
|
+
template <typename DstXprType, typename SrcXprType, typename Functor>
|
|
756
|
+
struct Assignment<DstXprType, SrcXprType, Functor, Triangular2Triangular> {
|
|
757
|
+
EIGEN_DEVICE_FUNC static void run(DstXprType& dst, const SrcXprType& src, const Functor& func) {
|
|
829
758
|
eigen_assert(int(DstXprType::Mode) == int(SrcXprType::Mode));
|
|
830
|
-
|
|
831
|
-
call_triangular_assignment_loop<DstXprType::Mode, false>(dst, src, func);
|
|
759
|
+
|
|
760
|
+
call_triangular_assignment_loop<DstXprType::Mode, false>(dst, src, func);
|
|
832
761
|
}
|
|
833
762
|
};
|
|
834
763
|
|
|
835
|
-
template<
|
|
836
|
-
struct Assignment<DstXprType, SrcXprType, Functor, Triangular2Dense>
|
|
837
|
-
{
|
|
838
|
-
|
|
839
|
-
{
|
|
840
|
-
call_triangular_assignment_loop<SrcXprType::Mode, (SrcXprType::Mode&SelfAdjoint)==0>(dst, src, func);
|
|
764
|
+
template <typename DstXprType, typename SrcXprType, typename Functor>
|
|
765
|
+
struct Assignment<DstXprType, SrcXprType, Functor, Triangular2Dense> {
|
|
766
|
+
EIGEN_DEVICE_FUNC static void run(DstXprType& dst, const SrcXprType& src, const Functor& func) {
|
|
767
|
+
call_triangular_assignment_loop<SrcXprType::Mode, (int(SrcXprType::Mode) & int(SelfAdjoint)) == 0>(dst, src, func);
|
|
841
768
|
}
|
|
842
769
|
};
|
|
843
770
|
|
|
844
|
-
template<
|
|
845
|
-
struct Assignment<DstXprType, SrcXprType, Functor, Dense2Triangular>
|
|
846
|
-
{
|
|
847
|
-
|
|
848
|
-
{
|
|
849
|
-
call_triangular_assignment_loop<DstXprType::Mode, false>(dst, src, func);
|
|
771
|
+
template <typename DstXprType, typename SrcXprType, typename Functor>
|
|
772
|
+
struct Assignment<DstXprType, SrcXprType, Functor, Dense2Triangular> {
|
|
773
|
+
EIGEN_DEVICE_FUNC static void run(DstXprType& dst, const SrcXprType& src, const Functor& func) {
|
|
774
|
+
call_triangular_assignment_loop<DstXprType::Mode, false>(dst, src, func);
|
|
850
775
|
}
|
|
851
776
|
};
|
|
852
777
|
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
struct triangular_assignment_loop
|
|
856
|
-
{
|
|
778
|
+
template <typename Kernel, unsigned int Mode, int UnrollCount, bool SetOpposite>
|
|
779
|
+
struct triangular_assignment_loop {
|
|
857
780
|
// FIXME: this is not very clean, perhaps this information should be provided by the kernel?
|
|
858
781
|
typedef typename Kernel::DstEvaluatorType DstEvaluatorType;
|
|
859
782
|
typedef typename DstEvaluatorType::XprType DstXprType;
|
|
860
|
-
|
|
783
|
+
|
|
861
784
|
enum {
|
|
862
|
-
col = (UnrollCount-1) / DstXprType::RowsAtCompileTime,
|
|
863
|
-
row = (UnrollCount-1) % DstXprType::RowsAtCompileTime
|
|
785
|
+
col = (UnrollCount - 1) / DstXprType::RowsAtCompileTime,
|
|
786
|
+
row = (UnrollCount - 1) % DstXprType::RowsAtCompileTime
|
|
864
787
|
};
|
|
865
|
-
|
|
788
|
+
|
|
866
789
|
typedef typename Kernel::Scalar Scalar;
|
|
867
790
|
|
|
868
|
-
EIGEN_DEVICE_FUNC
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
if(row==col)
|
|
791
|
+
EIGEN_DEVICE_FUNC static inline void run(Kernel& kernel) {
|
|
792
|
+
triangular_assignment_loop<Kernel, Mode, UnrollCount - 1, SetOpposite>::run(kernel);
|
|
793
|
+
|
|
794
|
+
if (row == col)
|
|
874
795
|
kernel.assignDiagonalCoeff(row);
|
|
875
|
-
else if
|
|
876
|
-
kernel.assignCoeff(row,col);
|
|
877
|
-
else if(SetOpposite)
|
|
878
|
-
kernel.assignOppositeCoeff(row,col);
|
|
796
|
+
else if (((Mode & Lower) && row > col) || ((Mode & Upper) && row < col))
|
|
797
|
+
kernel.assignCoeff(row, col);
|
|
798
|
+
else if (SetOpposite)
|
|
799
|
+
kernel.assignOppositeCoeff(row, col);
|
|
879
800
|
}
|
|
880
801
|
};
|
|
881
802
|
|
|
882
803
|
// prevent buggy user code from causing an infinite recursion
|
|
883
|
-
template<typename Kernel, unsigned int Mode, bool SetOpposite>
|
|
884
|
-
struct triangular_assignment_loop<Kernel, Mode, 0, SetOpposite>
|
|
885
|
-
{
|
|
886
|
-
EIGEN_DEVICE_FUNC
|
|
887
|
-
static inline void run(Kernel &) {}
|
|
804
|
+
template <typename Kernel, unsigned int Mode, bool SetOpposite>
|
|
805
|
+
struct triangular_assignment_loop<Kernel, Mode, 0, SetOpposite> {
|
|
806
|
+
EIGEN_DEVICE_FUNC static inline void run(Kernel&) {}
|
|
888
807
|
};
|
|
889
808
|
|
|
890
|
-
|
|
891
|
-
|
|
892
809
|
// TODO: experiment with a recursive assignment procedure splitting the current
|
|
893
810
|
// triangular part into one rectangular and two triangular parts.
|
|
894
811
|
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
struct triangular_assignment_loop<Kernel, Mode, Dynamic, SetOpposite>
|
|
898
|
-
{
|
|
812
|
+
template <typename Kernel, unsigned int Mode, bool SetOpposite>
|
|
813
|
+
struct triangular_assignment_loop<Kernel, Mode, Dynamic, SetOpposite> {
|
|
899
814
|
typedef typename Kernel::Scalar Scalar;
|
|
900
|
-
EIGEN_DEVICE_FUNC
|
|
901
|
-
|
|
902
|
-
{
|
|
903
|
-
for(Index j = 0; j < kernel.cols(); ++j)
|
|
904
|
-
{
|
|
815
|
+
EIGEN_DEVICE_FUNC static inline void run(Kernel& kernel) {
|
|
816
|
+
for (Index j = 0; j < kernel.cols(); ++j) {
|
|
905
817
|
Index maxi = numext::mini(j, kernel.rows());
|
|
906
818
|
Index i = 0;
|
|
907
|
-
if (((Mode&Lower) && SetOpposite) || (Mode&Upper))
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
else
|
|
912
|
-
|
|
913
|
-
else
|
|
819
|
+
if (((Mode & Lower) && SetOpposite) || (Mode & Upper)) {
|
|
820
|
+
for (; i < maxi; ++i)
|
|
821
|
+
if (Mode & Upper)
|
|
822
|
+
kernel.assignCoeff(i, j);
|
|
823
|
+
else
|
|
824
|
+
kernel.assignOppositeCoeff(i, j);
|
|
825
|
+
} else
|
|
914
826
|
i = maxi;
|
|
915
|
-
|
|
916
|
-
if(i<kernel.rows())
|
|
827
|
+
|
|
828
|
+
if (i < kernel.rows()) // then i==j
|
|
917
829
|
kernel.assignDiagonalCoeff(i++);
|
|
918
|
-
|
|
919
|
-
if (((Mode&Upper) && SetOpposite) || (Mode&Lower))
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
else
|
|
830
|
+
|
|
831
|
+
if (((Mode & Upper) && SetOpposite) || (Mode & Lower)) {
|
|
832
|
+
for (; i < kernel.rows(); ++i)
|
|
833
|
+
if (Mode & Lower)
|
|
834
|
+
kernel.assignCoeff(i, j);
|
|
835
|
+
else
|
|
836
|
+
kernel.assignOppositeCoeff(i, j);
|
|
924
837
|
}
|
|
925
838
|
}
|
|
926
839
|
}
|
|
927
840
|
};
|
|
928
841
|
|
|
929
|
-
}
|
|
842
|
+
} // end namespace internal
|
|
930
843
|
|
|
931
844
|
/** Assigns a triangular or selfadjoint matrix to a dense matrix.
|
|
932
|
-
|
|
933
|
-
template<typename Derived>
|
|
934
|
-
template<typename DenseDerived>
|
|
935
|
-
void TriangularBase<Derived>::evalToLazy(MatrixBase<DenseDerived
|
|
936
|
-
{
|
|
845
|
+
* If the matrix is triangular, the opposite part is set to zero. */
|
|
846
|
+
template <typename Derived>
|
|
847
|
+
template <typename DenseDerived>
|
|
848
|
+
EIGEN_DEVICE_FUNC void TriangularBase<Derived>::evalToLazy(MatrixBase<DenseDerived>& other) const {
|
|
937
849
|
other.derived().resize(this->rows(), this->cols());
|
|
938
|
-
internal::call_triangular_assignment_loop<Derived::Mode,
|
|
850
|
+
internal::call_triangular_assignment_loop<Derived::Mode,
|
|
851
|
+
(int(Derived::Mode) & int(SelfAdjoint)) == 0 /* SetOpposite */>(
|
|
852
|
+
other.derived(), derived().nestedExpression());
|
|
939
853
|
}
|
|
940
854
|
|
|
941
855
|
namespace internal {
|
|
942
|
-
|
|
856
|
+
|
|
943
857
|
// Triangular = Product
|
|
944
|
-
template<
|
|
945
|
-
struct Assignment<DstXprType, Product<Lhs,Rhs,
|
|
946
|
-
{
|
|
947
|
-
typedef Product<Lhs,Rhs,DefaultProduct> SrcXprType;
|
|
948
|
-
static void run(DstXprType
|
|
949
|
-
|
|
858
|
+
template <typename DstXprType, typename Lhs, typename Rhs, typename Scalar>
|
|
859
|
+
struct Assignment<DstXprType, Product<Lhs, Rhs, DefaultProduct>,
|
|
860
|
+
internal::assign_op<Scalar, typename Product<Lhs, Rhs, DefaultProduct>::Scalar>, Dense2Triangular> {
|
|
861
|
+
typedef Product<Lhs, Rhs, DefaultProduct> SrcXprType;
|
|
862
|
+
static void run(DstXprType& dst, const SrcXprType& src,
|
|
863
|
+
const internal::assign_op<Scalar, typename SrcXprType::Scalar>&) {
|
|
950
864
|
Index dstRows = src.rows();
|
|
951
865
|
Index dstCols = src.cols();
|
|
952
|
-
if((dst.rows()!=dstRows) || (dst.cols()!=dstCols))
|
|
953
|
-
dst.resize(dstRows, dstCols);
|
|
866
|
+
if ((dst.rows() != dstRows) || (dst.cols() != dstCols)) dst.resize(dstRows, dstCols);
|
|
954
867
|
|
|
955
|
-
dst._assignProduct(src, 1,
|
|
868
|
+
dst._assignProduct(src, Scalar(1), false);
|
|
956
869
|
}
|
|
957
870
|
};
|
|
958
871
|
|
|
959
872
|
// Triangular += Product
|
|
960
|
-
template<
|
|
961
|
-
struct Assignment<DstXprType, Product<Lhs,Rhs,
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
873
|
+
template <typename DstXprType, typename Lhs, typename Rhs, typename Scalar>
|
|
874
|
+
struct Assignment<DstXprType, Product<Lhs, Rhs, DefaultProduct>,
|
|
875
|
+
internal::add_assign_op<Scalar, typename Product<Lhs, Rhs, DefaultProduct>::Scalar>,
|
|
876
|
+
Dense2Triangular> {
|
|
877
|
+
typedef Product<Lhs, Rhs, DefaultProduct> SrcXprType;
|
|
878
|
+
static void run(DstXprType& dst, const SrcXprType& src,
|
|
879
|
+
const internal::add_assign_op<Scalar, typename SrcXprType::Scalar>&) {
|
|
880
|
+
dst._assignProduct(src, Scalar(1), true);
|
|
967
881
|
}
|
|
968
882
|
};
|
|
969
883
|
|
|
970
884
|
// Triangular -= Product
|
|
971
|
-
template<
|
|
972
|
-
struct Assignment<DstXprType, Product<Lhs,Rhs,
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
885
|
+
template <typename DstXprType, typename Lhs, typename Rhs, typename Scalar>
|
|
886
|
+
struct Assignment<DstXprType, Product<Lhs, Rhs, DefaultProduct>,
|
|
887
|
+
internal::sub_assign_op<Scalar, typename Product<Lhs, Rhs, DefaultProduct>::Scalar>,
|
|
888
|
+
Dense2Triangular> {
|
|
889
|
+
typedef Product<Lhs, Rhs, DefaultProduct> SrcXprType;
|
|
890
|
+
static void run(DstXprType& dst, const SrcXprType& src,
|
|
891
|
+
const internal::sub_assign_op<Scalar, typename SrcXprType::Scalar>&) {
|
|
892
|
+
dst._assignProduct(src, Scalar(-1), true);
|
|
978
893
|
}
|
|
979
894
|
};
|
|
980
895
|
|
|
981
|
-
}
|
|
896
|
+
} // end namespace internal
|
|
982
897
|
|
|
983
|
-
}
|
|
898
|
+
} // end namespace Eigen
|
|
984
899
|
|
|
985
|
-
#endif
|
|
900
|
+
#endif // EIGEN_TRIANGULARMATRIX_H
|