Re: [eigen] Obtaining triplets from sparsematrix

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




On Wed, Jul 22, 2015 at 10:24 AM, Mathieu Dutour <mathieu.dutour@xxxxxxxxx> wrote:
Yes, thanks.
yes I think it would be better.

Another thing, the example should be changed from
SparseMatrix<double>::InnerIterator
to
typename SparseMatrix<double>::InnerIterator
at least that's what gcc says.

not in this case, only if you write typename SparseMatrix<Scalar>::InnerIterator with Scalar a template typename.

gael
 


Mathieu

On Tue, Jul 21, 2015 at 3:42 PM, Gael Guennebaud <gael.guennebaud@xxxxxxxxx> wrote:

I confirm that you have to manually iterate over the non-zero and fill the std::vector.

Instead of adding such a shortcut returning a std::vector<Triplet>, a more powerful feature would be to add an iterator over all non-zeros so that one could do:

std::vector<Triplet<T> > triplet(mat.nnz_begin(), mat.nnz_end());

and more...

gael


On Wed, Jul 8, 2015 at 4:42 PM, <Daniel.Vollmer@xxxxxx> wrote:
Look at the iterating over the non-zero coefficients part on http://eigen.tuxfamily.org/dox/group__TutorialSparse.html


Best regards

Daniel Vollmer

--------------------------
Deutsches Zentrum für Luft- und Raumfahrt e.V. (DLR)
German Aerospace Center
Institute of Aerodynamics and Flow Technology | Lilienthalplatz 7 | 38108 Braunschweig | Germany






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