![]() |
Prusa Slicer 2.6.0
|
Sparse supernodal LU factorization for general matrices. More...
#include <src/eigen/Eigen/src/SparseLU/SparseLU.h>
Inheritance diagram for Eigen::SparseLU< _MatrixType, _OrderingType >:
Collaboration diagram for Eigen::SparseLU< _MatrixType, _OrderingType >:Protected Types | |
| typedef SparseSolverBase< SparseLU< _MatrixType, _OrderingType > > | APIBase |
Protected Member Functions | |
| void | initperfvalues () |
| Index | expand (VectorType &vec, Index &length, Index nbElts, Index keep_prev, Index &num_expansions) |
| Index | memInit (Index m, Index n, Index annz, Index lwork, Index fillratio, Index panel_size, GlobalLU_t &glu) |
| Allocate various working space for the numerical factorization phase. | |
| Index | memXpand (VectorType &vec, Index &maxlen, Index nbElts, MemType memtype, Index &num_expansions) |
| Expand the existing storage. | |
| void | heap_relax_snode (const Index n, IndexVector &et, const Index relax_columns, IndexVector &descendants, IndexVector &relax_end) |
| Identify the initial relaxed supernodes. | |
| void | relax_snode (const Index n, IndexVector &et, const Index relax_columns, IndexVector &descendants, IndexVector &relax_end) |
| Identify the initial relaxed supernodes. | |
| Index | snode_dfs (const Index jcol, const Index kcol, const MatrixType &mat, IndexVector &xprune, IndexVector &marker, GlobalLU_t &glu) |
| Index | snode_bmod (const Index jcol, const Index fsupc, ScalarVector &dense, GlobalLU_t &glu) |
| Index | pivotL (const Index jcol, const RealScalar &diagpivotthresh, IndexVector &perm_r, IndexVector &iperm_c, Index &pivrow, GlobalLU_t &glu) |
| Performs the numerical pivotin on the current column of L, and the CDIV operation. | |
| void | dfs_kernel (const _MatrixType::StorageIndex jj, IndexVector &perm_r, Index &nseg, IndexVector &panel_lsub, IndexVector &segrep, Ref< IndexVector > repfnz_col, IndexVector &xprune, Ref< IndexVector > marker, IndexVector &parent, IndexVector &xplore, GlobalLU_t &glu, Index &nextl_col, Index krow, Traits &traits) |
| void | panel_dfs (const Index m, const Index w, const Index jcol, MatrixType &A, IndexVector &perm_r, Index &nseg, ScalarVector &dense, IndexVector &panel_lsub, IndexVector &segrep, IndexVector &repfnz, IndexVector &xprune, IndexVector &marker, IndexVector &parent, IndexVector &xplore, GlobalLU_t &glu) |
| Performs a symbolic factorization on a panel of columns [jcol, jcol+w) | |
| void | panel_bmod (const Index m, const Index w, const Index jcol, const Index nseg, ScalarVector &dense, ScalarVector &tempv, IndexVector &segrep, IndexVector &repfnz, GlobalLU_t &glu) |
| Performs numeric block updates (sup-panel) in topological order. | |
| Index | column_dfs (const Index m, const Index jcol, IndexVector &perm_r, Index maxsuper, Index &nseg, BlockIndexVector lsub_col, IndexVector &segrep, BlockIndexVector repfnz, IndexVector &xprune, IndexVector &marker, IndexVector &parent, IndexVector &xplore, GlobalLU_t &glu) |
| Performs a symbolic factorization on column jcol and decide the supernode boundary. | |
| Index | column_bmod (const Index jcol, const Index nseg, BlockScalarVector dense, ScalarVector &tempv, BlockIndexVector segrep, BlockIndexVector repfnz, Index fpanelc, GlobalLU_t &glu) |
| Performs numeric block updates (sup-col) in topological order. | |
| Index | copy_to_ucol (const Index jcol, const Index nseg, IndexVector &segrep, BlockIndexVector repfnz, IndexVector &perm_r, BlockScalarVector dense, GlobalLU_t &glu) |
| Performs numeric block updates (sup-col) in topological order. | |
| void | pruneL (const Index jcol, const IndexVector &perm_r, const Index pivrow, const Index nseg, const IndexVector &segrep, BlockIndexVector repfnz, IndexVector &xprune, GlobalLU_t &glu) |
| Prunes the L-structure. | |
| void | countnz (const Index n, Index &nnzL, Index &nnzU, GlobalLU_t &glu) |
| Count Nonzero elements in the factors. | |
| void | fixupL (const Index n, const IndexVector &perm_r, GlobalLU_t &glu) |
| Fix up the data storage lsub for L-subscripts. | |
Protected Attributes | |
| ComputationInfo | m_info |
| bool | m_factorizationIsOk |
| bool | m_analysisIsOk |
| std::string | m_lastError |
| NCMatrix | m_mat |
| SCMatrix | m_Lstore |
| MappedSparseMatrix< Scalar, ColMajor, StorageIndex > | m_Ustore |
| PermutationType | m_perm_c |
| PermutationType | m_perm_r |
| IndexVector | m_etree |
| Base::GlobalLU_t | m_glu |
| bool | m_symmetricmode |
| internal::perfvalues | m_perfv |
| RealScalar | m_diagpivotthresh |
| Index | m_nnzL |
| Index | m_nnzU |
| Index | m_detPermR |
| Index | m_detPermC |
| bool | m_isInitialized |
Private Member Functions | |
| SparseLU (const SparseLU &) | |
Sparse supernodal LU factorization for general matrices.
This class implements the supernodal LU factorization for general matrices. It uses the main techniques from the sequential SuperLU package (http://crd-legacy.lbl.gov/~xiaoye/SuperLU/). It handles transparently real and complex arithmetics with single and double precision, depending on the scalar type of your input matrix. The code has been optimized to provide BLAS-3 operations during supernode-panel updates. It benefits directly from the built-in high-performant Eigen BLAS routines. Moreover, when the size of a supernode is very small, the BLAS calls are avoided to enable a better optimization from the compiler. For best performance, you should compile it with NDEBUG flag to avoid the numerous bounds checking on vectors.
An important parameter of this class is the ordering method. It is used to reorder the columns (and eventually the rows) of the matrix to reduce the number of new elements that are created during numerical factorization. The cheapest method available is COLAMD. See the OrderingMethods module for the list of built-in and external ordering methods.
Simple example with key steps
| _MatrixType | The type of the sparse matrix. It must be a column-major SparseMatrix<> |
| _OrderingType | The ordering method to use, either AMD, COLAMD or METIS. Default is COLMAD |
\implsparsesolverconcept
|
protected |
| typedef internal::SparseLUImpl<Scalar, StorageIndex> Eigen::SparseLU< _MatrixType, _OrderingType >::Base |
|
inherited |
|
inherited |
|
inherited |
| typedef Matrix<StorageIndex,Dynamic,1> Eigen::SparseLU< _MatrixType, _OrderingType >::IndexVector |
|
inherited |
| typedef _MatrixType Eigen::SparseLU< _MatrixType, _OrderingType >::MatrixType |
| typedef SparseMatrix<Scalar,ColMajor,StorageIndex> Eigen::SparseLU< _MatrixType, _OrderingType >::NCMatrix |
| typedef _OrderingType Eigen::SparseLU< _MatrixType, _OrderingType >::OrderingType |
| typedef PermutationMatrix<Dynamic, Dynamic, StorageIndex> Eigen::SparseLU< _MatrixType, _OrderingType >::PermutationType |
| typedef MatrixType::RealScalar Eigen::SparseLU< _MatrixType, _OrderingType >::RealScalar |
| typedef MatrixType::Scalar Eigen::SparseLU< _MatrixType, _OrderingType >::Scalar |
|
inherited |
| typedef Matrix<Scalar,Dynamic,1> Eigen::SparseLU< _MatrixType, _OrderingType >::ScalarVector |
| typedef internal::MappedSuperNodalMatrix<Scalar, StorageIndex> Eigen::SparseLU< _MatrixType, _OrderingType >::SCMatrix |
| typedef MatrixType::StorageIndex Eigen::SparseLU< _MatrixType, _OrderingType >::StorageIndex |
| anonymous enum |
| Enumerator | |
|---|---|
| ColsAtCompileTime | |
| MaxColsAtCompileTime | |
|
inline |
References Eigen::SparseLU< _MatrixType, _OrderingType >::initperfvalues().
Here is the call graph for this function:
|
inlineexplicit |
References Eigen::SparseLU< _MatrixType, _OrderingType >::compute(), and Eigen::SparseLU< _MatrixType, _OrderingType >::initperfvalues().
Here is the call graph for this function:
|
inline |
|
private |
|
inline |
References Eigen::SparseLU< _MatrixType, _OrderingType >::colsPermutation(), eigen_assert, EIGEN_STATIC_ASSERT, Eigen::PermutationBase< Derived >::inverse(), Eigen::SparseLU< _MatrixType, _OrderingType >::m_factorizationIsOk, Eigen::SparseLU< _MatrixType, _OrderingType >::matrixL(), Eigen::SparseLU< _MatrixType, _OrderingType >::matrixU(), Eigen::RowMajorBit, and Eigen::SparseLU< _MatrixType, _OrderingType >::rowsPermutation().
Here is the call graph for this function:
|
inlineinherited |
|
inline |
References Eigen::SparseLU< _MatrixType, _OrderingType >::cols(), eigen_assert, Eigen::SparseLU< _MatrixType, _OrderingType >::m_factorizationIsOk, and Eigen::SparseLU< _MatrixType, _OrderingType >::m_Lstore.
Here is the call graph for this function:| void Eigen::SparseLU< MatrixType, OrderingType >::analyzePattern | ( | const MatrixType & | mat | ) |
Compute the column permutation to minimize the fill-in
References Eigen::internal::coletree(), ei_declare_aligned_stack_constructed_variable, Eigen::PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, _StorageIndex >::indices(), Eigen::PlainObjectBase< Derived >::resize(), and Eigen::internal::treePostorder().
Referenced by Eigen::SparseLU< _MatrixType, _OrderingType >::compute().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::cols(), and Eigen::SparseLU< _MatrixType, _OrderingType >::m_mat.
Referenced by Eigen::SparseLU< _MatrixType, _OrderingType >::absDeterminant(), Eigen::SparseLU< _MatrixType, _OrderingType >::determinant(), Eigen::SparseLU< _MatrixType, _OrderingType >::logAbsDeterminant(), and Eigen::SparseLU< _MatrixType, _OrderingType >::signDeterminant().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
References Eigen::SparseLU< _MatrixType, _OrderingType >::m_perm_c.
Referenced by Eigen::SparseLU< _MatrixType, _OrderingType >::_solve_impl().
Here is the caller graph for this function:
|
protectedinherited |
Performs numeric block updates (sup-col) in topological order.
| jcol | current column to update |
| nseg | Number of segments in the U part |
| dense | Store the full representation of the column |
| tempv | working array |
| segrep | segment representative ... |
| repfnz | ??? First nonzero column in each row ??? ... |
| fpanelc | First column in the current panel |
| glu | Global LU data. |
|
protectedinherited |
Performs a symbolic factorization on column jcol and decide the supernode boundary.
A supernode representative is the last column of a supernode. The nonzeros in U[*,j] are segments that end at supernodes representatives. The routine returns a list of the supernodal representatives in topological order of the dfs that generates them. The location of the first nonzero in each supernodal segment (supernodal entry location) is also returned.
| m | number of rows in the matrix | |
| jcol | Current column | |
| perm_r | Row permutation | |
| maxsuper | Maximum number of column allowed in a supernode | |
| [in,out] | nseg | Number of segments in current U[*,j] - new segments appended |
| lsub_col | defines the rhs vector to start the dfs | |
| [in,out] | segrep | Segment representatives - new segments appended |
| repfnz | First nonzero location in each row | |
| xprune | ||
| marker | marker[i] == jj, if i was visited during dfs of current column jj; | |
| parent | ||
| xplore | working array | |
| glu | global LU data |
|
inline |
Compute the symbolic and numeric factorization of the input sparse matrix. The input matrix should be in column-major storage.
References Eigen::SparseLU< _MatrixType, _OrderingType >::analyzePattern(), and Eigen::SparseLU< _MatrixType, _OrderingType >::factorize().
Referenced by Eigen::SparseLU< _MatrixType, _OrderingType >::SparseLU(), and igl::copyleft::comiso::FrameInterpolator::interpolateSymmetric().
Here is the call graph for this function:
Here is the caller graph for this function:
|
protectedinherited |
Performs numeric block updates (sup-col) in topological order.
| jcol | current column to update |
| nseg | Number of segments in the U part |
| segrep | segment representative ... |
| repfnz | First nonzero column in each row ... |
| perm_r | Row permutation |
| dense | Store the full representation of the column |
| glu | Global LU data. |
|
protectedinherited |
Count Nonzero elements in the factors.
|
inlineinherited |
|
inlineinherited |
|
inline |
References Eigen::SparseLU< _MatrixType, _OrderingType >::cols(), eigen_assert, Eigen::SparseLU< _MatrixType, _OrderingType >::m_detPermC, Eigen::SparseLU< _MatrixType, _OrderingType >::m_detPermR, Eigen::SparseLU< _MatrixType, _OrderingType >::m_factorizationIsOk, and Eigen::SparseLU< _MatrixType, _OrderingType >::m_Lstore.
Here is the call graph for this function:
|
protectedinherited |
|
protectedinherited |
Expand the existing storage to accomodate more fill-ins
| vec | Valid pointer to the vector to allocate or expand | |
| [in,out] | length | At input, contain the current length of the vector that is to be increased. At output, length of the newly allocated vector |
| [in] | nbElts | Current number of elements in the factors |
| keep_prev | 1: use length and do not expand the vector; 0: compute new_len and expand | |
| [in,out] | num_expansions | Number of times the memory has been expanded |
| void Eigen::SparseLU< MatrixType, OrderingType >::factorize | ( | const MatrixType & | matrix | ) |
Interleaved with the symbolic factorization On exit, info is
= 0: successful factorization
0: if info = i, and i is
<= A->ncol: U(i,i) is exactly zero. The factorization has been completed, but the factor U is exactly singular, and division by zero will occur if it is used to solve a system of equations.
> A->ncol: number of bytes allocated when memory allocation failure occurred, plus A->ncol. If lwork = -1, it is the estimated amount of space needed, plus A->ncol.
References eigen_assert, Eigen::internal::emptyIdxLU, Eigen::PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, _StorageIndex >::indices(), Eigen::internal::LUNoMarker, Eigen::internal::LUnumTempV(), Eigen::NumericalIssue, Eigen::PlainObjectBase< Derived >::setConstant(), Eigen::PlainObjectBase< Derived >::setZero(), and Eigen::Success.
Referenced by Eigen::SparseLU< _MatrixType, _OrderingType >::compute().
Here is the call graph for this function:
Here is the caller graph for this function:
|
protectedinherited |
Fix up the data storage lsub for L-subscripts.
It removes the subscripts sets for structural pruning, and applies permutation to the remaining subscripts
|
protectedinherited |
Identify the initial relaxed supernodes.
This routine applied to a symmetric elimination tree. It assumes that the matrix has been reordered according to the postorder of the etree
| n | The number of columns |
| et | elimination tree |
| relax_columns | Maximum number of columns allowed in a relaxed snode |
| descendants | Number of descendants of each node in the etree |
| relax_end | last column in a supernode |
|
inline |
Reports whether previous computation was successful.
Success if computation was succesful, NumericalIssue if the LU factorization reports a problem, zero diagonal for instance InvalidInput if the input matrix is invalidReferences eigen_assert, Eigen::SparseLU< _MatrixType, _OrderingType >::m_info, and Eigen::SparseSolverBase< SparseLU< _MatrixType, _OrderingType > >::m_isInitialized.
Referenced by igl::copyleft::comiso::FrameInterpolator::interpolateSymmetric().
Here is the caller graph for this function:
|
inlineprotected |
References Eigen::internal::perfvalues::colblk, Eigen::internal::perfvalues::fillfactor, Eigen::SparseLU< _MatrixType, _OrderingType >::m_perfv, Eigen::internal::perfvalues::maxsuper, Eigen::internal::perfvalues::panel_size, Eigen::internal::perfvalues::relax, and Eigen::internal::perfvalues::rowblk.
Referenced by Eigen::SparseLU< _MatrixType, _OrderingType >::SparseLU(), and Eigen::SparseLU< _MatrixType, _OrderingType >::SparseLU().
Here is the caller graph for this function:
|
inline |
Indicate that the pattern of the input matrix is symmetric
References Eigen::SparseLU< _MatrixType, _OrderingType >::m_symmetricmode.
|
inline |
References Eigen::SparseLU< _MatrixType, _OrderingType >::m_lastError.
|
inline |
References Eigen::SparseLU< _MatrixType, _OrderingType >::cols(), eigen_assert, log(), Eigen::SparseLU< _MatrixType, _OrderingType >::m_factorizationIsOk, and Eigen::SparseLU< _MatrixType, _OrderingType >::m_Lstore.
Here is the call graph for this function:
|
inline |
References Eigen::SparseLU< _MatrixType, _OrderingType >::m_Lstore.
Referenced by Eigen::SparseLU< _MatrixType, _OrderingType >::_solve_impl().
Here is the caller graph for this function:
|
inline |
References Eigen::SparseLU< _MatrixType, _OrderingType >::m_Lstore, and Eigen::SparseLU< _MatrixType, _OrderingType >::m_Ustore.
Referenced by Eigen::SparseLU< _MatrixType, _OrderingType >::_solve_impl().
Here is the caller graph for this function:
|
protectedinherited |
Allocate various working space for the numerical factorization phase.
| m | number of rows of the input matrix |
| n | number of columns |
| annz | number of initial nonzeros in the matrix |
| lwork | if lwork=-1, this routine returns an estimated size of the required memory |
| glu | persistent data to facilitate multiple factors : will be deleted later ?? |
| fillratio | estimated ratio of fill in the factors |
| panel_size | Size of a panel |
|
protectedinherited |
Expand the existing storage.
| vec | vector to expand | |
| [in,out] | maxlen | On input, previous size of vec (Number of elements to copy ). on output, new size |
| nbElts | current number of elements in the vector. | |
| memtype | Type of the element to expand | |
| num_expansions | Number of expansions |
|
protectedinherited |
Performs numeric block updates (sup-panel) in topological order.
Before entering this routine, the original nonzeros in the panel were already copied i nto the spa[m,w]
| m | number of rows in the matrix |
| w | Panel size |
| jcol | Starting column of the panel |
| nseg | Number of segments in the U part |
| dense | Store the full representation of the panel |
| tempv | working array |
| segrep | segment representative... first row in the segment |
| repfnz | First nonzero rows |
| glu | Global LU data. |
|
protectedinherited |
Performs a symbolic factorization on a panel of columns [jcol, jcol+w)
A supernode representative is the last column of a supernode. The nonzeros in U[*,j] are segments that end at supernodes representatives
The routine returns a list of the supernodal representatives in topological order of the dfs that generates them. This list is a superset of the topological order of each individual column within the panel. The location of the first nonzero in each supernodal segment (supernodal entry location) is also returned. Each column has a separate list for this purpose.
Two markers arrays are used for dfs : marker[i] == jj, if i was visited during dfs of current column jj; marker1[i] >= jcol, if i was visited by earlier columns in this panel;
| [in] | m | number of rows in the matrix |
| [in] | w | Panel size |
| [in] | jcol | Starting column of the panel |
| [in] | A | Input matrix in column-major storage |
| [in] | perm_r | Row permutation |
| [out] | nseg | Number of U segments |
| [out] | dense | Accumulate the column vectors of the panel |
| [out] | panel_lsub | Subscripts of the row in the panel |
| [out] | segrep | Segment representative i.e first nonzero row of each segment |
| [out] | repfnz | First nonzero location in each row |
| [out] | xprune | The pruned elimination tree |
| [out] | marker | work vector |
| parent | The elimination tree | |
| xplore | work vector | |
| glu | The global data structure |
|
protectedinherited |
Performs the numerical pivotin on the current column of L, and the CDIV operation.
Pivot policy : (1) Compute thresh = u * max_(i>=j) abs(A_ij); (2) IF user specifies pivot row k and abs(A_kj) >= thresh THEN pivot row = k; ELSE IF abs(A_jj) >= thresh THEN pivot row = j; ELSE pivot row = m;
Note: If you absolutely want to use a given pivot order, then set u=0.0.
| jcol | The current column of L | |
| diagpivotthresh | diagonal pivoting threshold | |
| [in,out] | perm_r | Row permutation (threshold pivoting) |
| [in] | iperm_c | column permutation - used to finf diagonal of Pc*A*Pc' |
| [out] | pivrow | The pivot row |
| glu | Global LU data |
|
protectedinherited |
Prunes the L-structure.
It prunes the L-structure of supernodes whose L-structure contains the current pivot row "pivrow"
| jcol | The current column of L | |
| [in] | perm_r | Row permutation |
| [out] | pivrow | The pivot row |
| nseg | Number of segments | |
| segrep | ||
| repfnz | ||
| [out] | xprune | |
| glu | Global LU data |
|
protectedinherited |
Identify the initial relaxed supernodes.
This routine is applied to a column elimination tree. It assumes that the matrix has been reordered according to the postorder of the etree
| n | the number of columns |
| et | elimination tree |
| relax_columns | Maximum number of columns allowed in a relaxed snode |
| descendants | Number of descendants of each node in the etree |
| relax_end | last column in a supernode |
|
inline |
References Eigen::SparseLU< _MatrixType, _OrderingType >::m_mat, and Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::rows().
Here is the call graph for this function:
|
inline |
References Eigen::SparseLU< _MatrixType, _OrderingType >::m_perm_r.
Referenced by Eigen::SparseLU< _MatrixType, _OrderingType >::_solve_impl().
Here is the caller graph for this function:
|
inline |
Set the threshold used for a diagonal entry to be an acceptable pivot.
References Eigen::SparseLU< _MatrixType, _OrderingType >::m_diagpivotthresh.
|
inline |
References Eigen::SparseLU< _MatrixType, _OrderingType >::cols(), eigen_assert, Eigen::SparseLU< _MatrixType, _OrderingType >::m_detPermC, Eigen::SparseLU< _MatrixType, _OrderingType >::m_detPermR, Eigen::SparseLU< _MatrixType, _OrderingType >::m_factorizationIsOk, and Eigen::SparseLU< _MatrixType, _OrderingType >::m_Lstore.
Here is the call graph for this function:| void Eigen::SparseLU< _MatrixType, _OrderingType >::simplicialfactorize | ( | const MatrixType & | matrix | ) |
|
protectedinherited |
|
protectedinherited |
|
inlineinherited |
|
inlineinherited |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by Eigen::SparseLU< _MatrixType, _OrderingType >::_solve_impl(), Eigen::SparseLU< _MatrixType, _OrderingType >::absDeterminant(), Eigen::SparseLU< _MatrixType, _OrderingType >::determinant(), Eigen::SparseLU< _MatrixType, _OrderingType >::logAbsDeterminant(), and Eigen::SparseLU< _MatrixType, _OrderingType >::signDeterminant().
|
protected |
|
mutableprotected |
Referenced by Eigen::SparseLU< _MatrixType, _OrderingType >::info().
|
mutableprotectedinherited |
|
protected |
|
protected |
Referenced by Eigen::SparseLU< _MatrixType, _OrderingType >::absDeterminant(), Eigen::SparseLU< _MatrixType, _OrderingType >::determinant(), Eigen::SparseLU< _MatrixType, _OrderingType >::logAbsDeterminant(), Eigen::SparseLU< _MatrixType, _OrderingType >::matrixL(), Eigen::SparseLU< _MatrixType, _OrderingType >::matrixU(), and Eigen::SparseLU< _MatrixType, _OrderingType >::signDeterminant().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by Eigen::SparseLU< _MatrixType, _OrderingType >::isSymmetric().
|
protected |
Referenced by Eigen::SparseLU< _MatrixType, _OrderingType >::matrixU().