How to convert sparse matrix to dense matrix in Eigen

后端 未结 1 1035
日久生厌
日久生厌 2020-12-25 14:54

Is there some easy and fast way to convert a sparse matrix to a dense matrix of doubles?

Because my SparseMatrix is not sparse any more, but became dens

1条回答
  •  梦谈多话
    2020-12-25 15:15

    Let's declare two matrices:

    SparseMatrix spMat;
    MatrixXd dMat;
    

    Sparse to dense:

    dMat = MatrixXd(spMat);
    

    Dense to sparse:

    spMat = dMat.sparseView();
    

    0 讨论(0)
提交回复
热议问题