@smake/eigen 1.0.1 → 1.1.0
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/COPYING.APACHE +203 -0
- package/eigen/COPYING.BSD +1 -1
- package/eigen/COPYING.MINPACK +51 -52
- package/eigen/Eigen/Cholesky +0 -1
- package/eigen/Eigen/Core +108 -266
- package/eigen/Eigen/Eigenvalues +0 -1
- package/eigen/Eigen/Geometry +3 -6
- package/eigen/Eigen/Householder +0 -1
- package/eigen/Eigen/Jacobi +0 -1
- package/eigen/Eigen/KLUSupport +41 -0
- package/eigen/Eigen/LU +2 -5
- package/eigen/Eigen/OrderingMethods +0 -3
- package/eigen/Eigen/PaStiXSupport +1 -0
- package/eigen/Eigen/PardisoSupport +0 -0
- package/eigen/Eigen/QR +0 -1
- package/eigen/Eigen/QtAlignedMalloc +0 -1
- package/eigen/Eigen/SVD +0 -1
- package/eigen/Eigen/Sparse +0 -2
- package/eigen/Eigen/SparseCholesky +0 -8
- package/eigen/Eigen/SparseLU +4 -0
- package/eigen/Eigen/src/Cholesky/LDLT.h +42 -27
- package/eigen/Eigen/src/Cholesky/LLT.h +39 -23
- package/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +90 -47
- package/eigen/Eigen/src/Core/ArithmeticSequence.h +413 -0
- package/eigen/Eigen/src/Core/Array.h +99 -11
- package/eigen/Eigen/src/Core/ArrayBase.h +1 -1
- package/eigen/Eigen/src/Core/ArrayWrapper.h +21 -21
- package/eigen/Eigen/src/Core/Assign.h +1 -1
- package/eigen/Eigen/src/Core/AssignEvaluator.h +125 -50
- package/eigen/Eigen/src/Core/Assign_MKL.h +10 -10
- package/eigen/Eigen/src/Core/BandMatrix.h +16 -16
- package/eigen/Eigen/src/Core/Block.h +56 -60
- package/eigen/Eigen/src/Core/BooleanRedux.h +29 -31
- package/eigen/Eigen/src/Core/CommaInitializer.h +7 -3
- package/eigen/Eigen/src/Core/CoreEvaluators.h +325 -272
- package/eigen/Eigen/src/Core/CoreIterators.h +5 -0
- package/eigen/Eigen/src/Core/CwiseBinaryOp.h +21 -22
- package/eigen/Eigen/src/Core/CwiseNullaryOp.h +153 -18
- package/eigen/Eigen/src/Core/CwiseUnaryOp.h +6 -6
- package/eigen/Eigen/src/Core/CwiseUnaryView.h +12 -10
- package/eigen/Eigen/src/Core/DenseBase.h +128 -39
- package/eigen/Eigen/src/Core/DenseCoeffsBase.h +25 -21
- package/eigen/Eigen/src/Core/DenseStorage.h +150 -68
- package/eigen/Eigen/src/Core/Diagonal.h +21 -23
- package/eigen/Eigen/src/Core/DiagonalMatrix.h +50 -2
- package/eigen/Eigen/src/Core/DiagonalProduct.h +1 -1
- package/eigen/Eigen/src/Core/Dot.h +10 -10
- package/eigen/Eigen/src/Core/EigenBase.h +10 -9
- package/eigen/Eigen/src/Core/ForceAlignedAccess.h +8 -4
- package/eigen/Eigen/src/Core/Fuzzy.h +3 -3
- package/eigen/Eigen/src/Core/GeneralProduct.h +20 -10
- package/eigen/Eigen/src/Core/GenericPacketMath.h +597 -147
- package/eigen/Eigen/src/Core/GlobalFunctions.h +40 -33
- package/eigen/Eigen/src/Core/IO.h +40 -7
- package/eigen/Eigen/src/Core/IndexedView.h +237 -0
- package/eigen/Eigen/src/Core/Inverse.h +9 -10
- package/eigen/Eigen/src/Core/Map.h +7 -7
- package/eigen/Eigen/src/Core/MapBase.h +5 -3
- package/eigen/Eigen/src/Core/MathFunctions.h +756 -120
- package/eigen/Eigen/src/Core/MathFunctionsImpl.h +118 -19
- package/eigen/Eigen/src/Core/Matrix.h +131 -25
- package/eigen/Eigen/src/Core/MatrixBase.h +19 -2
- package/eigen/Eigen/src/Core/NestByValue.h +25 -50
- package/eigen/Eigen/src/Core/NoAlias.h +4 -3
- package/eigen/Eigen/src/Core/NumTraits.h +107 -20
- package/eigen/Eigen/src/Core/PartialReduxEvaluator.h +232 -0
- package/eigen/Eigen/src/Core/PermutationMatrix.h +3 -3
- package/eigen/Eigen/src/Core/PlainObjectBase.h +145 -54
- package/eigen/Eigen/src/Core/Product.h +30 -25
- package/eigen/Eigen/src/Core/ProductEvaluators.h +183 -142
- package/eigen/Eigen/src/Core/Random.h +37 -1
- package/eigen/Eigen/src/Core/Redux.h +180 -170
- package/eigen/Eigen/src/Core/Ref.h +118 -21
- package/eigen/Eigen/src/Core/Replicate.h +8 -8
- package/eigen/Eigen/src/Core/Reshaped.h +454 -0
- package/eigen/Eigen/src/Core/ReturnByValue.h +7 -5
- package/eigen/Eigen/src/Core/Reverse.h +18 -12
- package/eigen/Eigen/src/Core/Select.h +8 -6
- package/eigen/Eigen/src/Core/SelfAdjointView.h +33 -20
- package/eigen/Eigen/src/Core/Solve.h +14 -14
- package/eigen/Eigen/src/Core/SolveTriangular.h +13 -13
- package/eigen/Eigen/src/Core/SolverBase.h +41 -3
- package/eigen/Eigen/src/Core/StableNorm.h +100 -70
- package/eigen/Eigen/src/Core/StlIterators.h +463 -0
- package/eigen/Eigen/src/Core/Stride.h +9 -4
- package/eigen/Eigen/src/Core/Swap.h +5 -4
- package/eigen/Eigen/src/Core/Transpose.h +86 -27
- package/eigen/Eigen/src/Core/Transpositions.h +26 -8
- package/eigen/Eigen/src/Core/TriangularMatrix.h +88 -72
- package/eigen/Eigen/src/Core/VectorBlock.h +5 -5
- package/eigen/Eigen/src/Core/VectorwiseOp.h +159 -70
- package/eigen/Eigen/src/Core/Visitor.h +137 -29
- package/eigen/Eigen/src/Core/arch/AVX/Complex.h +50 -129
- package/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +126 -337
- package/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +1092 -155
- package/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +65 -1
- package/eigen/Eigen/src/Core/arch/AVX512/Complex.h +422 -0
- package/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +186 -213
- package/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +1250 -252
- package/eigen/Eigen/src/Core/arch/AVX512/TypeCasting.h +89 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +152 -165
- package/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +19 -251
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +2937 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +221 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +629 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h +2042 -392
- package/eigen/Eigen/src/Core/arch/CUDA/Complex.h +235 -80
- package/eigen/Eigen/src/Core/arch/Default/BFloat16.h +700 -0
- package/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +102 -14
- package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +1649 -0
- package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +110 -0
- package/eigen/Eigen/src/Core/arch/Default/Half.h +942 -0
- package/eigen/Eigen/src/Core/arch/Default/Settings.h +1 -1
- package/eigen/Eigen/src/Core/arch/Default/TypeCasting.h +120 -0
- package/eigen/Eigen/src/Core/arch/{CUDA → GPU}/MathFunctions.h +16 -4
- package/eigen/Eigen/src/Core/arch/GPU/PacketMath.h +1685 -0
- package/eigen/Eigen/src/Core/arch/GPU/TypeCasting.h +80 -0
- package/eigen/Eigen/src/Core/arch/HIP/hcc/math_constants.h +23 -0
- package/eigen/Eigen/src/Core/arch/MSA/Complex.h +648 -0
- package/eigen/Eigen/src/Core/arch/MSA/MathFunctions.h +387 -0
- package/eigen/Eigen/src/Core/arch/MSA/PacketMath.h +1233 -0
- package/eigen/Eigen/src/Core/arch/NEON/Complex.h +313 -219
- package/eigen/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +183 -0
- package/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +54 -70
- package/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +4376 -549
- package/eigen/Eigen/src/Core/arch/NEON/TypeCasting.h +1419 -0
- package/eigen/Eigen/src/Core/arch/SSE/Complex.h +59 -179
- package/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +65 -428
- package/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +893 -283
- package/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +65 -0
- package/eigen/Eigen/src/Core/arch/SVE/MathFunctions.h +44 -0
- package/eigen/Eigen/src/Core/arch/SVE/PacketMath.h +752 -0
- package/eigen/Eigen/src/Core/arch/SVE/TypeCasting.h +49 -0
- package/eigen/Eigen/src/Core/arch/SYCL/InteropHeaders.h +232 -0
- package/eigen/Eigen/src/Core/arch/SYCL/MathFunctions.h +301 -0
- package/eigen/Eigen/src/Core/arch/SYCL/PacketMath.h +670 -0
- package/eigen/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h +694 -0
- package/eigen/Eigen/src/Core/arch/SYCL/TypeCasting.h +85 -0
- package/eigen/Eigen/src/Core/arch/ZVector/Complex.h +212 -183
- package/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +101 -5
- package/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +510 -395
- package/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +11 -2
- package/eigen/Eigen/src/Core/functors/BinaryFunctors.h +112 -46
- package/eigen/Eigen/src/Core/functors/NullaryFunctors.h +31 -30
- package/eigen/Eigen/src/Core/functors/StlFunctors.h +32 -2
- package/eigen/Eigen/src/Core/functors/UnaryFunctors.h +354 -15
- package/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +1073 -585
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +29 -7
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +4 -4
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +1 -1
- package/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +382 -483
- package/eigen/Eigen/src/Core/products/Parallelizer.h +23 -9
- package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +23 -6
- package/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +8 -6
- package/eigen/Eigen/src/Core/products/SelfadjointProduct.h +2 -2
- package/eigen/Eigen/src/Core/products/SelfadjointRank2Update.h +5 -4
- package/eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h +3 -3
- package/eigen/Eigen/src/Core/products/TriangularSolverMatrix.h +5 -3
- package/eigen/Eigen/src/Core/products/TriangularSolverVector.h +13 -10
- package/eigen/Eigen/src/Core/util/BlasUtil.h +208 -124
- package/eigen/Eigen/src/Core/util/ConfigureVectorization.h +512 -0
- package/eigen/Eigen/src/Core/util/Constants.h +25 -9
- package/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +14 -2
- package/eigen/Eigen/src/Core/util/ForwardDeclarations.h +28 -4
- package/eigen/Eigen/src/Core/util/IndexedViewHelper.h +186 -0
- package/eigen/Eigen/src/Core/util/IntegralConstant.h +272 -0
- package/eigen/Eigen/src/Core/util/MKL_support.h +8 -1
- package/eigen/Eigen/src/Core/util/Macros.h +661 -250
- package/eigen/Eigen/src/Core/util/Memory.h +222 -52
- package/eigen/Eigen/src/Core/util/Meta.h +349 -105
- package/eigen/Eigen/src/Core/util/ReshapedHelper.h +51 -0
- package/eigen/Eigen/src/Core/util/StaticAssert.h +8 -5
- package/eigen/Eigen/src/Core/util/SymbolicIndex.h +293 -0
- package/eigen/Eigen/src/Core/util/XprHelper.h +48 -30
- package/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h +1 -1
- package/eigen/Eigen/src/Eigenvalues/ComplexSchur.h +1 -1
- package/eigen/Eigen/src/Eigenvalues/EigenSolver.h +2 -2
- package/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +1 -1
- package/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h +2 -2
- package/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +2 -2
- package/eigen/Eigen/src/Eigenvalues/RealQZ.h +9 -6
- package/eigen/Eigen/src/Eigenvalues/RealSchur.h +10 -5
- package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +75 -42
- package/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +20 -15
- package/eigen/Eigen/src/Geometry/AlignedBox.h +99 -5
- package/eigen/Eigen/src/Geometry/AngleAxis.h +4 -4
- package/eigen/Eigen/src/Geometry/EulerAngles.h +3 -3
- package/eigen/Eigen/src/Geometry/Homogeneous.h +15 -11
- package/eigen/Eigen/src/Geometry/Hyperplane.h +1 -1
- package/eigen/Eigen/src/Geometry/OrthoMethods.h +3 -2
- package/eigen/Eigen/src/Geometry/ParametrizedLine.h +39 -2
- package/eigen/Eigen/src/Geometry/Quaternion.h +52 -14
- package/eigen/Eigen/src/Geometry/Rotation2D.h +3 -3
- package/eigen/Eigen/src/Geometry/Scaling.h +22 -4
- package/eigen/Eigen/src/Geometry/Transform.h +86 -65
- package/eigen/Eigen/src/Geometry/Translation.h +6 -6
- package/eigen/Eigen/src/Geometry/arch/Geometry_SIMD.h +168 -0
- package/eigen/Eigen/src/Householder/BlockHouseholder.h +9 -2
- package/eigen/Eigen/src/Householder/Householder.h +8 -4
- package/eigen/Eigen/src/Householder/HouseholderSequence.h +123 -48
- package/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +15 -15
- package/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +7 -23
- package/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +5 -22
- package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +41 -47
- package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +51 -60
- package/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +70 -20
- package/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +2 -20
- package/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +11 -9
- package/eigen/Eigen/src/Jacobi/Jacobi.h +31 -10
- package/eigen/Eigen/src/KLUSupport/KLUSupport.h +358 -0
- package/eigen/Eigen/src/LU/Determinant.h +35 -19
- package/eigen/Eigen/src/LU/FullPivLU.h +29 -43
- package/eigen/Eigen/src/LU/InverseImpl.h +25 -8
- package/eigen/Eigen/src/LU/PartialPivLU.h +67 -57
- package/eigen/Eigen/src/LU/arch/InverseSize4.h +351 -0
- package/eigen/Eigen/src/OrderingMethods/Amd.h +7 -17
- package/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +297 -277
- package/eigen/Eigen/src/OrderingMethods/Ordering.h +6 -10
- package/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h +1 -1
- package/eigen/Eigen/src/PardisoSupport/PardisoSupport.h +10 -9
- package/eigen/Eigen/src/QR/ColPivHouseholderQR.h +41 -20
- package/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +100 -27
- package/eigen/Eigen/src/QR/FullPivHouseholderQR.h +59 -22
- package/eigen/Eigen/src/QR/HouseholderQR.h +48 -23
- package/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +25 -3
- package/eigen/Eigen/src/SVD/BDCSVD.h +137 -48
- package/eigen/Eigen/src/SVD/JacobiSVD.h +22 -14
- package/eigen/Eigen/src/SVD/SVDBase.h +82 -21
- package/eigen/Eigen/src/SVD/UpperBidiagonalization.h +3 -3
- package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +16 -8
- package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +11 -36
- package/eigen/Eigen/src/SparseCore/CompressedStorage.h +16 -0
- package/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +6 -6
- package/eigen/Eigen/src/SparseCore/SparseAssign.h +81 -27
- package/eigen/Eigen/src/SparseCore/SparseBlock.h +25 -57
- package/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +40 -11
- package/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +11 -15
- package/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +2 -2
- package/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +30 -8
- package/eigen/Eigen/src/SparseCore/SparseMatrix.h +124 -10
- package/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +5 -12
- package/eigen/Eigen/src/SparseCore/SparseProduct.h +13 -1
- package/eigen/Eigen/src/SparseCore/SparseRef.h +7 -7
- package/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h +3 -0
- package/eigen/Eigen/src/SparseCore/SparseUtil.h +8 -0
- package/eigen/Eigen/src/SparseCore/SparseVector.h +1 -1
- package/eigen/Eigen/src/SparseLU/SparseLU.h +160 -10
- package/eigen/Eigen/src/SparseLU/SparseLU_Memory.h +1 -1
- package/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +76 -2
- package/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +2 -2
- package/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +1 -1
- package/eigen/Eigen/src/SparseLU/SparseLU_panel_bmod.h +1 -1
- package/eigen/Eigen/src/SparseQR/SparseQR.h +19 -6
- package/eigen/Eigen/src/StlSupport/StdDeque.h +2 -14
- package/eigen/Eigen/src/StlSupport/StdList.h +2 -2
- package/eigen/Eigen/src/StlSupport/StdVector.h +2 -2
- package/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h +6 -8
- package/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h +175 -39
- package/eigen/Eigen/src/misc/lapacke.h +5 -4
- package/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h +27 -1
- package/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +155 -11
- package/eigen/Eigen/src/plugins/BlockMethods.h +626 -242
- package/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.h +14 -0
- package/eigen/Eigen/src/plugins/IndexedViewMethods.h +262 -0
- package/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +4 -4
- package/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +10 -0
- package/eigen/Eigen/src/plugins/ReshapedMethods.h +149 -0
- package/eigen/README.md +2 -0
- package/lib/LibEigen.d.ts +4 -0
- package/lib/LibEigen.js +14 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +7 -3
- package/package.json +2 -10
- package/eigen/Eigen/CMakeLists.txt +0 -19
- package/eigen/Eigen/src/Core/arch/CUDA/Half.h +0 -675
- package/eigen/Eigen/src/Core/arch/CUDA/PacketMath.h +0 -333
- package/eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h +0 -1124
- package/eigen/Eigen/src/Core/arch/CUDA/TypeCasting.h +0 -212
- package/eigen/Eigen/src/Geometry/arch/Geometry_SSE.h +0 -161
- package/eigen/Eigen/src/LU/arch/Inverse_SSE.h +0 -338
- package/lib/eigen.d.ts +0 -2
- package/lib/eigen.js +0 -15
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
#include <vector>
|
|
15
15
|
#include <list>
|
|
16
16
|
|
|
17
|
-
namespace Eigen {
|
|
18
|
-
/**
|
|
17
|
+
namespace Eigen {
|
|
18
|
+
/**
|
|
19
19
|
* \brief Modified Incomplete Cholesky with dual threshold
|
|
20
20
|
*
|
|
21
21
|
* References : C-J. Lin and J. J. Moré, Incomplete Cholesky Factorizations with
|
|
@@ -41,28 +41,22 @@ namespace Eigen {
|
|
|
41
41
|
* the info() method, then you can either increase the initial shift, or better use another preconditioning technique.
|
|
42
42
|
*
|
|
43
43
|
*/
|
|
44
|
-
template <typename Scalar, int _UpLo = Lower, typename _OrderingType =
|
|
45
|
-
#ifndef EIGEN_MPL2_ONLY
|
|
46
|
-
AMDOrdering<int>
|
|
47
|
-
#else
|
|
48
|
-
NaturalOrdering<int>
|
|
49
|
-
#endif
|
|
50
|
-
>
|
|
44
|
+
template <typename Scalar, int _UpLo = Lower, typename _OrderingType = AMDOrdering<int> >
|
|
51
45
|
class IncompleteCholesky : public SparseSolverBase<IncompleteCholesky<Scalar,_UpLo,_OrderingType> >
|
|
52
46
|
{
|
|
53
47
|
protected:
|
|
54
48
|
typedef SparseSolverBase<IncompleteCholesky<Scalar,_UpLo,_OrderingType> > Base;
|
|
55
49
|
using Base::m_isInitialized;
|
|
56
50
|
public:
|
|
57
|
-
typedef typename NumTraits<Scalar>::Real RealScalar;
|
|
51
|
+
typedef typename NumTraits<Scalar>::Real RealScalar;
|
|
58
52
|
typedef _OrderingType OrderingType;
|
|
59
53
|
typedef typename OrderingType::PermutationType PermutationType;
|
|
60
|
-
typedef typename PermutationType::StorageIndex StorageIndex;
|
|
54
|
+
typedef typename PermutationType::StorageIndex StorageIndex;
|
|
61
55
|
typedef SparseMatrix<Scalar,ColMajor,StorageIndex> FactorType;
|
|
62
56
|
typedef Matrix<Scalar,Dynamic,1> VectorSx;
|
|
63
57
|
typedef Matrix<RealScalar,Dynamic,1> VectorRx;
|
|
64
58
|
typedef Matrix<StorageIndex,Dynamic, 1> VectorIx;
|
|
65
|
-
typedef std::vector<std::list<StorageIndex> > VectorList;
|
|
59
|
+
typedef std::vector<std::list<StorageIndex> > VectorList;
|
|
66
60
|
enum { UpLo = _UpLo };
|
|
67
61
|
enum {
|
|
68
62
|
ColsAtCompileTime = Dynamic,
|
|
@@ -76,22 +70,22 @@ class IncompleteCholesky : public SparseSolverBase<IncompleteCholesky<Scalar,_Up
|
|
|
76
70
|
*
|
|
77
71
|
* \sa IncompleteCholesky(const MatrixType&)
|
|
78
72
|
*/
|
|
79
|
-
IncompleteCholesky() : m_initialShift(1e-3),m_factorizationIsOk(false) {}
|
|
80
|
-
|
|
73
|
+
IncompleteCholesky() : m_initialShift(1e-3),m_analysisIsOk(false),m_factorizationIsOk(false) {}
|
|
74
|
+
|
|
81
75
|
/** Constructor computing the incomplete factorization for the given matrix \a matrix.
|
|
82
76
|
*/
|
|
83
77
|
template<typename MatrixType>
|
|
84
|
-
IncompleteCholesky(const MatrixType& matrix) : m_initialShift(1e-3),m_factorizationIsOk(false)
|
|
78
|
+
IncompleteCholesky(const MatrixType& matrix) : m_initialShift(1e-3),m_analysisIsOk(false),m_factorizationIsOk(false)
|
|
85
79
|
{
|
|
86
80
|
compute(matrix);
|
|
87
81
|
}
|
|
88
|
-
|
|
82
|
+
|
|
89
83
|
/** \returns number of rows of the factored matrix */
|
|
90
|
-
Index rows() const { return m_L.rows(); }
|
|
91
|
-
|
|
84
|
+
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_L.rows(); }
|
|
85
|
+
|
|
92
86
|
/** \returns number of columns of the factored matrix */
|
|
93
|
-
Index cols() const { return m_L.cols(); }
|
|
94
|
-
|
|
87
|
+
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_L.cols(); }
|
|
88
|
+
|
|
95
89
|
|
|
96
90
|
/** \brief Reports whether previous computation was successful.
|
|
97
91
|
*
|
|
@@ -106,19 +100,19 @@ class IncompleteCholesky : public SparseSolverBase<IncompleteCholesky<Scalar,_Up
|
|
|
106
100
|
eigen_assert(m_isInitialized && "IncompleteCholesky is not initialized.");
|
|
107
101
|
return m_info;
|
|
108
102
|
}
|
|
109
|
-
|
|
103
|
+
|
|
110
104
|
/** \brief Set the initial shift parameter \f$ \sigma \f$.
|
|
111
105
|
*/
|
|
112
106
|
void setInitialShift(RealScalar shift) { m_initialShift = shift; }
|
|
113
|
-
|
|
107
|
+
|
|
114
108
|
/** \brief Computes the fill reducing permutation vector using the sparsity pattern of \a mat
|
|
115
109
|
*/
|
|
116
110
|
template<typename MatrixType>
|
|
117
111
|
void analyzePattern(const MatrixType& mat)
|
|
118
112
|
{
|
|
119
|
-
OrderingType ord;
|
|
113
|
+
OrderingType ord;
|
|
120
114
|
PermutationType pinv;
|
|
121
|
-
ord(mat.template selfadjointView<UpLo>(), pinv);
|
|
115
|
+
ord(mat.template selfadjointView<UpLo>(), pinv);
|
|
122
116
|
if(pinv.size()>0) m_perm = pinv.inverse();
|
|
123
117
|
else m_perm.resize(0);
|
|
124
118
|
m_L.resize(mat.rows(), mat.cols());
|
|
@@ -126,7 +120,7 @@ class IncompleteCholesky : public SparseSolverBase<IncompleteCholesky<Scalar,_Up
|
|
|
126
120
|
m_isInitialized = true;
|
|
127
121
|
m_info = Success;
|
|
128
122
|
}
|
|
129
|
-
|
|
123
|
+
|
|
130
124
|
/** \brief Performs the numerical factorization of the input matrix \a mat
|
|
131
125
|
*
|
|
132
126
|
* The method analyzePattern() or compute() must have been called beforehand
|
|
@@ -136,7 +130,7 @@ class IncompleteCholesky : public SparseSolverBase<IncompleteCholesky<Scalar,_Up
|
|
|
136
130
|
*/
|
|
137
131
|
template<typename MatrixType>
|
|
138
132
|
void factorize(const MatrixType& mat);
|
|
139
|
-
|
|
133
|
+
|
|
140
134
|
/** Computes or re-computes the incomplete Cholesky factorization of the input matrix \a mat
|
|
141
135
|
*
|
|
142
136
|
* It is a shortcut for a sequential call to the analyzePattern() and factorize() methods.
|
|
@@ -149,7 +143,7 @@ class IncompleteCholesky : public SparseSolverBase<IncompleteCholesky<Scalar,_Up
|
|
|
149
143
|
analyzePattern(mat);
|
|
150
144
|
factorize(mat);
|
|
151
145
|
}
|
|
152
|
-
|
|
146
|
+
|
|
153
147
|
// internal
|
|
154
148
|
template<typename Rhs, typename Dest>
|
|
155
149
|
void _solve_impl(const Rhs& b, Dest& x) const
|
|
@@ -176,16 +170,16 @@ class IncompleteCholesky : public SparseSolverBase<IncompleteCholesky<Scalar,_Up
|
|
|
176
170
|
|
|
177
171
|
protected:
|
|
178
172
|
FactorType m_L; // The lower part stored in CSC
|
|
179
|
-
VectorRx m_scale; // The vector for scaling the matrix
|
|
173
|
+
VectorRx m_scale; // The vector for scaling the matrix
|
|
180
174
|
RealScalar m_initialShift; // The initial shift parameter
|
|
181
|
-
bool m_analysisIsOk;
|
|
182
|
-
bool m_factorizationIsOk;
|
|
175
|
+
bool m_analysisIsOk;
|
|
176
|
+
bool m_factorizationIsOk;
|
|
183
177
|
ComputationInfo m_info;
|
|
184
|
-
PermutationType m_perm;
|
|
178
|
+
PermutationType m_perm;
|
|
185
179
|
|
|
186
180
|
private:
|
|
187
|
-
inline void updateList(Ref<const VectorIx> colPtr, Ref<VectorIx> rowIdx, Ref<VectorSx> vals, const Index& col, const Index& jk, VectorIx& firstElt, VectorList& listCol);
|
|
188
|
-
};
|
|
181
|
+
inline void updateList(Ref<const VectorIx> colPtr, Ref<VectorIx> rowIdx, Ref<VectorSx> vals, const Index& col, const Index& jk, VectorIx& firstElt, VectorList& listCol);
|
|
182
|
+
};
|
|
189
183
|
|
|
190
184
|
// Based on the following paper:
|
|
191
185
|
// C-J. Lin and J. J. Moré, Incomplete Cholesky Factorizations with
|
|
@@ -196,10 +190,10 @@ template<typename _MatrixType>
|
|
|
196
190
|
void IncompleteCholesky<Scalar,_UpLo, OrderingType>::factorize(const _MatrixType& mat)
|
|
197
191
|
{
|
|
198
192
|
using std::sqrt;
|
|
199
|
-
eigen_assert(m_analysisIsOk && "analyzePattern() should be called first");
|
|
200
|
-
|
|
193
|
+
eigen_assert(m_analysisIsOk && "analyzePattern() should be called first");
|
|
194
|
+
|
|
201
195
|
// Dropping strategy : Keep only the p largest elements per column, where p is the number of elements in the column of the original matrix. Other strategies will be added
|
|
202
|
-
|
|
196
|
+
|
|
203
197
|
// Apply the fill-reducing permutation computed in analyzePattern()
|
|
204
198
|
if (m_perm.rows() == mat.rows() ) // To detect the null permutation
|
|
205
199
|
{
|
|
@@ -212,8 +206,8 @@ void IncompleteCholesky<Scalar,_UpLo, OrderingType>::factorize(const _MatrixType
|
|
|
212
206
|
{
|
|
213
207
|
m_L.template selfadjointView<Lower>() = mat.template selfadjointView<_UpLo>();
|
|
214
208
|
}
|
|
215
|
-
|
|
216
|
-
Index n = m_L.cols();
|
|
209
|
+
|
|
210
|
+
Index n = m_L.cols();
|
|
217
211
|
Index nnz = m_L.nonZeros();
|
|
218
212
|
Map<VectorSx> vals(m_L.valuePtr(), nnz); //values
|
|
219
213
|
Map<VectorIx> rowIdx(m_L.innerIndexPtr(), nnz); //Row indices
|
|
@@ -225,9 +219,9 @@ void IncompleteCholesky<Scalar,_UpLo, OrderingType>::factorize(const _MatrixType
|
|
|
225
219
|
VectorIx col_pattern(n);
|
|
226
220
|
col_pattern.fill(-1);
|
|
227
221
|
StorageIndex col_nnz;
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
// Computes the scaling factors
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
// Computes the scaling factors
|
|
231
225
|
m_scale.resize(n);
|
|
232
226
|
m_scale.setZero();
|
|
233
227
|
for (Index j = 0; j < n; j++)
|
|
@@ -237,7 +231,7 @@ void IncompleteCholesky<Scalar,_UpLo, OrderingType>::factorize(const _MatrixType
|
|
|
237
231
|
if(rowIdx[k]!=j)
|
|
238
232
|
m_scale(rowIdx[k]) += numext::abs2(vals(k));
|
|
239
233
|
}
|
|
240
|
-
|
|
234
|
+
|
|
241
235
|
m_scale = m_scale.cwiseSqrt().cwiseSqrt();
|
|
242
236
|
|
|
243
237
|
for (Index j = 0; j < n; ++j)
|
|
@@ -247,8 +241,8 @@ void IncompleteCholesky<Scalar,_UpLo, OrderingType>::factorize(const _MatrixType
|
|
|
247
241
|
m_scale(j) = 1;
|
|
248
242
|
|
|
249
243
|
// TODO disable scaling if not needed, i.e., if it is roughly uniform? (this will make solve() faster)
|
|
250
|
-
|
|
251
|
-
// Scale and compute the shift for the matrix
|
|
244
|
+
|
|
245
|
+
// Scale and compute the shift for the matrix
|
|
252
246
|
RealScalar mindiag = NumTraits<RealScalar>::highest();
|
|
253
247
|
for (Index j = 0; j < n; j++)
|
|
254
248
|
{
|
|
@@ -259,7 +253,7 @@ void IncompleteCholesky<Scalar,_UpLo, OrderingType>::factorize(const _MatrixType
|
|
|
259
253
|
}
|
|
260
254
|
|
|
261
255
|
FactorType L_save = m_L;
|
|
262
|
-
|
|
256
|
+
|
|
263
257
|
RealScalar shift = 0;
|
|
264
258
|
if(mindiag <= RealScalar(0.))
|
|
265
259
|
shift = m_initialShift - mindiag;
|
|
@@ -381,7 +375,7 @@ inline void IncompleteCholesky<Scalar,_UpLo, OrderingType>::updateList(Ref<const
|
|
|
381
375
|
if (jk < colPtr(col+1) )
|
|
382
376
|
{
|
|
383
377
|
Index p = colPtr(col+1) - jk;
|
|
384
|
-
Index minpos;
|
|
378
|
+
Index minpos;
|
|
385
379
|
rowIdx.segment(jk,p).minCoeff(&minpos);
|
|
386
380
|
minpos += jk;
|
|
387
381
|
if (rowIdx(minpos) != rowIdx(jk))
|
|
@@ -395,6 +389,6 @@ inline void IncompleteCholesky<Scalar,_UpLo, OrderingType>::updateList(Ref<const
|
|
|
395
389
|
}
|
|
396
390
|
}
|
|
397
391
|
|
|
398
|
-
} // end namespace Eigen
|
|
392
|
+
} // end namespace Eigen
|
|
399
393
|
|
|
400
394
|
#endif
|
|
@@ -12,19 +12,19 @@
|
|
|
12
12
|
#define EIGEN_INCOMPLETE_LUT_H
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
namespace Eigen {
|
|
15
|
+
namespace Eigen {
|
|
16
16
|
|
|
17
17
|
namespace internal {
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
/** \internal
|
|
20
|
-
* Compute a quick-sort split of a vector
|
|
20
|
+
* Compute a quick-sort split of a vector
|
|
21
21
|
* On output, the vector row is permuted such that its elements satisfy
|
|
22
22
|
* abs(row(i)) >= abs(row(ncut)) if i<ncut
|
|
23
|
-
* abs(row(i)) <= abs(row(ncut)) if i>ncut
|
|
23
|
+
* abs(row(i)) <= abs(row(ncut)) if i>ncut
|
|
24
24
|
* \param row The vector of values
|
|
25
25
|
* \param ind The array of index for the elements in @p row
|
|
26
26
|
* \param ncut The number of largest elements to keep
|
|
27
|
-
**/
|
|
27
|
+
**/
|
|
28
28
|
template <typename VectorV, typename VectorI>
|
|
29
29
|
Index QuickSplit(VectorV &row, VectorI &ind, Index ncut)
|
|
30
30
|
{
|
|
@@ -34,15 +34,15 @@ Index QuickSplit(VectorV &row, VectorI &ind, Index ncut)
|
|
|
34
34
|
Index mid;
|
|
35
35
|
Index n = row.size(); /* length of the vector */
|
|
36
36
|
Index first, last ;
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
ncut--; /* to fit the zero-based indices */
|
|
39
|
-
first = 0;
|
|
40
|
-
last = n-1;
|
|
39
|
+
first = 0;
|
|
40
|
+
last = n-1;
|
|
41
41
|
if (ncut < first || ncut > last ) return 0;
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
do {
|
|
44
|
-
mid = first;
|
|
45
|
-
RealScalar abskey = abs(row(mid));
|
|
44
|
+
mid = first;
|
|
45
|
+
RealScalar abskey = abs(row(mid));
|
|
46
46
|
for (Index j = first + 1; j <= last; j++) {
|
|
47
47
|
if ( abs(row(j)) > abskey) {
|
|
48
48
|
++mid;
|
|
@@ -53,12 +53,12 @@ Index QuickSplit(VectorV &row, VectorI &ind, Index ncut)
|
|
|
53
53
|
/* Interchange for the pivot element */
|
|
54
54
|
swap(row(mid), row(first));
|
|
55
55
|
swap(ind(mid), ind(first));
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
if (mid > ncut) last = mid - 1;
|
|
58
|
-
else if (mid < ncut ) first = mid + 1;
|
|
58
|
+
else if (mid < ncut ) first = mid + 1;
|
|
59
59
|
} while (mid != ncut );
|
|
60
|
-
|
|
61
|
-
return 0; /* mid is equal to ncut */
|
|
60
|
+
|
|
61
|
+
return 0; /* mid is equal to ncut */
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
}// end namespace internal
|
|
@@ -71,23 +71,23 @@ Index QuickSplit(VectorV &row, VectorI &ind, Index ncut)
|
|
|
71
71
|
*
|
|
72
72
|
* During the numerical factorization, two dropping rules are used :
|
|
73
73
|
* 1) any element whose magnitude is less than some tolerance is dropped.
|
|
74
|
-
* This tolerance is obtained by multiplying the input tolerance @p droptol
|
|
74
|
+
* This tolerance is obtained by multiplying the input tolerance @p droptol
|
|
75
75
|
* by the average magnitude of all the original elements in the current row.
|
|
76
|
-
* 2) After the elimination of the row, only the @p fill largest elements in
|
|
77
|
-
* the L part and the @p fill largest elements in the U part are kept
|
|
78
|
-
* (in addition to the diagonal element ). Note that @p fill is computed from
|
|
79
|
-
* the input parameter @p fillfactor which is used the ratio to control the fill_in
|
|
76
|
+
* 2) After the elimination of the row, only the @p fill largest elements in
|
|
77
|
+
* the L part and the @p fill largest elements in the U part are kept
|
|
78
|
+
* (in addition to the diagonal element ). Note that @p fill is computed from
|
|
79
|
+
* the input parameter @p fillfactor which is used the ratio to control the fill_in
|
|
80
80
|
* relatively to the initial number of nonzero elements.
|
|
81
|
-
*
|
|
81
|
+
*
|
|
82
82
|
* The two extreme cases are when @p droptol=0 (to keep all the @p fill*2 largest elements)
|
|
83
|
-
* and when @p fill=n/2 with @p droptol being different to zero.
|
|
84
|
-
*
|
|
85
|
-
* References : Yousef Saad, ILUT: A dual threshold incomplete LU factorization,
|
|
83
|
+
* and when @p fill=n/2 with @p droptol being different to zero.
|
|
84
|
+
*
|
|
85
|
+
* References : Yousef Saad, ILUT: A dual threshold incomplete LU factorization,
|
|
86
86
|
* Numerical Linear Algebra with Applications, 1(4), pp 387-402, 1994.
|
|
87
|
-
*
|
|
87
|
+
*
|
|
88
88
|
* NOTE : The following implementation is derived from the ILUT implementation
|
|
89
|
-
* in the SPARSKIT package, Copyright (C) 2005, the Regents of the University of Minnesota
|
|
90
|
-
* released under the terms of the GNU LGPL:
|
|
89
|
+
* in the SPARSKIT package, Copyright (C) 2005, the Regents of the University of Minnesota
|
|
90
|
+
* released under the terms of the GNU LGPL:
|
|
91
91
|
* http://www-users.cs.umn.edu/~saad/software/SPARSKIT/README
|
|
92
92
|
* However, Yousef Saad gave us permission to relicense his ILUT code to MPL2.
|
|
93
93
|
* See the Eigen mailing list archive, thread: ILUT, date: July 8, 2012:
|
|
@@ -115,28 +115,28 @@ class IncompleteLUT : public SparseSolverBase<IncompleteLUT<_Scalar, _StorageInd
|
|
|
115
115
|
};
|
|
116
116
|
|
|
117
117
|
public:
|
|
118
|
-
|
|
118
|
+
|
|
119
119
|
IncompleteLUT()
|
|
120
120
|
: m_droptol(NumTraits<Scalar>::dummy_precision()), m_fillfactor(10),
|
|
121
121
|
m_analysisIsOk(false), m_factorizationIsOk(false)
|
|
122
122
|
{}
|
|
123
|
-
|
|
123
|
+
|
|
124
124
|
template<typename MatrixType>
|
|
125
125
|
explicit IncompleteLUT(const MatrixType& mat, const RealScalar& droptol=NumTraits<Scalar>::dummy_precision(), int fillfactor = 10)
|
|
126
126
|
: m_droptol(droptol),m_fillfactor(fillfactor),
|
|
127
127
|
m_analysisIsOk(false),m_factorizationIsOk(false)
|
|
128
128
|
{
|
|
129
129
|
eigen_assert(fillfactor != 0);
|
|
130
|
-
compute(mat);
|
|
130
|
+
compute(mat);
|
|
131
131
|
}
|
|
132
|
-
|
|
133
|
-
Index rows() const { return m_lu.rows(); }
|
|
134
|
-
|
|
135
|
-
Index cols() const { return m_lu.cols(); }
|
|
132
|
+
|
|
133
|
+
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_lu.rows(); }
|
|
134
|
+
|
|
135
|
+
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_lu.cols(); }
|
|
136
136
|
|
|
137
137
|
/** \brief Reports whether previous computation was successful.
|
|
138
138
|
*
|
|
139
|
-
* \returns \c Success if computation was
|
|
139
|
+
* \returns \c Success if computation was successful,
|
|
140
140
|
* \c NumericalIssue if the matrix.appears to be negative.
|
|
141
141
|
*/
|
|
142
142
|
ComputationInfo info() const
|
|
@@ -144,36 +144,36 @@ class IncompleteLUT : public SparseSolverBase<IncompleteLUT<_Scalar, _StorageInd
|
|
|
144
144
|
eigen_assert(m_isInitialized && "IncompleteLUT is not initialized.");
|
|
145
145
|
return m_info;
|
|
146
146
|
}
|
|
147
|
-
|
|
147
|
+
|
|
148
148
|
template<typename MatrixType>
|
|
149
149
|
void analyzePattern(const MatrixType& amat);
|
|
150
|
-
|
|
150
|
+
|
|
151
151
|
template<typename MatrixType>
|
|
152
152
|
void factorize(const MatrixType& amat);
|
|
153
|
-
|
|
153
|
+
|
|
154
154
|
/**
|
|
155
155
|
* Compute an incomplete LU factorization with dual threshold on the matrix mat
|
|
156
156
|
* No pivoting is done in this version
|
|
157
|
-
*
|
|
157
|
+
*
|
|
158
158
|
**/
|
|
159
159
|
template<typename MatrixType>
|
|
160
160
|
IncompleteLUT& compute(const MatrixType& amat)
|
|
161
161
|
{
|
|
162
|
-
analyzePattern(amat);
|
|
162
|
+
analyzePattern(amat);
|
|
163
163
|
factorize(amat);
|
|
164
164
|
return *this;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
void setDroptol(const RealScalar& droptol);
|
|
168
|
-
void setFillfactor(int fillfactor);
|
|
169
|
-
|
|
167
|
+
void setDroptol(const RealScalar& droptol);
|
|
168
|
+
void setFillfactor(int fillfactor);
|
|
169
|
+
|
|
170
170
|
template<typename Rhs, typename Dest>
|
|
171
171
|
void _solve_impl(const Rhs& b, Dest& x) const
|
|
172
172
|
{
|
|
173
173
|
x = m_Pinv * b;
|
|
174
174
|
x = m_lu.template triangularView<UnitLower>().solve(x);
|
|
175
175
|
x = m_lu.template triangularView<Upper>().solve(x);
|
|
176
|
-
x = m_P * x;
|
|
176
|
+
x = m_P * x;
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
protected:
|
|
@@ -200,22 +200,22 @@ protected:
|
|
|
200
200
|
|
|
201
201
|
/**
|
|
202
202
|
* Set control parameter droptol
|
|
203
|
-
* \param droptol Drop any element whose magnitude is less than this tolerance
|
|
204
|
-
**/
|
|
203
|
+
* \param droptol Drop any element whose magnitude is less than this tolerance
|
|
204
|
+
**/
|
|
205
205
|
template<typename Scalar, typename StorageIndex>
|
|
206
206
|
void IncompleteLUT<Scalar,StorageIndex>::setDroptol(const RealScalar& droptol)
|
|
207
207
|
{
|
|
208
|
-
this->m_droptol = droptol;
|
|
208
|
+
this->m_droptol = droptol;
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
/**
|
|
212
212
|
* Set control parameter fillfactor
|
|
213
|
-
* \param fillfactor This is used to compute the number @p fill_in of largest elements to keep on each row.
|
|
214
|
-
**/
|
|
213
|
+
* \param fillfactor This is used to compute the number @p fill_in of largest elements to keep on each row.
|
|
214
|
+
**/
|
|
215
215
|
template<typename Scalar, typename StorageIndex>
|
|
216
216
|
void IncompleteLUT<Scalar,StorageIndex>::setFillfactor(int fillfactor)
|
|
217
217
|
{
|
|
218
|
-
this->m_fillfactor = fillfactor;
|
|
218
|
+
this->m_fillfactor = fillfactor;
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
template <typename Scalar, typename StorageIndex>
|
|
@@ -225,24 +225,15 @@ void IncompleteLUT<Scalar,StorageIndex>::analyzePattern(const _MatrixType& amat)
|
|
|
225
225
|
// Compute the Fill-reducing permutation
|
|
226
226
|
// Since ILUT does not perform any numerical pivoting,
|
|
227
227
|
// it is highly preferable to keep the diagonal through symmetric permutations.
|
|
228
|
-
#ifndef EIGEN_MPL2_ONLY
|
|
229
228
|
// To this end, let's symmetrize the pattern and perform AMD on it.
|
|
230
229
|
SparseMatrix<Scalar,ColMajor, StorageIndex> mat1 = amat;
|
|
231
230
|
SparseMatrix<Scalar,ColMajor, StorageIndex> mat2 = amat.transpose();
|
|
232
231
|
// FIXME for a matrix with nearly symmetric pattern, mat2+mat1 is the appropriate choice.
|
|
233
|
-
// on the other hand for a really non-symmetric pattern, mat2*mat1 should be
|
|
232
|
+
// on the other hand for a really non-symmetric pattern, mat2*mat1 should be preferred...
|
|
234
233
|
SparseMatrix<Scalar,ColMajor, StorageIndex> AtA = mat2 + mat1;
|
|
235
234
|
AMDOrdering<StorageIndex> ordering;
|
|
236
235
|
ordering(AtA,m_P);
|
|
237
236
|
m_Pinv = m_P.inverse(); // cache the inverse permutation
|
|
238
|
-
#else
|
|
239
|
-
// If AMD is not available, (MPL2-only), then let's use the slower COLAMD routine.
|
|
240
|
-
SparseMatrix<Scalar,ColMajor, StorageIndex> mat1 = amat;
|
|
241
|
-
COLAMDOrdering<StorageIndex> ordering;
|
|
242
|
-
ordering(mat1,m_Pinv);
|
|
243
|
-
m_P = m_Pinv.inverse();
|
|
244
|
-
#endif
|
|
245
|
-
|
|
246
237
|
m_analysisIsOk = true;
|
|
247
238
|
m_factorizationIsOk = false;
|
|
248
239
|
m_isInitialized = true;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
#ifndef EIGEN_ITERATIVE_SOLVER_BASE_H
|
|
11
11
|
#define EIGEN_ITERATIVE_SOLVER_BASE_H
|
|
12
12
|
|
|
13
|
-
namespace Eigen {
|
|
13
|
+
namespace Eigen {
|
|
14
14
|
|
|
15
15
|
namespace internal {
|
|
16
16
|
|
|
@@ -145,7 +145,7 @@ class IterativeSolverBase : public SparseSolverBase<Derived>
|
|
|
145
145
|
protected:
|
|
146
146
|
typedef SparseSolverBase<Derived> Base;
|
|
147
147
|
using Base::m_isInitialized;
|
|
148
|
-
|
|
148
|
+
|
|
149
149
|
public:
|
|
150
150
|
typedef typename internal::traits<Derived>::MatrixType MatrixType;
|
|
151
151
|
typedef typename internal::traits<Derived>::Preconditioner Preconditioner;
|
|
@@ -169,10 +169,10 @@ public:
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
/** Initialize the solver with matrix \a A for further \c Ax=b solving.
|
|
172
|
-
*
|
|
172
|
+
*
|
|
173
173
|
* This constructor is a shortcut for the default constructor followed
|
|
174
174
|
* by a call to compute().
|
|
175
|
-
*
|
|
175
|
+
*
|
|
176
176
|
* \warning this class stores a reference to the matrix A as well as some
|
|
177
177
|
* precomputed values that depend on it. Therefore, if \a A is changed
|
|
178
178
|
* this class becomes invalid. Call compute() to update it with the new
|
|
@@ -187,7 +187,7 @@ public:
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
~IterativeSolverBase() {}
|
|
190
|
-
|
|
190
|
+
|
|
191
191
|
/** Initializes the iterative solver for the sparsity pattern of the matrix \a A for further solving \c Ax=b problems.
|
|
192
192
|
*
|
|
193
193
|
* Currently, this function mostly calls analyzePattern on the preconditioner. In the future
|
|
@@ -203,7 +203,7 @@ public:
|
|
|
203
203
|
m_info = m_preconditioner.info();
|
|
204
204
|
return derived();
|
|
205
205
|
}
|
|
206
|
-
|
|
206
|
+
|
|
207
207
|
/** Initializes the iterative solver with the numerical values of the matrix \a A for further solving \c Ax=b problems.
|
|
208
208
|
*
|
|
209
209
|
* Currently, this function mostly calls factorize on the preconditioner.
|
|
@@ -216,7 +216,7 @@ public:
|
|
|
216
216
|
template<typename MatrixDerived>
|
|
217
217
|
Derived& factorize(const EigenBase<MatrixDerived>& A)
|
|
218
218
|
{
|
|
219
|
-
eigen_assert(m_analysisIsOk && "You must first call analyzePattern()");
|
|
219
|
+
eigen_assert(m_analysisIsOk && "You must first call analyzePattern()");
|
|
220
220
|
grab(A.derived());
|
|
221
221
|
m_preconditioner.factorize(matrix());
|
|
222
222
|
m_factorizationIsOk = true;
|
|
@@ -247,16 +247,16 @@ public:
|
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
/** \internal */
|
|
250
|
-
Index rows() const { return matrix().rows(); }
|
|
250
|
+
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return matrix().rows(); }
|
|
251
251
|
|
|
252
252
|
/** \internal */
|
|
253
|
-
Index cols() const { return matrix().cols(); }
|
|
253
|
+
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return matrix().cols(); }
|
|
254
254
|
|
|
255
255
|
/** \returns the tolerance threshold used by the stopping criteria.
|
|
256
256
|
* \sa setTolerance()
|
|
257
257
|
*/
|
|
258
258
|
RealScalar tolerance() const { return m_tolerance; }
|
|
259
|
-
|
|
259
|
+
|
|
260
260
|
/** Sets the tolerance threshold used by the stopping criteria.
|
|
261
261
|
*
|
|
262
262
|
* This value is used as an upper bound to the relative residual error: |Ax-b|/|b|.
|
|
@@ -270,19 +270,19 @@ public:
|
|
|
270
270
|
|
|
271
271
|
/** \returns a read-write reference to the preconditioner for custom configuration. */
|
|
272
272
|
Preconditioner& preconditioner() { return m_preconditioner; }
|
|
273
|
-
|
|
273
|
+
|
|
274
274
|
/** \returns a read-only reference to the preconditioner. */
|
|
275
275
|
const Preconditioner& preconditioner() const { return m_preconditioner; }
|
|
276
276
|
|
|
277
277
|
/** \returns the max number of iterations.
|
|
278
|
-
* It is either the value
|
|
278
|
+
* It is either the value set by setMaxIterations or, by default,
|
|
279
279
|
* twice the number of columns of the matrix.
|
|
280
280
|
*/
|
|
281
281
|
Index maxIterations() const
|
|
282
282
|
{
|
|
283
283
|
return (m_maxIterations<0) ? 2*matrix().cols() : m_maxIterations;
|
|
284
284
|
}
|
|
285
|
-
|
|
285
|
+
|
|
286
286
|
/** Sets the max number of iterations.
|
|
287
287
|
* Default is twice the number of columns of the matrix.
|
|
288
288
|
*/
|
|
@@ -328,13 +328,13 @@ public:
|
|
|
328
328
|
eigen_assert(m_isInitialized && "IterativeSolverBase is not initialized.");
|
|
329
329
|
return m_info;
|
|
330
330
|
}
|
|
331
|
-
|
|
331
|
+
|
|
332
332
|
/** \internal */
|
|
333
333
|
template<typename Rhs, typename DestDerived>
|
|
334
|
-
void
|
|
334
|
+
void _solve_with_guess_impl(const Rhs& b, SparseMatrixBase<DestDerived> &aDest) const
|
|
335
335
|
{
|
|
336
336
|
eigen_assert(rows()==b.rows());
|
|
337
|
-
|
|
337
|
+
|
|
338
338
|
Index rhsCols = b.cols();
|
|
339
339
|
Index size = b.rows();
|
|
340
340
|
DestDerived& dest(aDest.derived());
|
|
@@ -344,15 +344,65 @@ public:
|
|
|
344
344
|
// We do not directly fill dest because sparse expressions have to be free of aliasing issue.
|
|
345
345
|
// For non square least-square problems, b and dest might not have the same size whereas they might alias each-other.
|
|
346
346
|
typename DestDerived::PlainObject tmp(cols(),rhsCols);
|
|
347
|
+
ComputationInfo global_info = Success;
|
|
347
348
|
for(Index k=0; k<rhsCols; ++k)
|
|
348
349
|
{
|
|
349
350
|
tb = b.col(k);
|
|
350
|
-
tx =
|
|
351
|
+
tx = dest.col(k);
|
|
352
|
+
derived()._solve_vector_with_guess_impl(tb,tx);
|
|
351
353
|
tmp.col(k) = tx.sparseView(0);
|
|
354
|
+
|
|
355
|
+
// The call to _solve_vector_with_guess_impl updates m_info, so if it failed for a previous column
|
|
356
|
+
// we need to restore it to the worst value.
|
|
357
|
+
if(m_info==NumericalIssue)
|
|
358
|
+
global_info = NumericalIssue;
|
|
359
|
+
else if(m_info==NoConvergence)
|
|
360
|
+
global_info = NoConvergence;
|
|
352
361
|
}
|
|
362
|
+
m_info = global_info;
|
|
353
363
|
dest.swap(tmp);
|
|
354
364
|
}
|
|
355
365
|
|
|
366
|
+
template<typename Rhs, typename DestDerived>
|
|
367
|
+
typename internal::enable_if<Rhs::ColsAtCompileTime!=1 && DestDerived::ColsAtCompileTime!=1>::type
|
|
368
|
+
_solve_with_guess_impl(const Rhs& b, MatrixBase<DestDerived> &aDest) const
|
|
369
|
+
{
|
|
370
|
+
eigen_assert(rows()==b.rows());
|
|
371
|
+
|
|
372
|
+
Index rhsCols = b.cols();
|
|
373
|
+
DestDerived& dest(aDest.derived());
|
|
374
|
+
ComputationInfo global_info = Success;
|
|
375
|
+
for(Index k=0; k<rhsCols; ++k)
|
|
376
|
+
{
|
|
377
|
+
typename DestDerived::ColXpr xk(dest,k);
|
|
378
|
+
typename Rhs::ConstColXpr bk(b,k);
|
|
379
|
+
derived()._solve_vector_with_guess_impl(bk,xk);
|
|
380
|
+
|
|
381
|
+
// The call to _solve_vector_with_guess updates m_info, so if it failed for a previous column
|
|
382
|
+
// we need to restore it to the worst value.
|
|
383
|
+
if(m_info==NumericalIssue)
|
|
384
|
+
global_info = NumericalIssue;
|
|
385
|
+
else if(m_info==NoConvergence)
|
|
386
|
+
global_info = NoConvergence;
|
|
387
|
+
}
|
|
388
|
+
m_info = global_info;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
template<typename Rhs, typename DestDerived>
|
|
392
|
+
typename internal::enable_if<Rhs::ColsAtCompileTime==1 || DestDerived::ColsAtCompileTime==1>::type
|
|
393
|
+
_solve_with_guess_impl(const Rhs& b, MatrixBase<DestDerived> &dest) const
|
|
394
|
+
{
|
|
395
|
+
derived()._solve_vector_with_guess_impl(b,dest.derived());
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/** \internal default initial guess = 0 */
|
|
399
|
+
template<typename Rhs,typename Dest>
|
|
400
|
+
void _solve_impl(const Rhs& b, Dest& x) const
|
|
401
|
+
{
|
|
402
|
+
x.setZero();
|
|
403
|
+
derived()._solve_with_guess_impl(b,x);
|
|
404
|
+
}
|
|
405
|
+
|
|
356
406
|
protected:
|
|
357
407
|
void init()
|
|
358
408
|
{
|
|
@@ -370,19 +420,19 @@ protected:
|
|
|
370
420
|
{
|
|
371
421
|
return m_matrixWrapper.matrix();
|
|
372
422
|
}
|
|
373
|
-
|
|
423
|
+
|
|
374
424
|
template<typename InputType>
|
|
375
425
|
void grab(const InputType &A)
|
|
376
426
|
{
|
|
377
427
|
m_matrixWrapper.grab(A);
|
|
378
428
|
}
|
|
379
|
-
|
|
429
|
+
|
|
380
430
|
MatrixWrapper m_matrixWrapper;
|
|
381
431
|
Preconditioner m_preconditioner;
|
|
382
432
|
|
|
383
433
|
Index m_maxIterations;
|
|
384
434
|
RealScalar m_tolerance;
|
|
385
|
-
|
|
435
|
+
|
|
386
436
|
mutable RealScalar m_error;
|
|
387
437
|
mutable Index m_iterations;
|
|
388
438
|
mutable ComputationInfo m_info;
|