@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
|
@@ -12,941 +12,922 @@
|
|
|
12
12
|
#define EIGEN_DENSESTORAGEBASE_H
|
|
13
13
|
|
|
14
14
|
#if defined(EIGEN_INITIALIZE_MATRICES_BY_ZERO)
|
|
15
|
-
#
|
|
16
|
-
#
|
|
15
|
+
#define EIGEN_INITIALIZE_COEFFS
|
|
16
|
+
#define EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED \
|
|
17
|
+
for (Index i = 0; i < base().size(); ++i) coeffRef(i) = Scalar(0);
|
|
17
18
|
#elif defined(EIGEN_INITIALIZE_MATRICES_BY_NAN)
|
|
18
|
-
#
|
|
19
|
-
#
|
|
19
|
+
#define EIGEN_INITIALIZE_COEFFS
|
|
20
|
+
#define EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED \
|
|
21
|
+
for (Index i = 0; i < base().size(); ++i) coeffRef(i) = std::numeric_limits<Scalar>::quiet_NaN();
|
|
20
22
|
#else
|
|
21
|
-
#
|
|
22
|
-
#
|
|
23
|
+
#undef EIGEN_INITIALIZE_COEFFS
|
|
24
|
+
#define EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
|
|
23
25
|
#endif
|
|
24
26
|
|
|
27
|
+
// IWYU pragma: private
|
|
28
|
+
#include "./InternalHeaderCheck.h"
|
|
29
|
+
|
|
25
30
|
namespace Eigen {
|
|
26
31
|
|
|
27
32
|
namespace internal {
|
|
28
33
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
#ifndef EIGEN_NO_DEBUG
|
|
35
|
+
template <int MaxSizeAtCompileTime, int MaxRowsAtCompileTime, int MaxColsAtCompileTime>
|
|
36
|
+
struct check_rows_cols_for_overflow {
|
|
37
|
+
EIGEN_STATIC_ASSERT(MaxRowsAtCompileTime* MaxColsAtCompileTime == MaxSizeAtCompileTime,
|
|
38
|
+
YOU MADE A PROGRAMMING MISTAKE)
|
|
39
|
+
template <typename Index>
|
|
40
|
+
EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE constexpr void run(Index, Index) {}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
template <int MaxRowsAtCompileTime>
|
|
44
|
+
struct check_rows_cols_for_overflow<Dynamic, MaxRowsAtCompileTime, Dynamic> {
|
|
45
|
+
template <typename Index>
|
|
46
|
+
EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE constexpr void run(Index, Index cols) {
|
|
47
|
+
constexpr Index MaxIndex = NumTraits<Index>::highest();
|
|
48
|
+
bool error = cols > (MaxIndex / MaxRowsAtCompileTime);
|
|
49
|
+
if (error) throw_std_bad_alloc();
|
|
34
50
|
}
|
|
35
51
|
};
|
|
36
52
|
|
|
37
|
-
template
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
static EIGEN_ALWAYS_INLINE void run(Index rows, Index
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
Index max_index = (std::size_t(1) << (8 * sizeof(Index) - 1)) - 1; // assume Index is signed
|
|
45
|
-
bool error = (rows == 0 || cols == 0) ? false
|
|
46
|
-
: (rows > max_index / cols);
|
|
47
|
-
if (error)
|
|
48
|
-
throw_std_bad_alloc();
|
|
53
|
+
template <int MaxColsAtCompileTime>
|
|
54
|
+
struct check_rows_cols_for_overflow<Dynamic, Dynamic, MaxColsAtCompileTime> {
|
|
55
|
+
template <typename Index>
|
|
56
|
+
EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE constexpr void run(Index rows, Index) {
|
|
57
|
+
constexpr Index MaxIndex = NumTraits<Index>::highest();
|
|
58
|
+
bool error = rows > (MaxIndex / MaxColsAtCompileTime);
|
|
59
|
+
if (error) throw_std_bad_alloc();
|
|
49
60
|
}
|
|
50
61
|
};
|
|
51
62
|
|
|
52
|
-
template
|
|
53
|
-
|
|
63
|
+
template <>
|
|
64
|
+
struct check_rows_cols_for_overflow<Dynamic, Dynamic, Dynamic> {
|
|
65
|
+
template <typename Index>
|
|
66
|
+
EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE constexpr void run(Index rows, Index cols) {
|
|
67
|
+
constexpr Index MaxIndex = NumTraits<Index>::highest();
|
|
68
|
+
bool error = cols == 0 ? false : (rows > (MaxIndex / cols));
|
|
69
|
+
if (error) throw_std_bad_alloc();
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
#endif
|
|
73
|
+
|
|
74
|
+
template <typename Derived, typename OtherDerived = Derived,
|
|
54
75
|
bool IsVector = bool(Derived::IsVectorAtCompileTime) && bool(OtherDerived::IsVectorAtCompileTime)>
|
|
55
76
|
struct conservative_resize_like_impl;
|
|
56
77
|
|
|
57
|
-
template<typename MatrixTypeA, typename MatrixTypeB, bool SwapPointers>
|
|
78
|
+
template <typename MatrixTypeA, typename MatrixTypeB, bool SwapPointers>
|
|
79
|
+
struct matrix_swap_impl;
|
|
58
80
|
|
|
59
|
-
}
|
|
81
|
+
} // end namespace internal
|
|
60
82
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
83
|
+
/** \class PlainObjectBase
|
|
84
|
+
* \ingroup Core_Module
|
|
85
|
+
* \brief %Dense storage base class for matrices and arrays.
|
|
86
|
+
*
|
|
87
|
+
* This class can be extended with the help of the plugin mechanism described on the page
|
|
88
|
+
* \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_PLAINOBJECTBASE_PLUGIN.
|
|
89
|
+
*
|
|
90
|
+
* \tparam Derived is the derived type, e.g., a Matrix or Array
|
|
91
|
+
*
|
|
92
|
+
* \sa \ref TopicClassHierarchy
|
|
93
|
+
*/
|
|
94
|
+
template <typename Derived>
|
|
95
|
+
class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
|
|
96
|
+
public:
|
|
97
|
+
enum { Options = internal::traits<Derived>::Options };
|
|
98
|
+
typedef typename internal::dense_xpr_base<Derived>::type Base;
|
|
99
|
+
|
|
100
|
+
typedef typename internal::traits<Derived>::StorageKind StorageKind;
|
|
101
|
+
typedef typename internal::traits<Derived>::Scalar Scalar;
|
|
102
|
+
|
|
103
|
+
typedef typename internal::packet_traits<Scalar>::type PacketScalar;
|
|
104
|
+
typedef typename NumTraits<Scalar>::Real RealScalar;
|
|
105
|
+
typedef Derived DenseType;
|
|
106
|
+
|
|
107
|
+
using Base::ColsAtCompileTime;
|
|
108
|
+
using Base::Flags;
|
|
109
|
+
using Base::IsVectorAtCompileTime;
|
|
110
|
+
using Base::MaxColsAtCompileTime;
|
|
111
|
+
using Base::MaxRowsAtCompileTime;
|
|
112
|
+
using Base::MaxSizeAtCompileTime;
|
|
113
|
+
using Base::RowsAtCompileTime;
|
|
114
|
+
using Base::SizeAtCompileTime;
|
|
115
|
+
|
|
116
|
+
typedef Eigen::Map<Derived, Unaligned> MapType;
|
|
117
|
+
typedef const Eigen::Map<const Derived, Unaligned> ConstMapType;
|
|
118
|
+
typedef Eigen::Map<Derived, AlignedMax> AlignedMapType;
|
|
119
|
+
typedef const Eigen::Map<const Derived, AlignedMax> ConstAlignedMapType;
|
|
120
|
+
template <typename StrideType>
|
|
121
|
+
struct StridedMapType {
|
|
122
|
+
typedef Eigen::Map<Derived, Unaligned, StrideType> type;
|
|
123
|
+
};
|
|
124
|
+
template <typename StrideType>
|
|
125
|
+
struct StridedConstMapType {
|
|
126
|
+
typedef Eigen::Map<const Derived, Unaligned, StrideType> type;
|
|
127
|
+
};
|
|
128
|
+
template <typename StrideType>
|
|
129
|
+
struct StridedAlignedMapType {
|
|
130
|
+
typedef Eigen::Map<Derived, AlignedMax, StrideType> type;
|
|
131
|
+
};
|
|
132
|
+
template <typename StrideType>
|
|
133
|
+
struct StridedConstAlignedMapType {
|
|
134
|
+
typedef Eigen::Map<const Derived, AlignedMax, StrideType> type;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
protected:
|
|
138
|
+
DenseStorage<Scalar, Base::MaxSizeAtCompileTime, Base::RowsAtCompileTime, Base::ColsAtCompileTime, Options> m_storage;
|
|
139
|
+
|
|
140
|
+
public:
|
|
141
|
+
enum { NeedsToAlign = (SizeAtCompileTime != Dynamic) && (internal::traits<Derived>::Alignment > 0) };
|
|
142
|
+
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
|
|
143
|
+
|
|
144
|
+
EIGEN_STATIC_ASSERT(internal::check_implication(MaxRowsAtCompileTime == 1 && MaxColsAtCompileTime != 1,
|
|
145
|
+
(int(Options) & RowMajor) == RowMajor),
|
|
146
|
+
INVALID_MATRIX_TEMPLATE_PARAMETERS)
|
|
147
|
+
EIGEN_STATIC_ASSERT(internal::check_implication(MaxColsAtCompileTime == 1 && MaxRowsAtCompileTime != 1,
|
|
148
|
+
(int(Options) & RowMajor) == 0),
|
|
149
|
+
INVALID_MATRIX_TEMPLATE_PARAMETERS)
|
|
150
|
+
EIGEN_STATIC_ASSERT((RowsAtCompileTime == Dynamic) || (RowsAtCompileTime >= 0), INVALID_MATRIX_TEMPLATE_PARAMETERS)
|
|
151
|
+
EIGEN_STATIC_ASSERT((ColsAtCompileTime == Dynamic) || (ColsAtCompileTime >= 0), INVALID_MATRIX_TEMPLATE_PARAMETERS)
|
|
152
|
+
EIGEN_STATIC_ASSERT((MaxRowsAtCompileTime == Dynamic) || (MaxRowsAtCompileTime >= 0),
|
|
153
|
+
INVALID_MATRIX_TEMPLATE_PARAMETERS)
|
|
154
|
+
EIGEN_STATIC_ASSERT((MaxColsAtCompileTime == Dynamic) || (MaxColsAtCompileTime >= 0),
|
|
155
|
+
INVALID_MATRIX_TEMPLATE_PARAMETERS)
|
|
156
|
+
EIGEN_STATIC_ASSERT((MaxRowsAtCompileTime == RowsAtCompileTime || RowsAtCompileTime == Dynamic),
|
|
157
|
+
INVALID_MATRIX_TEMPLATE_PARAMETERS)
|
|
158
|
+
EIGEN_STATIC_ASSERT((MaxColsAtCompileTime == ColsAtCompileTime || ColsAtCompileTime == Dynamic),
|
|
159
|
+
INVALID_MATRIX_TEMPLATE_PARAMETERS)
|
|
160
|
+
EIGEN_STATIC_ASSERT(((Options & (DontAlign | RowMajor)) == Options), INVALID_MATRIX_TEMPLATE_PARAMETERS)
|
|
161
|
+
|
|
162
|
+
EIGEN_DEVICE_FUNC Base& base() { return *static_cast<Base*>(this); }
|
|
163
|
+
EIGEN_DEVICE_FUNC const Base& base() const { return *static_cast<const Base*>(this); }
|
|
164
|
+
|
|
165
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const noexcept { return m_storage.rows(); }
|
|
166
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const noexcept { return m_storage.cols(); }
|
|
167
|
+
|
|
168
|
+
/** This is an overloaded version of DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index,Index) const
|
|
169
|
+
* provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.
|
|
170
|
+
*
|
|
171
|
+
* See DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const for details. */
|
|
172
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const Scalar& coeff(Index rowId, Index colId) const {
|
|
173
|
+
if (Flags & RowMajorBit)
|
|
174
|
+
return m_storage.data()[colId + rowId * m_storage.cols()];
|
|
175
|
+
else // column-major
|
|
176
|
+
return m_storage.data()[rowId + colId * m_storage.rows()];
|
|
177
|
+
}
|
|
69
178
|
|
|
70
|
-
/** This
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
|
|
78
|
-
struct dense_xpr_base_dispatcher<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
|
|
79
|
-
: public ArrayBase {};
|
|
179
|
+
/** This is an overloaded version of DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const
|
|
180
|
+
* provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.
|
|
181
|
+
*
|
|
182
|
+
* See DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const for details. */
|
|
183
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const Scalar& coeff(Index index) const {
|
|
184
|
+
return m_storage.data()[index];
|
|
185
|
+
}
|
|
80
186
|
|
|
81
|
-
|
|
187
|
+
/** This is an overloaded version of DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index,Index) const
|
|
188
|
+
* provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.
|
|
189
|
+
*
|
|
190
|
+
* See DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index,Index) const for details. */
|
|
191
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& coeffRef(Index rowId, Index colId) {
|
|
192
|
+
if (Flags & RowMajorBit)
|
|
193
|
+
return m_storage.data()[colId + rowId * m_storage.cols()];
|
|
194
|
+
else // column-major
|
|
195
|
+
return m_storage.data()[rowId + colId * m_storage.rows()];
|
|
196
|
+
}
|
|
82
197
|
|
|
83
|
-
/**
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
template<typename Derived>
|
|
98
|
-
class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
|
|
99
|
-
#endif
|
|
100
|
-
{
|
|
101
|
-
public:
|
|
102
|
-
enum { Options = internal::traits<Derived>::Options };
|
|
103
|
-
typedef typename internal::dense_xpr_base<Derived>::type Base;
|
|
104
|
-
|
|
105
|
-
typedef typename internal::traits<Derived>::StorageKind StorageKind;
|
|
106
|
-
typedef typename internal::traits<Derived>::Scalar Scalar;
|
|
107
|
-
|
|
108
|
-
typedef typename internal::packet_traits<Scalar>::type PacketScalar;
|
|
109
|
-
typedef typename NumTraits<Scalar>::Real RealScalar;
|
|
110
|
-
typedef Derived DenseType;
|
|
111
|
-
|
|
112
|
-
using Base::RowsAtCompileTime;
|
|
113
|
-
using Base::ColsAtCompileTime;
|
|
114
|
-
using Base::SizeAtCompileTime;
|
|
115
|
-
using Base::MaxRowsAtCompileTime;
|
|
116
|
-
using Base::MaxColsAtCompileTime;
|
|
117
|
-
using Base::MaxSizeAtCompileTime;
|
|
118
|
-
using Base::IsVectorAtCompileTime;
|
|
119
|
-
using Base::Flags;
|
|
120
|
-
|
|
121
|
-
template<typename PlainObjectType, int MapOptions, typename StrideType> friend class Eigen::Map;
|
|
122
|
-
friend class Eigen::Map<Derived, Unaligned>;
|
|
123
|
-
typedef Eigen::Map<Derived, Unaligned> MapType;
|
|
124
|
-
friend class Eigen::Map<const Derived, Unaligned>;
|
|
125
|
-
typedef const Eigen::Map<const Derived, Unaligned> ConstMapType;
|
|
126
|
-
#if EIGEN_MAX_ALIGN_BYTES>0
|
|
127
|
-
// for EIGEN_MAX_ALIGN_BYTES==0, AlignedMax==Unaligned, and many compilers generate warnings for friend-ing a class twice.
|
|
128
|
-
friend class Eigen::Map<Derived, AlignedMax>;
|
|
129
|
-
friend class Eigen::Map<const Derived, AlignedMax>;
|
|
130
|
-
#endif
|
|
131
|
-
typedef Eigen::Map<Derived, AlignedMax> AlignedMapType;
|
|
132
|
-
typedef const Eigen::Map<const Derived, AlignedMax> ConstAlignedMapType;
|
|
133
|
-
template<typename StrideType> struct StridedMapType { typedef Eigen::Map<Derived, Unaligned, StrideType> type; };
|
|
134
|
-
template<typename StrideType> struct StridedConstMapType { typedef Eigen::Map<const Derived, Unaligned, StrideType> type; };
|
|
135
|
-
template<typename StrideType> struct StridedAlignedMapType { typedef Eigen::Map<Derived, AlignedMax, StrideType> type; };
|
|
136
|
-
template<typename StrideType> struct StridedConstAlignedMapType { typedef Eigen::Map<const Derived, AlignedMax, StrideType> type; };
|
|
137
|
-
|
|
138
|
-
protected:
|
|
139
|
-
DenseStorage<Scalar, Base::MaxSizeAtCompileTime, Base::RowsAtCompileTime, Base::ColsAtCompileTime, Options> m_storage;
|
|
140
|
-
|
|
141
|
-
public:
|
|
142
|
-
enum { NeedsToAlign = (SizeAtCompileTime != Dynamic) && (internal::traits<Derived>::Alignment>0) };
|
|
143
|
-
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
|
|
144
|
-
|
|
145
|
-
EIGEN_DEVICE_FUNC
|
|
146
|
-
Base& base() { return *static_cast<Base*>(this); }
|
|
147
|
-
EIGEN_DEVICE_FUNC
|
|
148
|
-
const Base& base() const { return *static_cast<const Base*>(this); }
|
|
149
|
-
|
|
150
|
-
EIGEN_DEVICE_FUNC
|
|
151
|
-
EIGEN_STRONG_INLINE Index rows() const { return m_storage.rows(); }
|
|
152
|
-
EIGEN_DEVICE_FUNC
|
|
153
|
-
EIGEN_STRONG_INLINE Index cols() const { return m_storage.cols(); }
|
|
154
|
-
|
|
155
|
-
/** This is an overloaded version of DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index,Index) const
|
|
156
|
-
* provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.
|
|
157
|
-
*
|
|
158
|
-
* See DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const for details. */
|
|
159
|
-
EIGEN_DEVICE_FUNC
|
|
160
|
-
EIGEN_STRONG_INLINE const Scalar& coeff(Index rowId, Index colId) const
|
|
161
|
-
{
|
|
162
|
-
if(Flags & RowMajorBit)
|
|
163
|
-
return m_storage.data()[colId + rowId * m_storage.cols()];
|
|
164
|
-
else // column-major
|
|
165
|
-
return m_storage.data()[rowId + colId * m_storage.rows()];
|
|
166
|
-
}
|
|
198
|
+
/** This is an overloaded version of DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index) const
|
|
199
|
+
* provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.
|
|
200
|
+
*
|
|
201
|
+
* See DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index) const for details. */
|
|
202
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& coeffRef(Index index) { return m_storage.data()[index]; }
|
|
203
|
+
|
|
204
|
+
/** This is the const version of coeffRef(Index,Index) which is thus synonym of coeff(Index,Index).
|
|
205
|
+
* It is provided for convenience. */
|
|
206
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const Scalar& coeffRef(Index rowId, Index colId) const {
|
|
207
|
+
if (Flags & RowMajorBit)
|
|
208
|
+
return m_storage.data()[colId + rowId * m_storage.cols()];
|
|
209
|
+
else // column-major
|
|
210
|
+
return m_storage.data()[rowId + colId * m_storage.rows()];
|
|
211
|
+
}
|
|
167
212
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
EIGEN_STRONG_INLINE const Scalar& coeff(Index index) const
|
|
174
|
-
{
|
|
175
|
-
return m_storage.data()[index];
|
|
176
|
-
}
|
|
213
|
+
/** This is the const version of coeffRef(Index) which is thus synonym of coeff(Index).
|
|
214
|
+
* It is provided for convenience. */
|
|
215
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const Scalar& coeffRef(Index index) const {
|
|
216
|
+
return m_storage.data()[index];
|
|
217
|
+
}
|
|
177
218
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
{
|
|
185
|
-
if(Flags & RowMajorBit)
|
|
186
|
-
return m_storage.data()[colId + rowId * m_storage.cols()];
|
|
187
|
-
else // column-major
|
|
188
|
-
return m_storage.data()[rowId + colId * m_storage.rows()];
|
|
189
|
-
}
|
|
219
|
+
/** \internal */
|
|
220
|
+
template <int LoadMode>
|
|
221
|
+
EIGEN_STRONG_INLINE PacketScalar packet(Index rowId, Index colId) const {
|
|
222
|
+
return internal::ploadt<PacketScalar, LoadMode>(
|
|
223
|
+
m_storage.data() + (Flags & RowMajorBit ? colId + rowId * m_storage.cols() : rowId + colId * m_storage.rows()));
|
|
224
|
+
}
|
|
190
225
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
EIGEN_STRONG_INLINE Scalar& coeffRef(Index index)
|
|
197
|
-
{
|
|
198
|
-
return m_storage.data()[index];
|
|
199
|
-
}
|
|
226
|
+
/** \internal */
|
|
227
|
+
template <int LoadMode>
|
|
228
|
+
EIGEN_STRONG_INLINE PacketScalar packet(Index index) const {
|
|
229
|
+
return internal::ploadt<PacketScalar, LoadMode>(m_storage.data() + index);
|
|
230
|
+
}
|
|
200
231
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
else // column-major
|
|
209
|
-
return m_storage.data()[rowId + colId * m_storage.rows()];
|
|
210
|
-
}
|
|
232
|
+
/** \internal */
|
|
233
|
+
template <int StoreMode>
|
|
234
|
+
EIGEN_STRONG_INLINE void writePacket(Index rowId, Index colId, const PacketScalar& val) {
|
|
235
|
+
internal::pstoret<Scalar, PacketScalar, StoreMode>(
|
|
236
|
+
m_storage.data() + (Flags & RowMajorBit ? colId + rowId * m_storage.cols() : rowId + colId * m_storage.rows()),
|
|
237
|
+
val);
|
|
238
|
+
}
|
|
211
239
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
return m_storage.data()[index];
|
|
218
|
-
}
|
|
240
|
+
/** \internal */
|
|
241
|
+
template <int StoreMode>
|
|
242
|
+
EIGEN_STRONG_INLINE void writePacket(Index index, const PacketScalar& val) {
|
|
243
|
+
internal::pstoret<Scalar, PacketScalar, StoreMode>(m_storage.data() + index, val);
|
|
244
|
+
}
|
|
219
245
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
246
|
+
/** \returns a const pointer to the data array of this matrix */
|
|
247
|
+
EIGEN_DEVICE_FUNC constexpr const Scalar* data() const { return m_storage.data(); }
|
|
248
|
+
|
|
249
|
+
/** \returns a pointer to the data array of this matrix */
|
|
250
|
+
EIGEN_DEVICE_FUNC constexpr Scalar* data() { return m_storage.data(); }
|
|
251
|
+
|
|
252
|
+
/** Resizes \c *this to a \a rows x \a cols matrix.
|
|
253
|
+
*
|
|
254
|
+
* This method is intended for dynamic-size matrices, although it is legal to call it on any
|
|
255
|
+
* matrix as long as fixed dimensions are left unchanged. If you only want to change the number
|
|
256
|
+
* of rows and/or of columns, you can use resize(NoChange_t, Index), resize(Index, NoChange_t).
|
|
257
|
+
*
|
|
258
|
+
* If the current number of coefficients of \c *this exactly matches the
|
|
259
|
+
* product \a rows * \a cols, then no memory allocation is performed and
|
|
260
|
+
* the current values are left unchanged. In all other cases, including
|
|
261
|
+
* shrinking, the data is reallocated and all previous values are lost.
|
|
262
|
+
*
|
|
263
|
+
* Example: \include Matrix_resize_int_int.cpp
|
|
264
|
+
* Output: \verbinclude Matrix_resize_int_int.out
|
|
265
|
+
*
|
|
266
|
+
* \sa resize(Index) for vectors, resize(NoChange_t, Index), resize(Index, NoChange_t)
|
|
267
|
+
*/
|
|
268
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void resize(Index rows, Index cols) {
|
|
269
|
+
eigen_assert(internal::check_implication(RowsAtCompileTime != Dynamic, rows == RowsAtCompileTime) &&
|
|
270
|
+
internal::check_implication(ColsAtCompileTime != Dynamic, cols == ColsAtCompileTime) &&
|
|
271
|
+
internal::check_implication(RowsAtCompileTime == Dynamic && MaxRowsAtCompileTime != Dynamic,
|
|
272
|
+
rows <= MaxRowsAtCompileTime) &&
|
|
273
|
+
internal::check_implication(ColsAtCompileTime == Dynamic && MaxColsAtCompileTime != Dynamic,
|
|
274
|
+
cols <= MaxColsAtCompileTime) &&
|
|
275
|
+
rows >= 0 && cols >= 0 && "Invalid sizes when resizing a matrix or array.");
|
|
276
|
+
#ifndef EIGEN_NO_DEBUG
|
|
277
|
+
internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime, MaxRowsAtCompileTime, MaxColsAtCompileTime>::run(rows,
|
|
278
|
+
cols);
|
|
279
|
+
#endif
|
|
280
|
+
#ifdef EIGEN_INITIALIZE_COEFFS
|
|
281
|
+
Index size = rows * cols;
|
|
282
|
+
bool size_changed = size != this->size();
|
|
283
|
+
m_storage.resize(size, rows, cols);
|
|
284
|
+
if (size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
|
|
285
|
+
#else
|
|
286
|
+
m_storage.resize(rows * cols, rows, cols);
|
|
287
|
+
#endif
|
|
288
|
+
}
|
|
229
289
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
290
|
+
/** Resizes \c *this to a vector of length \a size
|
|
291
|
+
*
|
|
292
|
+
* \only_for_vectors. This method does not work for
|
|
293
|
+
* partially dynamic matrices when the static dimension is anything other
|
|
294
|
+
* than 1. For example it will not work with Matrix<double, 2, Dynamic>.
|
|
295
|
+
*
|
|
296
|
+
* Example: \include Matrix_resize_int.cpp
|
|
297
|
+
* Output: \verbinclude Matrix_resize_int.out
|
|
298
|
+
*
|
|
299
|
+
* \sa resize(Index,Index), resize(NoChange_t, Index), resize(Index, NoChange_t)
|
|
300
|
+
*/
|
|
301
|
+
EIGEN_DEVICE_FUNC constexpr void resize(Index size) {
|
|
302
|
+
EIGEN_STATIC_ASSERT_VECTOR_ONLY(PlainObjectBase)
|
|
303
|
+
eigen_assert(((SizeAtCompileTime == Dynamic && (MaxSizeAtCompileTime == Dynamic || size <= MaxSizeAtCompileTime)) ||
|
|
304
|
+
SizeAtCompileTime == size) &&
|
|
305
|
+
size >= 0);
|
|
306
|
+
#ifdef EIGEN_INITIALIZE_COEFFS
|
|
307
|
+
bool size_changed = size != this->size();
|
|
308
|
+
#endif
|
|
309
|
+
if (RowsAtCompileTime == 1)
|
|
310
|
+
m_storage.resize(size, 1, size);
|
|
311
|
+
else
|
|
312
|
+
m_storage.resize(size, size, 1);
|
|
313
|
+
#ifdef EIGEN_INITIALIZE_COEFFS
|
|
314
|
+
if (size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
|
|
315
|
+
#endif
|
|
316
|
+
}
|
|
236
317
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
318
|
+
/** Resizes the matrix, changing only the number of columns. For the parameter of type NoChange_t, just pass the
|
|
319
|
+
* special value \c NoChange as in the example below.
|
|
320
|
+
*
|
|
321
|
+
* Example: \include Matrix_resize_NoChange_int.cpp
|
|
322
|
+
* Output: \verbinclude Matrix_resize_NoChange_int.out
|
|
323
|
+
*
|
|
324
|
+
* \sa resize(Index,Index)
|
|
325
|
+
*/
|
|
326
|
+
EIGEN_DEVICE_FUNC constexpr void resize(NoChange_t, Index cols) { resize(rows(), cols); }
|
|
327
|
+
|
|
328
|
+
/** Resizes the matrix, changing only the number of rows. For the parameter of type NoChange_t, just pass the special
|
|
329
|
+
* value \c NoChange as in the example below.
|
|
330
|
+
*
|
|
331
|
+
* Example: \include Matrix_resize_int_NoChange.cpp
|
|
332
|
+
* Output: \verbinclude Matrix_resize_int_NoChange.out
|
|
333
|
+
*
|
|
334
|
+
* \sa resize(Index,Index)
|
|
335
|
+
*/
|
|
336
|
+
EIGEN_DEVICE_FUNC constexpr void resize(Index rows, NoChange_t) { resize(rows, cols()); }
|
|
337
|
+
|
|
338
|
+
/** Resizes \c *this to have the same dimensions as \a other.
|
|
339
|
+
* Takes care of doing all the checking that's needed.
|
|
340
|
+
*
|
|
341
|
+
* Note that copying a row-vector into a vector (and conversely) is allowed.
|
|
342
|
+
* The resizing, if any, is then done in the appropriate way so that row-vectors
|
|
343
|
+
* remain row-vectors and vectors remain vectors.
|
|
344
|
+
*/
|
|
345
|
+
template <typename OtherDerived>
|
|
346
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resizeLike(const EigenBase<OtherDerived>& _other) {
|
|
347
|
+
const OtherDerived& other = _other.derived();
|
|
348
|
+
#ifndef EIGEN_NO_DEBUG
|
|
349
|
+
internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime, MaxRowsAtCompileTime, MaxColsAtCompileTime>::run(
|
|
350
|
+
other.rows(), other.cols());
|
|
351
|
+
#endif
|
|
352
|
+
const Index othersize = other.rows() * other.cols();
|
|
353
|
+
if (RowsAtCompileTime == 1) {
|
|
354
|
+
eigen_assert(other.rows() == 1 || other.cols() == 1);
|
|
355
|
+
resize(1, othersize);
|
|
356
|
+
} else if (ColsAtCompileTime == 1) {
|
|
357
|
+
eigen_assert(other.rows() == 1 || other.cols() == 1);
|
|
358
|
+
resize(othersize, 1);
|
|
359
|
+
} else
|
|
360
|
+
resize(other.rows(), other.cols());
|
|
361
|
+
}
|
|
246
362
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
363
|
+
/** Resizes the matrix to \a rows x \a cols while leaving old values untouched.
|
|
364
|
+
*
|
|
365
|
+
* The method is intended for matrices of dynamic size. If you only want to change the number
|
|
366
|
+
* of rows and/or of columns, you can use conservativeResize(NoChange_t, Index) or
|
|
367
|
+
* conservativeResize(Index, NoChange_t).
|
|
368
|
+
*
|
|
369
|
+
* Matrices are resized relative to the top-left element. In case values need to be
|
|
370
|
+
* appended to the matrix they will be uninitialized.
|
|
371
|
+
*/
|
|
372
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void conservativeResize(Index rows, Index cols) {
|
|
373
|
+
internal::conservative_resize_like_impl<Derived>::run(*this, rows, cols);
|
|
374
|
+
}
|
|
253
375
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
* matrix as long as fixed dimensions are left unchanged. If you only want to change the number
|
|
266
|
-
* of rows and/or of columns, you can use resize(NoChange_t, Index), resize(Index, NoChange_t).
|
|
267
|
-
*
|
|
268
|
-
* If the current number of coefficients of \c *this exactly matches the
|
|
269
|
-
* product \a rows * \a cols, then no memory allocation is performed and
|
|
270
|
-
* the current values are left unchanged. In all other cases, including
|
|
271
|
-
* shrinking, the data is reallocated and all previous values are lost.
|
|
272
|
-
*
|
|
273
|
-
* Example: \include Matrix_resize_int_int.cpp
|
|
274
|
-
* Output: \verbinclude Matrix_resize_int_int.out
|
|
275
|
-
*
|
|
276
|
-
* \sa resize(Index) for vectors, resize(NoChange_t, Index), resize(Index, NoChange_t)
|
|
277
|
-
*/
|
|
278
|
-
EIGEN_DEVICE_FUNC
|
|
279
|
-
EIGEN_STRONG_INLINE void resize(Index rows, Index cols)
|
|
280
|
-
{
|
|
281
|
-
eigen_assert( EIGEN_IMPLIES(RowsAtCompileTime!=Dynamic,rows==RowsAtCompileTime)
|
|
282
|
-
&& EIGEN_IMPLIES(ColsAtCompileTime!=Dynamic,cols==ColsAtCompileTime)
|
|
283
|
-
&& EIGEN_IMPLIES(RowsAtCompileTime==Dynamic && MaxRowsAtCompileTime!=Dynamic,rows<=MaxRowsAtCompileTime)
|
|
284
|
-
&& EIGEN_IMPLIES(ColsAtCompileTime==Dynamic && MaxColsAtCompileTime!=Dynamic,cols<=MaxColsAtCompileTime)
|
|
285
|
-
&& rows>=0 && cols>=0 && "Invalid sizes when resizing a matrix or array.");
|
|
286
|
-
internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime>::run(rows, cols);
|
|
287
|
-
#ifdef EIGEN_INITIALIZE_COEFFS
|
|
288
|
-
Index size = rows*cols;
|
|
289
|
-
bool size_changed = size != this->size();
|
|
290
|
-
m_storage.resize(size, rows, cols);
|
|
291
|
-
if(size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
|
|
292
|
-
#else
|
|
293
|
-
m_storage.resize(rows*cols, rows, cols);
|
|
294
|
-
#endif
|
|
295
|
-
}
|
|
376
|
+
/** Resizes the matrix to \a rows x \a cols while leaving old values untouched.
|
|
377
|
+
*
|
|
378
|
+
* As opposed to conservativeResize(Index rows, Index cols), this version leaves
|
|
379
|
+
* the number of columns unchanged.
|
|
380
|
+
*
|
|
381
|
+
* In case the matrix is growing, new rows will be uninitialized.
|
|
382
|
+
*/
|
|
383
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void conservativeResize(Index rows, NoChange_t) {
|
|
384
|
+
// Note: see the comment in conservativeResize(Index,Index)
|
|
385
|
+
conservativeResize(rows, cols());
|
|
386
|
+
}
|
|
296
387
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
EIGEN_DEVICE_FUNC
|
|
309
|
-
inline void resize(Index size)
|
|
310
|
-
{
|
|
311
|
-
EIGEN_STATIC_ASSERT_VECTOR_ONLY(PlainObjectBase)
|
|
312
|
-
eigen_assert(((SizeAtCompileTime == Dynamic && (MaxSizeAtCompileTime==Dynamic || size<=MaxSizeAtCompileTime)) || SizeAtCompileTime == size) && size>=0);
|
|
313
|
-
#ifdef EIGEN_INITIALIZE_COEFFS
|
|
314
|
-
bool size_changed = size != this->size();
|
|
315
|
-
#endif
|
|
316
|
-
if(RowsAtCompileTime == 1)
|
|
317
|
-
m_storage.resize(size, 1, size);
|
|
318
|
-
else
|
|
319
|
-
m_storage.resize(size, size, 1);
|
|
320
|
-
#ifdef EIGEN_INITIALIZE_COEFFS
|
|
321
|
-
if(size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
|
|
322
|
-
#endif
|
|
323
|
-
}
|
|
388
|
+
/** Resizes the matrix to \a rows x \a cols while leaving old values untouched.
|
|
389
|
+
*
|
|
390
|
+
* As opposed to conservativeResize(Index rows, Index cols), this version leaves
|
|
391
|
+
* the number of rows unchanged.
|
|
392
|
+
*
|
|
393
|
+
* In case the matrix is growing, new columns will be uninitialized.
|
|
394
|
+
*/
|
|
395
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void conservativeResize(NoChange_t, Index cols) {
|
|
396
|
+
// Note: see the comment in conservativeResize(Index,Index)
|
|
397
|
+
conservativeResize(rows(), cols);
|
|
398
|
+
}
|
|
324
399
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
resize(rows(), cols);
|
|
337
|
-
}
|
|
400
|
+
/** Resizes the vector to \a size while retaining old values.
|
|
401
|
+
*
|
|
402
|
+
* \only_for_vectors. This method does not work for
|
|
403
|
+
* partially dynamic matrices when the static dimension is anything other
|
|
404
|
+
* than 1. For example it will not work with Matrix<double, 2, Dynamic>.
|
|
405
|
+
*
|
|
406
|
+
* When values are appended, they will be uninitialized.
|
|
407
|
+
*/
|
|
408
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void conservativeResize(Index size) {
|
|
409
|
+
internal::conservative_resize_like_impl<Derived>::run(*this, size);
|
|
410
|
+
}
|
|
338
411
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
412
|
+
/** Resizes the matrix to \a rows x \a cols of \c other, while leaving old values untouched.
|
|
413
|
+
*
|
|
414
|
+
* The method is intended for matrices of dynamic size. If you only want to change the number
|
|
415
|
+
* of rows and/or of columns, you can use conservativeResize(NoChange_t, Index) or
|
|
416
|
+
* conservativeResize(Index, NoChange_t).
|
|
417
|
+
*
|
|
418
|
+
* Matrices are resized relative to the top-left element. In case values need to be
|
|
419
|
+
* appended to the matrix they will copied from \c other.
|
|
420
|
+
*/
|
|
421
|
+
template <typename OtherDerived>
|
|
422
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void conservativeResizeLike(const DenseBase<OtherDerived>& other) {
|
|
423
|
+
internal::conservative_resize_like_impl<Derived, OtherDerived>::run(*this, other);
|
|
424
|
+
}
|
|
352
425
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
*/
|
|
360
|
-
template<typename OtherDerived>
|
|
361
|
-
EIGEN_DEVICE_FUNC
|
|
362
|
-
EIGEN_STRONG_INLINE void resizeLike(const EigenBase<OtherDerived>& _other)
|
|
363
|
-
{
|
|
364
|
-
const OtherDerived& other = _other.derived();
|
|
365
|
-
internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime>::run(other.rows(), other.cols());
|
|
366
|
-
const Index othersize = other.rows()*other.cols();
|
|
367
|
-
if(RowsAtCompileTime == 1)
|
|
368
|
-
{
|
|
369
|
-
eigen_assert(other.rows() == 1 || other.cols() == 1);
|
|
370
|
-
resize(1, othersize);
|
|
371
|
-
}
|
|
372
|
-
else if(ColsAtCompileTime == 1)
|
|
373
|
-
{
|
|
374
|
-
eigen_assert(other.rows() == 1 || other.cols() == 1);
|
|
375
|
-
resize(othersize, 1);
|
|
376
|
-
}
|
|
377
|
-
else resize(other.rows(), other.cols());
|
|
378
|
-
}
|
|
426
|
+
/** This is a special case of the templated operator=. Its purpose is to
|
|
427
|
+
* prevent a default operator= from hiding the templated operator=.
|
|
428
|
+
*/
|
|
429
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Derived& operator=(const PlainObjectBase& other) {
|
|
430
|
+
return _set(other);
|
|
431
|
+
}
|
|
379
432
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
* Matrices are resized relative to the top-left element. In case values need to be
|
|
387
|
-
* appended to the matrix they will be uninitialized.
|
|
388
|
-
*/
|
|
389
|
-
EIGEN_DEVICE_FUNC
|
|
390
|
-
EIGEN_STRONG_INLINE void conservativeResize(Index rows, Index cols)
|
|
391
|
-
{
|
|
392
|
-
internal::conservative_resize_like_impl<Derived>::run(*this, rows, cols);
|
|
393
|
-
}
|
|
433
|
+
/** \sa MatrixBase::lazyAssign() */
|
|
434
|
+
template <typename OtherDerived>
|
|
435
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& lazyAssign(const DenseBase<OtherDerived>& other) {
|
|
436
|
+
_resize_to_match(other);
|
|
437
|
+
return Base::lazyAssign(other.derived());
|
|
438
|
+
}
|
|
394
439
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
* In case the matrix is growing, new rows will be uninitialized.
|
|
401
|
-
*/
|
|
402
|
-
EIGEN_DEVICE_FUNC
|
|
403
|
-
EIGEN_STRONG_INLINE void conservativeResize(Index rows, NoChange_t)
|
|
404
|
-
{
|
|
405
|
-
// Note: see the comment in conservativeResize(Index,Index)
|
|
406
|
-
conservativeResize(rows, cols());
|
|
407
|
-
}
|
|
440
|
+
template <typename OtherDerived>
|
|
441
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const ReturnByValue<OtherDerived>& func) {
|
|
442
|
+
resize(func.rows(), func.cols());
|
|
443
|
+
return Base::operator=(func);
|
|
444
|
+
}
|
|
408
445
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
conservativeResize(rows(), cols);
|
|
421
|
-
}
|
|
446
|
+
// Prevent user from trying to instantiate PlainObjectBase objects
|
|
447
|
+
// by making all its constructor protected. See bug 1074.
|
|
448
|
+
protected:
|
|
449
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr PlainObjectBase() = default;
|
|
450
|
+
/** \brief Move constructor */
|
|
451
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr PlainObjectBase(PlainObjectBase&&) = default;
|
|
452
|
+
/** \brief Move assignment operator */
|
|
453
|
+
EIGEN_DEVICE_FUNC constexpr PlainObjectBase& operator=(PlainObjectBase&& other) noexcept {
|
|
454
|
+
m_storage = std::move(other.m_storage);
|
|
455
|
+
return *this;
|
|
456
|
+
}
|
|
422
457
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
458
|
+
/** Copy constructor */
|
|
459
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr PlainObjectBase(const PlainObjectBase&) = default;
|
|
460
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(Index size, Index rows, Index cols)
|
|
461
|
+
: m_storage(size, rows, cols) {}
|
|
462
|
+
|
|
463
|
+
/** \brief Construct a row of column vector with fixed size from an arbitrary number of coefficients.
|
|
464
|
+
*
|
|
465
|
+
* \only_for_vectors
|
|
466
|
+
*
|
|
467
|
+
* This constructor is for 1D array or vectors with more than 4 coefficients.
|
|
468
|
+
*
|
|
469
|
+
* \warning To construct a column (resp. row) vector of fixed length, the number of values passed to this
|
|
470
|
+
* constructor must match the the fixed number of rows (resp. columns) of \c *this.
|
|
471
|
+
*/
|
|
472
|
+
template <typename... ArgTypes>
|
|
473
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(const Scalar& a0, const Scalar& a1, const Scalar& a2,
|
|
474
|
+
const Scalar& a3, const ArgTypes&... args)
|
|
475
|
+
: m_storage() {
|
|
476
|
+
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, sizeof...(args) + 4);
|
|
477
|
+
m_storage.data()[0] = a0;
|
|
478
|
+
m_storage.data()[1] = a1;
|
|
479
|
+
m_storage.data()[2] = a2;
|
|
480
|
+
m_storage.data()[3] = a3;
|
|
481
|
+
Index i = 4;
|
|
482
|
+
auto x = {(m_storage.data()[i++] = args, 0)...};
|
|
483
|
+
static_cast<void>(x);
|
|
484
|
+
}
|
|
436
485
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
{
|
|
450
|
-
|
|
486
|
+
/** \brief Constructs a Matrix or Array and initializes it by elements given by an initializer list of initializer
|
|
487
|
+
* lists
|
|
488
|
+
*/
|
|
489
|
+
EIGEN_DEVICE_FUNC explicit constexpr EIGEN_STRONG_INLINE PlainObjectBase(
|
|
490
|
+
const std::initializer_list<std::initializer_list<Scalar>>& list)
|
|
491
|
+
: m_storage() {
|
|
492
|
+
size_t list_size = 0;
|
|
493
|
+
if (list.begin() != list.end()) {
|
|
494
|
+
list_size = list.begin()->size();
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
// This is to allow syntax like VectorXi {{1, 2, 3, 4}}
|
|
498
|
+
if (ColsAtCompileTime == 1 && list.size() == 1) {
|
|
499
|
+
eigen_assert(list_size == static_cast<size_t>(RowsAtCompileTime) || RowsAtCompileTime == Dynamic);
|
|
500
|
+
resize(list_size, ColsAtCompileTime);
|
|
501
|
+
if (list.begin()->begin() != nullptr) {
|
|
502
|
+
Index index = 0;
|
|
503
|
+
for (const Scalar& e : *list.begin()) {
|
|
504
|
+
coeffRef(index++) = e;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
} else {
|
|
508
|
+
eigen_assert(list.size() == static_cast<size_t>(RowsAtCompileTime) || RowsAtCompileTime == Dynamic);
|
|
509
|
+
eigen_assert(list_size == static_cast<size_t>(ColsAtCompileTime) || ColsAtCompileTime == Dynamic);
|
|
510
|
+
resize(list.size(), list_size);
|
|
511
|
+
|
|
512
|
+
Index row_index = 0;
|
|
513
|
+
for (const std::initializer_list<Scalar>& row : list) {
|
|
514
|
+
eigen_assert(list_size == row.size());
|
|
515
|
+
Index col_index = 0;
|
|
516
|
+
for (const Scalar& e : row) {
|
|
517
|
+
coeffRef(row_index, col_index) = e;
|
|
518
|
+
++col_index;
|
|
519
|
+
}
|
|
520
|
+
++row_index;
|
|
521
|
+
}
|
|
451
522
|
}
|
|
523
|
+
}
|
|
452
524
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
return _set(other);
|
|
460
|
-
}
|
|
525
|
+
/** \sa PlainObjectBase::operator=(const EigenBase<OtherDerived>&) */
|
|
526
|
+
template <typename OtherDerived>
|
|
527
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(const DenseBase<OtherDerived>& other) : m_storage() {
|
|
528
|
+
resizeLike(other);
|
|
529
|
+
_set_noalias(other);
|
|
530
|
+
}
|
|
461
531
|
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
532
|
+
/** \sa PlainObjectBase::operator=(const EigenBase<OtherDerived>&) */
|
|
533
|
+
template <typename OtherDerived>
|
|
534
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(const EigenBase<OtherDerived>& other) : m_storage() {
|
|
535
|
+
resizeLike(other);
|
|
536
|
+
*this = other.derived();
|
|
537
|
+
}
|
|
538
|
+
/** \brief Copy constructor with in-place evaluation */
|
|
539
|
+
template <typename OtherDerived>
|
|
540
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(const ReturnByValue<OtherDerived>& other) {
|
|
541
|
+
// FIXME this does not automatically transpose vectors if necessary
|
|
542
|
+
resize(other.rows(), other.cols());
|
|
543
|
+
other.evalTo(this->derived());
|
|
544
|
+
}
|
|
470
545
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
546
|
+
public:
|
|
547
|
+
/** \brief Copies the generic expression \a other into *this.
|
|
548
|
+
* \copydetails DenseBase::operator=(const EigenBase<OtherDerived> &other)
|
|
549
|
+
*/
|
|
550
|
+
template <typename OtherDerived>
|
|
551
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const EigenBase<OtherDerived>& other) {
|
|
552
|
+
_resize_to_match(other);
|
|
553
|
+
Base::operator=(other.derived());
|
|
554
|
+
return this->derived();
|
|
555
|
+
}
|
|
478
556
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
557
|
+
/** \name Map
|
|
558
|
+
* These are convenience functions returning Map objects. The Map() static functions return unaligned Map objects,
|
|
559
|
+
* while the AlignedMap() functions return aligned Map objects and thus should be called only with 16-byte-aligned
|
|
560
|
+
* \a data pointers.
|
|
561
|
+
*
|
|
562
|
+
* Here is an example using strides:
|
|
563
|
+
* \include Matrix_Map_stride.cpp
|
|
564
|
+
* Output: \verbinclude Matrix_Map_stride.out
|
|
565
|
+
*
|
|
566
|
+
* \see class Map
|
|
567
|
+
*/
|
|
568
|
+
///@{
|
|
569
|
+
static inline ConstMapType Map(const Scalar* data) { return ConstMapType(data); }
|
|
570
|
+
static inline MapType Map(Scalar* data) { return MapType(data); }
|
|
571
|
+
static inline ConstMapType Map(const Scalar* data, Index size) { return ConstMapType(data, size); }
|
|
572
|
+
static inline MapType Map(Scalar* data, Index size) { return MapType(data, size); }
|
|
573
|
+
static inline ConstMapType Map(const Scalar* data, Index rows, Index cols) { return ConstMapType(data, rows, cols); }
|
|
574
|
+
static inline MapType Map(Scalar* data, Index rows, Index cols) { return MapType(data, rows, cols); }
|
|
575
|
+
|
|
576
|
+
static inline ConstAlignedMapType MapAligned(const Scalar* data) { return ConstAlignedMapType(data); }
|
|
577
|
+
static inline AlignedMapType MapAligned(Scalar* data) { return AlignedMapType(data); }
|
|
578
|
+
static inline ConstAlignedMapType MapAligned(const Scalar* data, Index size) {
|
|
579
|
+
return ConstAlignedMapType(data, size);
|
|
580
|
+
}
|
|
581
|
+
static inline AlignedMapType MapAligned(Scalar* data, Index size) { return AlignedMapType(data, size); }
|
|
582
|
+
static inline ConstAlignedMapType MapAligned(const Scalar* data, Index rows, Index cols) {
|
|
583
|
+
return ConstAlignedMapType(data, rows, cols);
|
|
584
|
+
}
|
|
585
|
+
static inline AlignedMapType MapAligned(Scalar* data, Index rows, Index cols) {
|
|
586
|
+
return AlignedMapType(data, rows, cols);
|
|
587
|
+
}
|
|
482
588
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
589
|
+
template <int Outer, int Inner>
|
|
590
|
+
static inline typename StridedConstMapType<Stride<Outer, Inner>>::type Map(const Scalar* data,
|
|
591
|
+
const Stride<Outer, Inner>& stride) {
|
|
592
|
+
return typename StridedConstMapType<Stride<Outer, Inner>>::type(data, stride);
|
|
593
|
+
}
|
|
594
|
+
template <int Outer, int Inner>
|
|
595
|
+
static inline typename StridedMapType<Stride<Outer, Inner>>::type Map(Scalar* data,
|
|
596
|
+
const Stride<Outer, Inner>& stride) {
|
|
597
|
+
return typename StridedMapType<Stride<Outer, Inner>>::type(data, stride);
|
|
598
|
+
}
|
|
599
|
+
template <int Outer, int Inner>
|
|
600
|
+
static inline typename StridedConstMapType<Stride<Outer, Inner>>::type Map(const Scalar* data, Index size,
|
|
601
|
+
const Stride<Outer, Inner>& stride) {
|
|
602
|
+
return typename StridedConstMapType<Stride<Outer, Inner>>::type(data, size, stride);
|
|
603
|
+
}
|
|
604
|
+
template <int Outer, int Inner>
|
|
605
|
+
static inline typename StridedMapType<Stride<Outer, Inner>>::type Map(Scalar* data, Index size,
|
|
606
|
+
const Stride<Outer, Inner>& stride) {
|
|
607
|
+
return typename StridedMapType<Stride<Outer, Inner>>::type(data, size, stride);
|
|
608
|
+
}
|
|
609
|
+
template <int Outer, int Inner>
|
|
610
|
+
static inline typename StridedConstMapType<Stride<Outer, Inner>>::type Map(const Scalar* data, Index rows, Index cols,
|
|
611
|
+
const Stride<Outer, Inner>& stride) {
|
|
612
|
+
return typename StridedConstMapType<Stride<Outer, Inner>>::type(data, rows, cols, stride);
|
|
613
|
+
}
|
|
614
|
+
template <int Outer, int Inner>
|
|
615
|
+
static inline typename StridedMapType<Stride<Outer, Inner>>::type Map(Scalar* data, Index rows, Index cols,
|
|
616
|
+
const Stride<Outer, Inner>& stride) {
|
|
617
|
+
return typename StridedMapType<Stride<Outer, Inner>>::type(data, rows, cols, stride);
|
|
618
|
+
}
|
|
489
619
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
620
|
+
template <int Outer, int Inner>
|
|
621
|
+
static inline typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
|
|
622
|
+
const Scalar* data, const Stride<Outer, Inner>& stride) {
|
|
623
|
+
return typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type(data, stride);
|
|
624
|
+
}
|
|
625
|
+
template <int Outer, int Inner>
|
|
626
|
+
static inline typename StridedAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
|
|
627
|
+
Scalar* data, const Stride<Outer, Inner>& stride) {
|
|
628
|
+
return typename StridedAlignedMapType<Stride<Outer, Inner>>::type(data, stride);
|
|
629
|
+
}
|
|
630
|
+
template <int Outer, int Inner>
|
|
631
|
+
static inline typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
|
|
632
|
+
const Scalar* data, Index size, const Stride<Outer, Inner>& stride) {
|
|
633
|
+
return typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type(data, size, stride);
|
|
634
|
+
}
|
|
635
|
+
template <int Outer, int Inner>
|
|
636
|
+
static inline typename StridedAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
|
|
637
|
+
Scalar* data, Index size, const Stride<Outer, Inner>& stride) {
|
|
638
|
+
return typename StridedAlignedMapType<Stride<Outer, Inner>>::type(data, size, stride);
|
|
639
|
+
}
|
|
640
|
+
template <int Outer, int Inner>
|
|
641
|
+
static inline typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
|
|
642
|
+
const Scalar* data, Index rows, Index cols, const Stride<Outer, Inner>& stride) {
|
|
643
|
+
return typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type(data, rows, cols, stride);
|
|
644
|
+
}
|
|
645
|
+
template <int Outer, int Inner>
|
|
646
|
+
static inline typename StridedAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
|
|
647
|
+
Scalar* data, Index rows, Index cols, const Stride<Outer, Inner>& stride) {
|
|
648
|
+
return typename StridedAlignedMapType<Stride<Outer, Inner>>::type(data, rows, cols, stride);
|
|
649
|
+
}
|
|
650
|
+
///@}
|
|
651
|
+
|
|
652
|
+
using Base::setConstant;
|
|
653
|
+
EIGEN_DEVICE_FUNC Derived& setConstant(Index size, const Scalar& val);
|
|
654
|
+
EIGEN_DEVICE_FUNC Derived& setConstant(Index rows, Index cols, const Scalar& val);
|
|
655
|
+
EIGEN_DEVICE_FUNC Derived& setConstant(NoChange_t, Index cols, const Scalar& val);
|
|
656
|
+
EIGEN_DEVICE_FUNC Derived& setConstant(Index rows, NoChange_t, const Scalar& val);
|
|
657
|
+
|
|
658
|
+
using Base::setZero;
|
|
659
|
+
EIGEN_DEVICE_FUNC Derived& setZero(Index size);
|
|
660
|
+
EIGEN_DEVICE_FUNC Derived& setZero(Index rows, Index cols);
|
|
661
|
+
EIGEN_DEVICE_FUNC Derived& setZero(NoChange_t, Index cols);
|
|
662
|
+
EIGEN_DEVICE_FUNC Derived& setZero(Index rows, NoChange_t);
|
|
663
|
+
|
|
664
|
+
using Base::setOnes;
|
|
665
|
+
EIGEN_DEVICE_FUNC Derived& setOnes(Index size);
|
|
666
|
+
EIGEN_DEVICE_FUNC Derived& setOnes(Index rows, Index cols);
|
|
667
|
+
EIGEN_DEVICE_FUNC Derived& setOnes(NoChange_t, Index cols);
|
|
668
|
+
EIGEN_DEVICE_FUNC Derived& setOnes(Index rows, NoChange_t);
|
|
669
|
+
|
|
670
|
+
using Base::setRandom;
|
|
671
|
+
Derived& setRandom(Index size);
|
|
672
|
+
Derived& setRandom(Index rows, Index cols);
|
|
673
|
+
Derived& setRandom(NoChange_t, Index cols);
|
|
674
|
+
Derived& setRandom(Index rows, NoChange_t);
|
|
675
|
+
|
|
676
|
+
#ifdef EIGEN_PLAINOBJECTBASE_PLUGIN
|
|
677
|
+
#include EIGEN_PLAINOBJECTBASE_PLUGIN
|
|
499
678
|
#endif
|
|
500
679
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
680
|
+
protected:
|
|
681
|
+
/** \internal Resizes *this in preparation for assigning \a other to it.
|
|
682
|
+
* Takes care of doing all the checking that's needed.
|
|
683
|
+
*
|
|
684
|
+
* Note that copying a row-vector into a vector (and conversely) is allowed.
|
|
685
|
+
* The resizing, if any, is then done in the appropriate way so that row-vectors
|
|
686
|
+
* remain row-vectors and vectors remain vectors.
|
|
687
|
+
*/
|
|
688
|
+
template <typename OtherDerived>
|
|
689
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _resize_to_match(const EigenBase<OtherDerived>& other) {
|
|
690
|
+
#ifdef EIGEN_NO_AUTOMATIC_RESIZING
|
|
691
|
+
eigen_assert((this->size() == 0 || (IsVectorAtCompileTime ? (this->size() == other.size())
|
|
692
|
+
: (rows() == other.rows() && cols() == other.cols()))) &&
|
|
693
|
+
"Size mismatch. Automatic resizing is disabled because EIGEN_NO_AUTOMATIC_RESIZING is defined");
|
|
694
|
+
EIGEN_ONLY_USED_FOR_DEBUG(other);
|
|
695
|
+
#else
|
|
696
|
+
resizeLike(other);
|
|
515
697
|
#endif
|
|
698
|
+
}
|
|
516
699
|
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
700
|
+
/**
|
|
701
|
+
* \brief Copies the value of the expression \a other into \c *this with automatic resizing.
|
|
702
|
+
*
|
|
703
|
+
* *this might be resized to match the dimensions of \a other. If *this was a null matrix (not already initialized),
|
|
704
|
+
* it will be initialized.
|
|
705
|
+
*
|
|
706
|
+
* Note that copying a row-vector into a vector (and conversely) is allowed.
|
|
707
|
+
* The resizing, if any, is then done in the appropriate way so that row-vectors
|
|
708
|
+
* remain row-vectors and vectors remain vectors.
|
|
709
|
+
*
|
|
710
|
+
* \sa operator=(const MatrixBase<OtherDerived>&), _set_noalias()
|
|
711
|
+
*
|
|
712
|
+
* \internal
|
|
713
|
+
*/
|
|
714
|
+
// aliasing is dealt once in internal::call_assignment
|
|
715
|
+
// so at this stage we have to assume aliasing... and resising has to be done later.
|
|
716
|
+
template <typename OtherDerived>
|
|
717
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Derived& _set(const DenseBase<OtherDerived>& other) {
|
|
718
|
+
internal::call_assignment(this->derived(), other.derived());
|
|
719
|
+
return this->derived();
|
|
720
|
+
}
|
|
528
721
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
722
|
+
/** \internal Like _set() but additionally makes the assumption that no aliasing effect can happen (which
|
|
723
|
+
* is the case when creating a new matrix) so one can enforce lazy evaluation.
|
|
724
|
+
*
|
|
725
|
+
* \sa operator=(const MatrixBase<OtherDerived>&), _set()
|
|
726
|
+
*/
|
|
727
|
+
template <typename OtherDerived>
|
|
728
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Derived& _set_noalias(const DenseBase<OtherDerived>& other) {
|
|
729
|
+
// I don't think we need this resize call since the lazyAssign will anyways resize
|
|
730
|
+
// and lazyAssign will be called by the assign selector.
|
|
731
|
+
//_resize_to_match(other);
|
|
732
|
+
// the 'false' below means to enforce lazy evaluation. We don't use lazyAssign() because
|
|
733
|
+
// it wouldn't allow to copy a row-vector into a column-vector.
|
|
734
|
+
internal::call_assignment_no_alias(this->derived(), other.derived(),
|
|
735
|
+
internal::assign_op<Scalar, typename OtherDerived::Scalar>());
|
|
736
|
+
return this->derived();
|
|
737
|
+
}
|
|
539
738
|
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
resizeLike(other);
|
|
548
|
-
*this = other.derived();
|
|
549
|
-
}
|
|
550
|
-
/** \brief Copy constructor with in-place evaluation */
|
|
551
|
-
template<typename OtherDerived>
|
|
552
|
-
EIGEN_DEVICE_FUNC
|
|
553
|
-
EIGEN_STRONG_INLINE PlainObjectBase(const ReturnByValue<OtherDerived>& other)
|
|
554
|
-
{
|
|
555
|
-
_check_template_params();
|
|
556
|
-
// FIXME this does not automatically transpose vectors if necessary
|
|
557
|
-
resize(other.rows(), other.cols());
|
|
558
|
-
other.evalTo(this->derived());
|
|
559
|
-
}
|
|
739
|
+
template <typename T0, typename T1>
|
|
740
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init2(Index rows, Index cols,
|
|
741
|
+
std::enable_if_t<Base::SizeAtCompileTime != 2, T0>* = 0) {
|
|
742
|
+
EIGEN_STATIC_ASSERT(internal::is_valid_index_type<T0>::value && internal::is_valid_index_type<T1>::value,
|
|
743
|
+
T0 AND T1 MUST BE INTEGER TYPES)
|
|
744
|
+
resize(rows, cols);
|
|
745
|
+
}
|
|
560
746
|
|
|
561
|
-
|
|
747
|
+
template <typename T0, typename T1>
|
|
748
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init2(const T0& val0, const T1& val1,
|
|
749
|
+
std::enable_if_t<Base::SizeAtCompileTime == 2, T0>* = 0) {
|
|
750
|
+
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2)
|
|
751
|
+
m_storage.data()[0] = Scalar(val0);
|
|
752
|
+
m_storage.data()[1] = Scalar(val1);
|
|
753
|
+
}
|
|
562
754
|
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
}
|
|
755
|
+
template <typename T0, typename T1>
|
|
756
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init2(
|
|
757
|
+
const Index& val0, const Index& val1,
|
|
758
|
+
std::enable_if_t<(!internal::is_same<Index, Scalar>::value) && (internal::is_same<T0, Index>::value) &&
|
|
759
|
+
(internal::is_same<T1, Index>::value) && Base::SizeAtCompileTime == 2,
|
|
760
|
+
T1>* = 0) {
|
|
761
|
+
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2)
|
|
762
|
+
m_storage.data()[0] = Scalar(val0);
|
|
763
|
+
m_storage.data()[1] = Scalar(val1);
|
|
764
|
+
}
|
|
574
765
|
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
{ return MapType(data); }
|
|
591
|
-
static inline ConstMapType Map(const Scalar* data, Index size)
|
|
592
|
-
{ return ConstMapType(data, size); }
|
|
593
|
-
static inline MapType Map(Scalar* data, Index size)
|
|
594
|
-
{ return MapType(data, size); }
|
|
595
|
-
static inline ConstMapType Map(const Scalar* data, Index rows, Index cols)
|
|
596
|
-
{ return ConstMapType(data, rows, cols); }
|
|
597
|
-
static inline MapType Map(Scalar* data, Index rows, Index cols)
|
|
598
|
-
{ return MapType(data, rows, cols); }
|
|
599
|
-
|
|
600
|
-
static inline ConstAlignedMapType MapAligned(const Scalar* data)
|
|
601
|
-
{ return ConstAlignedMapType(data); }
|
|
602
|
-
static inline AlignedMapType MapAligned(Scalar* data)
|
|
603
|
-
{ return AlignedMapType(data); }
|
|
604
|
-
static inline ConstAlignedMapType MapAligned(const Scalar* data, Index size)
|
|
605
|
-
{ return ConstAlignedMapType(data, size); }
|
|
606
|
-
static inline AlignedMapType MapAligned(Scalar* data, Index size)
|
|
607
|
-
{ return AlignedMapType(data, size); }
|
|
608
|
-
static inline ConstAlignedMapType MapAligned(const Scalar* data, Index rows, Index cols)
|
|
609
|
-
{ return ConstAlignedMapType(data, rows, cols); }
|
|
610
|
-
static inline AlignedMapType MapAligned(Scalar* data, Index rows, Index cols)
|
|
611
|
-
{ return AlignedMapType(data, rows, cols); }
|
|
612
|
-
|
|
613
|
-
template<int Outer, int Inner>
|
|
614
|
-
static inline typename StridedConstMapType<Stride<Outer, Inner> >::type Map(const Scalar* data, const Stride<Outer, Inner>& stride)
|
|
615
|
-
{ return typename StridedConstMapType<Stride<Outer, Inner> >::type(data, stride); }
|
|
616
|
-
template<int Outer, int Inner>
|
|
617
|
-
static inline typename StridedMapType<Stride<Outer, Inner> >::type Map(Scalar* data, const Stride<Outer, Inner>& stride)
|
|
618
|
-
{ return typename StridedMapType<Stride<Outer, Inner> >::type(data, stride); }
|
|
619
|
-
template<int Outer, int Inner>
|
|
620
|
-
static inline typename StridedConstMapType<Stride<Outer, Inner> >::type Map(const Scalar* data, Index size, const Stride<Outer, Inner>& stride)
|
|
621
|
-
{ return typename StridedConstMapType<Stride<Outer, Inner> >::type(data, size, stride); }
|
|
622
|
-
template<int Outer, int Inner>
|
|
623
|
-
static inline typename StridedMapType<Stride<Outer, Inner> >::type Map(Scalar* data, Index size, const Stride<Outer, Inner>& stride)
|
|
624
|
-
{ return typename StridedMapType<Stride<Outer, Inner> >::type(data, size, stride); }
|
|
625
|
-
template<int Outer, int Inner>
|
|
626
|
-
static inline typename StridedConstMapType<Stride<Outer, Inner> >::type Map(const Scalar* data, Index rows, Index cols, const Stride<Outer, Inner>& stride)
|
|
627
|
-
{ return typename StridedConstMapType<Stride<Outer, Inner> >::type(data, rows, cols, stride); }
|
|
628
|
-
template<int Outer, int Inner>
|
|
629
|
-
static inline typename StridedMapType<Stride<Outer, Inner> >::type Map(Scalar* data, Index rows, Index cols, const Stride<Outer, Inner>& stride)
|
|
630
|
-
{ return typename StridedMapType<Stride<Outer, Inner> >::type(data, rows, cols, stride); }
|
|
631
|
-
|
|
632
|
-
template<int Outer, int Inner>
|
|
633
|
-
static inline typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type MapAligned(const Scalar* data, const Stride<Outer, Inner>& stride)
|
|
634
|
-
{ return typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type(data, stride); }
|
|
635
|
-
template<int Outer, int Inner>
|
|
636
|
-
static inline typename StridedAlignedMapType<Stride<Outer, Inner> >::type MapAligned(Scalar* data, const Stride<Outer, Inner>& stride)
|
|
637
|
-
{ return typename StridedAlignedMapType<Stride<Outer, Inner> >::type(data, stride); }
|
|
638
|
-
template<int Outer, int Inner>
|
|
639
|
-
static inline typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type MapAligned(const Scalar* data, Index size, const Stride<Outer, Inner>& stride)
|
|
640
|
-
{ return typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type(data, size, stride); }
|
|
641
|
-
template<int Outer, int Inner>
|
|
642
|
-
static inline typename StridedAlignedMapType<Stride<Outer, Inner> >::type MapAligned(Scalar* data, Index size, const Stride<Outer, Inner>& stride)
|
|
643
|
-
{ return typename StridedAlignedMapType<Stride<Outer, Inner> >::type(data, size, stride); }
|
|
644
|
-
template<int Outer, int Inner>
|
|
645
|
-
static inline typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type MapAligned(const Scalar* data, Index rows, Index cols, const Stride<Outer, Inner>& stride)
|
|
646
|
-
{ return typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type(data, rows, cols, stride); }
|
|
647
|
-
template<int Outer, int Inner>
|
|
648
|
-
static inline typename StridedAlignedMapType<Stride<Outer, Inner> >::type MapAligned(Scalar* data, Index rows, Index cols, const Stride<Outer, Inner>& stride)
|
|
649
|
-
{ return typename StridedAlignedMapType<Stride<Outer, Inner> >::type(data, rows, cols, stride); }
|
|
650
|
-
//@}
|
|
651
|
-
|
|
652
|
-
using Base::setConstant;
|
|
653
|
-
EIGEN_DEVICE_FUNC Derived& setConstant(Index size, const Scalar& val);
|
|
654
|
-
EIGEN_DEVICE_FUNC Derived& setConstant(Index rows, Index cols, const Scalar& val);
|
|
655
|
-
|
|
656
|
-
using Base::setZero;
|
|
657
|
-
EIGEN_DEVICE_FUNC Derived& setZero(Index size);
|
|
658
|
-
EIGEN_DEVICE_FUNC Derived& setZero(Index rows, Index cols);
|
|
659
|
-
|
|
660
|
-
using Base::setOnes;
|
|
661
|
-
EIGEN_DEVICE_FUNC Derived& setOnes(Index size);
|
|
662
|
-
EIGEN_DEVICE_FUNC Derived& setOnes(Index rows, Index cols);
|
|
663
|
-
|
|
664
|
-
using Base::setRandom;
|
|
665
|
-
Derived& setRandom(Index size);
|
|
666
|
-
Derived& setRandom(Index rows, Index cols);
|
|
667
|
-
|
|
668
|
-
#ifdef EIGEN_PLAINOBJECTBASE_PLUGIN
|
|
669
|
-
#include EIGEN_PLAINOBJECTBASE_PLUGIN
|
|
670
|
-
#endif
|
|
671
|
-
|
|
672
|
-
protected:
|
|
673
|
-
/** \internal Resizes *this in preparation for assigning \a other to it.
|
|
674
|
-
* Takes care of doing all the checking that's needed.
|
|
675
|
-
*
|
|
676
|
-
* Note that copying a row-vector into a vector (and conversely) is allowed.
|
|
677
|
-
* The resizing, if any, is then done in the appropriate way so that row-vectors
|
|
678
|
-
* remain row-vectors and vectors remain vectors.
|
|
679
|
-
*/
|
|
680
|
-
template<typename OtherDerived>
|
|
681
|
-
EIGEN_DEVICE_FUNC
|
|
682
|
-
EIGEN_STRONG_INLINE void _resize_to_match(const EigenBase<OtherDerived>& other)
|
|
683
|
-
{
|
|
684
|
-
#ifdef EIGEN_NO_AUTOMATIC_RESIZING
|
|
685
|
-
eigen_assert((this->size()==0 || (IsVectorAtCompileTime ? (this->size() == other.size())
|
|
686
|
-
: (rows() == other.rows() && cols() == other.cols())))
|
|
687
|
-
&& "Size mismatch. Automatic resizing is disabled because EIGEN_NO_AUTOMATIC_RESIZING is defined");
|
|
688
|
-
EIGEN_ONLY_USED_FOR_DEBUG(other);
|
|
689
|
-
#else
|
|
690
|
-
resizeLike(other);
|
|
691
|
-
#endif
|
|
692
|
-
}
|
|
766
|
+
// The argument is convertible to the Index type and we either have a non 1x1 Matrix, or a dynamic-sized Array,
|
|
767
|
+
// then the argument is meant to be the size of the object.
|
|
768
|
+
template <typename T>
|
|
769
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(
|
|
770
|
+
Index size,
|
|
771
|
+
std::enable_if_t<(Base::SizeAtCompileTime != 1 || !internal::is_convertible<T, Scalar>::value) &&
|
|
772
|
+
((!internal::is_same<typename internal::traits<Derived>::XprKind, ArrayXpr>::value ||
|
|
773
|
+
Base::SizeAtCompileTime == Dynamic)),
|
|
774
|
+
T>* = 0) {
|
|
775
|
+
// NOTE MSVC 2008 complains if we directly put bool(NumTraits<T>::IsInteger) as the EIGEN_STATIC_ASSERT argument.
|
|
776
|
+
const bool is_integer_alike = internal::is_valid_index_type<T>::value;
|
|
777
|
+
EIGEN_UNUSED_VARIABLE(is_integer_alike);
|
|
778
|
+
EIGEN_STATIC_ASSERT(is_integer_alike, FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED)
|
|
779
|
+
resize(size);
|
|
780
|
+
}
|
|
693
781
|
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
*
|
|
704
|
-
* \sa operator=(const MatrixBase<OtherDerived>&), _set_noalias()
|
|
705
|
-
*
|
|
706
|
-
* \internal
|
|
707
|
-
*/
|
|
708
|
-
// aliasing is dealt once in internall::call_assignment
|
|
709
|
-
// so at this stage we have to assume aliasing... and resising has to be done later.
|
|
710
|
-
template<typename OtherDerived>
|
|
711
|
-
EIGEN_DEVICE_FUNC
|
|
712
|
-
EIGEN_STRONG_INLINE Derived& _set(const DenseBase<OtherDerived>& other)
|
|
713
|
-
{
|
|
714
|
-
internal::call_assignment(this->derived(), other.derived());
|
|
715
|
-
return this->derived();
|
|
716
|
-
}
|
|
782
|
+
// We have a 1x1 matrix/array => the argument is interpreted as the value of the unique coefficient (case where scalar
|
|
783
|
+
// type can be implicitly converted)
|
|
784
|
+
template <typename T>
|
|
785
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(
|
|
786
|
+
const Scalar& val0,
|
|
787
|
+
std::enable_if_t<Base::SizeAtCompileTime == 1 && internal::is_convertible<T, Scalar>::value, T>* = 0) {
|
|
788
|
+
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 1)
|
|
789
|
+
m_storage.data()[0] = val0;
|
|
790
|
+
}
|
|
717
791
|
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
//_resize_to_match(other);
|
|
730
|
-
// the 'false' below means to enforce lazy evaluation. We don't use lazyAssign() because
|
|
731
|
-
// it wouldn't allow to copy a row-vector into a column-vector.
|
|
732
|
-
internal::call_assignment_no_alias(this->derived(), other.derived(), internal::assign_op<Scalar,typename OtherDerived::Scalar>());
|
|
733
|
-
return this->derived();
|
|
734
|
-
}
|
|
792
|
+
// We have a 1x1 matrix/array => the argument is interpreted as the value of the unique coefficient (case where scalar
|
|
793
|
+
// type match the index type)
|
|
794
|
+
template <typename T>
|
|
795
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(
|
|
796
|
+
const Index& val0,
|
|
797
|
+
std::enable_if_t<(!internal::is_same<Index, Scalar>::value) && (internal::is_same<Index, T>::value) &&
|
|
798
|
+
Base::SizeAtCompileTime == 1 && internal::is_convertible<T, Scalar>::value,
|
|
799
|
+
T*>* = 0) {
|
|
800
|
+
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 1)
|
|
801
|
+
m_storage.data()[0] = Scalar(val0);
|
|
802
|
+
}
|
|
735
803
|
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
const bool t1_is_integer_alike = internal::is_valid_index_type<T1>::value;
|
|
742
|
-
EIGEN_STATIC_ASSERT(t0_is_integer_alike &&
|
|
743
|
-
t1_is_integer_alike,
|
|
744
|
-
FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED)
|
|
745
|
-
resize(rows,cols);
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
template<typename T0, typename T1>
|
|
749
|
-
EIGEN_DEVICE_FUNC
|
|
750
|
-
EIGEN_STRONG_INLINE void _init2(const T0& val0, const T1& val1, typename internal::enable_if<Base::SizeAtCompileTime==2,T0>::type* = 0)
|
|
751
|
-
{
|
|
752
|
-
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2)
|
|
753
|
-
m_storage.data()[0] = Scalar(val0);
|
|
754
|
-
m_storage.data()[1] = Scalar(val1);
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
template<typename T0, typename T1>
|
|
758
|
-
EIGEN_DEVICE_FUNC
|
|
759
|
-
EIGEN_STRONG_INLINE void _init2(const Index& val0, const Index& val1,
|
|
760
|
-
typename internal::enable_if< (!internal::is_same<Index,Scalar>::value)
|
|
761
|
-
&& (internal::is_same<T0,Index>::value)
|
|
762
|
-
&& (internal::is_same<T1,Index>::value)
|
|
763
|
-
&& Base::SizeAtCompileTime==2,T1>::type* = 0)
|
|
764
|
-
{
|
|
765
|
-
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2)
|
|
766
|
-
m_storage.data()[0] = Scalar(val0);
|
|
767
|
-
m_storage.data()[1] = Scalar(val1);
|
|
768
|
-
}
|
|
804
|
+
// Initialize a fixed size matrix from a pointer to raw data
|
|
805
|
+
template <typename T>
|
|
806
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(const Scalar* data) {
|
|
807
|
+
this->_set_noalias(ConstMapType(data));
|
|
808
|
+
}
|
|
769
809
|
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
&& ((!internal::is_same<typename internal::traits<Derived>::XprKind,ArrayXpr>::value || Base::SizeAtCompileTime==Dynamic)),T>::type* = 0)
|
|
776
|
-
{
|
|
777
|
-
// NOTE MSVC 2008 complains if we directly put bool(NumTraits<T>::IsInteger) as the EIGEN_STATIC_ASSERT argument.
|
|
778
|
-
const bool is_integer_alike = internal::is_valid_index_type<T>::value;
|
|
779
|
-
EIGEN_UNUSED_VARIABLE(is_integer_alike);
|
|
780
|
-
EIGEN_STATIC_ASSERT(is_integer_alike,
|
|
781
|
-
FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED)
|
|
782
|
-
resize(size);
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
// We have a 1x1 matrix/array => the argument is interpreted as the value of the unique coefficient (case where scalar type can be implicitely converted)
|
|
786
|
-
template<typename T>
|
|
787
|
-
EIGEN_DEVICE_FUNC
|
|
788
|
-
EIGEN_STRONG_INLINE void _init1(const Scalar& val0, typename internal::enable_if<Base::SizeAtCompileTime==1 && internal::is_convertible<T, Scalar>::value,T>::type* = 0)
|
|
789
|
-
{
|
|
790
|
-
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 1)
|
|
791
|
-
m_storage.data()[0] = val0;
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
// We have a 1x1 matrix/array => the argument is interpreted as the value of the unique coefficient (case where scalar type match the index type)
|
|
795
|
-
template<typename T>
|
|
796
|
-
EIGEN_DEVICE_FUNC
|
|
797
|
-
EIGEN_STRONG_INLINE void _init1(const Index& val0,
|
|
798
|
-
typename internal::enable_if< (!internal::is_same<Index,Scalar>::value)
|
|
799
|
-
&& (internal::is_same<Index,T>::value)
|
|
800
|
-
&& Base::SizeAtCompileTime==1
|
|
801
|
-
&& internal::is_convertible<T, Scalar>::value,T*>::type* = 0)
|
|
802
|
-
{
|
|
803
|
-
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 1)
|
|
804
|
-
m_storage.data()[0] = Scalar(val0);
|
|
805
|
-
}
|
|
810
|
+
// Initialize an arbitrary matrix from a dense expression
|
|
811
|
+
template <typename T, typename OtherDerived>
|
|
812
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(const DenseBase<OtherDerived>& other) {
|
|
813
|
+
this->_set_noalias(other);
|
|
814
|
+
}
|
|
806
815
|
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
}
|
|
816
|
+
// Initialize an arbitrary matrix from an object convertible to the Derived type.
|
|
817
|
+
template <typename T>
|
|
818
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(const Derived& other) {
|
|
819
|
+
this->_set_noalias(other);
|
|
820
|
+
}
|
|
813
821
|
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
}
|
|
822
|
+
// Initialize an arbitrary matrix from a generic Eigen expression
|
|
823
|
+
template <typename T, typename OtherDerived>
|
|
824
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(const EigenBase<OtherDerived>& other) {
|
|
825
|
+
this->derived() = other;
|
|
826
|
+
}
|
|
820
827
|
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
}
|
|
828
|
+
template <typename T, typename OtherDerived>
|
|
829
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(const ReturnByValue<OtherDerived>& other) {
|
|
830
|
+
resize(other.rows(), other.cols());
|
|
831
|
+
other.evalTo(this->derived());
|
|
832
|
+
}
|
|
827
833
|
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
this->derived() = other;
|
|
833
|
-
}
|
|
834
|
+
template <typename T, typename OtherDerived, int ColsAtCompileTime>
|
|
835
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(const RotationBase<OtherDerived, ColsAtCompileTime>& r) {
|
|
836
|
+
this->derived() = r;
|
|
837
|
+
}
|
|
834
838
|
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
839
|
+
// For fixed-size Array<Scalar,...>
|
|
840
|
+
template <typename T>
|
|
841
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(
|
|
842
|
+
const Scalar& val0,
|
|
843
|
+
std::enable_if_t<Base::SizeAtCompileTime != Dynamic && Base::SizeAtCompileTime != 1 &&
|
|
844
|
+
internal::is_convertible<T, Scalar>::value &&
|
|
845
|
+
internal::is_same<typename internal::traits<Derived>::XprKind, ArrayXpr>::value,
|
|
846
|
+
T>* = 0) {
|
|
847
|
+
Base::setConstant(val0);
|
|
848
|
+
}
|
|
842
849
|
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
typename internal::enable_if< Base::SizeAtCompileTime!=Dynamic
|
|
855
|
-
&& Base::SizeAtCompileTime!=1
|
|
856
|
-
&& internal::is_convertible<T, Scalar>::value
|
|
857
|
-
&& internal::is_same<typename internal::traits<Derived>::XprKind,ArrayXpr>::value,T>::type* = 0)
|
|
858
|
-
{
|
|
859
|
-
Base::setConstant(val0);
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
// For fixed-size Array<Index,...>
|
|
863
|
-
template<typename T>
|
|
864
|
-
EIGEN_DEVICE_FUNC
|
|
865
|
-
EIGEN_STRONG_INLINE void _init1(const Index& val0,
|
|
866
|
-
typename internal::enable_if< (!internal::is_same<Index,Scalar>::value)
|
|
867
|
-
&& (internal::is_same<Index,T>::value)
|
|
868
|
-
&& Base::SizeAtCompileTime!=Dynamic
|
|
869
|
-
&& Base::SizeAtCompileTime!=1
|
|
870
|
-
&& internal::is_convertible<T, Scalar>::value
|
|
871
|
-
&& internal::is_same<typename internal::traits<Derived>::XprKind,ArrayXpr>::value,T*>::type* = 0)
|
|
872
|
-
{
|
|
873
|
-
Base::setConstant(val0);
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
template<typename MatrixTypeA, typename MatrixTypeB, bool SwapPointers>
|
|
877
|
-
friend struct internal::matrix_swap_impl;
|
|
850
|
+
// For fixed-size Array<Index,...>
|
|
851
|
+
template <typename T>
|
|
852
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(
|
|
853
|
+
const Index& val0,
|
|
854
|
+
std::enable_if_t<(!internal::is_same<Index, Scalar>::value) && (internal::is_same<Index, T>::value) &&
|
|
855
|
+
Base::SizeAtCompileTime != Dynamic && Base::SizeAtCompileTime != 1 &&
|
|
856
|
+
internal::is_convertible<T, Scalar>::value &&
|
|
857
|
+
internal::is_same<typename internal::traits<Derived>::XprKind, ArrayXpr>::value,
|
|
858
|
+
T*>* = 0) {
|
|
859
|
+
Base::setConstant(val0);
|
|
860
|
+
}
|
|
878
861
|
|
|
879
|
-
|
|
880
|
-
|
|
862
|
+
template <typename MatrixTypeA, typename MatrixTypeB, bool SwapPointers>
|
|
863
|
+
friend struct internal::matrix_swap_impl;
|
|
864
|
+
|
|
865
|
+
public:
|
|
881
866
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
internal::matrix_swap_impl<Derived, OtherDerived, bool(SwapPointers)>::run(this->derived(), other.derived());
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
/** \internal
|
|
895
|
-
* \brief const version forwarded to DenseBase::swap
|
|
896
|
-
*/
|
|
897
|
-
template<typename OtherDerived>
|
|
898
|
-
EIGEN_DEVICE_FUNC
|
|
899
|
-
void swap(DenseBase<OtherDerived> const & other)
|
|
900
|
-
{ Base::swap(other.derived()); }
|
|
901
|
-
|
|
902
|
-
EIGEN_DEVICE_FUNC
|
|
903
|
-
static EIGEN_STRONG_INLINE void _check_template_params()
|
|
904
|
-
{
|
|
905
|
-
EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, (Options&RowMajor)==RowMajor)
|
|
906
|
-
&& EIGEN_IMPLIES(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, (Options&RowMajor)==0)
|
|
907
|
-
&& ((RowsAtCompileTime == Dynamic) || (RowsAtCompileTime >= 0))
|
|
908
|
-
&& ((ColsAtCompileTime == Dynamic) || (ColsAtCompileTime >= 0))
|
|
909
|
-
&& ((MaxRowsAtCompileTime == Dynamic) || (MaxRowsAtCompileTime >= 0))
|
|
910
|
-
&& ((MaxColsAtCompileTime == Dynamic) || (MaxColsAtCompileTime >= 0))
|
|
911
|
-
&& (MaxRowsAtCompileTime == RowsAtCompileTime || RowsAtCompileTime==Dynamic)
|
|
912
|
-
&& (MaxColsAtCompileTime == ColsAtCompileTime || ColsAtCompileTime==Dynamic)
|
|
913
|
-
&& (Options & (DontAlign|RowMajor)) == Options),
|
|
914
|
-
INVALID_MATRIX_TEMPLATE_PARAMETERS)
|
|
915
|
-
}
|
|
867
|
+
/** \internal
|
|
868
|
+
* \brief Override DenseBase::swap() since for dynamic-sized matrices
|
|
869
|
+
* of same type it is enough to swap the data pointers.
|
|
870
|
+
*/
|
|
871
|
+
template <typename OtherDerived>
|
|
872
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void swap(DenseBase<OtherDerived>& other) {
|
|
873
|
+
enum {SwapPointers = internal::is_same<Derived, OtherDerived>::value && Base::SizeAtCompileTime == Dynamic};
|
|
874
|
+
internal::matrix_swap_impl<Derived, OtherDerived, bool(SwapPointers)>::run(this->derived(), other.derived());
|
|
875
|
+
}
|
|
916
876
|
|
|
917
|
-
|
|
877
|
+
/** \internal
|
|
878
|
+
* \brief const version forwarded to DenseBase::swap
|
|
879
|
+
*/
|
|
880
|
+
template <typename OtherDerived>
|
|
881
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void swap(DenseBase<OtherDerived> const& other) {
|
|
882
|
+
Base::swap(other.derived());
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
enum {IsPlainObjectBase = 1};
|
|
886
|
+
#endif
|
|
887
|
+
public:
|
|
888
|
+
// These apparently need to be down here for nvcc+icc to prevent duplicate
|
|
889
|
+
// Map symbol.
|
|
890
|
+
template <typename PlainObjectType, int MapOptions, typename StrideType>
|
|
891
|
+
friend class Eigen::Map;
|
|
892
|
+
friend class Eigen::Map<Derived, Unaligned>;
|
|
893
|
+
friend class Eigen::Map<const Derived, Unaligned>;
|
|
894
|
+
#if EIGEN_MAX_ALIGN_BYTES > 0
|
|
895
|
+
// for EIGEN_MAX_ALIGN_BYTES==0, AlignedMax==Unaligned, and many compilers generate warnings for friend-ing a class
|
|
896
|
+
// twice.
|
|
897
|
+
friend class Eigen::Map<Derived, AlignedMax>;
|
|
898
|
+
friend class Eigen::Map<const Derived, AlignedMax>;
|
|
918
899
|
#endif
|
|
919
900
|
};
|
|
920
901
|
|
|
921
902
|
namespace internal {
|
|
922
903
|
|
|
923
904
|
template <typename Derived, typename OtherDerived, bool IsVector>
|
|
924
|
-
struct conservative_resize_like_impl
|
|
925
|
-
|
|
926
|
-
static void run(DenseBase<Derived>& _this, Index rows, Index cols)
|
|
927
|
-
{
|
|
905
|
+
struct conservative_resize_like_impl {
|
|
906
|
+
static constexpr bool IsRelocatable = std::is_trivially_copyable<typename Derived::Scalar>::value;
|
|
907
|
+
static void run(DenseBase<Derived>& _this, Index rows, Index cols) {
|
|
928
908
|
if (_this.rows() == rows && _this.cols() == cols) return;
|
|
929
909
|
EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(Derived)
|
|
930
910
|
|
|
931
|
-
if (
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
internal::check_rows_cols_for_overflow<Derived::MaxSizeAtCompileTime>::run(rows, cols);
|
|
935
|
-
_this.derived().m_storage.conservativeResize(rows*cols,rows,cols);
|
|
936
|
-
}
|
|
937
|
-
else
|
|
911
|
+
if (IsRelocatable &&
|
|
912
|
+
((Derived::IsRowMajor && _this.cols() == cols) || // row-major and we change only the number of rows
|
|
913
|
+
(!Derived::IsRowMajor && _this.rows() == rows))) // column-major and we change only the number of columns
|
|
938
914
|
{
|
|
915
|
+
#ifndef EIGEN_NO_DEBUG
|
|
916
|
+
internal::check_rows_cols_for_overflow<Derived::MaxSizeAtCompileTime, Derived::MaxRowsAtCompileTime,
|
|
917
|
+
Derived::MaxColsAtCompileTime>::run(rows, cols);
|
|
918
|
+
#endif
|
|
919
|
+
_this.derived().m_storage.conservativeResize(rows * cols, rows, cols);
|
|
920
|
+
} else {
|
|
939
921
|
// The storage order does not allow us to use reallocation.
|
|
940
|
-
|
|
922
|
+
Derived tmp(rows, cols);
|
|
941
923
|
const Index common_rows = numext::mini(rows, _this.rows());
|
|
942
924
|
const Index common_cols = numext::mini(cols, _this.cols());
|
|
943
|
-
tmp.block(0,0,common_rows,common_cols) = _this.block(0,0,common_rows,common_cols);
|
|
925
|
+
tmp.block(0, 0, common_rows, common_cols) = _this.block(0, 0, common_rows, common_cols);
|
|
944
926
|
_this.derived().swap(tmp);
|
|
945
927
|
}
|
|
946
928
|
}
|
|
947
929
|
|
|
948
|
-
static void run(DenseBase<Derived>& _this, const DenseBase<OtherDerived>& other)
|
|
949
|
-
{
|
|
930
|
+
static void run(DenseBase<Derived>& _this, const DenseBase<OtherDerived>& other) {
|
|
950
931
|
if (_this.rows() == other.rows() && _this.cols() == other.cols()) return;
|
|
951
932
|
|
|
952
933
|
// Note: Here is space for improvement. Basically, for conservativeResize(Index,Index),
|
|
@@ -957,24 +938,24 @@ struct conservative_resize_like_impl
|
|
|
957
938
|
EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(Derived)
|
|
958
939
|
EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(OtherDerived)
|
|
959
940
|
|
|
960
|
-
if (
|
|
961
|
-
|
|
941
|
+
if (IsRelocatable &&
|
|
942
|
+
((Derived::IsRowMajor && _this.cols() == other.cols()) || // row-major and we change only the number of rows
|
|
943
|
+
(!Derived::IsRowMajor &&
|
|
944
|
+
_this.rows() == other.rows()))) // column-major and we change only the number of columns
|
|
962
945
|
{
|
|
963
946
|
const Index new_rows = other.rows() - _this.rows();
|
|
964
947
|
const Index new_cols = other.cols() - _this.cols();
|
|
965
|
-
_this.derived().m_storage.conservativeResize(other.size(),other.rows(),other.cols());
|
|
966
|
-
if (new_rows>0)
|
|
948
|
+
_this.derived().m_storage.conservativeResize(other.size(), other.rows(), other.cols());
|
|
949
|
+
if (new_rows > 0)
|
|
967
950
|
_this.bottomRightCorner(new_rows, other.cols()) = other.bottomRows(new_rows);
|
|
968
|
-
else if (new_cols>0)
|
|
951
|
+
else if (new_cols > 0)
|
|
969
952
|
_this.bottomRightCorner(other.rows(), new_cols) = other.rightCols(new_cols);
|
|
970
|
-
}
|
|
971
|
-
else
|
|
972
|
-
{
|
|
953
|
+
} else {
|
|
973
954
|
// The storage order does not allow us to use reallocation.
|
|
974
|
-
|
|
955
|
+
Derived tmp(other);
|
|
975
956
|
const Index common_rows = numext::mini(tmp.rows(), _this.rows());
|
|
976
957
|
const Index common_cols = numext::mini(tmp.cols(), _this.cols());
|
|
977
|
-
tmp.block(0,0,common_rows,common_cols) = _this.block(0,0,common_rows,common_cols);
|
|
958
|
+
tmp.block(0, 0, common_rows, common_cols) = _this.block(0, 0, common_rows, common_cols);
|
|
978
959
|
_this.derived().swap(tmp);
|
|
979
960
|
}
|
|
980
961
|
}
|
|
@@ -983,55 +964,51 @@ struct conservative_resize_like_impl
|
|
|
983
964
|
// Here, the specialization for vectors inherits from the general matrix case
|
|
984
965
|
// to allow calling .conservativeResize(rows,cols) on vectors.
|
|
985
966
|
template <typename Derived, typename OtherDerived>
|
|
986
|
-
struct conservative_resize_like_impl<Derived,OtherDerived,true>
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
using
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
{
|
|
993
|
-
const Index new_rows = Derived::RowsAtCompileTime==1 ? 1 : size;
|
|
994
|
-
const Index new_cols = Derived::RowsAtCompileTime==1 ? size : 1;
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
967
|
+
struct conservative_resize_like_impl<Derived, OtherDerived, true>
|
|
968
|
+
: conservative_resize_like_impl<Derived, OtherDerived, false> {
|
|
969
|
+
typedef conservative_resize_like_impl<Derived, OtherDerived, false> Base;
|
|
970
|
+
using Base::IsRelocatable;
|
|
971
|
+
using Base::run;
|
|
972
|
+
|
|
973
|
+
static void run(DenseBase<Derived>& _this, Index size) {
|
|
974
|
+
const Index new_rows = Derived::RowsAtCompileTime == 1 ? 1 : size;
|
|
975
|
+
const Index new_cols = Derived::RowsAtCompileTime == 1 ? size : 1;
|
|
976
|
+
if (IsRelocatable)
|
|
977
|
+
_this.derived().m_storage.conservativeResize(size, new_rows, new_cols);
|
|
978
|
+
else
|
|
979
|
+
Base::run(_this.derived(), new_rows, new_cols);
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
static void run(DenseBase<Derived>& _this, const DenseBase<OtherDerived>& other) {
|
|
1000
983
|
if (_this.rows() == other.rows() && _this.cols() == other.cols()) return;
|
|
1001
984
|
|
|
1002
985
|
const Index num_new_elements = other.size() - _this.size();
|
|
1003
986
|
|
|
1004
|
-
const Index new_rows = Derived::RowsAtCompileTime==1 ? 1 : other.rows();
|
|
1005
|
-
const Index new_cols = Derived::RowsAtCompileTime==1 ? other.cols() : 1;
|
|
1006
|
-
|
|
987
|
+
const Index new_rows = Derived::RowsAtCompileTime == 1 ? 1 : other.rows();
|
|
988
|
+
const Index new_cols = Derived::RowsAtCompileTime == 1 ? other.cols() : 1;
|
|
989
|
+
if (IsRelocatable)
|
|
990
|
+
_this.derived().m_storage.conservativeResize(other.size(), new_rows, new_cols);
|
|
991
|
+
else
|
|
992
|
+
Base::run(_this.derived(), new_rows, new_cols);
|
|
1007
993
|
|
|
1008
|
-
if (num_new_elements > 0)
|
|
1009
|
-
_this.tail(num_new_elements) = other.tail(num_new_elements);
|
|
994
|
+
if (num_new_elements > 0) _this.tail(num_new_elements) = other.tail(num_new_elements);
|
|
1010
995
|
}
|
|
1011
996
|
};
|
|
1012
997
|
|
|
1013
|
-
template<typename MatrixTypeA, typename MatrixTypeB, bool SwapPointers>
|
|
1014
|
-
struct matrix_swap_impl
|
|
1015
|
-
{
|
|
1016
|
-
EIGEN_DEVICE_FUNC
|
|
1017
|
-
static inline void run(MatrixTypeA& a, MatrixTypeB& b)
|
|
1018
|
-
{
|
|
1019
|
-
a.base().swap(b);
|
|
1020
|
-
}
|
|
998
|
+
template <typename MatrixTypeA, typename MatrixTypeB, bool SwapPointers>
|
|
999
|
+
struct matrix_swap_impl {
|
|
1000
|
+
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(MatrixTypeA& a, MatrixTypeB& b) { a.base().swap(b); }
|
|
1021
1001
|
};
|
|
1022
1002
|
|
|
1023
|
-
template<typename MatrixTypeA, typename MatrixTypeB>
|
|
1024
|
-
struct matrix_swap_impl<MatrixTypeA, MatrixTypeB, true>
|
|
1025
|
-
{
|
|
1026
|
-
EIGEN_DEVICE_FUNC
|
|
1027
|
-
static inline void run(MatrixTypeA& a, MatrixTypeB& b)
|
|
1028
|
-
{
|
|
1003
|
+
template <typename MatrixTypeA, typename MatrixTypeB>
|
|
1004
|
+
struct matrix_swap_impl<MatrixTypeA, MatrixTypeB, true> {
|
|
1005
|
+
EIGEN_DEVICE_FUNC static inline void run(MatrixTypeA& a, MatrixTypeB& b) {
|
|
1029
1006
|
static_cast<typename MatrixTypeA::Base&>(a).m_storage.swap(static_cast<typename MatrixTypeB::Base&>(b).m_storage);
|
|
1030
1007
|
}
|
|
1031
1008
|
};
|
|
1032
1009
|
|
|
1033
|
-
}
|
|
1010
|
+
} // end namespace internal
|
|
1034
1011
|
|
|
1035
|
-
}
|
|
1012
|
+
} // end namespace Eigen
|
|
1036
1013
|
|
|
1037
|
-
#endif
|
|
1014
|
+
#endif // EIGEN_DENSESTORAGEBASE_H
|