11 #ifndef EIGEN_SPARSELU_SUPERNODAL_MATRIX_H
12 #define EIGEN_SPARSELU_SUPERNODAL_MATRIX_H
32 template <
typename _Scalar,
typename _StorageIndex>
48 setInfos(m, n, nzval, nzval_colptr, rowind, rowind_colptr, col_to_sup, sup_to_col);
157 template<
typename Dest>
159 template<
bool Conjugate,
typename Dest>
184 template<
typename Scalar,
typename StorageIndex>
193 m_startidval(m_idval),
204 inline Scalar value()
const {
return m_matrix.valuePtr()[m_idval]; }
208 inline Index index()
const {
return m_matrix.rowIndex()[m_idrow]; }
214 inline operator bool()
const
216 return ( (m_idval < m_endidval) && (m_idval >= m_startidval)
217 && (m_idrow < m_endidrow) );
235 template<
typename Scalar,
typename Index_>
236 template<
typename Dest>
242 Index n = int(X.rows());
244 const Scalar * Lval = valuePtr();
247 for (
Index k = 0; k <= nsuper(); k ++)
249 Index fsupc = supToCol()[k];
250 Index istart = rowIndexPtr()[fsupc];
251 Index nsupr = rowIndexPtr()[fsupc+1] - istart;
252 Index nsupc = supToCol()[k+1] - fsupc;
253 Index nrow = nsupr - nsupc;
258 for (
Index j = 0; j < nrhs; j++)
265 X(irow, j) -= X(fsupc, j) * it.
value();
272 Index luptr = colIndexPtr()[fsupc];
273 Index lda = colIndexPtr()[fsupc+1] - luptr;
278 U = A.template triangularView<UnitLower>().solve(U);
282 work.topRows(nrow).noalias() = A * U;
285 for (
Index j = 0; j < nrhs; j++)
287 Index iptr = istart + nsupc;
288 for (
Index i = 0; i < nrow; i++)
290 irow = rowIndex()[iptr];
291 X(irow, j) -= work(i, j);
300 template<
typename Scalar,
typename Index_>
301 template<
bool Conjugate,
typename Dest>
305 Index n = int(X.rows());
307 const Scalar * Lval = valuePtr();
310 for (
Index k = nsuper(); k >= 0; k--)
312 Index fsupc = supToCol()[k];
313 Index istart = rowIndexPtr()[fsupc];
314 Index nsupr = rowIndexPtr()[fsupc+1] - istart;
315 Index nsupc = supToCol()[k+1] - fsupc;
316 Index nrow = nsupr - nsupc;
321 for (
Index j = 0; j < nrhs; j++)
335 Index luptr = colIndexPtr()[fsupc];
336 Index lda = colIndexPtr()[fsupc+1] - luptr;
339 for (
Index j = 0; j < nrhs; j++)
341 Index iptr = istart + nsupc;
342 for (
Index i = 0; i < nrow; i++)
344 irow = rowIndex()[iptr];
345 work.topRows(nrow)(i,j)= X(irow,j);
354 U = U - A.adjoint() * work.topRows(nrow);
356 U = U - A.transpose() * work.topRows(nrow);
361 U = A.adjoint().template triangularView<UnitUpper>().solve(U);
363 U = A.transpose().template triangularView<UnitUpper>().solve(U);
Definition: ForwardDeclarations.h:87
An InnerIterator allows to loop over the element of any matrix expression.
Definition: CoreIterators.h:34
A matrix or vector expression mapping an existing array of data.
Definition: Map.h:96
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:50
Convenience specialization of Stride to specify only an outer stride See class Map for some examples.
Definition: Stride.h:107
EIGEN_DEVICE_FUNC Derived & setZero(Index size)
Definition: CwiseNullaryOp.h:562
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar * data() const
Definition: PlainObjectBase.h:247
InnerIterator class to iterate over nonzero values of the current column in the supernodal matrix L.
Definition: SparseLU_SupernodalMatrix.h:186
Index m_idval
Definition: SparseLU_SupernodalMatrix.h:224
const Index m_startidval
Definition: SparseLU_SupernodalMatrix.h:225
Index m_endidrow
Definition: SparseLU_SupernodalMatrix.h:228
Scalar value() const
Definition: SparseLU_SupernodalMatrix.h:204
InnerIterator(const MappedSuperNodalMatrix &mat, Index outer)
Definition: SparseLU_SupernodalMatrix.h:188
const Index m_endidval
Definition: SparseLU_SupernodalMatrix.h:226
InnerIterator & operator++()
Definition: SparseLU_SupernodalMatrix.h:198
Index supIndex() const
Definition: SparseLU_SupernodalMatrix.h:212
Index m_idrow
Definition: SparseLU_SupernodalMatrix.h:227
Index col() const
Definition: SparseLU_SupernodalMatrix.h:210
const MappedSuperNodalMatrix & m_matrix
Definition: SparseLU_SupernodalMatrix.h:221
Index index() const
Definition: SparseLU_SupernodalMatrix.h:208
const Index m_outer
Definition: SparseLU_SupernodalMatrix.h:222
const Index m_supno
Definition: SparseLU_SupernodalMatrix.h:223
Index row() const
Definition: SparseLU_SupernodalMatrix.h:209
Scalar & valueRef()
Definition: SparseLU_SupernodalMatrix.h:206
a class to manipulate the L supernodal factor from the SparseLU factorization
Definition: SparseLU_SupernodalMatrix.h:34
const StorageIndex * supToCol() const
Definition: SparseLU_SupernodalMatrix.h:143
_Scalar Scalar
Definition: SparseLU_SupernodalMatrix.h:36
const StorageIndex * colToSup() const
Definition: SparseLU_SupernodalMatrix.h:134
StorageIndex * colToSup()
Definition: SparseLU_SupernodalMatrix.h:132
Index m_nsuper
Definition: SparseLU_SupernodalMatrix.h:169
const StorageIndex * rowIndex() const
Definition: SparseLU_SupernodalMatrix.h:114
MappedSuperNodalMatrix(Index m, Index n, ScalarVector &nzval, IndexVector &nzval_colptr, IndexVector &rowind, IndexVector &rowind_colptr, IndexVector &col_to_sup, IndexVector &sup_to_col)
Definition: SparseLU_SupernodalMatrix.h:45
const Scalar * valuePtr() const
Definition: SparseLU_SupernodalMatrix.h:92
const StorageIndex * rowIndexPtr() const
Definition: SparseLU_SupernodalMatrix.h:124
Scalar * m_nzval
Definition: SparseLU_SupernodalMatrix.h:170
StorageIndex * m_sup_to_col
Definition: SparseLU_SupernodalMatrix.h:175
Scalar * valuePtr()
Definition: SparseLU_SupernodalMatrix.h:90
StorageIndex * m_col_to_sup
Definition: SparseLU_SupernodalMatrix.h:174
Matrix< StorageIndex, Dynamic, 1 > IndexVector
Definition: SparseLU_SupernodalMatrix.h:38
const StorageIndex * colIndexPtr() const
Definition: SparseLU_SupernodalMatrix.h:104
_StorageIndex StorageIndex
Definition: SparseLU_SupernodalMatrix.h:37
StorageIndex * m_rowind
Definition: SparseLU_SupernodalMatrix.h:172
StorageIndex * rowIndexPtr()
Definition: SparseLU_SupernodalMatrix.h:122
StorageIndex * colIndexPtr()
Definition: SparseLU_SupernodalMatrix.h:99
void solveTransposedInPlace(MatrixBase< Dest > &X) const
Definition: SparseLU_SupernodalMatrix.h:302
StorageIndex * rowIndex()
Definition: SparseLU_SupernodalMatrix.h:112
Index nsuper() const
Definition: SparseLU_SupernodalMatrix.h:151
StorageIndex * m_nzval_colptr
Definition: SparseLU_SupernodalMatrix.h:171
Index rows() const
Definition: SparseLU_SupernodalMatrix.h:78
StorageIndex * supToCol()
Definition: SparseLU_SupernodalMatrix.h:141
Matrix< Scalar, Dynamic, 1 > ScalarVector
Definition: SparseLU_SupernodalMatrix.h:39
void solveInPlace(MatrixBase< Dest > &X) const
Solve with the supernode triangular matrix.
Definition: SparseLU_SupernodalMatrix.h:237
Index m_col
Definition: SparseLU_SupernodalMatrix.h:168
MappedSuperNodalMatrix()
Definition: SparseLU_SupernodalMatrix.h:41
Index m_row
Definition: SparseLU_SupernodalMatrix.h:167
StorageIndex * m_rowind_colptr
Definition: SparseLU_SupernodalMatrix.h:173
Index cols() const
Definition: SparseLU_SupernodalMatrix.h:83
void setInfos(Index m, Index n, ScalarVector &nzval, IndexVector &nzval_colptr, IndexVector &rowind, IndexVector &rowind_colptr, IndexVector &col_to_sup, IndexVector &sup_to_col)
Definition: SparseLU_SupernodalMatrix.h:61
~MappedSuperNodalMatrix()
Definition: SparseLU_SupernodalMatrix.h:51
Namespace containing all symbols from the Eigen library.
Definition: LDLT.h:16
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
Definition: document.h:416