mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-05-13 00:08:08 +08:00
Supernodal Matrix
This commit is contained in:
parent
b26d6b02de
commit
4e5655cc03
@ -26,13 +26,17 @@
|
|||||||
#ifndef EIGEN_SPARSE_LU
|
#ifndef EIGEN_SPARSE_LU
|
||||||
#define EIGEN_SPARSE_LU
|
#define EIGEN_SPARSE_LU
|
||||||
|
|
||||||
|
namespace Eigen {
|
||||||
|
|
||||||
|
template <typename _MatrixType>
|
||||||
|
class SparseLU;
|
||||||
|
|
||||||
#include <Ordering.h>
|
#include <Ordering.h>
|
||||||
#include <SparseLU_Utils.h>
|
#include <SparseLU_Utils.h>
|
||||||
#include <SuperNodalMatrix.h>
|
#include <SuperNodalMatrix.h>
|
||||||
#include <SparseLU_Structs.h>
|
#include <SparseLU_Structs.h>
|
||||||
#include <SparseLU_Memory.h>
|
#include <SparseLU_Memory.h>
|
||||||
#include <SparseLU_Coletree.h>
|
#include <SparseLU_Coletree.h>
|
||||||
namespace Eigen {
|
|
||||||
|
|
||||||
template <typename _MatrixType>
|
template <typename _MatrixType>
|
||||||
class SparseLU
|
class SparseLU
|
||||||
@ -412,9 +416,11 @@ void SparseLU::factorize(const MatrixType& matrix)
|
|||||||
// ?? Should it be done automatically by C++
|
// ?? Should it be done automatically by C++
|
||||||
//...
|
//...
|
||||||
|
|
||||||
// Create supernode matrix L and the column major matrix U
|
// Create supernode matrix L
|
||||||
// ...
|
m_Lstore.setInfos(m, min_mn, nnzL, Glu.lusup, Glu.xlusup, Glu.lsub, Glu.xlsub, Glu.supno; Glu.xsup);
|
||||||
|
// Create the column major upper sparse matrix U
|
||||||
|
// Could be great to have the SparseMatrix constructor accepting the CSC matrix pointers
|
||||||
|
// The Map class can do the job somehow
|
||||||
m_info = Success;
|
m_info = Success;
|
||||||
m_factorizationIsOk = ok;
|
m_factorizationIsOk = ok;
|
||||||
}
|
}
|
||||||
|
@ -27,47 +27,83 @@
|
|||||||
#define EIGEN_SPARSELU_MATRIX_H
|
#define EIGEN_SPARSELU_MATRIX_H
|
||||||
|
|
||||||
/** \ingroup SparseLU_Module
|
/** \ingroup SparseLU_Module
|
||||||
* \brief a class to manipulate the supernodal matrices in the SparseLU factorization
|
* \brief a class to manipulate the L supernodal factor from the SparseLU factorization
|
||||||
*
|
*
|
||||||
* This class extends the class SparseMatrix and should contain the data to easily store
|
* This class contain the data to easily store
|
||||||
* and manipulate the supernodes during the factorization and solution phase of Sparse LU.
|
* and manipulate the supernodes during the factorization and solution phase of Sparse LU.
|
||||||
* Only the lower triangular matrix has supernodes.
|
* Only the lower triangular matrix has supernodes.
|
||||||
*
|
*
|
||||||
* NOTE : This class corresponds to the SCformat structure in SuperLU
|
* NOTE : This class corresponds to the SCformat structure in SuperLU
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
/* TO DO
|
||||||
|
* InnerIterator as for sparsematrix
|
||||||
|
* SuperInnerIterator to iterate through all supernodes
|
||||||
|
* Function for triangular solve
|
||||||
|
*/
|
||||||
template <typename _Scalar, typename _Index>
|
template <typename _Scalar, typename _Index>
|
||||||
class SuperNodalMatrix
|
class SuperNodalMatrix
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SCMatrix()
|
typedef typename _Scalar Scalar;
|
||||||
|
typedef typename _Index Index;
|
||||||
|
public:
|
||||||
|
SuperNodalMatrix()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
SuperNodalMatrix(Index m, Index n, Index nnz, Scalar *nzval, Index* nzval_colptr, Index* rowind,
|
||||||
|
Index* rowind_colptr, Index* col_to_sup, Index* sup_to_col ):m_row(m),m_col(n),m_nnz(nnz),
|
||||||
|
m_nzval(nzval),m_nzval_colptr(nzval_colptr),m_rowind(rowind),
|
||||||
|
m_rowind_colptr(rowind_colptr),m_col_to_sup(col_to_sup),m_sup_to_col(sup_to_col)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~SCMatrix()
|
~SuperNodalMatrix()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
operator SparseMatrix();
|
void setInfos(Index m, Index n, Index nnz, Scalar *nzval, Index* nzval_colptr, Index* rowind,
|
||||||
|
Index* rowind_colptr, Index* col_to_sup, Index* sup_to_col )
|
||||||
|
{
|
||||||
|
m_row = m;
|
||||||
|
m_col = n;
|
||||||
|
m_nnz = nnz;
|
||||||
|
m_nzval = nzval;
|
||||||
|
m_nzval_colptr = nzval_colptr;
|
||||||
|
m_rowind = rowind;
|
||||||
|
m_rowind_colptr = rowind_colptr;
|
||||||
|
m_col_to_sup = col_to_sup;
|
||||||
|
m_sup_to_col = sup_to_col;
|
||||||
|
|
||||||
|
}
|
||||||
|
SuperNodalMatrix(SparseMatrix& mat);
|
||||||
|
|
||||||
|
class InnerIterator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
}:
|
||||||
protected:
|
protected:
|
||||||
Index nnz; // Number of nonzero values
|
Index m_row; // Number of rows
|
||||||
Index nsupper; // Index of the last supernode
|
Index m_col; // Number of columns
|
||||||
Scalar *nzval; //array of nonzero values packed by (supernode ??) column
|
Index m_nnz; // Number of nonzero values
|
||||||
Index *nzval_colptr; //nzval_colptr[j] Stores the location in nzval[] which starts column j
|
Index m_nsupper; // Index of the last supernode
|
||||||
Index *rowind; // Array of compressed row indices of rectangular supernodes
|
Scalar* m_nzval; //array of nonzero values packed by (supernode ??) column
|
||||||
Index rowind_colptr; //rowind_colptr[j] stores the location in rowind[] which starts column j
|
Index* m_nzval_colptr; //nzval_colptr[j] Stores the location in nzval[] which starts column j
|
||||||
Index *col_to_sup; // col_to_sup[j] is the supernode number to which column j belongs
|
Index* m_rowind; // Array of compressed row indices of rectangular supernodes
|
||||||
Index *sup_to_col; //sup_to_col[s] points to the starting column of the s-th supernode
|
Index* m_rowind_colptr; //rowind_colptr[j] stores the location in rowind[] which starts column j
|
||||||
// Index *nzval_colptr corresponds to m_outerIndex in SparseMatrix
|
Index *m_col_to_sup; // col_to_sup[j] is the supernode number to which column j belongs
|
||||||
|
Index *m_sup_to_col; //sup_to_col[s] points to the starting column of the s-th supernode
|
||||||
|
|
||||||
private :
|
private :
|
||||||
SuperNodalMatrix(SparseMatrix& ) {}
|
SuperNodalMatrix(SparseMatrix& ) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
SuperNodalMatrix::operator SparseMatrix()
|
SuperNodalMatrix::SuperNodalMatrix(SparseMatrix& mat)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -92,4 +92,5 @@ void SparseLU::LU_fixupL(const int n, const VectorXi& perm_r, GlobalLU_t& Glu)
|
|||||||
|
|
||||||
xlsub(n) = nextl;
|
xlsub(n) = nextl;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user