This forum has been archived. All content is frozen. Please use KDE Discuss instead.

SparseLDLT PermutationMatrix w EIGEN_NO_AUTOMATIC_RESIZING

Tags: None
(comma "," separated)
jonaswallin
Registered Member
Posts
2
Karma
0
Hello,

I have currently been debugging some code, and was using the flag EIGEN_NO_AUTOMATIC_RESIZING.
Now I ran into an issue that I can't figure out, namely I can't recover the PermutationMatrix from SparseLDLT
using permutationP(). I have attached a simplified code below which works fine if I turn off EIGEN_NO_AUTOMATIC_RESIZING,
but does not work when I turn it on.
Does anybody know what I am doing wrong?

Code: Select all
#include <iostream>
#include <Eigen/Dense>

int main(){
  Eigen::IOFormat CleanFmt(4, 0, ", ", "\n", "[", "]");
  int k = 5;
  Eigen::SparseMatrix<double> A;
  A.resize(k,k);
  A.reserve(Eigen::VectorXi::Constant(k,2));
  for (int j=0; j<k; j++) {
    A.insert(j,j)=1.;
  }
  A.insert(3,0) = .2;
  A.insert(4,3) = -.1;
  A.insert(0,3) = A.coeff(3,0);
  A.insert(3,4) = A.coeff(4,3);
  A.makeCompressed();
  Eigen::SimplicialLDLT<Eigen::SparseMatrix<double> > LDLT(A);
  Eigen::PermutationMatrix<Eigen::Dynamic> perm = LDLT.permutationP();
  Eigen::MatrixXd P = perm.toDenseMatrix().cast<double>();
  std::cout << "A.perm = \n" << P.format(CleanFmt) << std::endl << std::endl;
return(0);
}


Thanks
Jonas Wallin
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
This works with the devel branch. Let me see what's wrong with the 3.2 branch.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]