Fix regression in DynamicSparseMatrix and SuperLUSupport wrt recent change on nonZeros/nonZerosEstimate

This commit is contained in:
Gael Guennebaud 2015-04-02 22:21:41 +02:00
parent 03a0df2010
commit 15b5adb327
2 changed files with 7 additions and 5 deletions

View File

@ -165,8 +165,9 @@ struct SluMatrix : SuperMatrix
} }
template<typename MatrixType> template<typename MatrixType>
static SluMatrix Map(SparseMatrixBase<MatrixType>& mat) static SluMatrix Map(SparseMatrixBase<MatrixType>& a_mat)
{ {
MatrixType &mat(a_mat.derived());
SluMatrix res; SluMatrix res;
if ((MatrixType::Flags&RowMajorBit)==RowMajorBit) if ((MatrixType::Flags&RowMajorBit)==RowMajorBit)
{ {
@ -184,9 +185,9 @@ struct SluMatrix : SuperMatrix
res.Mtype = SLU_GE; res.Mtype = SLU_GE;
res.storage.nnz = internal::convert_index<int>(mat.nonZeros()); res.storage.nnz = internal::convert_index<int>(mat.nonZeros());
res.storage.values = mat.derived().valuePtr(); res.storage.values = mat.valuePtr();
res.storage.innerInd = mat.derived().innerIndexPtr(); res.storage.innerInd = mat.innerIndexPtr();
res.storage.outerInd = mat.derived().outerIndexPtr(); res.storage.outerInd = mat.outerIndexPtr();
res.setScalarType<typename MatrixType::Scalar>(); res.setScalarType<typename MatrixType::Scalar>();

View File

@ -361,7 +361,6 @@ struct evaluator<DynamicSparseMatrix<_Scalar,_Options,_StorageIndex> >
: evaluator_base<DynamicSparseMatrix<_Scalar,_Options,_StorageIndex> > : evaluator_base<DynamicSparseMatrix<_Scalar,_Options,_StorageIndex> >
{ {
typedef _Scalar Scalar; typedef _Scalar Scalar;
typedef _StorageIndex Index;
typedef DynamicSparseMatrix<_Scalar,_Options,_StorageIndex> SparseMatrixType; typedef DynamicSparseMatrix<_Scalar,_Options,_StorageIndex> SparseMatrixType;
typedef typename SparseMatrixType::InnerIterator InnerIterator; typedef typename SparseMatrixType::InnerIterator InnerIterator;
typedef typename SparseMatrixType::ReverseInnerIterator ReverseInnerIterator; typedef typename SparseMatrixType::ReverseInnerIterator ReverseInnerIterator;
@ -378,6 +377,8 @@ struct evaluator<DynamicSparseMatrix<_Scalar,_Options,_StorageIndex> >
operator const SparseMatrixType&() const { return *m_matrix; } operator const SparseMatrixType&() const { return *m_matrix; }
Scalar coeff(Index row, Index col) const { return m_matrix->coeff(row,col); } Scalar coeff(Index row, Index col) const { return m_matrix->coeff(row,col); }
Index nonZerosEstimate() const { return m_matrix->nonZeros(); }
const SparseMatrixType *m_matrix; const SparseMatrixType *m_matrix;
}; };