Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex > Class Template Reference

a class to manipulate the L supernodal factor from the SparseLU factorization More...

#include <src/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h>

+ Inheritance diagram for Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >:

Classes

class  InnerIterator
 InnerIterator class to iterate over nonzero values of the current column in the supernodal matrix L. More...
 

Public Types

typedef _Scalar Scalar
 
typedef _StorageIndex StorageIndex
 
typedef Matrix< StorageIndex, Dynamic, 1 > IndexVector
 
typedef Matrix< Scalar, Dynamic, 1 > ScalarVector
 

Public Member Functions

 MappedSuperNodalMatrix ()
 
 MappedSuperNodalMatrix (Index m, Index n, ScalarVector &nzval, IndexVector &nzval_colptr, IndexVector &rowind, IndexVector &rowind_colptr, IndexVector &col_to_sup, IndexVector &sup_to_col)
 
 ~MappedSuperNodalMatrix ()
 
void setInfos (Index m, Index n, ScalarVector &nzval, IndexVector &nzval_colptr, IndexVector &rowind, IndexVector &rowind_colptr, IndexVector &col_to_sup, IndexVector &sup_to_col)
 
Index rows ()
 
Index cols ()
 
ScalarvaluePtr ()
 
const ScalarvaluePtr () const
 
StorageIndexcolIndexPtr ()
 
const StorageIndexcolIndexPtr () const
 
StorageIndexrowIndex ()
 
const StorageIndexrowIndex () const
 
StorageIndexrowIndexPtr ()
 
const StorageIndexrowIndexPtr () const
 
StorageIndexcolToSup ()
 
const StorageIndexcolToSup () const
 
StorageIndexsupToCol ()
 
const StorageIndexsupToCol () const
 
Index nsuper () const
 
template<typename Dest >
void solveInPlace (MatrixBase< Dest > &X) const
 Solve with the supernode triangular matrix.
 

Protected Attributes

Index m_row
 
Index m_col
 
Index m_nsuper
 
Scalarm_nzval
 
StorageIndexm_nzval_colptr
 
StorageIndexm_rowind
 
StorageIndexm_rowind_colptr
 
StorageIndexm_col_to_sup
 
StorageIndexm_sup_to_col
 

Detailed Description

template<typename _Scalar, typename _StorageIndex>
class Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >

a class to manipulate the L supernodal factor from the SparseLU factorization

This class contain the data to easily store and manipulate the supernodes during the factorization and solution phase of Sparse LU. Only the lower triangular matrix has supernodes.

NOTE : This class corresponds to the SCformat structure in SuperLU

Member Typedef Documentation

◆ IndexVector

template<typename _Scalar , typename _StorageIndex >
typedef Matrix<StorageIndex,Dynamic,1> Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::IndexVector

◆ Scalar

template<typename _Scalar , typename _StorageIndex >
typedef _Scalar Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::Scalar

◆ ScalarVector

template<typename _Scalar , typename _StorageIndex >
typedef Matrix<Scalar,Dynamic,1> Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::ScalarVector

◆ StorageIndex

template<typename _Scalar , typename _StorageIndex >
typedef _StorageIndex Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::StorageIndex

Constructor & Destructor Documentation

◆ MappedSuperNodalMatrix() [1/2]

template<typename _Scalar , typename _StorageIndex >
Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::MappedSuperNodalMatrix ( )
inline
42 {
43
44 }

◆ MappedSuperNodalMatrix() [2/2]

template<typename _Scalar , typename _StorageIndex >
Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::MappedSuperNodalMatrix ( Index  m,
Index  n,
ScalarVector nzval,
IndexVector nzval_colptr,
IndexVector rowind,
IndexVector rowind_colptr,
IndexVector col_to_sup,
IndexVector sup_to_col 
)
inline
47 {
48 setInfos(m, n, nzval, nzval_colptr, rowind, rowind_colptr, col_to_sup, sup_to_col);
49 }
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

References Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::setInfos().

+ Here is the call graph for this function:

◆ ~MappedSuperNodalMatrix()

template<typename _Scalar , typename _StorageIndex >
Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::~MappedSuperNodalMatrix ( )
inline
52 {
53
54 }

Member Function Documentation

◆ colIndexPtr() [1/2]

template<typename _Scalar , typename _StorageIndex >
StorageIndex * Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::colIndexPtr ( )
inline

Return the pointers to the beginning of each column in valuePtr()

100 {
101 return m_nzval_colptr;
102 }
StorageIndex * m_nzval_colptr
Definition SparseLU_SupernodalMatrix.h:168

References Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::m_nzval_colptr.

◆ colIndexPtr() [2/2]

template<typename _Scalar , typename _StorageIndex >
const StorageIndex * Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::colIndexPtr ( ) const
inline

◆ cols()

template<typename _Scalar , typename _StorageIndex >
Index Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::cols ( )
inline

Number of columns

83{ return m_col; }
Index m_col
Definition SparseLU_SupernodalMatrix.h:165

References Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::m_col.

◆ colToSup() [1/2]

template<typename _Scalar , typename _StorageIndex >
StorageIndex * Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::colToSup ( )
inline

Return the array of column-to-supernode mapping

132{ return m_col_to_sup; }
StorageIndex * m_col_to_sup
Definition SparseLU_SupernodalMatrix.h:171

References Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::m_col_to_sup.

◆ colToSup() [2/2]

template<typename _Scalar , typename _StorageIndex >
const StorageIndex * Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::colToSup ( ) const
inline

◆ nsuper()

template<typename _Scalar , typename _StorageIndex >
Index Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::nsuper ( ) const
inline

Return the number of supernodes

152 {
153 return m_nsuper;
154 }
Index m_nsuper
Definition SparseLU_SupernodalMatrix.h:166

References Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::m_nsuper.

◆ rowIndex() [1/2]

template<typename _Scalar , typename _StorageIndex >
StorageIndex * Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::rowIndex ( )
inline

Return the array of compressed row indices of all supernodes

112{ return m_rowind; }
StorageIndex * m_rowind
Definition SparseLU_SupernodalMatrix.h:169

References Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::m_rowind.

◆ rowIndex() [2/2]

template<typename _Scalar , typename _StorageIndex >
const StorageIndex * Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::rowIndex ( ) const
inline

◆ rowIndexPtr() [1/2]

template<typename _Scalar , typename _StorageIndex >
StorageIndex * Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::rowIndexPtr ( )
inline

Return the location in rowvaluePtr() which starts each column

122{ return m_rowind_colptr; }
StorageIndex * m_rowind_colptr
Definition SparseLU_SupernodalMatrix.h:170

References Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::m_rowind_colptr.

◆ rowIndexPtr() [2/2]

template<typename _Scalar , typename _StorageIndex >
const StorageIndex * Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::rowIndexPtr ( ) const
inline

◆ rows()

template<typename _Scalar , typename _StorageIndex >
Index Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::rows ( )
inline

Number of rows

78{ return m_row; }
Index m_row
Definition SparseLU_SupernodalMatrix.h:164

References Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::m_row.

◆ setInfos()

template<typename _Scalar , typename _StorageIndex >
void Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::setInfos ( Index  m,
Index  n,
ScalarVector nzval,
IndexVector nzval_colptr,
IndexVector rowind,
IndexVector rowind_colptr,
IndexVector col_to_sup,
IndexVector sup_to_col 
)
inline

Set appropriate pointers for the lower triangular supernodal matrix These infos are available at the end of the numerical factorization FIXME This class will be modified such that it can be use in the course of the factorization.

63 {
64 m_row = m;
65 m_col = n;
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();
73 }
Scalar * m_nzval
Definition SparseLU_SupernodalMatrix.h:167
StorageIndex * m_sup_to_col
Definition SparseLU_SupernodalMatrix.h:172

References Eigen::PlainObjectBase< Derived >::data(), Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::m_col, Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::m_col_to_sup, Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::m_nsuper, Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::m_nzval, Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::m_nzval_colptr, Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::m_row, Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::m_rowind, Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::m_rowind_colptr, and Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::m_sup_to_col.

Referenced by Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::MappedSuperNodalMatrix().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ solveInPlace()

template<typename Scalar , typename Index_ >
template<typename Dest >
void Eigen::internal::MappedSuperNodalMatrix< Scalar, Index_ >::solveInPlace ( MatrixBase< Dest > &  X) const

Solve with the supernode triangular matrix.

235{
236 /* Explicit type conversion as the Index type of MatrixBase<Dest> may be wider than Index */
237// eigen_assert(X.rows() <= NumTraits<Index>::highest());
238// eigen_assert(X.cols() <= NumTraits<Index>::highest());
239 Index n = int(X.rows());
240 Index nrhs = Index(X.cols());
241 const Scalar * Lval = valuePtr(); // Nonzero values
242 Matrix<Scalar,Dynamic,Dest::ColsAtCompileTime, ColMajor> work(n, nrhs); // working vector
243 work.setZero();
244 for (Index k = 0; k <= nsuper(); k ++)
245 {
246 Index fsupc = supToCol()[k]; // First column of the current supernode
247 Index istart = rowIndexPtr()[fsupc]; // Pointer index to the subscript of the current column
248 Index nsupr = rowIndexPtr()[fsupc+1] - istart; // Number of rows in the current supernode
249 Index nsupc = supToCol()[k+1] - fsupc; // Number of columns in the current supernode
250 Index nrow = nsupr - nsupc; // Number of rows in the non-diagonal part of the supernode
251 Index irow; //Current index row
252
253 if (nsupc == 1 )
254 {
255 for (Index j = 0; j < nrhs; j++)
256 {
257 InnerIterator it(*this, fsupc);
258 ++it; // Skip the diagonal element
259 for (; it; ++it)
260 {
261 irow = it.row();
262 X(irow, j) -= X(fsupc, j) * it.value();
263 }
264 }
265 }
266 else
267 {
268 // The supernode has more than one column
269 Index luptr = colIndexPtr()[fsupc];
270 Index lda = colIndexPtr()[fsupc+1] - luptr;
271
272 // Triangular solve
273 Map<const Matrix<Scalar,Dynamic,Dynamic, ColMajor>, 0, OuterStride<> > A( &(Lval[luptr]), nsupc, nsupc, OuterStride<>(lda) );
274 Map< Matrix<Scalar,Dynamic,Dest::ColsAtCompileTime, ColMajor>, 0, OuterStride<> > U (&(X(fsupc,0)), nsupc, nrhs, OuterStride<>(n) );
275 U = A.template triangularView<UnitLower>().solve(U);
276
277 // Matrix-vector product
278 new (&A) Map<const Matrix<Scalar,Dynamic,Dynamic, ColMajor>, 0, OuterStride<> > ( &(Lval[luptr+nsupc]), nrow, nsupc, OuterStride<>(lda) );
279 work.topRows(nrow).noalias() = A * U;
280
281 //Begin Scatter
282 for (Index j = 0; j < nrhs; j++)
283 {
284 Index iptr = istart + nsupc;
285 for (Index i = 0; i < nrow; i++)
286 {
287 irow = rowIndex()[iptr];
288 X(irow, j) -= work(i, j); // Scatter operation
289 work(i, j) = Scalar(0);
290 iptr++;
291 }
292 }
293 }
294 }
295}
StorageIndex * supToCol()
Definition SparseLU_SupernodalMatrix.h:141
StorageIndex * rowIndex()
Definition SparseLU_SupernodalMatrix.h:112
_Scalar Scalar
Definition SparseLU_SupernodalMatrix.h:36
StorageIndex * rowIndexPtr()
Definition SparseLU_SupernodalMatrix.h:122
StorageIndex * colIndexPtr()
Definition SparseLU_SupernodalMatrix.h:99
Index nsuper() const
Definition SparseLU_SupernodalMatrix.h:151
Scalar * valuePtr()
Definition SparseLU_SupernodalMatrix.h:90
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:33
@ X
Definition libslic3r.h:98

References Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::InnerIterator::row(), Eigen::PlainObjectBase< Derived >::setZero(), and Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::InnerIterator::value().

+ Here is the call graph for this function:

◆ supToCol() [1/2]

template<typename _Scalar , typename _StorageIndex >
StorageIndex * Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::supToCol ( )
inline

Return the array of supernode-to-column mapping

141{ return m_sup_to_col; }

References Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::m_sup_to_col.

◆ supToCol() [2/2]

template<typename _Scalar , typename _StorageIndex >
const StorageIndex * Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::supToCol ( ) const
inline

◆ valuePtr() [1/2]

template<typename _Scalar , typename _StorageIndex >
Scalar * Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::valuePtr ( )
inline

Return the array of nonzero values packed by column

The size is nnz

90{ return m_nzval; }

References Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::m_nzval.

◆ valuePtr() [2/2]

template<typename _Scalar , typename _StorageIndex >
const Scalar * Eigen::internal::MappedSuperNodalMatrix< _Scalar, _StorageIndex >::valuePtr ( ) const
inline

Member Data Documentation

◆ m_col

◆ m_col_to_sup

◆ m_nsuper

◆ m_nzval

◆ m_nzval_colptr

◆ m_row

◆ m_rowind

◆ m_rowind_colptr

◆ m_sup_to_col


The documentation for this class was generated from the following file: