@smake/eigen 1.1.0 → 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 -20
- package/eigen/Eigen/CholmodSupport +28 -28
- package/eigen/Eigen/Core +187 -120
- package/eigen/Eigen/Eigenvalues +16 -13
- package/eigen/Eigen/Geometry +18 -18
- package/eigen/Eigen/Householder +9 -7
- package/eigen/Eigen/IterativeLinearSolvers +8 -4
- package/eigen/Eigen/Jacobi +14 -13
- package/eigen/Eigen/KLUSupport +23 -21
- package/eigen/Eigen/LU +15 -16
- package/eigen/Eigen/MetisSupport +12 -12
- package/eigen/Eigen/OrderingMethods +54 -51
- package/eigen/Eigen/PaStiXSupport +23 -21
- package/eigen/Eigen/PardisoSupport +17 -14
- package/eigen/Eigen/QR +18 -20
- package/eigen/Eigen/QtAlignedMalloc +5 -12
- package/eigen/Eigen/SPQRSupport +21 -14
- package/eigen/Eigen/SVD +23 -17
- package/eigen/Eigen/Sparse +1 -2
- package/eigen/Eigen/SparseCholesky +18 -15
- package/eigen/Eigen/SparseCore +18 -17
- package/eigen/Eigen/SparseLU +9 -9
- 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 +366 -405
- package/eigen/Eigen/src/Cholesky/LLT.h +323 -367
- package/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h +81 -56
- package/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +585 -529
- package/eigen/Eigen/src/CholmodSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Core/ArithmeticSequence.h +143 -317
- package/eigen/Eigen/src/Core/Array.h +329 -370
- package/eigen/Eigen/src/Core/ArrayBase.h +190 -203
- package/eigen/Eigen/src/Core/ArrayWrapper.h +126 -170
- package/eigen/Eigen/src/Core/Assign.h +30 -40
- package/eigen/Eigen/src/Core/AssignEvaluator.h +651 -604
- package/eigen/Eigen/src/Core/Assign_MKL.h +125 -120
- package/eigen/Eigen/src/Core/BandMatrix.h +267 -282
- package/eigen/Eigen/src/Core/Block.h +371 -390
- package/eigen/Eigen/src/Core/CommaInitializer.h +85 -100
- package/eigen/Eigen/src/Core/ConditionEstimator.h +51 -53
- package/eigen/Eigen/src/Core/CoreEvaluators.h +1214 -937
- package/eigen/Eigen/src/Core/CoreIterators.h +72 -63
- package/eigen/Eigen/src/Core/CwiseBinaryOp.h +112 -129
- package/eigen/Eigen/src/Core/CwiseNullaryOp.h +676 -702
- package/eigen/Eigen/src/Core/CwiseTernaryOp.h +77 -103
- package/eigen/Eigen/src/Core/CwiseUnaryOp.h +55 -67
- package/eigen/Eigen/src/Core/CwiseUnaryView.h +127 -92
- package/eigen/Eigen/src/Core/DenseBase.h +630 -658
- package/eigen/Eigen/src/Core/DenseCoeffsBase.h +511 -628
- package/eigen/Eigen/src/Core/DenseStorage.h +511 -590
- package/eigen/Eigen/src/Core/DeviceWrapper.h +153 -0
- package/eigen/Eigen/src/Core/Diagonal.h +168 -207
- package/eigen/Eigen/src/Core/DiagonalMatrix.h +346 -317
- package/eigen/Eigen/src/Core/DiagonalProduct.h +12 -10
- package/eigen/Eigen/src/Core/Dot.h +167 -217
- package/eigen/Eigen/src/Core/EigenBase.h +74 -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 -113
- package/eigen/Eigen/src/Core/Fuzzy.h +82 -105
- package/eigen/Eigen/src/Core/GeneralProduct.h +315 -261
- package/eigen/Eigen/src/Core/GenericPacketMath.h +1182 -520
- package/eigen/Eigen/src/Core/GlobalFunctions.h +193 -157
- package/eigen/Eigen/src/Core/IO.h +131 -156
- package/eigen/Eigen/src/Core/IndexedView.h +209 -125
- 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 +50 -59
- package/eigen/Eigen/src/Core/Map.h +123 -141
- package/eigen/Eigen/src/Core/MapBase.h +255 -282
- package/eigen/Eigen/src/Core/MathFunctions.h +1247 -1201
- package/eigen/Eigen/src/Core/MathFunctionsImpl.h +162 -99
- package/eigen/Eigen/src/Core/Matrix.h +463 -494
- package/eigen/Eigen/src/Core/MatrixBase.h +468 -470
- package/eigen/Eigen/src/Core/NestByValue.h +58 -52
- package/eigen/Eigen/src/Core/NoAlias.h +79 -86
- package/eigen/Eigen/src/Core/NumTraits.h +206 -206
- package/eigen/Eigen/src/Core/PartialReduxEvaluator.h +163 -142
- package/eigen/Eigen/src/Core/PermutationMatrix.h +461 -511
- package/eigen/Eigen/src/Core/PlainObjectBase.h +858 -972
- package/eigen/Eigen/src/Core/Product.h +246 -130
- package/eigen/Eigen/src/Core/ProductEvaluators.h +779 -671
- package/eigen/Eigen/src/Core/Random.h +153 -164
- 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 +334 -314
- package/eigen/Eigen/src/Core/Ref.h +259 -257
- package/eigen/Eigen/src/Core/Replicate.h +92 -104
- package/eigen/Eigen/src/Core/Reshaped.h +215 -271
- package/eigen/Eigen/src/Core/ReturnByValue.h +47 -55
- package/eigen/Eigen/src/Core/Reverse.h +133 -148
- package/eigen/Eigen/src/Core/Select.h +68 -140
- package/eigen/Eigen/src/Core/SelfAdjointView.h +254 -290
- 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 +88 -102
- package/eigen/Eigen/src/Core/SolveTriangular.h +126 -124
- package/eigen/Eigen/src/Core/SolverBase.h +132 -133
- package/eigen/Eigen/src/Core/StableNorm.h +113 -147
- package/eigen/Eigen/src/Core/StlIterators.h +404 -248
- package/eigen/Eigen/src/Core/Stride.h +90 -92
- package/eigen/Eigen/src/Core/Swap.h +70 -39
- package/eigen/Eigen/src/Core/Transpose.h +258 -295
- package/eigen/Eigen/src/Core/Transpositions.h +270 -333
- package/eigen/Eigen/src/Core/TriangularMatrix.h +642 -743
- package/eigen/Eigen/src/Core/VectorBlock.h +59 -72
- package/eigen/Eigen/src/Core/VectorwiseOp.h +653 -704
- package/eigen/Eigen/src/Core/Visitor.h +464 -308
- package/eigen/Eigen/src/Core/arch/AVX/Complex.h +380 -187
- package/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +65 -163
- package/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +2145 -638
- package/eigen/Eigen/src/Core/arch/AVX/Reductions.h +353 -0
- package/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +253 -60
- package/eigen/Eigen/src/Core/arch/AVX512/Complex.h +278 -228
- package/eigen/Eigen/src/Core/arch/AVX512/GemmKernel.h +1245 -0
- package/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +48 -269
- package/eigen/Eigen/src/Core/arch/AVX512/MathFunctionsFP16.h +75 -0
- package/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +1597 -754
- 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 +229 -41
- package/eigen/Eigen/src/Core/arch/AVX512/TypeCastingFP16.h +130 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +420 -184
- package/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +40 -49
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +2962 -2213
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +196 -212
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +713 -441
- 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 +2380 -1362
- package/eigen/Eigen/src/Core/arch/AltiVec/TypeCasting.h +153 -0
- package/eigen/Eigen/src/Core/arch/Default/BFloat16.h +390 -224
- package/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +78 -67
- package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +1784 -799
- package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +167 -50
- package/eigen/Eigen/src/Core/arch/Default/Half.h +528 -379
- package/eigen/Eigen/src/Core/arch/Default/Settings.h +10 -12
- package/eigen/Eigen/src/Core/arch/GPU/Complex.h +244 -0
- package/eigen/Eigen/src/Core/arch/GPU/MathFunctions.h +41 -40
- package/eigen/Eigen/src/Core/arch/GPU/PacketMath.h +550 -523
- package/eigen/Eigen/src/Core/arch/GPU/Tuple.h +268 -0
- package/eigen/Eigen/src/Core/arch/GPU/TypeCasting.h +27 -30
- package/eigen/Eigen/src/Core/arch/HIP/hcc/math_constants.h +8 -8
- 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 +54 -82
- package/eigen/Eigen/src/Core/arch/MSA/MathFunctions.h +84 -92
- package/eigen/Eigen/src/Core/arch/MSA/PacketMath.h +51 -47
- package/eigen/Eigen/src/Core/arch/NEON/Complex.h +454 -306
- package/eigen/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +175 -115
- package/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +23 -30
- package/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +4366 -2857
- package/eigen/Eigen/src/Core/arch/NEON/TypeCasting.h +616 -393
- package/eigen/Eigen/src/Core/arch/NEON/UnaryFunctors.h +57 -0
- package/eigen/Eigen/src/Core/arch/SSE/Complex.h +350 -198
- package/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +38 -149
- package/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +1791 -912
- package/eigen/Eigen/src/Core/arch/SSE/Reductions.h +324 -0
- package/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +128 -40
- package/eigen/Eigen/src/Core/arch/SVE/MathFunctions.h +10 -6
- package/eigen/Eigen/src/Core/arch/SVE/PacketMath.h +156 -234
- package/eigen/Eigen/src/Core/arch/SVE/TypeCasting.h +6 -3
- package/eigen/Eigen/src/Core/arch/SYCL/InteropHeaders.h +27 -32
- package/eigen/Eigen/src/Core/arch/SYCL/MathFunctions.h +119 -117
- package/eigen/Eigen/src/Core/arch/SYCL/PacketMath.h +325 -419
- package/eigen/Eigen/src/Core/arch/SYCL/TypeCasting.h +15 -17
- package/eigen/Eigen/src/Core/arch/ZVector/Complex.h +325 -181
- package/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +94 -83
- package/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +811 -458
- package/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +121 -124
- package/eigen/Eigen/src/Core/functors/BinaryFunctors.h +576 -370
- package/eigen/Eigen/src/Core/functors/NullaryFunctors.h +194 -109
- package/eigen/Eigen/src/Core/functors/StlFunctors.h +95 -112
- package/eigen/Eigen/src/Core/functors/TernaryFunctors.h +34 -7
- package/eigen/Eigen/src/Core/functors/UnaryFunctors.h +1038 -749
- package/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +1883 -1375
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +312 -370
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +189 -176
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +84 -81
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +154 -73
- package/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +292 -337
- package/eigen/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +80 -77
- package/eigen/Eigen/src/Core/products/Parallelizer.h +207 -105
- package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +327 -388
- package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +206 -224
- package/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +138 -147
- 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 -47
- 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 -277
- package/eigen/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +108 -109
- package/eigen/Eigen/src/Core/products/TriangularSolverVector.h +68 -94
- package/eigen/Eigen/src/Core/util/Assert.h +158 -0
- package/eigen/Eigen/src/Core/util/BlasUtil.h +342 -303
- package/eigen/Eigen/src/Core/util/ConfigureVectorization.h +348 -317
- package/eigen/Eigen/src/Core/util/Constants.h +297 -262
- package/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +130 -90
- package/eigen/Eigen/src/Core/util/EmulateArray.h +270 -0
- package/eigen/Eigen/src/Core/util/ForwardDeclarations.h +449 -247
- 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 +417 -116
- package/eigen/Eigen/src/Core/util/IntegralConstant.h +211 -204
- package/eigen/Eigen/src/Core/util/MKL_support.h +39 -37
- package/eigen/Eigen/src/Core/util/Macros.h +655 -773
- package/eigen/Eigen/src/Core/util/MaxSizeVector.h +139 -0
- package/eigen/Eigen/src/Core/util/Memory.h +970 -748
- package/eigen/Eigen/src/Core/util/Meta.h +581 -633
- 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 +17 -17
- package/eigen/Eigen/src/Core/util/Serializer.h +209 -0
- package/eigen/Eigen/src/Core/util/StaticAssert.h +50 -166
- package/eigen/Eigen/src/Core/util/SymbolicIndex.h +377 -225
- package/eigen/Eigen/src/Core/util/XprHelper.h +784 -547
- 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 +89 -105
- package/eigen/Eigen/src/Eigenvalues/RealQZ.h +537 -607
- package/eigen/Eigen/src/Eigenvalues/RealSchur.h +342 -381
- package/eigen/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +41 -35
- package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +541 -595
- package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +47 -44
- package/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +430 -462
- package/eigen/Eigen/src/Geometry/AlignedBox.h +226 -227
- package/eigen/Eigen/src/Geometry/AngleAxis.h +131 -133
- package/eigen/Eigen/src/Geometry/EulerAngles.h +163 -74
- package/eigen/Eigen/src/Geometry/Homogeneous.h +285 -333
- package/eigen/Eigen/src/Geometry/Hyperplane.h +151 -160
- package/eigen/Eigen/src/Geometry/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Geometry/OrthoMethods.h +168 -146
- package/eigen/Eigen/src/Geometry/ParametrizedLine.h +127 -127
- package/eigen/Eigen/src/Geometry/Quaternion.h +566 -506
- package/eigen/Eigen/src/Geometry/Rotation2D.h +107 -105
- package/eigen/Eigen/src/Geometry/RotationBase.h +148 -145
- package/eigen/Eigen/src/Geometry/Scaling.h +113 -106
- package/eigen/Eigen/src/Geometry/Transform.h +858 -936
- package/eigen/Eigen/src/Geometry/Translation.h +94 -92
- package/eigen/Eigen/src/Geometry/Umeyama.h +79 -84
- package/eigen/Eigen/src/Geometry/arch/Geometry_SIMD.h +90 -104
- package/eigen/Eigen/src/Householder/BlockHouseholder.h +51 -46
- package/eigen/Eigen/src/Householder/Householder.h +102 -124
- package/eigen/Eigen/src/Householder/HouseholderSequence.h +412 -453
- package/eigen/Eigen/src/Householder/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +149 -162
- package/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +124 -119
- package/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +92 -104
- package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +251 -243
- package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +224 -228
- package/eigen/Eigen/src/IterativeLinearSolvers/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +178 -227
- package/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +79 -84
- package/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +54 -60
- package/eigen/Eigen/src/Jacobi/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Jacobi/Jacobi.h +252 -308
- package/eigen/Eigen/src/KLUSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/KLUSupport/KLUSupport.h +208 -227
- package/eigen/Eigen/src/LU/Determinant.h +50 -69
- package/eigen/Eigen/src/LU/FullPivLU.h +545 -596
- package/eigen/Eigen/src/LU/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/LU/InverseImpl.h +206 -285
- package/eigen/Eigen/src/LU/PartialPivLU.h +390 -428
- package/eigen/Eigen/src/LU/PartialPivLU_LAPACKE.h +54 -40
- package/eigen/Eigen/src/LU/arch/InverseSize4.h +72 -70
- 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 +243 -265
- package/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +831 -1004
- package/eigen/Eigen/src/OrderingMethods/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/OrderingMethods/Ordering.h +112 -119
- 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 -430
- package/eigen/Eigen/src/QR/ColPivHouseholderQR.h +479 -479
- package/eigen/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +120 -56
- package/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +166 -153
- package/eigen/Eigen/src/QR/FullPivHouseholderQR.h +495 -475
- package/eigen/Eigen/src/QR/HouseholderQR.h +394 -285
- 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 +244 -264
- package/eigen/Eigen/src/SVD/BDCSVD.h +817 -713
- 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 +577 -543
- package/eigen/Eigen/src/SVD/JacobiSVD_LAPACKE.h +85 -49
- package/eigen/Eigen/src/SVD/SVDBase.h +242 -182
- package/eigen/Eigen/src/SVD/UpperBidiagonalization.h +200 -235
- package/eigen/Eigen/src/SparseCholesky/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +765 -594
- package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +308 -94
- package/eigen/Eigen/src/SparseCore/AmbiVector.h +202 -251
- package/eigen/Eigen/src/SparseCore/CompressedStorage.h +184 -252
- package/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +134 -178
- package/eigen/Eigen/src/SparseCore/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SparseCore/SparseAssign.h +149 -140
- package/eigen/Eigen/src/SparseCore/SparseBlock.h +403 -440
- package/eigen/Eigen/src/SparseCore/SparseColEtree.h +100 -112
- package/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +525 -303
- package/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +555 -339
- package/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +100 -108
- package/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +169 -197
- 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 +1603 -1245
- package/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +403 -350
- package/eigen/Eigen/src/SparseCore/SparsePermutation.h +186 -115
- package/eigen/Eigen/src/SparseCore/SparseProduct.h +94 -97
- 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 +370 -416
- 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 +138 -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 +756 -710
- 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 +245 -301
- 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 +89 -100
- 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 +124 -132
- 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 +450 -502
- package/eigen/Eigen/src/StlSupport/StdDeque.h +28 -93
- 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 -730
- 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 +428 -464
- 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 +9972 -16179
- 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.h → BlockMethods.inc} +434 -506
- package/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.inc +116 -0
- package/eigen/Eigen/src/plugins/{CommonCwiseUnaryOps.h → CommonCwiseUnaryOps.inc} +58 -68
- 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/package.json +1 -1
- package/eigen/COPYING.APACHE +0 -203
- package/eigen/COPYING.BSD +0 -26
- package/eigen/COPYING.GPL +0 -674
- package/eigen/COPYING.LGPL +0 -502
- package/eigen/COPYING.MINPACK +0 -51
- package/eigen/COPYING.MPL2 +0 -373
- package/eigen/COPYING.README +0 -18
- package/eigen/Eigen/src/Core/BooleanRedux.h +0 -162
- package/eigen/Eigen/src/Core/arch/CUDA/Complex.h +0 -258
- package/eigen/Eigen/src/Core/arch/Default/TypeCasting.h +0 -120
- package/eigen/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h +0 -694
- package/eigen/Eigen/src/Core/util/NonMPL2.h +0 -3
- 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 -358
- package/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +0 -696
- package/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.h +0 -115
- package/eigen/Eigen/src/plugins/IndexedViewMethods.h +0 -262
- package/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +0 -152
- package/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +0 -95
- package/eigen/Eigen/src/plugins/ReshapedMethods.h +0 -149
- package/eigen/README.md +0 -5
|
@@ -9,26 +9,26 @@
|
|
|
9
9
|
// Public License v. 2.0. If a copy of the MPL was not distributed
|
|
10
10
|
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
11
11
|
|
|
12
|
-
|
|
13
12
|
#ifndef EIGEN_PRODUCTEVALUATORS_H
|
|
14
13
|
#define EIGEN_PRODUCTEVALUATORS_H
|
|
15
14
|
|
|
15
|
+
// IWYU pragma: private
|
|
16
|
+
#include "./InternalHeaderCheck.h"
|
|
17
|
+
|
|
16
18
|
namespace Eigen {
|
|
17
19
|
|
|
18
20
|
namespace internal {
|
|
19
21
|
|
|
20
22
|
/** \internal
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
template<typename Lhs, typename Rhs, int Options>
|
|
29
|
-
struct evaluator<Product<Lhs, Rhs, Options
|
|
30
|
-
: public product_evaluator<Product<Lhs, Rhs, Options> >
|
|
31
|
-
{
|
|
23
|
+
* Evaluator of a product expression.
|
|
24
|
+
* Since products require special treatments to handle all possible cases,
|
|
25
|
+
* we simply defer the evaluation logic to a product_evaluator class
|
|
26
|
+
* which offers more partial specialization possibilities.
|
|
27
|
+
*
|
|
28
|
+
* \sa class product_evaluator
|
|
29
|
+
*/
|
|
30
|
+
template <typename Lhs, typename Rhs, int Options>
|
|
31
|
+
struct evaluator<Product<Lhs, Rhs, Options>> : public product_evaluator<Product<Lhs, Rhs, Options>> {
|
|
32
32
|
typedef Product<Lhs, Rhs, Options> XprType;
|
|
33
33
|
typedef product_evaluator<XprType> Base;
|
|
34
34
|
|
|
@@ -37,94 +37,82 @@ struct evaluator<Product<Lhs, Rhs, Options> >
|
|
|
37
37
|
|
|
38
38
|
// Catch "scalar * ( A * B )" and transform it to "(A*scalar) * B"
|
|
39
39
|
// TODO we should apply that rule only if that's really helpful
|
|
40
|
-
template<typename Lhs, typename Rhs, typename Scalar1, typename Scalar2, typename Plain1>
|
|
41
|
-
struct evaluator_assume_aliasing<CwiseBinaryOp<internal::scalar_product_op<Scalar1,Scalar2>,
|
|
40
|
+
template <typename Lhs, typename Rhs, typename Scalar1, typename Scalar2, typename Plain1>
|
|
41
|
+
struct evaluator_assume_aliasing<CwiseBinaryOp<internal::scalar_product_op<Scalar1, Scalar2>,
|
|
42
42
|
const CwiseNullaryOp<internal::scalar_constant_op<Scalar1>, Plain1>,
|
|
43
|
-
const Product<Lhs, Rhs, DefaultProduct
|
|
44
|
-
{
|
|
43
|
+
const Product<Lhs, Rhs, DefaultProduct>>> {
|
|
45
44
|
static const bool value = true;
|
|
46
45
|
};
|
|
47
|
-
template<typename Lhs, typename Rhs, typename Scalar1, typename Scalar2, typename Plain1>
|
|
48
|
-
struct evaluator<CwiseBinaryOp<internal::scalar_product_op<Scalar1,Scalar2>,
|
|
46
|
+
template <typename Lhs, typename Rhs, typename Scalar1, typename Scalar2, typename Plain1>
|
|
47
|
+
struct evaluator<CwiseBinaryOp<internal::scalar_product_op<Scalar1, Scalar2>,
|
|
49
48
|
const CwiseNullaryOp<internal::scalar_constant_op<Scalar1>, Plain1>,
|
|
50
|
-
const Product<Lhs, Rhs, DefaultProduct
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
typedef evaluator<Product<EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(Scalar1,Lhs,product), Rhs, DefaultProduct
|
|
49
|
+
const Product<Lhs, Rhs, DefaultProduct>>>
|
|
50
|
+
: public evaluator<Product<EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(Scalar1, Lhs, product), Rhs, DefaultProduct>> {
|
|
51
|
+
typedef CwiseBinaryOp<internal::scalar_product_op<Scalar1, Scalar2>,
|
|
52
|
+
const CwiseNullaryOp<internal::scalar_constant_op<Scalar1>, Plain1>,
|
|
53
|
+
const Product<Lhs, Rhs, DefaultProduct>>
|
|
54
|
+
XprType;
|
|
55
|
+
typedef evaluator<Product<EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(Scalar1, Lhs, product), Rhs, DefaultProduct>> Base;
|
|
57
56
|
|
|
58
57
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& xpr)
|
|
59
|
-
|
|
60
|
-
{}
|
|
58
|
+
: Base(xpr.lhs().functor().m_other * xpr.rhs().lhs() * xpr.rhs().rhs()) {}
|
|
61
59
|
};
|
|
62
60
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
: public evaluator<Diagonal<const Product<Lhs, Rhs, LazyProduct>, DiagIndex> >
|
|
67
|
-
{
|
|
61
|
+
template <typename Lhs, typename Rhs, int DiagIndex>
|
|
62
|
+
struct evaluator<Diagonal<const Product<Lhs, Rhs, DefaultProduct>, DiagIndex>>
|
|
63
|
+
: public evaluator<Diagonal<const Product<Lhs, Rhs, LazyProduct>, DiagIndex>> {
|
|
68
64
|
typedef Diagonal<const Product<Lhs, Rhs, DefaultProduct>, DiagIndex> XprType;
|
|
69
|
-
typedef evaluator<Diagonal<const Product<Lhs, Rhs, LazyProduct>, DiagIndex
|
|
65
|
+
typedef evaluator<Diagonal<const Product<Lhs, Rhs, LazyProduct>, DiagIndex>> Base;
|
|
70
66
|
|
|
71
67
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& xpr)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
xpr.index() ))
|
|
75
|
-
{}
|
|
68
|
+
: Base(Diagonal<const Product<Lhs, Rhs, LazyProduct>, DiagIndex>(
|
|
69
|
+
Product<Lhs, Rhs, LazyProduct>(xpr.nestedExpression().lhs(), xpr.nestedExpression().rhs()), xpr.index())) {}
|
|
76
70
|
};
|
|
77
71
|
|
|
78
|
-
|
|
79
72
|
// Helper class to perform a matrix product with the destination at hand.
|
|
80
73
|
// Depending on the sizes of the factors, there are different evaluation strategies
|
|
81
74
|
// as controlled by internal::product_type.
|
|
82
|
-
template<
|
|
83
|
-
typename LhsShape = typename evaluator_traits<Lhs>::Shape,
|
|
75
|
+
template <typename Lhs, typename Rhs, typename LhsShape = typename evaluator_traits<Lhs>::Shape,
|
|
84
76
|
typename RhsShape = typename evaluator_traits<Rhs>::Shape,
|
|
85
|
-
int ProductType = internal::product_type<Lhs,Rhs>::value>
|
|
77
|
+
int ProductType = internal::product_type<Lhs, Rhs>::value>
|
|
86
78
|
struct generic_product_impl;
|
|
87
79
|
|
|
88
|
-
template<typename Lhs, typename Rhs>
|
|
89
|
-
struct evaluator_assume_aliasing<Product<Lhs, Rhs, DefaultProduct
|
|
80
|
+
template <typename Lhs, typename Rhs>
|
|
81
|
+
struct evaluator_assume_aliasing<Product<Lhs, Rhs, DefaultProduct>> {
|
|
90
82
|
static const bool value = true;
|
|
91
83
|
};
|
|
92
84
|
|
|
93
85
|
// This is the default evaluator implementation for products:
|
|
94
86
|
// It creates a temporary and call generic_product_impl
|
|
95
|
-
template<typename Lhs, typename Rhs, int Options, int ProductTag, typename LhsShape, typename RhsShape>
|
|
87
|
+
template <typename Lhs, typename Rhs, int Options, int ProductTag, typename LhsShape, typename RhsShape>
|
|
96
88
|
struct product_evaluator<Product<Lhs, Rhs, Options>, ProductTag, LhsShape, RhsShape>
|
|
97
|
-
|
|
98
|
-
{
|
|
89
|
+
: public evaluator<typename Product<Lhs, Rhs, Options>::PlainObject> {
|
|
99
90
|
typedef Product<Lhs, Rhs, Options> XprType;
|
|
100
91
|
typedef typename XprType::PlainObject PlainObject;
|
|
101
92
|
typedef evaluator<PlainObject> Base;
|
|
102
|
-
enum {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
//
|
|
113
|
-
//
|
|
114
|
-
// typedef
|
|
115
|
-
//
|
|
116
|
-
//
|
|
117
|
-
//
|
|
118
|
-
//
|
|
119
|
-
//
|
|
120
|
-
// const RhsNested rhs(xpr.rhs());
|
|
121
|
-
//
|
|
122
|
-
// generic_product_impl<LhsNestedCleaned, RhsNestedCleaned>::evalTo(m_result, lhs, rhs);
|
|
93
|
+
enum { Flags = Base::Flags | EvalBeforeNestingBit };
|
|
94
|
+
|
|
95
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit product_evaluator(const XprType& xpr)
|
|
96
|
+
: m_result(xpr.rows(), xpr.cols()) {
|
|
97
|
+
internal::construct_at<Base>(this, m_result);
|
|
98
|
+
|
|
99
|
+
// FIXME shall we handle nested_eval here?,
|
|
100
|
+
// if so, then we must take care at removing the call to nested_eval in the specializations (e.g., in
|
|
101
|
+
// permutation_matrix_product, transposition_matrix_product, etc.)
|
|
102
|
+
// typedef typename internal::nested_eval<Lhs,Rhs::ColsAtCompileTime>::type LhsNested;
|
|
103
|
+
// typedef typename internal::nested_eval<Rhs,Lhs::RowsAtCompileTime>::type RhsNested;
|
|
104
|
+
// typedef internal::remove_all_t<LhsNested> LhsNestedCleaned;
|
|
105
|
+
// typedef internal::remove_all_t<RhsNested> RhsNestedCleaned;
|
|
106
|
+
//
|
|
107
|
+
// const LhsNested lhs(xpr.lhs());
|
|
108
|
+
// const RhsNested rhs(xpr.rhs());
|
|
109
|
+
//
|
|
110
|
+
// generic_product_impl<LhsNestedCleaned, RhsNestedCleaned>::evalTo(m_result, lhs, rhs);
|
|
123
111
|
|
|
124
112
|
generic_product_impl<Lhs, Rhs, LhsShape, RhsShape, ProductTag>::evalTo(m_result, xpr.lhs(), xpr.rhs());
|
|
125
113
|
}
|
|
126
114
|
|
|
127
|
-
protected:
|
|
115
|
+
protected:
|
|
128
116
|
PlainObject m_result;
|
|
129
117
|
};
|
|
130
118
|
|
|
@@ -132,32 +120,27 @@ protected:
|
|
|
132
120
|
// TODO: we could enable them for different scalar types when the product is not vectorized.
|
|
133
121
|
|
|
134
122
|
// Dense = Product
|
|
135
|
-
template<
|
|
136
|
-
struct Assignment<DstXprType, Product<Lhs,Rhs,Options>, internal::assign_op<Scalar,Scalar>, Dense2Dense,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op<Scalar,Scalar> &)
|
|
142
|
-
{
|
|
123
|
+
template <typename DstXprType, typename Lhs, typename Rhs, int Options, typename Scalar>
|
|
124
|
+
struct Assignment<DstXprType, Product<Lhs, Rhs, Options>, internal::assign_op<Scalar, Scalar>, Dense2Dense,
|
|
125
|
+
std::enable_if_t<(Options == DefaultProduct || Options == AliasFreeProduct)>> {
|
|
126
|
+
typedef Product<Lhs, Rhs, Options> SrcXprType;
|
|
127
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(DstXprType& dst, const SrcXprType& src,
|
|
128
|
+
const internal::assign_op<Scalar, Scalar>&) {
|
|
143
129
|
Index dstRows = src.rows();
|
|
144
130
|
Index dstCols = src.cols();
|
|
145
|
-
if((dst.rows()!=dstRows) || (dst.cols()!=dstCols))
|
|
146
|
-
dst.resize(dstRows, dstCols);
|
|
131
|
+
if ((dst.rows() != dstRows) || (dst.cols() != dstCols)) dst.resize(dstRows, dstCols);
|
|
147
132
|
// FIXME shall we handle nested_eval here?
|
|
148
133
|
generic_product_impl<Lhs, Rhs>::evalTo(dst, src.lhs(), src.rhs());
|
|
149
134
|
}
|
|
150
135
|
};
|
|
151
136
|
|
|
152
137
|
// Dense += Product
|
|
153
|
-
template<
|
|
154
|
-
struct Assignment<DstXprType, Product<Lhs,Rhs,Options>, internal::add_assign_op<Scalar,Scalar>, Dense2Dense,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
void run(DstXprType &dst, const SrcXprType &src, const internal::add_assign_op<Scalar,Scalar> &)
|
|
160
|
-
{
|
|
138
|
+
template <typename DstXprType, typename Lhs, typename Rhs, int Options, typename Scalar>
|
|
139
|
+
struct Assignment<DstXprType, Product<Lhs, Rhs, Options>, internal::add_assign_op<Scalar, Scalar>, Dense2Dense,
|
|
140
|
+
std::enable_if_t<(Options == DefaultProduct || Options == AliasFreeProduct)>> {
|
|
141
|
+
typedef Product<Lhs, Rhs, Options> SrcXprType;
|
|
142
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(DstXprType& dst, const SrcXprType& src,
|
|
143
|
+
const internal::add_assign_op<Scalar, Scalar>&) {
|
|
161
144
|
eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols());
|
|
162
145
|
// FIXME shall we handle nested_eval here?
|
|
163
146
|
generic_product_impl<Lhs, Rhs>::addTo(dst, src.lhs(), src.rhs());
|
|
@@ -165,35 +148,35 @@ struct Assignment<DstXprType, Product<Lhs,Rhs,Options>, internal::add_assign_op<
|
|
|
165
148
|
};
|
|
166
149
|
|
|
167
150
|
// Dense -= Product
|
|
168
|
-
template<
|
|
169
|
-
struct Assignment<DstXprType, Product<Lhs,Rhs,Options>, internal::sub_assign_op<Scalar,Scalar>, Dense2Dense,
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
void run(DstXprType &dst, const SrcXprType &src, const internal::sub_assign_op<Scalar,Scalar> &)
|
|
175
|
-
{
|
|
151
|
+
template <typename DstXprType, typename Lhs, typename Rhs, int Options, typename Scalar>
|
|
152
|
+
struct Assignment<DstXprType, Product<Lhs, Rhs, Options>, internal::sub_assign_op<Scalar, Scalar>, Dense2Dense,
|
|
153
|
+
std::enable_if_t<(Options == DefaultProduct || Options == AliasFreeProduct)>> {
|
|
154
|
+
typedef Product<Lhs, Rhs, Options> SrcXprType;
|
|
155
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(DstXprType& dst, const SrcXprType& src,
|
|
156
|
+
const internal::sub_assign_op<Scalar, Scalar>&) {
|
|
176
157
|
eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols());
|
|
177
158
|
// FIXME shall we handle nested_eval here?
|
|
178
159
|
generic_product_impl<Lhs, Rhs>::subTo(dst, src.lhs(), src.rhs());
|
|
179
160
|
}
|
|
180
161
|
};
|
|
181
162
|
|
|
182
|
-
|
|
183
163
|
// Dense ?= scalar * Product
|
|
184
164
|
// TODO we should apply that rule if that's really helpful
|
|
185
165
|
// for instance, this is not good for inner products
|
|
186
|
-
template<
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
166
|
+
template <typename DstXprType, typename Lhs, typename Rhs, typename AssignFunc, typename Scalar, typename ScalarBis,
|
|
167
|
+
typename Plain>
|
|
168
|
+
struct Assignment<DstXprType,
|
|
169
|
+
CwiseBinaryOp<internal::scalar_product_op<ScalarBis, Scalar>,
|
|
170
|
+
const CwiseNullaryOp<internal::scalar_constant_op<ScalarBis>, Plain>,
|
|
171
|
+
const Product<Lhs, Rhs, DefaultProduct>>,
|
|
172
|
+
AssignFunc, Dense2Dense> {
|
|
173
|
+
typedef CwiseBinaryOp<internal::scalar_product_op<ScalarBis, Scalar>,
|
|
174
|
+
const CwiseNullaryOp<internal::scalar_constant_op<ScalarBis>, Plain>,
|
|
175
|
+
const Product<Lhs, Rhs, DefaultProduct>>
|
|
176
|
+
SrcXprType;
|
|
177
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(DstXprType& dst, const SrcXprType& src,
|
|
178
|
+
const AssignFunc& func) {
|
|
179
|
+
call_assignment_no_alias(dst, (src.lhs().functor().m_other * src.rhs().lhs()) * src.rhs().rhs(), func);
|
|
197
180
|
}
|
|
198
181
|
};
|
|
199
182
|
|
|
@@ -201,219 +184,237 @@ struct Assignment<DstXprType, CwiseBinaryOp<internal::scalar_product_op<ScalarBi
|
|
|
201
184
|
// Catch "Dense ?= xpr + Product<>" expression to save one temporary
|
|
202
185
|
// FIXME we could probably enable these rules for any product, i.e., not only Dense and DefaultProduct
|
|
203
186
|
|
|
204
|
-
template<typename OtherXpr, typename Lhs, typename Rhs>
|
|
205
|
-
struct evaluator_assume_aliasing<
|
|
206
|
-
|
|
187
|
+
template <typename OtherXpr, typename Lhs, typename Rhs>
|
|
188
|
+
struct evaluator_assume_aliasing<
|
|
189
|
+
CwiseBinaryOp<
|
|
190
|
+
internal::scalar_sum_op<typename OtherXpr::Scalar, typename Product<Lhs, Rhs, DefaultProduct>::Scalar>,
|
|
191
|
+
const OtherXpr, const Product<Lhs, Rhs, DefaultProduct>>,
|
|
192
|
+
DenseShape> {
|
|
207
193
|
static const bool value = true;
|
|
208
194
|
};
|
|
209
195
|
|
|
210
|
-
template<typename OtherXpr, typename Lhs, typename Rhs>
|
|
211
|
-
struct evaluator_assume_aliasing<
|
|
212
|
-
|
|
196
|
+
template <typename OtherXpr, typename Lhs, typename Rhs>
|
|
197
|
+
struct evaluator_assume_aliasing<
|
|
198
|
+
CwiseBinaryOp<
|
|
199
|
+
internal::scalar_difference_op<typename OtherXpr::Scalar, typename Product<Lhs, Rhs, DefaultProduct>::Scalar>,
|
|
200
|
+
const OtherXpr, const Product<Lhs, Rhs, DefaultProduct>>,
|
|
201
|
+
DenseShape> {
|
|
213
202
|
static const bool value = true;
|
|
214
203
|
};
|
|
215
204
|
|
|
216
|
-
template<typename DstXprType, typename OtherXpr, typename ProductType, typename Func1, typename Func2>
|
|
217
|
-
struct assignment_from_xpr_op_product
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
void run(DstXprType &dst, const SrcXprType &src, const InitialFunc& /*func*/)
|
|
222
|
-
{
|
|
205
|
+
template <typename DstXprType, typename OtherXpr, typename ProductType, typename Func1, typename Func2>
|
|
206
|
+
struct assignment_from_xpr_op_product {
|
|
207
|
+
template <typename SrcXprType, typename InitialFunc>
|
|
208
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(DstXprType& dst, const SrcXprType& src,
|
|
209
|
+
const InitialFunc& /*func*/) {
|
|
223
210
|
call_assignment_no_alias(dst, src.lhs(), Func1());
|
|
224
211
|
call_assignment_no_alias(dst, src.rhs(), Func2());
|
|
225
212
|
}
|
|
226
213
|
};
|
|
227
214
|
|
|
228
|
-
#define EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(ASSIGN_OP,BINOP,ASSIGN_OP2)
|
|
229
|
-
template<
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(assign_op,
|
|
240
|
-
EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(add_assign_op,
|
|
241
|
-
EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(sub_assign_op,
|
|
215
|
+
#define EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(ASSIGN_OP, BINOP, ASSIGN_OP2) \
|
|
216
|
+
template <typename DstXprType, typename OtherXpr, typename Lhs, typename Rhs, typename DstScalar, \
|
|
217
|
+
typename SrcScalar, typename OtherScalar, typename ProdScalar> \
|
|
218
|
+
struct Assignment<DstXprType, \
|
|
219
|
+
CwiseBinaryOp<internal::BINOP<OtherScalar, ProdScalar>, const OtherXpr, \
|
|
220
|
+
const Product<Lhs, Rhs, DefaultProduct>>, \
|
|
221
|
+
internal::ASSIGN_OP<DstScalar, SrcScalar>, Dense2Dense> \
|
|
222
|
+
: assignment_from_xpr_op_product<DstXprType, OtherXpr, Product<Lhs, Rhs, DefaultProduct>, \
|
|
223
|
+
internal::ASSIGN_OP<DstScalar, OtherScalar>, \
|
|
224
|
+
internal::ASSIGN_OP2<DstScalar, ProdScalar>> {}
|
|
225
|
+
|
|
226
|
+
EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(assign_op, scalar_sum_op, add_assign_op);
|
|
227
|
+
EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(add_assign_op, scalar_sum_op, add_assign_op);
|
|
228
|
+
EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(sub_assign_op, scalar_sum_op, sub_assign_op);
|
|
229
|
+
|
|
230
|
+
EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(assign_op, scalar_difference_op, sub_assign_op);
|
|
231
|
+
EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(add_assign_op, scalar_difference_op, sub_assign_op);
|
|
232
|
+
EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(sub_assign_op, scalar_difference_op, add_assign_op);
|
|
242
233
|
|
|
243
234
|
//----------------------------------------
|
|
244
235
|
|
|
245
|
-
template<typename Lhs, typename Rhs>
|
|
246
|
-
struct generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,InnerProduct>
|
|
247
|
-
|
|
248
|
-
template<typename Dst>
|
|
249
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
|
|
250
|
-
|
|
251
|
-
dst.coeffRef(0,0) = (lhs.transpose().cwiseProduct(rhs)).sum();
|
|
236
|
+
template <typename Lhs, typename Rhs>
|
|
237
|
+
struct generic_product_impl<Lhs, Rhs, DenseShape, DenseShape, InnerProduct> {
|
|
238
|
+
using impl = default_inner_product_impl<Lhs, Rhs, false>;
|
|
239
|
+
template <typename Dst>
|
|
240
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) {
|
|
241
|
+
dst.coeffRef(0, 0) = impl::run(lhs, rhs);
|
|
252
242
|
}
|
|
253
243
|
|
|
254
|
-
template<typename Dst>
|
|
255
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
|
|
256
|
-
|
|
257
|
-
dst.coeffRef(0,0) += (lhs.transpose().cwiseProduct(rhs)).sum();
|
|
244
|
+
template <typename Dst>
|
|
245
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) {
|
|
246
|
+
dst.coeffRef(0, 0) += impl::run(lhs, rhs);
|
|
258
247
|
}
|
|
259
248
|
|
|
260
|
-
template<typename Dst>
|
|
261
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
|
|
262
|
-
|
|
249
|
+
template <typename Dst>
|
|
250
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) {
|
|
251
|
+
dst.coeffRef(0, 0) -= impl::run(lhs, rhs);
|
|
252
|
+
}
|
|
263
253
|
};
|
|
264
254
|
|
|
265
|
-
|
|
266
255
|
/***********************************************************************
|
|
267
|
-
* Implementation of outer dense * dense vector product
|
|
268
|
-
***********************************************************************/
|
|
256
|
+
* Implementation of outer dense * dense vector product
|
|
257
|
+
***********************************************************************/
|
|
269
258
|
|
|
270
259
|
// Column major result
|
|
271
|
-
template<typename Dst, typename Lhs, typename Rhs, typename Func>
|
|
272
|
-
void EIGEN_DEVICE_FUNC outer_product_selector_run(Dst& dst, const Lhs
|
|
273
|
-
{
|
|
260
|
+
template <typename Dst, typename Lhs, typename Rhs, typename Func>
|
|
261
|
+
void EIGEN_DEVICE_FUNC outer_product_selector_run(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Func& func,
|
|
262
|
+
const false_type&) {
|
|
274
263
|
evaluator<Rhs> rhsEval(rhs);
|
|
275
|
-
ei_declare_local_nested_eval(Lhs,lhs,Rhs::SizeAtCompileTime,actual_lhs);
|
|
264
|
+
ei_declare_local_nested_eval(Lhs, lhs, Rhs::SizeAtCompileTime, actual_lhs);
|
|
276
265
|
// FIXME if cols is large enough, then it might be useful to make sure that lhs is sequentially stored
|
|
277
266
|
// FIXME not very good if rhs is real and lhs complex while alpha is real too
|
|
278
267
|
const Index cols = dst.cols();
|
|
279
|
-
for (Index j=0; j<cols; ++j)
|
|
280
|
-
func(dst.col(j), rhsEval.coeff(Index(0),j) * actual_lhs);
|
|
268
|
+
for (Index j = 0; j < cols; ++j) func(dst.col(j), rhsEval.coeff(Index(0), j) * actual_lhs);
|
|
281
269
|
}
|
|
282
270
|
|
|
283
271
|
// Row major result
|
|
284
|
-
template<typename Dst, typename Lhs, typename Rhs, typename Func>
|
|
285
|
-
void EIGEN_DEVICE_FUNC outer_product_selector_run(Dst& dst, const Lhs
|
|
286
|
-
{
|
|
272
|
+
template <typename Dst, typename Lhs, typename Rhs, typename Func>
|
|
273
|
+
void EIGEN_DEVICE_FUNC outer_product_selector_run(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Func& func,
|
|
274
|
+
const true_type&) {
|
|
287
275
|
evaluator<Lhs> lhsEval(lhs);
|
|
288
|
-
ei_declare_local_nested_eval(Rhs,rhs,Lhs::SizeAtCompileTime,actual_rhs);
|
|
276
|
+
ei_declare_local_nested_eval(Rhs, rhs, Lhs::SizeAtCompileTime, actual_rhs);
|
|
289
277
|
// FIXME if rows is large enough, then it might be useful to make sure that rhs is sequentially stored
|
|
290
278
|
// FIXME not very good if lhs is real and rhs complex while alpha is real too
|
|
291
279
|
const Index rows = dst.rows();
|
|
292
|
-
for (Index i=0; i<rows; ++i)
|
|
293
|
-
func(dst.row(i), lhsEval.coeff(i,Index(0)) * actual_rhs);
|
|
280
|
+
for (Index i = 0; i < rows; ++i) func(dst.row(i), lhsEval.coeff(i, Index(0)) * actual_rhs);
|
|
294
281
|
}
|
|
295
282
|
|
|
296
|
-
template<typename Lhs, typename Rhs>
|
|
297
|
-
struct generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,OuterProduct>
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
typedef typename Product<Lhs,Rhs>::Scalar Scalar;
|
|
283
|
+
template <typename Lhs, typename Rhs>
|
|
284
|
+
struct generic_product_impl<Lhs, Rhs, DenseShape, DenseShape, OuterProduct> {
|
|
285
|
+
template <typename T>
|
|
286
|
+
struct is_row_major : bool_constant<(int(T::Flags) & RowMajorBit)> {};
|
|
287
|
+
typedef typename Product<Lhs, Rhs>::Scalar Scalar;
|
|
301
288
|
|
|
302
289
|
// TODO it would be nice to be able to exploit our *_assign_op functors for that purpose
|
|
303
|
-
struct set
|
|
304
|
-
|
|
305
|
-
|
|
290
|
+
struct set {
|
|
291
|
+
template <typename Dst, typename Src>
|
|
292
|
+
EIGEN_DEVICE_FUNC void operator()(const Dst& dst, const Src& src) const {
|
|
293
|
+
dst.const_cast_derived() = src;
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
struct add {
|
|
297
|
+
/** Add to dst. */
|
|
298
|
+
template <typename Dst, typename Src>
|
|
299
|
+
EIGEN_DEVICE_FUNC void operator()(const Dst& dst, const Src& src) const {
|
|
300
|
+
dst.const_cast_derived() += src;
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
struct sub {
|
|
304
|
+
template <typename Dst, typename Src>
|
|
305
|
+
EIGEN_DEVICE_FUNC void operator()(const Dst& dst, const Src& src) const {
|
|
306
|
+
dst.const_cast_derived() -= src;
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
/** Scaled add. */
|
|
306
310
|
struct adds {
|
|
307
311
|
Scalar m_scale;
|
|
312
|
+
/** Constructor */
|
|
308
313
|
explicit adds(const Scalar& s) : m_scale(s) {}
|
|
309
|
-
|
|
314
|
+
/** Scaled add to dst. */
|
|
315
|
+
template <typename Dst, typename Src>
|
|
316
|
+
void EIGEN_DEVICE_FUNC operator()(const Dst& dst, const Src& src) const {
|
|
310
317
|
dst.const_cast_derived() += m_scale * src;
|
|
311
318
|
}
|
|
312
319
|
};
|
|
313
320
|
|
|
314
|
-
template<typename Dst>
|
|
315
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
|
|
316
|
-
{
|
|
321
|
+
template <typename Dst>
|
|
322
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) {
|
|
317
323
|
internal::outer_product_selector_run(dst, lhs, rhs, set(), is_row_major<Dst>());
|
|
318
324
|
}
|
|
319
325
|
|
|
320
|
-
template<typename Dst>
|
|
321
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
|
|
322
|
-
{
|
|
326
|
+
template <typename Dst>
|
|
327
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) {
|
|
323
328
|
internal::outer_product_selector_run(dst, lhs, rhs, add(), is_row_major<Dst>());
|
|
324
329
|
}
|
|
325
330
|
|
|
326
|
-
template<typename Dst>
|
|
327
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
|
|
328
|
-
{
|
|
331
|
+
template <typename Dst>
|
|
332
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) {
|
|
329
333
|
internal::outer_product_selector_run(dst, lhs, rhs, sub(), is_row_major<Dst>());
|
|
330
334
|
}
|
|
331
335
|
|
|
332
|
-
template<typename Dst>
|
|
333
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void scaleAndAddTo(Dst& dst, const Lhs& lhs, const Rhs& rhs,
|
|
334
|
-
|
|
336
|
+
template <typename Dst>
|
|
337
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void scaleAndAddTo(Dst& dst, const Lhs& lhs, const Rhs& rhs,
|
|
338
|
+
const Scalar& alpha) {
|
|
335
339
|
internal::outer_product_selector_run(dst, lhs, rhs, adds(alpha), is_row_major<Dst>());
|
|
336
340
|
}
|
|
337
|
-
|
|
338
341
|
};
|
|
339
342
|
|
|
340
|
-
|
|
341
343
|
// This base class provides default implementations for evalTo, addTo, subTo, in terms of scaleAndAddTo
|
|
342
|
-
template<typename Lhs, typename Rhs, typename Derived>
|
|
343
|
-
struct generic_product_impl_base
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
template<typename Dst>
|
|
352
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
|
|
353
|
-
{ scaleAndAddTo(dst,lhs, rhs, Scalar(1)); }
|
|
344
|
+
template <typename Lhs, typename Rhs, typename Derived>
|
|
345
|
+
struct generic_product_impl_base {
|
|
346
|
+
typedef typename Product<Lhs, Rhs>::Scalar Scalar;
|
|
347
|
+
|
|
348
|
+
template <typename Dst>
|
|
349
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) {
|
|
350
|
+
dst.setZero();
|
|
351
|
+
scaleAndAddTo(dst, lhs, rhs, Scalar(1));
|
|
352
|
+
}
|
|
354
353
|
|
|
355
|
-
template<typename Dst>
|
|
356
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void
|
|
357
|
-
|
|
354
|
+
template <typename Dst>
|
|
355
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) {
|
|
356
|
+
scaleAndAddTo(dst, lhs, rhs, Scalar(1));
|
|
357
|
+
}
|
|
358
358
|
|
|
359
|
-
template<typename Dst>
|
|
360
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void
|
|
361
|
-
|
|
359
|
+
template <typename Dst>
|
|
360
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) {
|
|
361
|
+
scaleAndAddTo(dst, lhs, rhs, Scalar(-1));
|
|
362
|
+
}
|
|
362
363
|
|
|
364
|
+
template <typename Dst>
|
|
365
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void scaleAndAddTo(Dst& dst, const Lhs& lhs, const Rhs& rhs,
|
|
366
|
+
const Scalar& alpha) {
|
|
367
|
+
Derived::scaleAndAddTo(dst, lhs, rhs, alpha);
|
|
368
|
+
}
|
|
363
369
|
};
|
|
364
370
|
|
|
365
|
-
template<typename Lhs, typename Rhs>
|
|
366
|
-
struct generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,GemvProduct>
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
typedef typename nested_eval<
|
|
370
|
-
typedef typename
|
|
371
|
-
typedef typename Product<Lhs,Rhs>::Scalar Scalar;
|
|
371
|
+
template <typename Lhs, typename Rhs>
|
|
372
|
+
struct generic_product_impl<Lhs, Rhs, DenseShape, DenseShape, GemvProduct>
|
|
373
|
+
: generic_product_impl_base<Lhs, Rhs, generic_product_impl<Lhs, Rhs, DenseShape, DenseShape, GemvProduct>> {
|
|
374
|
+
typedef typename nested_eval<Lhs, 1>::type LhsNested;
|
|
375
|
+
typedef typename nested_eval<Rhs, 1>::type RhsNested;
|
|
376
|
+
typedef typename Product<Lhs, Rhs>::Scalar Scalar;
|
|
372
377
|
enum { Side = Lhs::IsVectorAtCompileTime ? OnTheLeft : OnTheRight };
|
|
373
|
-
typedef
|
|
378
|
+
typedef internal::remove_all_t<std::conditional_t<int(Side) == OnTheRight, LhsNested, RhsNested>> MatrixType;
|
|
374
379
|
|
|
375
|
-
template<typename Dest>
|
|
376
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs,
|
|
377
|
-
|
|
380
|
+
template <typename Dest>
|
|
381
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs,
|
|
382
|
+
const Scalar& alpha) {
|
|
378
383
|
// Fallback to inner product if both the lhs and rhs is a runtime vector.
|
|
379
384
|
if (lhs.rows() == 1 && rhs.cols() == 1) {
|
|
380
|
-
dst.coeffRef(0,0) += alpha * lhs.row(0).conjugate().dot(rhs.col(0));
|
|
385
|
+
dst.coeffRef(0, 0) += alpha * lhs.row(0).conjugate().dot(rhs.col(0));
|
|
381
386
|
return;
|
|
382
387
|
}
|
|
383
388
|
LhsNested actual_lhs(lhs);
|
|
384
389
|
RhsNested actual_rhs(rhs);
|
|
385
|
-
internal::gemv_dense_selector<Side,
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
390
|
+
internal::gemv_dense_selector<Side, (int(MatrixType::Flags) & RowMajorBit) ? RowMajor : ColMajor,
|
|
391
|
+
bool(internal::blas_traits<MatrixType>::HasUsableDirectAccess)>::run(actual_lhs,
|
|
392
|
+
actual_rhs, dst,
|
|
393
|
+
alpha);
|
|
389
394
|
}
|
|
390
395
|
};
|
|
391
396
|
|
|
392
|
-
template<typename Lhs, typename Rhs>
|
|
393
|
-
struct generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,CoeffBasedProductMode>
|
|
394
|
-
|
|
395
|
-
typedef typename Product<Lhs,Rhs>::Scalar Scalar;
|
|
397
|
+
template <typename Lhs, typename Rhs>
|
|
398
|
+
struct generic_product_impl<Lhs, Rhs, DenseShape, DenseShape, CoeffBasedProductMode> {
|
|
399
|
+
typedef typename Product<Lhs, Rhs>::Scalar Scalar;
|
|
396
400
|
|
|
397
|
-
template<typename Dst>
|
|
398
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
|
|
399
|
-
{
|
|
401
|
+
template <typename Dst>
|
|
402
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) {
|
|
400
403
|
// Same as: dst.noalias() = lhs.lazyProduct(rhs);
|
|
401
404
|
// but easier on the compiler side
|
|
402
|
-
call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::assign_op<typename Dst::Scalar,Scalar>());
|
|
405
|
+
call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::assign_op<typename Dst::Scalar, Scalar>());
|
|
403
406
|
}
|
|
404
407
|
|
|
405
|
-
template<typename Dst>
|
|
406
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
|
|
407
|
-
{
|
|
408
|
+
template <typename Dst>
|
|
409
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) {
|
|
408
410
|
// dst.noalias() += lhs.lazyProduct(rhs);
|
|
409
|
-
call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::add_assign_op<typename Dst::Scalar,Scalar>());
|
|
411
|
+
call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::add_assign_op<typename Dst::Scalar, Scalar>());
|
|
410
412
|
}
|
|
411
413
|
|
|
412
|
-
template<typename Dst>
|
|
413
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
|
|
414
|
-
{
|
|
414
|
+
template <typename Dst>
|
|
415
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) {
|
|
415
416
|
// dst.noalias() -= lhs.lazyProduct(rhs);
|
|
416
|
-
call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::sub_assign_op<typename Dst::Scalar,Scalar>());
|
|
417
|
+
call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::sub_assign_op<typename Dst::Scalar, Scalar>());
|
|
417
418
|
}
|
|
418
419
|
|
|
419
420
|
// This is a special evaluation path called from generic_product_impl<...,GemmProduct> in file GeneralMatrixMatrix.h
|
|
@@ -427,13 +428,12 @@ struct generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,CoeffBasedProductMode>
|
|
|
427
428
|
// 3 - it makes this fallback consistent with the heavy GEMM routine.
|
|
428
429
|
// 4 - it fully by-passes huge stack allocation attempts when multiplying huge fixed-size matrices.
|
|
429
430
|
// (see https://stackoverflow.com/questions/54738495)
|
|
430
|
-
// For small fixed sizes matrices,
|
|
431
|
-
// and the behavior depends also a lot on the compiler... This is why this re-
|
|
431
|
+
// For small fixed sizes matrices, however, the gains are less obvious, it is sometimes x2 faster, but sometimes x3
|
|
432
|
+
// slower, and the behavior depends also a lot on the compiler... This is why this re-writing strategy is currently
|
|
432
433
|
// enabled only when falling back from the main GEMM.
|
|
433
|
-
template<typename Dst, typename Func>
|
|
434
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
|
435
|
-
|
|
436
|
-
{
|
|
434
|
+
template <typename Dst, typename Func>
|
|
435
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void eval_dynamic(Dst& dst, const Lhs& lhs, const Rhs& rhs,
|
|
436
|
+
const Func& func) {
|
|
437
437
|
enum {
|
|
438
438
|
HasScalarFactor = blas_traits<Lhs>::HasScalarFactor || blas_traits<Rhs>::HasScalarFactor,
|
|
439
439
|
ConjLhs = blas_traits<Lhs>::NeedToConjugate,
|
|
@@ -443,37 +443,32 @@ struct generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,CoeffBasedProductMode>
|
|
|
443
443
|
// this is important for real*complex_mat
|
|
444
444
|
Scalar actualAlpha = combine_scalar_factors<Scalar>(lhs, rhs);
|
|
445
445
|
|
|
446
|
-
eval_dynamic_impl(dst,
|
|
447
|
-
blas_traits<
|
|
448
|
-
|
|
449
|
-
func,
|
|
450
|
-
actualAlpha,
|
|
451
|
-
typename conditional<HasScalarFactor,true_type,false_type>::type());
|
|
446
|
+
eval_dynamic_impl(dst, blas_traits<Lhs>::extract(lhs).template conjugateIf<ConjLhs>(),
|
|
447
|
+
blas_traits<Rhs>::extract(rhs).template conjugateIf<ConjRhs>(), func, actualAlpha,
|
|
448
|
+
bool_constant<HasScalarFactor>());
|
|
452
449
|
}
|
|
453
450
|
|
|
454
|
-
protected:
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
{
|
|
451
|
+
protected:
|
|
452
|
+
template <typename Dst, typename LhsT, typename RhsT, typename Func, typename Scalar>
|
|
453
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void eval_dynamic_impl(Dst& dst, const LhsT& lhs, const RhsT& rhs,
|
|
454
|
+
const Func& func, const Scalar& s /* == 1 */,
|
|
455
|
+
false_type) {
|
|
460
456
|
EIGEN_UNUSED_VARIABLE(s);
|
|
461
|
-
eigen_internal_assert(s
|
|
457
|
+
eigen_internal_assert(numext::is_exactly_one(s));
|
|
462
458
|
call_restricted_packet_assignment_no_alias(dst, lhs.lazyProduct(rhs), func);
|
|
463
459
|
}
|
|
464
460
|
|
|
465
|
-
template<typename Dst, typename LhsT, typename RhsT, typename Func, typename Scalar>
|
|
466
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
|
467
|
-
|
|
468
|
-
{
|
|
461
|
+
template <typename Dst, typename LhsT, typename RhsT, typename Func, typename Scalar>
|
|
462
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void eval_dynamic_impl(Dst& dst, const LhsT& lhs, const RhsT& rhs,
|
|
463
|
+
const Func& func, const Scalar& s, true_type) {
|
|
469
464
|
call_restricted_packet_assignment_no_alias(dst, s * lhs.lazyProduct(rhs), func);
|
|
470
465
|
}
|
|
471
466
|
};
|
|
472
467
|
|
|
473
468
|
// This specialization enforces the use of a coefficient-based evaluation strategy
|
|
474
|
-
template<typename Lhs, typename Rhs>
|
|
475
|
-
struct generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,LazyCoeffBasedProductMode>
|
|
476
|
-
|
|
469
|
+
template <typename Lhs, typename Rhs>
|
|
470
|
+
struct generic_product_impl<Lhs, Rhs, DenseShape, DenseShape, LazyCoeffBasedProductMode>
|
|
471
|
+
: generic_product_impl<Lhs, Rhs, DenseShape, DenseShape, CoeffBasedProductMode> {};
|
|
477
472
|
|
|
478
473
|
// Case 2: Evaluate coeff by coeff
|
|
479
474
|
//
|
|
@@ -481,29 +476,27 @@ struct generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,LazyCoeffBasedProductM
|
|
|
481
476
|
// The main difference is that we add an extra argument to the etor_product_*_impl::run() function
|
|
482
477
|
// for the inner dimension of the product, because evaluator object do not know their size.
|
|
483
478
|
|
|
484
|
-
template<int Traversal, int UnrollingIndex, typename Lhs, typename Rhs, typename RetScalar>
|
|
479
|
+
template <int Traversal, int UnrollingIndex, typename Lhs, typename Rhs, typename RetScalar>
|
|
485
480
|
struct etor_product_coeff_impl;
|
|
486
481
|
|
|
487
|
-
template<int StorageOrder, int UnrollingIndex, typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
|
482
|
+
template <int StorageOrder, int UnrollingIndex, typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
|
488
483
|
struct etor_product_packet_impl;
|
|
489
484
|
|
|
490
|
-
template<typename Lhs, typename Rhs, int ProductTag>
|
|
485
|
+
template <typename Lhs, typename Rhs, int ProductTag>
|
|
491
486
|
struct product_evaluator<Product<Lhs, Rhs, LazyProduct>, ProductTag, DenseShape, DenseShape>
|
|
492
|
-
: evaluator_base<Product<Lhs, Rhs, LazyProduct
|
|
493
|
-
{
|
|
487
|
+
: evaluator_base<Product<Lhs, Rhs, LazyProduct>> {
|
|
494
488
|
typedef Product<Lhs, Rhs, LazyProduct> XprType;
|
|
495
489
|
typedef typename XprType::Scalar Scalar;
|
|
496
490
|
typedef typename XprType::CoeffReturnType CoeffReturnType;
|
|
497
491
|
|
|
498
|
-
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
{
|
|
492
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit product_evaluator(const XprType& xpr)
|
|
493
|
+
: m_lhs(xpr.lhs()),
|
|
494
|
+
m_rhs(xpr.rhs()),
|
|
495
|
+
m_lhsImpl(m_lhs), // FIXME the creation of the evaluator objects should result in a no-op, but check that!
|
|
496
|
+
m_rhsImpl(m_rhs), // Moreover, they are only useful for the packet path, so we could completely disable
|
|
497
|
+
// them when not needed, or perhaps declare them on the fly on the packet method... We
|
|
498
|
+
// have experiment to check what's best.
|
|
499
|
+
m_innerDim(xpr.lhs().cols()) {
|
|
507
500
|
EIGEN_INTERNAL_CHECK_COST_VALUE(NumTraits<Scalar>::MulCost);
|
|
508
501
|
EIGEN_INTERNAL_CHECK_COST_VALUE(NumTraits<Scalar>::AddCost);
|
|
509
502
|
EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
|
|
@@ -523,11 +516,11 @@ struct product_evaluator<Product<Lhs, Rhs, LazyProduct>, ProductTag, DenseShape,
|
|
|
523
516
|
|
|
524
517
|
// Everything below here is taken from CoeffBasedProduct.h
|
|
525
518
|
|
|
526
|
-
typedef typename internal::nested_eval<Lhs,Rhs::ColsAtCompileTime>::type LhsNested;
|
|
527
|
-
typedef typename internal::nested_eval<Rhs,Lhs::RowsAtCompileTime>::type RhsNested;
|
|
519
|
+
typedef typename internal::nested_eval<Lhs, Rhs::ColsAtCompileTime>::type LhsNested;
|
|
520
|
+
typedef typename internal::nested_eval<Rhs, Lhs::RowsAtCompileTime>::type RhsNested;
|
|
528
521
|
|
|
529
|
-
typedef
|
|
530
|
-
typedef
|
|
522
|
+
typedef internal::remove_all_t<LhsNested> LhsNestedCleaned;
|
|
523
|
+
typedef internal::remove_all_t<RhsNested> RhsNestedCleaned;
|
|
531
524
|
|
|
532
525
|
typedef evaluator<LhsNestedCleaned> LhsEtorType;
|
|
533
526
|
typedef evaluator<RhsNestedCleaned> RhsEtorType;
|
|
@@ -535,22 +528,23 @@ struct product_evaluator<Product<Lhs, Rhs, LazyProduct>, ProductTag, DenseShape,
|
|
|
535
528
|
enum {
|
|
536
529
|
RowsAtCompileTime = LhsNestedCleaned::RowsAtCompileTime,
|
|
537
530
|
ColsAtCompileTime = RhsNestedCleaned::ColsAtCompileTime,
|
|
538
|
-
InnerSize =
|
|
531
|
+
InnerSize = min_size_prefer_fixed(LhsNestedCleaned::ColsAtCompileTime, RhsNestedCleaned::RowsAtCompileTime),
|
|
539
532
|
MaxRowsAtCompileTime = LhsNestedCleaned::MaxRowsAtCompileTime,
|
|
540
533
|
MaxColsAtCompileTime = RhsNestedCleaned::MaxColsAtCompileTime
|
|
541
534
|
};
|
|
542
535
|
|
|
543
|
-
typedef typename find_best_packet<Scalar,RowsAtCompileTime>::type LhsVecPacketType;
|
|
544
|
-
typedef typename find_best_packet<Scalar,ColsAtCompileTime>::type RhsVecPacketType;
|
|
536
|
+
typedef typename find_best_packet<Scalar, RowsAtCompileTime>::type LhsVecPacketType;
|
|
537
|
+
typedef typename find_best_packet<Scalar, ColsAtCompileTime>::type RhsVecPacketType;
|
|
545
538
|
|
|
546
539
|
enum {
|
|
547
540
|
|
|
548
541
|
LhsCoeffReadCost = LhsEtorType::CoeffReadCost,
|
|
549
542
|
RhsCoeffReadCost = RhsEtorType::CoeffReadCost,
|
|
550
|
-
CoeffReadCost = InnerSize==0 ? NumTraits<Scalar>::ReadCost
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
543
|
+
CoeffReadCost = InnerSize == 0 ? NumTraits<Scalar>::ReadCost
|
|
544
|
+
: InnerSize == Dynamic
|
|
545
|
+
? HugeCost
|
|
546
|
+
: InnerSize * (NumTraits<Scalar>::MulCost + int(LhsCoeffReadCost) + int(RhsCoeffReadCost)) +
|
|
547
|
+
(InnerSize - 1) * NumTraits<Scalar>::AddCost,
|
|
554
548
|
|
|
555
549
|
Unroll = CoeffReadCost <= EIGEN_UNROLLING_LIMIT,
|
|
556
550
|
|
|
@@ -564,84 +558,104 @@ struct product_evaluator<Product<Lhs, Rhs, LazyProduct>, ProductTag, DenseShape,
|
|
|
564
558
|
RhsVecPacketSize = unpacket_traits<RhsVecPacketType>::size,
|
|
565
559
|
|
|
566
560
|
// Here, we don't care about alignment larger than the usable packet size.
|
|
567
|
-
LhsAlignment =
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
561
|
+
LhsAlignment =
|
|
562
|
+
plain_enum_min(LhsEtorType::Alignment, LhsVecPacketSize* int(sizeof(typename LhsNestedCleaned::Scalar))),
|
|
563
|
+
RhsAlignment =
|
|
564
|
+
plain_enum_min(RhsEtorType::Alignment, RhsVecPacketSize* int(sizeof(typename RhsNestedCleaned::Scalar))),
|
|
565
|
+
|
|
566
|
+
SameType = is_same<typename LhsNestedCleaned::Scalar, typename RhsNestedCleaned::Scalar>::value,
|
|
567
|
+
|
|
568
|
+
CanVectorizeRhs = bool(RhsRowMajor) && (RhsFlags & PacketAccessBit) && (ColsAtCompileTime != 1),
|
|
569
|
+
CanVectorizeLhs = (!LhsRowMajor) && (LhsFlags & PacketAccessBit) && (RowsAtCompileTime != 1),
|
|
570
|
+
|
|
571
|
+
EvalToRowMajor = (MaxRowsAtCompileTime == 1 && MaxColsAtCompileTime != 1) ? 1
|
|
572
|
+
: (MaxColsAtCompileTime == 1 && MaxRowsAtCompileTime != 1)
|
|
573
|
+
? 0
|
|
574
|
+
: (bool(RhsRowMajor) && !CanVectorizeLhs),
|
|
575
|
+
|
|
576
|
+
Flags = ((int(LhsFlags) | int(RhsFlags)) & HereditaryBits & ~RowMajorBit) |
|
|
577
|
+
(EvalToRowMajor ? RowMajorBit : 0)
|
|
578
|
+
// TODO enable vectorization for mixed types
|
|
579
|
+
| (SameType && (CanVectorizeLhs || CanVectorizeRhs) ? PacketAccessBit : 0) |
|
|
580
|
+
(XprType::IsVectorAtCompileTime ? LinearAccessBit : 0),
|
|
581
|
+
|
|
582
|
+
LhsOuterStrideBytes =
|
|
583
|
+
int(LhsNestedCleaned::OuterStrideAtCompileTime) * int(sizeof(typename LhsNestedCleaned::Scalar)),
|
|
584
|
+
RhsOuterStrideBytes =
|
|
585
|
+
int(RhsNestedCleaned::OuterStrideAtCompileTime) * int(sizeof(typename RhsNestedCleaned::Scalar)),
|
|
586
|
+
|
|
587
|
+
Alignment = bool(CanVectorizeLhs)
|
|
588
|
+
? (LhsOuterStrideBytes <= 0 || (int(LhsOuterStrideBytes) % plain_enum_max(1, LhsAlignment)) != 0
|
|
589
|
+
? 0
|
|
590
|
+
: LhsAlignment)
|
|
591
|
+
: bool(CanVectorizeRhs)
|
|
592
|
+
? (RhsOuterStrideBytes <= 0 || (int(RhsOuterStrideBytes) % plain_enum_max(1, RhsAlignment)) != 0
|
|
593
|
+
? 0
|
|
594
|
+
: RhsAlignment)
|
|
595
|
+
: 0,
|
|
591
596
|
|
|
592
597
|
/* CanVectorizeInner deserves special explanation. It does not affect the product flags. It is not used outside
|
|
593
598
|
* of Product. If the Product itself is not a packet-access expression, there is still a chance that the inner
|
|
594
599
|
* loop of the product might be vectorized. This is the meaning of CanVectorizeInner. Since it doesn't affect
|
|
595
600
|
* the Flags, it is safe to make this value depend on ActualPacketAccessBit, that doesn't affect the ABI.
|
|
596
601
|
*/
|
|
597
|
-
CanVectorizeInner =
|
|
598
|
-
&&
|
|
599
|
-
|
|
600
|
-
&& (int(LhsFlags) & int(RhsFlags) & ActualPacketAccessBit)
|
|
601
|
-
&& (int(InnerSize) % packet_traits<Scalar>::size == 0)
|
|
602
|
+
CanVectorizeInner = SameType && LhsRowMajor && (!RhsRowMajor) &&
|
|
603
|
+
(int(LhsFlags) & int(RhsFlags) & ActualPacketAccessBit) &&
|
|
604
|
+
(int(InnerSize) % packet_traits<Scalar>::size == 0)
|
|
602
605
|
};
|
|
603
606
|
|
|
604
|
-
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index row, Index col) const
|
|
605
|
-
|
|
606
|
-
return (m_lhs.row(row).transpose().cwiseProduct( m_rhs.col(col) )).sum();
|
|
607
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index row, Index col) const {
|
|
608
|
+
return (m_lhs.row(row).transpose().cwiseProduct(m_rhs.col(col))).sum();
|
|
607
609
|
}
|
|
608
610
|
|
|
609
611
|
/* Allow index-based non-packet access. It is impossible though to allow index-based packed access,
|
|
610
612
|
* which is why we don't set the LinearAccessBit.
|
|
611
613
|
* TODO: this seems possible when the result is a vector
|
|
612
614
|
*/
|
|
613
|
-
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
template<int LoadMode, typename PacketType>
|
|
622
|
-
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
|
623
|
-
const PacketType packet(Index row, Index col) const
|
|
624
|
-
{
|
|
615
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index index) const {
|
|
616
|
+
const Index row = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime == 1) ? 0 : index;
|
|
617
|
+
const Index col = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime == 1) ? index : 0;
|
|
618
|
+
return (m_lhs.row(row).transpose().cwiseProduct(m_rhs.col(col))).sum();
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
template <int LoadMode, typename PacketType>
|
|
622
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const PacketType packet(Index row, Index col) const {
|
|
625
623
|
PacketType res;
|
|
626
|
-
typedef etor_product_packet_impl<bool(int(Flags)&RowMajorBit) ? RowMajor : ColMajor,
|
|
627
|
-
Unroll ? int(InnerSize) : Dynamic,
|
|
628
|
-
|
|
624
|
+
typedef etor_product_packet_impl<bool(int(Flags) & RowMajorBit) ? RowMajor : ColMajor,
|
|
625
|
+
Unroll ? int(InnerSize) : Dynamic, LhsEtorType, RhsEtorType, PacketType, LoadMode>
|
|
626
|
+
PacketImpl;
|
|
629
627
|
PacketImpl::run(row, col, m_lhsImpl, m_rhsImpl, m_innerDim, res);
|
|
630
628
|
return res;
|
|
631
629
|
}
|
|
632
630
|
|
|
633
|
-
template<int LoadMode, typename PacketType>
|
|
634
|
-
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
631
|
+
template <int LoadMode, typename PacketType>
|
|
632
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const PacketType packet(Index index) const {
|
|
633
|
+
const Index row = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime == 1) ? 0 : index;
|
|
634
|
+
const Index col = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime == 1) ? index : 0;
|
|
635
|
+
return packet<LoadMode, PacketType>(row, col);
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
template <int LoadMode, typename PacketType>
|
|
639
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const PacketType packetSegment(Index row, Index col, Index begin,
|
|
640
|
+
Index count) const {
|
|
641
|
+
PacketType res;
|
|
642
|
+
typedef etor_product_packet_impl<bool(int(Flags) & RowMajorBit) ? RowMajor : ColMajor,
|
|
643
|
+
Unroll ? int(InnerSize) : Dynamic, LhsEtorType, RhsEtorType, PacketType, LoadMode>
|
|
644
|
+
PacketImpl;
|
|
645
|
+
PacketImpl::run_segment(row, col, m_lhsImpl, m_rhsImpl, m_innerDim, res, begin, count);
|
|
646
|
+
return res;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
template <int LoadMode, typename PacketType>
|
|
650
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const PacketType packetSegment(Index index, Index begin, Index count) const {
|
|
651
|
+
const Index row = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime == 1) ? 0 : index;
|
|
652
|
+
const Index col = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime == 1) ? index : 0;
|
|
653
|
+
return packetSegment<LoadMode, PacketType>(row, col, begin, count);
|
|
640
654
|
}
|
|
641
655
|
|
|
642
|
-
protected:
|
|
643
|
-
|
|
644
|
-
|
|
656
|
+
protected:
|
|
657
|
+
add_const_on_value_type_t<LhsNested> m_lhs;
|
|
658
|
+
add_const_on_value_type_t<RhsNested> m_rhs;
|
|
645
659
|
|
|
646
660
|
LhsEtorType m_lhsImpl;
|
|
647
661
|
RhsEtorType m_rhsImpl;
|
|
@@ -650,530 +664,624 @@ protected:
|
|
|
650
664
|
Index m_innerDim;
|
|
651
665
|
};
|
|
652
666
|
|
|
653
|
-
template<typename Lhs, typename Rhs>
|
|
667
|
+
template <typename Lhs, typename Rhs>
|
|
654
668
|
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, LazyCoeffBasedProductMode, DenseShape, DenseShape>
|
|
655
|
-
|
|
656
|
-
{
|
|
669
|
+
: product_evaluator<Product<Lhs, Rhs, LazyProduct>, CoeffBasedProductMode, DenseShape, DenseShape> {
|
|
657
670
|
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
|
|
658
671
|
typedef Product<Lhs, Rhs, LazyProduct> BaseProduct;
|
|
659
672
|
typedef product_evaluator<BaseProduct, CoeffBasedProductMode, DenseShape, DenseShape> Base;
|
|
660
|
-
enum {
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
|
664
|
-
explicit product_evaluator(const XprType& xpr)
|
|
665
|
-
: Base(BaseProduct(xpr.lhs(),xpr.rhs()))
|
|
666
|
-
{}
|
|
673
|
+
enum { Flags = Base::Flags | EvalBeforeNestingBit };
|
|
674
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit product_evaluator(const XprType& xpr)
|
|
675
|
+
: Base(BaseProduct(xpr.lhs(), xpr.rhs())) {}
|
|
667
676
|
};
|
|
668
677
|
|
|
669
678
|
/****************************************
|
|
670
679
|
*** Coeff based product, Packet path ***
|
|
671
680
|
****************************************/
|
|
672
681
|
|
|
673
|
-
template<int UnrollingIndex, typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
|
674
|
-
struct etor_product_packet_impl<RowMajor, UnrollingIndex, Lhs, Rhs, Packet, LoadMode>
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
res =
|
|
682
|
+
template <int UnrollingIndex, typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
|
683
|
+
struct etor_product_packet_impl<RowMajor, UnrollingIndex, Lhs, Rhs, Packet, LoadMode> {
|
|
684
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs,
|
|
685
|
+
Index innerDim, Packet& res) {
|
|
686
|
+
etor_product_packet_impl<RowMajor, UnrollingIndex - 1, Lhs, Rhs, Packet, LoadMode>::run(row, col, lhs, rhs,
|
|
687
|
+
innerDim, res);
|
|
688
|
+
res = pmadd(pset1<Packet>(lhs.coeff(row, Index(UnrollingIndex - 1))),
|
|
689
|
+
rhs.template packet<LoadMode, Packet>(Index(UnrollingIndex - 1), col), res);
|
|
690
|
+
}
|
|
691
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run_segment(Index row, Index col, const Lhs& lhs, const Rhs& rhs,
|
|
692
|
+
Index innerDim, Packet& res, Index begin, Index count) {
|
|
693
|
+
etor_product_packet_impl<RowMajor, UnrollingIndex - 1, Lhs, Rhs, Packet, LoadMode>::run_segment(
|
|
694
|
+
row, col, lhs, rhs, innerDim, res, begin, count);
|
|
695
|
+
res = pmadd(pset1<Packet>(lhs.coeff(row, Index(UnrollingIndex - 1))),
|
|
696
|
+
rhs.template packetSegment<LoadMode, Packet>(Index(UnrollingIndex - 1), col, begin, count), res);
|
|
680
697
|
}
|
|
681
698
|
};
|
|
682
699
|
|
|
683
|
-
template<int UnrollingIndex, typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
|
684
|
-
struct etor_product_packet_impl<ColMajor, UnrollingIndex, Lhs, Rhs, Packet, LoadMode>
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
res =
|
|
700
|
+
template <int UnrollingIndex, typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
|
701
|
+
struct etor_product_packet_impl<ColMajor, UnrollingIndex, Lhs, Rhs, Packet, LoadMode> {
|
|
702
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs,
|
|
703
|
+
Index innerDim, Packet& res) {
|
|
704
|
+
etor_product_packet_impl<ColMajor, UnrollingIndex - 1, Lhs, Rhs, Packet, LoadMode>::run(row, col, lhs, rhs,
|
|
705
|
+
innerDim, res);
|
|
706
|
+
res = pmadd(lhs.template packet<LoadMode, Packet>(row, Index(UnrollingIndex - 1)),
|
|
707
|
+
pset1<Packet>(rhs.coeff(Index(UnrollingIndex - 1), col)), res);
|
|
708
|
+
}
|
|
709
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run_segment(Index row, Index col, const Lhs& lhs, const Rhs& rhs,
|
|
710
|
+
Index innerDim, Packet& res, Index begin, Index count) {
|
|
711
|
+
etor_product_packet_impl<ColMajor, UnrollingIndex - 1, Lhs, Rhs, Packet, LoadMode>::run_segment(
|
|
712
|
+
row, col, lhs, rhs, innerDim, res, begin, count);
|
|
713
|
+
res = pmadd(lhs.template packetSegment<LoadMode, Packet>(row, Index(UnrollingIndex - 1), begin, count),
|
|
714
|
+
pset1<Packet>(rhs.coeff(Index(UnrollingIndex - 1), col)), res);
|
|
690
715
|
}
|
|
691
716
|
};
|
|
692
717
|
|
|
693
|
-
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
|
694
|
-
struct etor_product_packet_impl<RowMajor, 1, Lhs, Rhs, Packet, LoadMode>
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
718
|
+
template <typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
|
719
|
+
struct etor_product_packet_impl<RowMajor, 1, Lhs, Rhs, Packet, LoadMode> {
|
|
720
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs,
|
|
721
|
+
Index /*innerDim*/, Packet& res) {
|
|
722
|
+
res = pmul(pset1<Packet>(lhs.coeff(row, Index(0))), rhs.template packet<LoadMode, Packet>(Index(0), col));
|
|
723
|
+
}
|
|
724
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run_segment(Index row, Index col, const Lhs& lhs, const Rhs& rhs,
|
|
725
|
+
Index /*innerDim*/, Packet& res, Index begin,
|
|
726
|
+
Index count) {
|
|
727
|
+
res = pmul(pset1<Packet>(lhs.coeff(row, Index(0))),
|
|
728
|
+
rhs.template packetSegment<LoadMode, Packet>(Index(0), col, begin, count));
|
|
699
729
|
}
|
|
700
730
|
};
|
|
701
731
|
|
|
702
|
-
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
|
703
|
-
struct etor_product_packet_impl<ColMajor, 1, Lhs, Rhs, Packet, LoadMode>
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
732
|
+
template <typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
|
733
|
+
struct etor_product_packet_impl<ColMajor, 1, Lhs, Rhs, Packet, LoadMode> {
|
|
734
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs,
|
|
735
|
+
Index /*innerDim*/, Packet& res) {
|
|
736
|
+
res = pmul(lhs.template packet<LoadMode, Packet>(row, Index(0)), pset1<Packet>(rhs.coeff(Index(0), col)));
|
|
737
|
+
}
|
|
738
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run_segment(Index row, Index col, const Lhs& lhs, const Rhs& rhs,
|
|
739
|
+
Index /*innerDim*/, Packet& res, Index begin,
|
|
740
|
+
Index count) {
|
|
741
|
+
res = pmul(lhs.template packetSegment<LoadMode, Packet>(row, Index(0), begin, count),
|
|
742
|
+
pset1<Packet>(rhs.coeff(Index(0), col)));
|
|
708
743
|
}
|
|
709
744
|
};
|
|
710
745
|
|
|
711
|
-
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
|
712
|
-
struct etor_product_packet_impl<RowMajor, 0, Lhs, Rhs, Packet, LoadMode>
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
746
|
+
template <typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
|
747
|
+
struct etor_product_packet_impl<RowMajor, 0, Lhs, Rhs, Packet, LoadMode> {
|
|
748
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index /*row*/, Index /*col*/, const Lhs& /*lhs*/,
|
|
749
|
+
const Rhs& /*rhs*/, Index /*innerDim*/, Packet& res) {
|
|
750
|
+
res = pset1<Packet>(typename unpacket_traits<Packet>::type(0));
|
|
751
|
+
}
|
|
752
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run_segment(Index /*row*/, Index /*col*/, const Lhs& /*lhs*/,
|
|
753
|
+
const Rhs& /*rhs*/, Index /*innerDim*/, Packet& res,
|
|
754
|
+
Index /*begin*/, Index /*count*/) {
|
|
716
755
|
res = pset1<Packet>(typename unpacket_traits<Packet>::type(0));
|
|
717
756
|
}
|
|
718
757
|
};
|
|
719
758
|
|
|
720
|
-
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
|
721
|
-
struct etor_product_packet_impl<ColMajor, 0, Lhs, Rhs, Packet, LoadMode>
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
759
|
+
template <typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
|
760
|
+
struct etor_product_packet_impl<ColMajor, 0, Lhs, Rhs, Packet, LoadMode> {
|
|
761
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index /*row*/, Index /*col*/, const Lhs& /*lhs*/,
|
|
762
|
+
const Rhs& /*rhs*/, Index /*innerDim*/, Packet& res) {
|
|
763
|
+
res = pset1<Packet>(typename unpacket_traits<Packet>::type(0));
|
|
764
|
+
}
|
|
765
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run_segment(Index /*row*/, Index /*col*/, const Lhs& /*lhs*/,
|
|
766
|
+
const Rhs& /*rhs*/, Index /*innerDim*/, Packet& res,
|
|
767
|
+
Index /*begin*/, Index /*count*/) {
|
|
725
768
|
res = pset1<Packet>(typename unpacket_traits<Packet>::type(0));
|
|
726
769
|
}
|
|
727
770
|
};
|
|
728
771
|
|
|
729
|
-
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
|
730
|
-
struct etor_product_packet_impl<RowMajor, Dynamic, Lhs, Rhs, Packet, LoadMode>
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
772
|
+
template <typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
|
773
|
+
struct etor_product_packet_impl<RowMajor, Dynamic, Lhs, Rhs, Packet, LoadMode> {
|
|
774
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs,
|
|
775
|
+
Index innerDim, Packet& res) {
|
|
776
|
+
res = pset1<Packet>(typename unpacket_traits<Packet>::type(0));
|
|
777
|
+
for (Index i = 0; i < innerDim; ++i)
|
|
778
|
+
res = pmadd(pset1<Packet>(lhs.coeff(row, i)), rhs.template packet<LoadMode, Packet>(i, col), res);
|
|
779
|
+
}
|
|
780
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run_segment(Index row, Index col, const Lhs& lhs, const Rhs& rhs,
|
|
781
|
+
Index innerDim, Packet& res, Index begin, Index count) {
|
|
734
782
|
res = pset1<Packet>(typename unpacket_traits<Packet>::type(0));
|
|
735
|
-
for(Index i = 0; i < innerDim; ++i)
|
|
736
|
-
res =
|
|
783
|
+
for (Index i = 0; i < innerDim; ++i)
|
|
784
|
+
res = pmadd(pset1<Packet>(lhs.coeff(row, i)), rhs.template packetSegment<LoadMode, Packet>(i, col, begin, count),
|
|
785
|
+
res);
|
|
737
786
|
}
|
|
738
787
|
};
|
|
739
788
|
|
|
740
|
-
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
|
741
|
-
struct etor_product_packet_impl<ColMajor, Dynamic, Lhs, Rhs, Packet, LoadMode>
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
{
|
|
789
|
+
template <typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
|
790
|
+
struct etor_product_packet_impl<ColMajor, Dynamic, Lhs, Rhs, Packet, LoadMode> {
|
|
791
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs,
|
|
792
|
+
Index innerDim, Packet& res) {
|
|
745
793
|
res = pset1<Packet>(typename unpacket_traits<Packet>::type(0));
|
|
746
|
-
for(Index i = 0; i < innerDim; ++i)
|
|
747
|
-
res =
|
|
794
|
+
for (Index i = 0; i < innerDim; ++i)
|
|
795
|
+
res = pmadd(lhs.template packet<LoadMode, Packet>(row, i), pset1<Packet>(rhs.coeff(i, col)), res);
|
|
796
|
+
}
|
|
797
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run_segment(Index row, Index col, const Lhs& lhs, const Rhs& rhs,
|
|
798
|
+
Index innerDim, Packet& res, Index begin, Index count) {
|
|
799
|
+
res = pset1<Packet>(typename unpacket_traits<Packet>::type(0));
|
|
800
|
+
for (Index i = 0; i < innerDim; ++i)
|
|
801
|
+
res = pmadd(lhs.template packetSegment<LoadMode, Packet>(row, i, begin, count), pset1<Packet>(rhs.coeff(i, col)),
|
|
802
|
+
res);
|
|
748
803
|
}
|
|
749
804
|
};
|
|
750
805
|
|
|
751
|
-
|
|
752
806
|
/***************************************************************************
|
|
753
|
-
* Triangular products
|
|
754
|
-
***************************************************************************/
|
|
755
|
-
template<int Mode, bool LhsIsTriangular,
|
|
756
|
-
typename Lhs, bool LhsIsVector,
|
|
757
|
-
typename Rhs, bool RhsIsVector>
|
|
807
|
+
* Triangular products
|
|
808
|
+
***************************************************************************/
|
|
809
|
+
template <int Mode, bool LhsIsTriangular, typename Lhs, bool LhsIsVector, typename Rhs, bool RhsIsVector>
|
|
758
810
|
struct triangular_product_impl;
|
|
759
811
|
|
|
760
|
-
template<typename Lhs, typename Rhs, int ProductTag>
|
|
761
|
-
struct generic_product_impl<Lhs,Rhs,TriangularShape,DenseShape,ProductTag>
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
typedef typename Product<Lhs,Rhs>::Scalar Scalar;
|
|
812
|
+
template <typename Lhs, typename Rhs, int ProductTag>
|
|
813
|
+
struct generic_product_impl<Lhs, Rhs, TriangularShape, DenseShape, ProductTag>
|
|
814
|
+
: generic_product_impl_base<Lhs, Rhs, generic_product_impl<Lhs, Rhs, TriangularShape, DenseShape, ProductTag>> {
|
|
815
|
+
typedef typename Product<Lhs, Rhs>::Scalar Scalar;
|
|
765
816
|
|
|
766
|
-
template<typename Dest>
|
|
767
|
-
static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha)
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
::run(dst, lhs.nestedExpression(), rhs, alpha);
|
|
817
|
+
template <typename Dest>
|
|
818
|
+
static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) {
|
|
819
|
+
triangular_product_impl<Lhs::Mode, true, typename Lhs::MatrixType, false, Rhs, Rhs::ColsAtCompileTime == 1>::run(
|
|
820
|
+
dst, lhs.nestedExpression(), rhs, alpha);
|
|
771
821
|
}
|
|
772
822
|
};
|
|
773
823
|
|
|
774
|
-
template<typename Lhs, typename Rhs, int ProductTag>
|
|
775
|
-
struct generic_product_impl<Lhs,Rhs,DenseShape,TriangularShape,ProductTag>
|
|
776
|
-
: generic_product_impl_base<Lhs,Rhs,generic_product_impl<Lhs,Rhs,DenseShape,TriangularShape,ProductTag
|
|
777
|
-
|
|
778
|
-
typedef typename Product<Lhs,Rhs>::Scalar Scalar;
|
|
824
|
+
template <typename Lhs, typename Rhs, int ProductTag>
|
|
825
|
+
struct generic_product_impl<Lhs, Rhs, DenseShape, TriangularShape, ProductTag>
|
|
826
|
+
: generic_product_impl_base<Lhs, Rhs, generic_product_impl<Lhs, Rhs, DenseShape, TriangularShape, ProductTag>> {
|
|
827
|
+
typedef typename Product<Lhs, Rhs>::Scalar Scalar;
|
|
779
828
|
|
|
780
|
-
template<typename Dest>
|
|
781
|
-
static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha)
|
|
782
|
-
|
|
783
|
-
|
|
829
|
+
template <typename Dest>
|
|
830
|
+
static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) {
|
|
831
|
+
triangular_product_impl<Rhs::Mode, false, Lhs, Lhs::RowsAtCompileTime == 1, typename Rhs::MatrixType, false>::run(
|
|
832
|
+
dst, lhs, rhs.nestedExpression(), alpha);
|
|
784
833
|
}
|
|
785
834
|
};
|
|
786
835
|
|
|
787
|
-
|
|
788
836
|
/***************************************************************************
|
|
789
|
-
* SelfAdjoint products
|
|
790
|
-
***************************************************************************/
|
|
791
|
-
template <typename Lhs, int LhsMode, bool LhsIsVector,
|
|
792
|
-
typename Rhs, int RhsMode, bool RhsIsVector>
|
|
837
|
+
* SelfAdjoint products
|
|
838
|
+
***************************************************************************/
|
|
839
|
+
template <typename Lhs, int LhsMode, bool LhsIsVector, typename Rhs, int RhsMode, bool RhsIsVector>
|
|
793
840
|
struct selfadjoint_product_impl;
|
|
794
841
|
|
|
795
|
-
template<typename Lhs, typename Rhs, int ProductTag>
|
|
796
|
-
struct generic_product_impl<Lhs,Rhs,SelfAdjointShape,DenseShape,ProductTag>
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
typedef typename Product<Lhs,Rhs>::Scalar Scalar;
|
|
842
|
+
template <typename Lhs, typename Rhs, int ProductTag>
|
|
843
|
+
struct generic_product_impl<Lhs, Rhs, SelfAdjointShape, DenseShape, ProductTag>
|
|
844
|
+
: generic_product_impl_base<Lhs, Rhs, generic_product_impl<Lhs, Rhs, SelfAdjointShape, DenseShape, ProductTag>> {
|
|
845
|
+
typedef typename Product<Lhs, Rhs>::Scalar Scalar;
|
|
800
846
|
|
|
801
|
-
template<typename Dest>
|
|
802
|
-
static EIGEN_DEVICE_FUNC
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
selfadjoint_product_impl<typename Lhs::MatrixType,Lhs::Mode,false,Rhs,0,Rhs::IsVectorAtCompileTime>::run(dst, lhs.nestedExpression(), rhs, alpha);
|
|
847
|
+
template <typename Dest>
|
|
848
|
+
static EIGEN_DEVICE_FUNC void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) {
|
|
849
|
+
selfadjoint_product_impl<typename Lhs::MatrixType, Lhs::Mode, false, Rhs, 0, Rhs::ColsAtCompileTime == 1>::run(
|
|
850
|
+
dst, lhs.nestedExpression(), rhs, alpha);
|
|
806
851
|
}
|
|
807
852
|
};
|
|
808
853
|
|
|
809
|
-
template<typename Lhs, typename Rhs, int ProductTag>
|
|
810
|
-
struct generic_product_impl<Lhs,Rhs,DenseShape,SelfAdjointShape,ProductTag>
|
|
811
|
-
: generic_product_impl_base<Lhs,Rhs,generic_product_impl<Lhs,Rhs,DenseShape,SelfAdjointShape,ProductTag
|
|
812
|
-
|
|
813
|
-
typedef typename Product<Lhs,Rhs>::Scalar Scalar;
|
|
854
|
+
template <typename Lhs, typename Rhs, int ProductTag>
|
|
855
|
+
struct generic_product_impl<Lhs, Rhs, DenseShape, SelfAdjointShape, ProductTag>
|
|
856
|
+
: generic_product_impl_base<Lhs, Rhs, generic_product_impl<Lhs, Rhs, DenseShape, SelfAdjointShape, ProductTag>> {
|
|
857
|
+
typedef typename Product<Lhs, Rhs>::Scalar Scalar;
|
|
814
858
|
|
|
815
|
-
template<typename Dest>
|
|
816
|
-
static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha)
|
|
817
|
-
|
|
818
|
-
|
|
859
|
+
template <typename Dest>
|
|
860
|
+
static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) {
|
|
861
|
+
selfadjoint_product_impl<Lhs, 0, Lhs::RowsAtCompileTime == 1, typename Rhs::MatrixType, Rhs::Mode, false>::run(
|
|
862
|
+
dst, lhs, rhs.nestedExpression(), alpha);
|
|
819
863
|
}
|
|
820
864
|
};
|
|
821
865
|
|
|
822
|
-
|
|
823
866
|
/***************************************************************************
|
|
824
|
-
* Diagonal products
|
|
825
|
-
***************************************************************************/
|
|
826
|
-
|
|
827
|
-
template<typename MatrixType, typename DiagonalType, typename Derived, int ProductOrder>
|
|
828
|
-
struct diagonal_product_evaluator_base
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
public:
|
|
867
|
+
* Diagonal products
|
|
868
|
+
***************************************************************************/
|
|
869
|
+
|
|
870
|
+
template <typename MatrixType, typename DiagonalType, typename Derived, int ProductOrder>
|
|
871
|
+
struct diagonal_product_evaluator_base : evaluator_base<Derived> {
|
|
872
|
+
typedef typename ScalarBinaryOpTraits<typename MatrixType::Scalar, typename DiagonalType::Scalar>::ReturnType Scalar;
|
|
873
|
+
|
|
874
|
+
public:
|
|
833
875
|
enum {
|
|
834
|
-
CoeffReadCost = int(NumTraits<Scalar>::MulCost) + int(evaluator<MatrixType>::CoeffReadCost) +
|
|
876
|
+
CoeffReadCost = int(NumTraits<Scalar>::MulCost) + int(evaluator<MatrixType>::CoeffReadCost) +
|
|
877
|
+
int(evaluator<DiagonalType>::CoeffReadCost),
|
|
835
878
|
|
|
836
879
|
MatrixFlags = evaluator<MatrixType>::Flags,
|
|
837
880
|
DiagFlags = evaluator<DiagonalType>::Flags,
|
|
838
881
|
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
882
|
+
StorageOrder_ = (Derived::MaxRowsAtCompileTime == 1 && Derived::MaxColsAtCompileTime != 1) ? RowMajor
|
|
883
|
+
: (Derived::MaxColsAtCompileTime == 1 && Derived::MaxRowsAtCompileTime != 1) ? ColMajor
|
|
884
|
+
: MatrixFlags & RowMajorBit ? RowMajor
|
|
885
|
+
: ColMajor,
|
|
886
|
+
SameStorageOrder_ = int(StorageOrder_) == ((MatrixFlags & RowMajorBit) ? RowMajor : ColMajor),
|
|
843
887
|
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
888
|
+
ScalarAccessOnDiag_ = !((int(StorageOrder_) == ColMajor && int(ProductOrder) == OnTheLeft) ||
|
|
889
|
+
(int(StorageOrder_) == RowMajor && int(ProductOrder) == OnTheRight)),
|
|
890
|
+
SameTypes_ = is_same<typename MatrixType::Scalar, typename DiagonalType::Scalar>::value,
|
|
847
891
|
// FIXME currently we need same types, but in the future the next rule should be the one
|
|
848
|
-
//
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
892
|
+
// Vectorizable_ = bool(int(MatrixFlags)&PacketAccessBit) && ((!_PacketOnDiag) || (SameTypes_ &&
|
|
893
|
+
// bool(int(DiagFlags)&PacketAccessBit))),
|
|
894
|
+
Vectorizable_ = bool(int(MatrixFlags) & PacketAccessBit) && SameTypes_ &&
|
|
895
|
+
(SameStorageOrder_ || (MatrixFlags & LinearAccessBit) == LinearAccessBit) &&
|
|
896
|
+
(ScalarAccessOnDiag_ || (bool(int(DiagFlags) & PacketAccessBit))),
|
|
897
|
+
LinearAccessMask_ =
|
|
898
|
+
(MatrixType::RowsAtCompileTime == 1 || MatrixType::ColsAtCompileTime == 1) ? LinearAccessBit : 0,
|
|
899
|
+
Flags =
|
|
900
|
+
((HereditaryBits | LinearAccessMask_) & (unsigned int)(MatrixFlags)) | (Vectorizable_ ? PacketAccessBit : 0),
|
|
855
901
|
Alignment = evaluator<MatrixType>::Alignment,
|
|
856
902
|
|
|
857
|
-
AsScalarProduct =
|
|
858
|
-
|
|
859
|
-
|
|
903
|
+
AsScalarProduct =
|
|
904
|
+
(DiagonalType::SizeAtCompileTime == 1) ||
|
|
905
|
+
(DiagonalType::SizeAtCompileTime == Dynamic && MatrixType::RowsAtCompileTime == 1 &&
|
|
906
|
+
ProductOrder == OnTheLeft) ||
|
|
907
|
+
(DiagonalType::SizeAtCompileTime == Dynamic && MatrixType::ColsAtCompileTime == 1 && ProductOrder == OnTheRight)
|
|
860
908
|
};
|
|
861
909
|
|
|
862
|
-
EIGEN_DEVICE_FUNC diagonal_product_evaluator_base(const MatrixType
|
|
863
|
-
|
|
864
|
-
{
|
|
910
|
+
EIGEN_DEVICE_FUNC diagonal_product_evaluator_base(const MatrixType& mat, const DiagonalType& diag)
|
|
911
|
+
: m_diagImpl(diag), m_matImpl(mat) {
|
|
865
912
|
EIGEN_INTERNAL_CHECK_COST_VALUE(NumTraits<Scalar>::MulCost);
|
|
866
913
|
EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
|
|
867
914
|
}
|
|
868
915
|
|
|
869
|
-
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index idx) const
|
|
870
|
-
|
|
871
|
-
if(AsScalarProduct)
|
|
916
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index idx) const {
|
|
917
|
+
if (AsScalarProduct)
|
|
872
918
|
return m_diagImpl.coeff(0) * m_matImpl.coeff(idx);
|
|
873
919
|
else
|
|
874
920
|
return m_diagImpl.coeff(idx) * m_matImpl.coeff(idx);
|
|
875
921
|
}
|
|
876
922
|
|
|
877
|
-
protected:
|
|
878
|
-
template<int LoadMode,typename PacketType>
|
|
879
|
-
EIGEN_STRONG_INLINE PacketType packet_impl(Index row, Index col, Index id, internal::true_type) const
|
|
880
|
-
|
|
881
|
-
|
|
923
|
+
protected:
|
|
924
|
+
template <int LoadMode, typename PacketType>
|
|
925
|
+
EIGEN_STRONG_INLINE PacketType packet_impl(Index row, Index col, Index id, internal::true_type) const {
|
|
926
|
+
return internal::pmul(m_matImpl.template packet<LoadMode, PacketType>(row, col),
|
|
927
|
+
internal::pset1<PacketType>(m_diagImpl.coeff(id)));
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
template <int LoadMode, typename PacketType>
|
|
931
|
+
EIGEN_STRONG_INLINE PacketType packet_impl(Index row, Index col, Index id, internal::false_type) const {
|
|
932
|
+
enum {
|
|
933
|
+
InnerSize = (MatrixType::Flags & RowMajorBit) ? MatrixType::ColsAtCompileTime : MatrixType::RowsAtCompileTime,
|
|
934
|
+
DiagonalPacketLoadMode = plain_enum_min(
|
|
935
|
+
LoadMode,
|
|
936
|
+
((InnerSize % 16) == 0) ? int(Aligned16) : int(evaluator<DiagonalType>::Alignment)) // FIXME hardcoded 16!!
|
|
937
|
+
};
|
|
938
|
+
return internal::pmul(m_matImpl.template packet<LoadMode, PacketType>(row, col),
|
|
939
|
+
m_diagImpl.template packet<DiagonalPacketLoadMode, PacketType>(id));
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
template <int LoadMode, typename PacketType>
|
|
943
|
+
EIGEN_STRONG_INLINE PacketType packet_segment_impl(Index row, Index col, Index id, Index begin, Index count,
|
|
944
|
+
internal::true_type) const {
|
|
945
|
+
return internal::pmul(m_matImpl.template packetSegment<LoadMode, PacketType>(row, col, begin, count),
|
|
882
946
|
internal::pset1<PacketType>(m_diagImpl.coeff(id)));
|
|
883
947
|
}
|
|
884
948
|
|
|
885
|
-
template<int LoadMode,typename PacketType>
|
|
886
|
-
EIGEN_STRONG_INLINE PacketType
|
|
887
|
-
|
|
949
|
+
template <int LoadMode, typename PacketType>
|
|
950
|
+
EIGEN_STRONG_INLINE PacketType packet_segment_impl(Index row, Index col, Index id, Index begin, Index count,
|
|
951
|
+
internal::false_type) const {
|
|
888
952
|
enum {
|
|
889
953
|
InnerSize = (MatrixType::Flags & RowMajorBit) ? MatrixType::ColsAtCompileTime : MatrixType::RowsAtCompileTime,
|
|
890
|
-
DiagonalPacketLoadMode =
|
|
954
|
+
DiagonalPacketLoadMode = plain_enum_min(
|
|
955
|
+
LoadMode,
|
|
956
|
+
((InnerSize % 16) == 0) ? int(Aligned16) : int(evaluator<DiagonalType>::Alignment)) // FIXME hardcoded 16!!
|
|
891
957
|
};
|
|
892
|
-
return internal::pmul(m_matImpl.template
|
|
893
|
-
m_diagImpl.template
|
|
958
|
+
return internal::pmul(m_matImpl.template packetSegment<LoadMode, PacketType>(row, col, begin, count),
|
|
959
|
+
m_diagImpl.template packetSegment<DiagonalPacketLoadMode, PacketType>(id, begin, count));
|
|
894
960
|
}
|
|
895
961
|
|
|
896
962
|
evaluator<DiagonalType> m_diagImpl;
|
|
897
|
-
evaluator<MatrixType>
|
|
963
|
+
evaluator<MatrixType> m_matImpl;
|
|
898
964
|
};
|
|
899
965
|
|
|
900
966
|
// diagonal * dense
|
|
901
|
-
template<typename Lhs, typename Rhs, int ProductKind, int ProductTag>
|
|
967
|
+
template <typename Lhs, typename Rhs, int ProductKind, int ProductTag>
|
|
902
968
|
struct product_evaluator<Product<Lhs, Rhs, ProductKind>, ProductTag, DiagonalShape, DenseShape>
|
|
903
|
-
|
|
904
|
-
{
|
|
905
|
-
typedef diagonal_product_evaluator_base<Rhs, typename Lhs::DiagonalVectorType, Product<Lhs, Rhs, LazyProduct>,
|
|
969
|
+
: diagonal_product_evaluator_base<Rhs, typename Lhs::DiagonalVectorType, Product<Lhs, Rhs, LazyProduct>,
|
|
970
|
+
OnTheLeft> {
|
|
971
|
+
typedef diagonal_product_evaluator_base<Rhs, typename Lhs::DiagonalVectorType, Product<Lhs, Rhs, LazyProduct>,
|
|
972
|
+
OnTheLeft>
|
|
973
|
+
Base;
|
|
974
|
+
using Base::coeff;
|
|
906
975
|
using Base::m_diagImpl;
|
|
907
976
|
using Base::m_matImpl;
|
|
908
|
-
using Base::coeff;
|
|
909
977
|
typedef typename Base::Scalar Scalar;
|
|
910
978
|
|
|
911
979
|
typedef Product<Lhs, Rhs, ProductKind> XprType;
|
|
912
980
|
typedef typename XprType::PlainObject PlainObject;
|
|
913
981
|
typedef typename Lhs::DiagonalVectorType DiagonalType;
|
|
914
982
|
|
|
983
|
+
static constexpr int StorageOrder = Base::StorageOrder_;
|
|
984
|
+
using IsRowMajor_t = bool_constant<StorageOrder == RowMajor>;
|
|
915
985
|
|
|
916
|
-
|
|
986
|
+
EIGEN_DEVICE_FUNC explicit product_evaluator(const XprType& xpr) : Base(xpr.rhs(), xpr.lhs().diagonal()) {}
|
|
917
987
|
|
|
918
|
-
EIGEN_DEVICE_FUNC
|
|
919
|
-
: Base(xpr.rhs(), xpr.lhs().diagonal())
|
|
920
|
-
{
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const
|
|
924
|
-
{
|
|
988
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const {
|
|
925
989
|
return m_diagImpl.coeff(row) * m_matImpl.coeff(row, col);
|
|
926
990
|
}
|
|
927
991
|
|
|
928
992
|
#ifndef EIGEN_GPUCC
|
|
929
|
-
template<int LoadMode,typename PacketType>
|
|
930
|
-
EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const
|
|
931
|
-
|
|
993
|
+
template <int LoadMode, typename PacketType>
|
|
994
|
+
EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const {
|
|
995
|
+
// FIXME: NVCC used to complain about the template keyword, but we have to check whether this is still the case.
|
|
996
|
+
// See also similar calls below.
|
|
997
|
+
return this->template packet_impl<LoadMode, PacketType>(row, col, row, IsRowMajor_t());
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
template <int LoadMode, typename PacketType>
|
|
1001
|
+
EIGEN_STRONG_INLINE PacketType packet(Index idx) const {
|
|
1002
|
+
return packet<LoadMode, PacketType>(int(StorageOrder) == ColMajor ? idx : 0,
|
|
1003
|
+
int(StorageOrder) == ColMajor ? 0 : idx);
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
template <int LoadMode, typename PacketType>
|
|
1007
|
+
EIGEN_STRONG_INLINE PacketType packetSegment(Index row, Index col, Index begin, Index count) const {
|
|
932
1008
|
// FIXME: NVCC used to complain about the template keyword, but we have to check whether this is still the case.
|
|
933
1009
|
// See also similar calls below.
|
|
934
|
-
return this->template
|
|
935
|
-
typename internal::conditional<int(StorageOrder)==RowMajor, internal::true_type, internal::false_type>::type());
|
|
1010
|
+
return this->template packet_segment_impl<LoadMode, PacketType>(row, col, row, begin, count, IsRowMajor_t());
|
|
936
1011
|
}
|
|
937
1012
|
|
|
938
|
-
template<int LoadMode,typename PacketType>
|
|
939
|
-
EIGEN_STRONG_INLINE PacketType
|
|
940
|
-
|
|
941
|
-
|
|
1013
|
+
template <int LoadMode, typename PacketType>
|
|
1014
|
+
EIGEN_STRONG_INLINE PacketType packetSegment(Index idx, Index begin, Index count) const {
|
|
1015
|
+
return packetSegment<LoadMode, PacketType>(StorageOrder == ColMajor ? idx : 0, StorageOrder == ColMajor ? 0 : idx,
|
|
1016
|
+
begin, count);
|
|
942
1017
|
}
|
|
943
1018
|
#endif
|
|
944
1019
|
};
|
|
945
1020
|
|
|
946
1021
|
// dense * diagonal
|
|
947
|
-
template<typename Lhs, typename Rhs, int ProductKind, int ProductTag>
|
|
1022
|
+
template <typename Lhs, typename Rhs, int ProductKind, int ProductTag>
|
|
948
1023
|
struct product_evaluator<Product<Lhs, Rhs, ProductKind>, ProductTag, DenseShape, DiagonalShape>
|
|
949
|
-
|
|
950
|
-
{
|
|
951
|
-
typedef diagonal_product_evaluator_base<Lhs, typename Rhs::DiagonalVectorType, Product<Lhs, Rhs, LazyProduct>,
|
|
1024
|
+
: diagonal_product_evaluator_base<Lhs, typename Rhs::DiagonalVectorType, Product<Lhs, Rhs, LazyProduct>,
|
|
1025
|
+
OnTheRight> {
|
|
1026
|
+
typedef diagonal_product_evaluator_base<Lhs, typename Rhs::DiagonalVectorType, Product<Lhs, Rhs, LazyProduct>,
|
|
1027
|
+
OnTheRight>
|
|
1028
|
+
Base;
|
|
1029
|
+
using Base::coeff;
|
|
952
1030
|
using Base::m_diagImpl;
|
|
953
1031
|
using Base::m_matImpl;
|
|
954
|
-
using Base::coeff;
|
|
955
1032
|
typedef typename Base::Scalar Scalar;
|
|
956
1033
|
|
|
957
1034
|
typedef Product<Lhs, Rhs, ProductKind> XprType;
|
|
958
1035
|
typedef typename XprType::PlainObject PlainObject;
|
|
959
1036
|
|
|
960
|
-
|
|
1037
|
+
static constexpr int StorageOrder = Base::StorageOrder_;
|
|
1038
|
+
using IsColMajor_t = bool_constant<StorageOrder == ColMajor>;
|
|
961
1039
|
|
|
962
|
-
EIGEN_DEVICE_FUNC explicit product_evaluator(const XprType& xpr)
|
|
963
|
-
: Base(xpr.lhs(), xpr.rhs().diagonal())
|
|
964
|
-
{
|
|
965
|
-
}
|
|
1040
|
+
EIGEN_DEVICE_FUNC explicit product_evaluator(const XprType& xpr) : Base(xpr.lhs(), xpr.rhs().diagonal()) {}
|
|
966
1041
|
|
|
967
|
-
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const
|
|
968
|
-
{
|
|
1042
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const {
|
|
969
1043
|
return m_matImpl.coeff(row, col) * m_diagImpl.coeff(col);
|
|
970
1044
|
}
|
|
971
1045
|
|
|
972
1046
|
#ifndef EIGEN_GPUCC
|
|
973
|
-
template<int LoadMode,typename PacketType>
|
|
974
|
-
EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const
|
|
975
|
-
|
|
976
|
-
return this->template packet_impl<LoadMode,PacketType>(row,col, col,
|
|
977
|
-
typename internal::conditional<int(StorageOrder)==ColMajor, internal::true_type, internal::false_type>::type());
|
|
1047
|
+
template <int LoadMode, typename PacketType>
|
|
1048
|
+
EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const {
|
|
1049
|
+
return this->template packet_impl<LoadMode, PacketType>(row, col, col, IsColMajor_t());
|
|
978
1050
|
}
|
|
979
1051
|
|
|
980
|
-
template<int LoadMode,typename PacketType>
|
|
981
|
-
EIGEN_STRONG_INLINE PacketType packet(Index idx) const
|
|
982
|
-
|
|
983
|
-
|
|
1052
|
+
template <int LoadMode, typename PacketType>
|
|
1053
|
+
EIGEN_STRONG_INLINE PacketType packet(Index idx) const {
|
|
1054
|
+
return packet<LoadMode, PacketType>(StorageOrder == ColMajor ? idx : 0, StorageOrder == ColMajor ? 0 : idx);
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
template <int LoadMode, typename PacketType>
|
|
1058
|
+
EIGEN_STRONG_INLINE PacketType packetSegment(Index row, Index col, Index begin, Index count) const {
|
|
1059
|
+
return this->template packet_segment_impl<LoadMode, PacketType>(row, col, col, begin, count, IsColMajor_t());
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
template <int LoadMode, typename PacketType>
|
|
1063
|
+
EIGEN_STRONG_INLINE PacketType packetSegment(Index idx, Index begin, Index count) const {
|
|
1064
|
+
return packetSegment<LoadMode, PacketType>(StorageOrder == ColMajor ? idx : 0, StorageOrder == ColMajor ? 0 : idx,
|
|
1065
|
+
begin, count);
|
|
984
1066
|
}
|
|
985
1067
|
#endif
|
|
986
1068
|
};
|
|
987
1069
|
|
|
988
1070
|
/***************************************************************************
|
|
989
|
-
* Products with permutation matrices
|
|
990
|
-
***************************************************************************/
|
|
1071
|
+
* Products with permutation matrices
|
|
1072
|
+
***************************************************************************/
|
|
991
1073
|
|
|
992
1074
|
/** \internal
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
template<typename ExpressionType, int Side, bool Transposed, typename ExpressionShape>
|
|
1075
|
+
* \class permutation_matrix_product
|
|
1076
|
+
* Internal helper class implementing the product between a permutation matrix and a matrix.
|
|
1077
|
+
* This class is specialized for DenseShape below and for SparseShape in SparseCore/SparsePermutation.h
|
|
1078
|
+
*/
|
|
1079
|
+
template <typename ExpressionType, int Side, bool Transposed, typename ExpressionShape>
|
|
998
1080
|
struct permutation_matrix_product;
|
|
999
1081
|
|
|
1000
|
-
template<typename ExpressionType, int Side, bool Transposed>
|
|
1001
|
-
struct permutation_matrix_product<ExpressionType, Side, Transposed, DenseShape>
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
typedef typename remove_all<MatrixType>::type MatrixTypeCleaned;
|
|
1005
|
-
|
|
1006
|
-
template<typename Dest, typename PermutationType>
|
|
1007
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Dest& dst, const PermutationType& perm, const ExpressionType& xpr)
|
|
1008
|
-
{
|
|
1009
|
-
MatrixType mat(xpr);
|
|
1010
|
-
const Index n = Side==OnTheLeft ? mat.rows() : mat.cols();
|
|
1011
|
-
// FIXME we need an is_same for expression that is not sensitive to constness. For instance
|
|
1012
|
-
// is_same_xpr<Block<const Matrix>, Block<Matrix> >::value should be true.
|
|
1013
|
-
//if(is_same<MatrixTypeCleaned,Dest>::value && extract_data(dst) == extract_data(mat))
|
|
1014
|
-
if(is_same_dense(dst, mat))
|
|
1015
|
-
{
|
|
1016
|
-
// apply the permutation inplace
|
|
1017
|
-
Matrix<bool,PermutationType::RowsAtCompileTime,1,0,PermutationType::MaxRowsAtCompileTime> mask(perm.size());
|
|
1018
|
-
mask.fill(false);
|
|
1019
|
-
Index r = 0;
|
|
1020
|
-
while(r < perm.size())
|
|
1021
|
-
{
|
|
1022
|
-
// search for the next seed
|
|
1023
|
-
while(r<perm.size() && mask[r]) r++;
|
|
1024
|
-
if(r>=perm.size())
|
|
1025
|
-
break;
|
|
1026
|
-
// we got one, let's follow it until we are back to the seed
|
|
1027
|
-
Index k0 = r++;
|
|
1028
|
-
Index kPrev = k0;
|
|
1029
|
-
mask.coeffRef(k0) = true;
|
|
1030
|
-
for(Index k=perm.indices().coeff(k0); k!=k0; k=perm.indices().coeff(k))
|
|
1031
|
-
{
|
|
1032
|
-
Block<Dest, Side==OnTheLeft ? 1 : Dest::RowsAtCompileTime, Side==OnTheRight ? 1 : Dest::ColsAtCompileTime>(dst, k)
|
|
1033
|
-
.swap(Block<Dest, Side==OnTheLeft ? 1 : Dest::RowsAtCompileTime, Side==OnTheRight ? 1 : Dest::ColsAtCompileTime>
|
|
1034
|
-
(dst,((Side==OnTheLeft) ^ Transposed) ? k0 : kPrev));
|
|
1035
|
-
|
|
1036
|
-
mask.coeffRef(k) = true;
|
|
1037
|
-
kPrev = k;
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
else
|
|
1042
|
-
{
|
|
1043
|
-
for(Index i = 0; i < n; ++i)
|
|
1044
|
-
{
|
|
1045
|
-
Block<Dest, Side==OnTheLeft ? 1 : Dest::RowsAtCompileTime, Side==OnTheRight ? 1 : Dest::ColsAtCompileTime>
|
|
1046
|
-
(dst, ((Side==OnTheLeft) ^ Transposed) ? perm.indices().coeff(i) : i)
|
|
1047
|
-
|
|
1048
|
-
=
|
|
1082
|
+
template <typename ExpressionType, int Side, bool Transposed>
|
|
1083
|
+
struct permutation_matrix_product<ExpressionType, Side, Transposed, DenseShape> {
|
|
1084
|
+
typedef typename nested_eval<ExpressionType, 1>::type MatrixType;
|
|
1085
|
+
typedef remove_all_t<MatrixType> MatrixTypeCleaned;
|
|
1049
1086
|
|
|
1050
|
-
|
|
1051
|
-
|
|
1087
|
+
template <typename Dest, typename PermutationType>
|
|
1088
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Dest& dst, const PermutationType& perm,
|
|
1089
|
+
const ExpressionType& xpr) {
|
|
1090
|
+
MatrixType mat(xpr);
|
|
1091
|
+
const Index n = Side == OnTheLeft ? mat.rows() : mat.cols();
|
|
1092
|
+
// FIXME we need an is_same for expression that is not sensitive to constness. For instance
|
|
1093
|
+
// is_same_xpr<Block<const Matrix>, Block<Matrix> >::value should be true.
|
|
1094
|
+
// if(is_same<MatrixTypeCleaned,Dest>::value && extract_data(dst) == extract_data(mat))
|
|
1095
|
+
if (is_same_dense(dst, mat)) {
|
|
1096
|
+
// apply the permutation inplace
|
|
1097
|
+
Matrix<bool, PermutationType::RowsAtCompileTime, 1, 0, PermutationType::MaxRowsAtCompileTime> mask(perm.size());
|
|
1098
|
+
mask.fill(false);
|
|
1099
|
+
Index r = 0;
|
|
1100
|
+
while (r < perm.size()) {
|
|
1101
|
+
// search for the next seed
|
|
1102
|
+
while (r < perm.size() && mask[r]) r++;
|
|
1103
|
+
if (r >= perm.size()) break;
|
|
1104
|
+
// we got one, let's follow it until we are back to the seed
|
|
1105
|
+
Index k0 = r++;
|
|
1106
|
+
Index kPrev = k0;
|
|
1107
|
+
mask.coeffRef(k0) = true;
|
|
1108
|
+
for (Index k = perm.indices().coeff(k0); k != k0; k = perm.indices().coeff(k)) {
|
|
1109
|
+
Block<Dest, Side == OnTheLeft ? 1 : Dest::RowsAtCompileTime,
|
|
1110
|
+
Side == OnTheRight ? 1 : Dest::ColsAtCompileTime>(dst, k)
|
|
1111
|
+
.swap(Block < Dest, Side == OnTheLeft ? 1 : Dest::RowsAtCompileTime,
|
|
1112
|
+
Side == OnTheRight
|
|
1113
|
+
? 1
|
|
1114
|
+
: Dest::ColsAtCompileTime > (dst, ((Side == OnTheLeft) ^ Transposed) ? k0 : kPrev));
|
|
1115
|
+
|
|
1116
|
+
mask.coeffRef(k) = true;
|
|
1117
|
+
kPrev = k;
|
|
1052
1118
|
}
|
|
1053
1119
|
}
|
|
1120
|
+
} else {
|
|
1121
|
+
for (Index i = 0; i < n; ++i) {
|
|
1122
|
+
Block<Dest, Side == OnTheLeft ? 1 : Dest::RowsAtCompileTime, Side == OnTheRight ? 1 : Dest::ColsAtCompileTime>(
|
|
1123
|
+
dst, ((Side == OnTheLeft) ^ Transposed) ? perm.indices().coeff(i) : i)
|
|
1124
|
+
|
|
1125
|
+
=
|
|
1126
|
+
|
|
1127
|
+
Block < const MatrixTypeCleaned,
|
|
1128
|
+
Side == OnTheLeft ? 1 : MatrixTypeCleaned::RowsAtCompileTime,
|
|
1129
|
+
Side == OnTheRight ? 1
|
|
1130
|
+
: MatrixTypeCleaned::ColsAtCompileTime >
|
|
1131
|
+
(mat, ((Side == OnTheRight) ^ Transposed) ? perm.indices().coeff(i) : i);
|
|
1132
|
+
}
|
|
1054
1133
|
}
|
|
1134
|
+
}
|
|
1055
1135
|
};
|
|
1056
1136
|
|
|
1057
|
-
template<typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
|
|
1058
|
-
struct generic_product_impl<Lhs, Rhs, PermutationShape, MatrixShape, ProductTag>
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs)
|
|
1062
|
-
{
|
|
1137
|
+
template <typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
|
|
1138
|
+
struct generic_product_impl<Lhs, Rhs, PermutationShape, MatrixShape, ProductTag> {
|
|
1139
|
+
template <typename Dest>
|
|
1140
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) {
|
|
1063
1141
|
permutation_matrix_product<Rhs, OnTheLeft, false, MatrixShape>::run(dst, lhs, rhs);
|
|
1064
1142
|
}
|
|
1065
1143
|
};
|
|
1066
1144
|
|
|
1067
|
-
template<typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
|
|
1068
|
-
struct generic_product_impl<Lhs, Rhs, MatrixShape, PermutationShape, ProductTag>
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs)
|
|
1072
|
-
{
|
|
1145
|
+
template <typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
|
|
1146
|
+
struct generic_product_impl<Lhs, Rhs, MatrixShape, PermutationShape, ProductTag> {
|
|
1147
|
+
template <typename Dest>
|
|
1148
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) {
|
|
1073
1149
|
permutation_matrix_product<Lhs, OnTheRight, false, MatrixShape>::run(dst, rhs, lhs);
|
|
1074
1150
|
}
|
|
1075
1151
|
};
|
|
1076
1152
|
|
|
1077
|
-
template<typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
|
|
1078
|
-
struct generic_product_impl<Inverse<Lhs>, Rhs, PermutationShape, MatrixShape, ProductTag>
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Inverse<Lhs>& lhs, const Rhs& rhs)
|
|
1082
|
-
{
|
|
1153
|
+
template <typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
|
|
1154
|
+
struct generic_product_impl<Inverse<Lhs>, Rhs, PermutationShape, MatrixShape, ProductTag> {
|
|
1155
|
+
template <typename Dest>
|
|
1156
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Inverse<Lhs>& lhs, const Rhs& rhs) {
|
|
1083
1157
|
permutation_matrix_product<Rhs, OnTheLeft, true, MatrixShape>::run(dst, lhs.nestedExpression(), rhs);
|
|
1084
1158
|
}
|
|
1085
1159
|
};
|
|
1086
1160
|
|
|
1087
|
-
template<typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
|
|
1088
|
-
struct generic_product_impl<Lhs, Inverse<Rhs>, MatrixShape, PermutationShape, ProductTag>
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Inverse<Rhs>& rhs)
|
|
1092
|
-
{
|
|
1161
|
+
template <typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
|
|
1162
|
+
struct generic_product_impl<Lhs, Inverse<Rhs>, MatrixShape, PermutationShape, ProductTag> {
|
|
1163
|
+
template <typename Dest>
|
|
1164
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Inverse<Rhs>& rhs) {
|
|
1093
1165
|
permutation_matrix_product<Lhs, OnTheRight, true, MatrixShape>::run(dst, rhs.nestedExpression(), lhs);
|
|
1094
1166
|
}
|
|
1095
1167
|
};
|
|
1096
1168
|
|
|
1097
|
-
|
|
1098
1169
|
/***************************************************************************
|
|
1099
|
-
* Products with transpositions matrices
|
|
1100
|
-
***************************************************************************/
|
|
1170
|
+
* Products with transpositions matrices
|
|
1171
|
+
***************************************************************************/
|
|
1101
1172
|
|
|
1102
1173
|
// FIXME could we unify Transpositions and Permutation into a single "shape"??
|
|
1103
1174
|
|
|
1104
1175
|
/** \internal
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
template<typename ExpressionType, int Side, bool Transposed, typename ExpressionShape>
|
|
1109
|
-
struct transposition_matrix_product
|
|
1110
|
-
{
|
|
1176
|
+
* \class transposition_matrix_product
|
|
1177
|
+
* Internal helper class implementing the product between a permutation matrix and a matrix.
|
|
1178
|
+
*/
|
|
1179
|
+
template <typename ExpressionType, int Side, bool Transposed, typename ExpressionShape>
|
|
1180
|
+
struct transposition_matrix_product {
|
|
1111
1181
|
typedef typename nested_eval<ExpressionType, 1>::type MatrixType;
|
|
1112
|
-
typedef
|
|
1182
|
+
typedef remove_all_t<MatrixType> MatrixTypeCleaned;
|
|
1113
1183
|
|
|
1114
|
-
template<typename Dest, typename TranspositionType>
|
|
1115
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Dest& dst, const TranspositionType& tr,
|
|
1116
|
-
|
|
1184
|
+
template <typename Dest, typename TranspositionType>
|
|
1185
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Dest& dst, const TranspositionType& tr,
|
|
1186
|
+
const ExpressionType& xpr) {
|
|
1117
1187
|
MatrixType mat(xpr);
|
|
1118
1188
|
typedef typename TranspositionType::StorageIndex StorageIndex;
|
|
1119
1189
|
const Index size = tr.size();
|
|
1120
1190
|
StorageIndex j = 0;
|
|
1121
1191
|
|
|
1122
|
-
if(!is_same_dense(dst,mat))
|
|
1123
|
-
dst = mat;
|
|
1192
|
+
if (!is_same_dense(dst, mat)) dst = mat;
|
|
1124
1193
|
|
|
1125
|
-
for(Index k=(Transposed?size-1:0)
|
|
1126
|
-
if(Index(j=tr.coeff(k))!=k)
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
else if(Side==OnTheRight)
|
|
1194
|
+
for (Index k = (Transposed ? size - 1 : 0); Transposed ? k >= 0 : k < size; Transposed ? --k : ++k)
|
|
1195
|
+
if (Index(j = tr.coeff(k)) != k) {
|
|
1196
|
+
if (Side == OnTheLeft)
|
|
1197
|
+
dst.row(k).swap(dst.row(j));
|
|
1198
|
+
else if (Side == OnTheRight)
|
|
1199
|
+
dst.col(k).swap(dst.col(j));
|
|
1130
1200
|
}
|
|
1131
1201
|
}
|
|
1132
1202
|
};
|
|
1133
1203
|
|
|
1134
|
-
template<typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
|
|
1135
|
-
struct generic_product_impl<Lhs, Rhs, TranspositionsShape, MatrixShape, ProductTag>
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs)
|
|
1139
|
-
{
|
|
1204
|
+
template <typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
|
|
1205
|
+
struct generic_product_impl<Lhs, Rhs, TranspositionsShape, MatrixShape, ProductTag> {
|
|
1206
|
+
template <typename Dest>
|
|
1207
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) {
|
|
1140
1208
|
transposition_matrix_product<Rhs, OnTheLeft, false, MatrixShape>::run(dst, lhs, rhs);
|
|
1141
1209
|
}
|
|
1142
1210
|
};
|
|
1143
1211
|
|
|
1144
|
-
template<typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
|
|
1145
|
-
struct generic_product_impl<Lhs, Rhs, MatrixShape, TranspositionsShape, ProductTag>
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs)
|
|
1149
|
-
{
|
|
1212
|
+
template <typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
|
|
1213
|
+
struct generic_product_impl<Lhs, Rhs, MatrixShape, TranspositionsShape, ProductTag> {
|
|
1214
|
+
template <typename Dest>
|
|
1215
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) {
|
|
1150
1216
|
transposition_matrix_product<Lhs, OnTheRight, false, MatrixShape>::run(dst, rhs, lhs);
|
|
1151
1217
|
}
|
|
1152
1218
|
};
|
|
1153
1219
|
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
{
|
|
1158
|
-
template<typename Dest>
|
|
1159
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Transpose<Lhs>& lhs, const Rhs& rhs)
|
|
1160
|
-
{
|
|
1220
|
+
template <typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
|
|
1221
|
+
struct generic_product_impl<Transpose<Lhs>, Rhs, TranspositionsShape, MatrixShape, ProductTag> {
|
|
1222
|
+
template <typename Dest>
|
|
1223
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Transpose<Lhs>& lhs, const Rhs& rhs) {
|
|
1161
1224
|
transposition_matrix_product<Rhs, OnTheLeft, true, MatrixShape>::run(dst, lhs.nestedExpression(), rhs);
|
|
1162
1225
|
}
|
|
1163
1226
|
};
|
|
1164
1227
|
|
|
1165
|
-
template<typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
|
|
1166
|
-
struct generic_product_impl<Lhs, Transpose<Rhs>, MatrixShape, TranspositionsShape, ProductTag>
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Transpose<Rhs>& rhs)
|
|
1170
|
-
{
|
|
1228
|
+
template <typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
|
|
1229
|
+
struct generic_product_impl<Lhs, Transpose<Rhs>, MatrixShape, TranspositionsShape, ProductTag> {
|
|
1230
|
+
template <typename Dest>
|
|
1231
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Transpose<Rhs>& rhs) {
|
|
1171
1232
|
transposition_matrix_product<Lhs, OnTheRight, true, MatrixShape>::run(dst, rhs.nestedExpression(), lhs);
|
|
1172
1233
|
}
|
|
1173
1234
|
};
|
|
1174
1235
|
|
|
1175
|
-
|
|
1236
|
+
/***************************************************************************
|
|
1237
|
+
* skew symmetric products
|
|
1238
|
+
* for now we just call the generic implementation
|
|
1239
|
+
***************************************************************************/
|
|
1240
|
+
template <typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
|
|
1241
|
+
struct generic_product_impl<Lhs, Rhs, SkewSymmetricShape, MatrixShape, ProductTag> {
|
|
1242
|
+
template <typename Dest>
|
|
1243
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) {
|
|
1244
|
+
generic_product_impl<typename Lhs::DenseMatrixType, Rhs, DenseShape, MatrixShape, ProductTag>::evalTo(dst, lhs,
|
|
1245
|
+
rhs);
|
|
1246
|
+
}
|
|
1247
|
+
};
|
|
1248
|
+
|
|
1249
|
+
template <typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
|
|
1250
|
+
struct generic_product_impl<Lhs, Rhs, MatrixShape, SkewSymmetricShape, ProductTag> {
|
|
1251
|
+
template <typename Dest>
|
|
1252
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) {
|
|
1253
|
+
generic_product_impl<Lhs, typename Rhs::DenseMatrixType, MatrixShape, DenseShape, ProductTag>::evalTo(dst, lhs,
|
|
1254
|
+
rhs);
|
|
1255
|
+
}
|
|
1256
|
+
};
|
|
1257
|
+
|
|
1258
|
+
template <typename Lhs, typename Rhs, int ProductTag>
|
|
1259
|
+
struct generic_product_impl<Lhs, Rhs, SkewSymmetricShape, SkewSymmetricShape, ProductTag> {
|
|
1260
|
+
template <typename Dest>
|
|
1261
|
+
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) {
|
|
1262
|
+
generic_product_impl<typename Lhs::DenseMatrixType, typename Rhs::DenseMatrixType, DenseShape, DenseShape,
|
|
1263
|
+
ProductTag>::evalTo(dst, lhs, rhs);
|
|
1264
|
+
}
|
|
1265
|
+
};
|
|
1266
|
+
|
|
1267
|
+
template <typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
|
|
1268
|
+
struct generic_product_impl<Lhs, Rhs, MatrixShape, HomogeneousShape, ProductTag>
|
|
1269
|
+
: generic_product_impl<Lhs, typename Rhs::PlainObject, MatrixShape, DenseShape, ProductTag> {};
|
|
1270
|
+
|
|
1271
|
+
template <typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
|
|
1272
|
+
struct generic_product_impl<Lhs, Rhs, HomogeneousShape, MatrixShape, ProductTag>
|
|
1273
|
+
: generic_product_impl<typename Lhs::PlainObject, Rhs, DenseShape, MatrixShape, ProductTag> {};
|
|
1274
|
+
|
|
1275
|
+
template <typename Lhs, typename Rhs, int ProductTag>
|
|
1276
|
+
struct generic_product_impl<Lhs, Rhs, PermutationShape, HomogeneousShape, ProductTag>
|
|
1277
|
+
: generic_product_impl<Lhs, Rhs, PermutationShape, DenseShape, ProductTag> {};
|
|
1278
|
+
|
|
1279
|
+
template <typename Lhs, typename Rhs, int ProductTag>
|
|
1280
|
+
struct generic_product_impl<Lhs, Rhs, HomogeneousShape, PermutationShape, ProductTag>
|
|
1281
|
+
: generic_product_impl<Lhs, Rhs, DenseShape, PermutationShape, ProductTag> {};
|
|
1282
|
+
|
|
1283
|
+
} // end namespace internal
|
|
1176
1284
|
|
|
1177
|
-
}
|
|
1285
|
+
} // end namespace Eigen
|
|
1178
1286
|
|
|
1179
|
-
#endif
|
|
1287
|
+
#endif // EIGEN_PRODUCT_EVALUATORS_H
|