Registered Member
|
Hi, i am having trouble transforming a matrix to its upper triangular form (echelon form) using Eigen.
Basically, i want to perform elementary row operations such that the resulting matrix is on echelon form (i do not require the zero-rows to be at the bottom). Afterwards i would like to identify those columns that contains pivots (linearly independent columns of the matrix). The order of the columns is important, so if the columns are swapped, then i should be able to identify the old columns that corresponds to the linearly independent columns of the new matrix. I do not know if the materix is square and invertible, so the procedure should work for all types of matrices. Thank you for the help!
Last edited by kaffeplet on Mon Jan 30, 2017 6:03 pm, edited 1 time in total.
|
Registered Member
|
I have tried the following using Eigen:
Eigen::MatrixXd U = C.fullPivLu().matrixLU().triangularView<Eigen::Upper>(); where C is of type Eigen::MatrixXd, but it looks like some columns are swapped. I have also tried: Eigen::MatrixXd U = C.partialPivLu().matrixLU().triangularView<Eigen::Upper>(); but then it outputs eg: -1 1 1 0 0 0 0 0 0 0 0 0 -1 1 -1 0 0 0 0 0 and the zero rows are not at the bottom (is this intended?). Does the partialPivLu() method work for all types of matrices? Because the output is acceptable if it works for every matrix, since i only need to identify the pivot columns. Also, is there a faster approach to identify pivot columns (here 1 and 3) then to iterate the matrix manually? |
Moderator
|
Have you looked at the image() and kernel() methods of FullPivLU? Maybe they address your initial needs.
|
Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]