Fix bug #454: allow Block/Map objects for solving with SuperLU

This commit is contained in:
Gael Guennebaud 2012-06-06 09:37:59 +02:00
parent fc5f21903b
commit c58b759865

View File

@ -161,14 +161,14 @@ struct SluMatrix : SuperMatrix
}
}
template<typename Scalar, int Rows, int Cols, int Options, int MRows, int MCols>
static SluMatrix Map(Matrix<Scalar,Rows,Cols,Options,MRows,MCols>& mat)
template<typename MatrixType>
static SluMatrix Map(MatrixBase<MatrixType>& _mat)
{
typedef Matrix<Scalar,Rows,Cols,Options,MRows,MCols> MatrixType;
eigen_assert( ((Options&RowMajor)!=RowMajor) && "row-major dense matrices is not supported by SuperLU");
MatrixType& mat(_mat.derived());
eigen_assert( ((MatrixType::Flags&RowMajorBit)!=RowMajorBit) && "row-major dense matrices are not supported by SuperLU");
SluMatrix res;
res.setStorageType(SLU_DN);
res.setScalarType<Scalar>();
res.setScalarType<typename MatrixType::Scalar>();
res.Mtype = SLU_GE;
res.nrow = mat.rows();