[eigen] Converting a sparse symmetric matrix to a (nonsymmetric) dense one

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


I would like to know how to convert a symmetric matrix into a dense one whose storage is unsymmetric.

For the moment, I perform the converison like this:

        MatrixXd Id = MatrixXd::Identity(n, p);
        MatrixXd dense_matrix = sparse_matrix.selfadjointView<Upper>() * Id;

But I guess it it not optimal.

I would prefer to perform a real conversion, following something like that:

    MatrixXd dense_matrix = MatrixXd(sparse_matrix.selfadjointView<Upper>());

but this syntax does not seem to be correct.

What is the best way to do it?


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