11 #ifndef EIGEN_SPARSELU_SUPERNODAL_MATRIX_H
12 #define EIGEN_SPARSELU_SUPERNODAL_MATRIX_H
32 template <
typename _Scalar,
typename _StorageIndex>
36 typedef _Scalar Scalar;
37 typedef _StorageIndex StorageIndex;
48 setInfos(m, n, nzval, nzval_colptr, rowind, rowind_colptr, col_to_sup, 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();
101 return m_nzval_colptr;
106 return m_nzval_colptr;
114 const StorageIndex*
rowIndex()
const
126 return m_rowind_colptr;
134 const StorageIndex*
colToSup()
const
143 const StorageIndex*
supToCol()
const
157 template<
typename Dest>
168 StorageIndex* m_nzval_colptr;
169 StorageIndex* m_rowind;
170 StorageIndex* m_rowind_colptr;
171 StorageIndex* m_col_to_sup;
172 StorageIndex* m_sup_to_col;
181 template<
typename Scalar,
typename StorageIndex>
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>
239 Index n = int(X.rows());
241 const Scalar * Lval = valuePtr();
244 for (
Index k = 0; k <= nsuper(); k ++)
246 Index fsupc = supToCol()[k];
247 Index istart = rowIndexPtr()[fsupc];
248 Index nsupr = rowIndexPtr()[fsupc+1] - istart;
249 Index nsupc = supToCol()[k+1] - fsupc;
250 Index nrow = nsupr - nsupc;
255 for (
Index j = 0; j < nrhs; j++)
262 X(irow, j) -= X(fsupc, j) * it.value();
269 Index luptr = colIndexPtr()[fsupc];
270 Index lda = colIndexPtr()[fsupc+1] - luptr;
275 U = A.template triangularView<UnitLower>().solve(U);
279 work.topRows(nrow).noalias() = A * U;
282 for (
Index j = 0; j < nrhs; j++)
284 Index iptr = istart + nsupc;
285 for (
Index i = 0; i < nrow; i++)
287 irow = rowIndex()[iptr];
288 X(irow, j) -= work(i, j);
289 work(i, j) = Scalar(0);
301 #endif // EIGEN_SPARSELU_MATRIX_H