diff --git a/Eigen/src/SparseLU/SparseLU.h b/Eigen/src/SparseLU/SparseLU.h index 833832f3b..593ec7e25 100644 --- a/Eigen/src/SparseLU/SparseLU.h +++ b/Eigen/src/SparseLU/SparseLU.h @@ -26,13 +26,17 @@ #ifndef EIGEN_SPARSE_LU #define EIGEN_SPARSE_LU +namespace Eigen { + +template +class SparseLU; + #include #include #include #include #include #include -namespace Eigen { template class SparseLU @@ -412,9 +416,11 @@ void SparseLU::factorize(const MatrixType& matrix) // ?? 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_factorizationIsOk = ok; } diff --git a/Eigen/src/SparseLU/SparseLU_Matrix.h b/Eigen/src/SparseLU/SparseLU_Matrix.h index c4d56ee0a..1fe991d1c 100644 --- a/Eigen/src/SparseLU/SparseLU_Matrix.h +++ b/Eigen/src/SparseLU/SparseLU_Matrix.h @@ -27,47 +27,83 @@ #define EIGEN_SPARSELU_MATRIX_H /** \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. * Only the lower triangular matrix has supernodes. * * 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 class SuperNodalMatrix { 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: - Index nnz; // Number of nonzero values - Index nsupper; // Index of the last supernode - Scalar *nzval; //array of nonzero values packed by (supernode ??) column - Index *nzval_colptr; //nzval_colptr[j] Stores the location in nzval[] which starts column j - Index *rowind; // Array of compressed row indices of rectangular supernodes - Index rowind_colptr; //rowind_colptr[j] stores the location in rowind[] which starts column j - Index *col_to_sup; // col_to_sup[j] is the supernode number to which column j belongs - Index *sup_to_col; //sup_to_col[s] points to the starting column of the s-th supernode - // Index *nzval_colptr corresponds to m_outerIndex in SparseMatrix + Index m_row; // Number of rows + Index m_col; // Number of columns + Index m_nnz; // Number of nonzero values + Index m_nsupper; // Index of the last supernode + Scalar* m_nzval; //array of nonzero values packed by (supernode ??) column + Index* m_nzval_colptr; //nzval_colptr[j] Stores the location in nzval[] which starts column j + Index* m_rowind; // Array of compressed row indices of rectangular supernodes + Index* m_rowind_colptr; //rowind_colptr[j] stores the location in rowind[] which starts column j + 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 : SuperNodalMatrix(SparseMatrix& ) {} }; -SuperNodalMatrix::operator SparseMatrix() +SuperNodalMatrix::SuperNodalMatrix(SparseMatrix& mat) { } diff --git a/Eigen/src/SparseLU/SparseLU_Utils.h b/Eigen/src/SparseLU/SparseLU_Utils.h index 88d1c8b80..8d3d5efee 100644 --- a/Eigen/src/SparseLU/SparseLU_Utils.h +++ b/Eigen/src/SparseLU/SparseLU_Utils.h @@ -92,4 +92,5 @@ void SparseLU::LU_fixupL(const int n, const VectorXi& perm_r, GlobalLU_t& Glu) xlsub(n) = nextl; } + #endif