Registered Member
|
I have a Eigen::VectorXi and I want to multiply it by a Permutation matrix and assign it again into same vector like the code below,but i am having difficulties,
Eigen::VectorXi independentIndexes,v; for (Math::mech_uint iter=0;iter<coorcnt;iter++) v(iter)=iter; mech_Matrix cq=system->getConstraintJacMatrix(); v=v*cq.fullPivLu().permutationQ(); //here is the problem independentIndexes=v.block(constcnt,0,dof,1); How to product permutation matrix with a vector without a problem? Thanks in advance. |
Moderator
|
A PermutationMatrix as to be understood as a NxN matrix, so writing v * P where v is a Nx1 column vector and P a NxN permutation is not correct. You have to write:
v.transpose() = v.transpose() * cq.fullPivLu().permutationQ(); |
Registered users: Baidu [Spider], Bing [Bot], Google [Bot], Yahoo [Bot]