[eigen] adding constructor to SparseMatrix

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]

Sorry about the previous mis-post.
I think that it'd be useful to be able to quickly cast a regular
Matrix type into a SparseMatrix.  I have two questions about the
1) Would it be better to implement a new SparseMatrix ctor that
accepts a Matrix as an argument, or to implement a function like
sparseView in the Matrix class which returns a SparseMatrix?
2)  At what level would it make sense for this to work?  In the first
direction, a general MatrixBase shouldn't be able to be turned into a
SparseMatrix because this doesn't make sense for some subtypes of
MatrixBases such as expressions.  In the other direction, if the
answer to the first question is to add a ctor, then should it be added
to SparseMatrixBase and be available to all of it's children, or
should it be specific to SparseMatrix?  Casting a DenseMatrix to a
SparseMatrix is probably most useful when a DenseMatrix is constructed
as part of an algorithm but the algorithm requires operations like
factorization and linear system solving which are more efficient when
performed on a SparseMatrix [if the matrix is truly sparse].  Because
of this, casting a Matrix to a DynamicSparseMatrix doesn't  seem too

What do you think?

On 6/7/10, Daniel Lowengrub <lowdanie@xxxxxxxxx> wrote:

Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/