11 #ifndef EIGEN_SPARSELU_SUPERNODAL_MATRIX_H 12 #define EIGEN_SPARSELU_SUPERNODAL_MATRIX_H 32 template <
typename _Scalar,
typename _Index>
36 typedef _Scalar Scalar;
45 MappedSuperNodalMatrix(Index m, Index n, ScalarVector& nzval, IndexVector& nzval_colptr, IndexVector& rowind,
46 IndexVector& rowind_colptr, IndexVector& col_to_sup, IndexVector& sup_to_col )
48 setInfos(m, n, nzval, nzval_colptr, rowind, rowind_colptr, col_to_sup, sup_to_col);
61 void setInfos(Index m, Index n, ScalarVector& nzval, IndexVector& nzval_colptr, IndexVector& rowind,
62 IndexVector& rowind_colptr, IndexVector& col_to_sup, IndexVector& sup_to_col )
66 m_nzval = nzval.
data();
67 m_nzval_colptr = nzval_colptr.
data();
68 m_rowind = rowind.
data();
69 m_rowind_colptr = rowind_colptr.
data();
70 m_nsuper = col_to_sup(n);
71 m_col_to_sup = col_to_sup.
data();
72 m_sup_to_col = sup_to_col.
data();
78 Index
rows() {
return m_row; }
83 Index
cols() {
return m_col; }
101 return m_nzval_colptr;
106 return m_nzval_colptr;
126 return m_rowind_colptr;
157 template<
typename Dest>
168 Index* m_nzval_colptr;
170 Index* m_rowind_colptr;
181 template<
typename Scalar,
typename Index>
190 m_startidval(m_idval),
201 inline Scalar value()
const {
return m_matrix.valuePtr()[m_idval]; }
203 inline Scalar& valueRef() {
return const_cast<Scalar&
>(m_matrix.valuePtr()[m_idval]); }
205 inline Index index()
const {
return m_matrix.rowIndex()[m_idrow]; }
206 inline Index row()
const {
return index(); }
207 inline Index col()
const {
return m_outer; }
209 inline Index supIndex()
const {
return m_supno; }
211 inline operator bool()
const 213 return ( (m_idval < m_endidval) && (m_idval >= m_startidval)
214 && (m_idrow < m_endidrow) );
222 const Index m_startidval;
223 const Index m_endidval;
232 template<
typename Scalar,
typename Index>
233 template<
typename Dest>
237 Index nrhs = X.cols();
241 for (Index k = 0; k <=
nsuper(); k ++)
246 Index nsupc =
supToCol()[k+1] - fsupc;
247 Index nrow = nsupr - nsupc;
252 for (Index j = 0; j < nrhs; j++)
259 X(irow, j) -= X(fsupc, j) * it.value();
272 U = A.template triangularView<UnitLower>().solve(U);
276 work.block(0, 0, nrow, nrhs) = A * U;
279 for (Index j = 0; j < nrhs; j++)
281 Index iptr = istart + nsupc;
282 for (Index i = 0; i < nrow; i++)
285 X(irow, j) -= work(i, j);
286 work(i, j) = Scalar(0);
298 #endif // EIGEN_SPARSELU_MATRIX_H Index nsuper() const
Return the number of supernodes.
Definition: SparseLU_SupernodalMatrix.h:151
EIGEN_STRONG_INLINE const Scalar * data() const
Definition: PlainObjectBase.h:212
A matrix or vector expression mapping an existing array of data.
Definition: Map.h:104
Index * supToCol()
Return the array of supernode-to-column mapping.
Definition: SparseLU_SupernodalMatrix.h:141
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: TestIMU_Common.h:87
InnerIterator class to iterate over nonzero values of the current column in the supernodal matrix L...
Definition: SparseLU_SupernodalMatrix.h:182
Index * colToSup()
Return the array of column-to-supernode mapping.
Definition: SparseLU_SupernodalMatrix.h:132
Index rows()
Number of rows.
Definition: SparseLU_SupernodalMatrix.h:78
void setInfos(Index m, Index n, ScalarVector &nzval, IndexVector &nzval_colptr, IndexVector &rowind, IndexVector &rowind_colptr, IndexVector &col_to_sup, IndexVector &sup_to_col)
Set appropriate pointers for the lower triangular supernodal matrix These infos are available at the ...
Definition: SparseLU_SupernodalMatrix.h:61
void solveInPlace(MatrixBase< Dest > &X) const
Solve with the supernode triangular matrix.
Definition: SparseLU_SupernodalMatrix.h:234
Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > & setZero(Index size)
Resizes to the given size, and sets all coefficients in this expression to zero.
Definition: CwiseNullaryOp.h:515
Definition: BandTriangularSolver.h:13
An InnerIterator allows to loop over the element of a sparse (or dense) matrix or expression...
Index * colIndexPtr()
Return the pointers to the beginning of each column in valuePtr()
Definition: SparseLU_SupernodalMatrix.h:99
Scalar * valuePtr()
Return the array of nonzero values packed by column.
Definition: SparseLU_SupernodalMatrix.h:90
Index cols()
Number of columns.
Definition: SparseLU_SupernodalMatrix.h:83
Index * rowIndexPtr()
Return the location in rowvaluePtr() which starts each column.
Definition: SparseLU_SupernodalMatrix.h:122
Index * rowIndex()
Return the array of compressed row indices of all supernodes.
Definition: SparseLU_SupernodalMatrix.h:112
a class to manipulate the L supernodal factor from the SparseLU factorization
Definition: SparseLU_SupernodalMatrix.h:33
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48