Registered Member
|
I'm trying to implement a function that maps a coordinate system to another coordinate system, and it was suggested to use Gauss-Jordan method to do this (they provided me some Lisp code as a working example).
I've tried figuring out how to do this with Eigen, but my knowledge of linear algebra is about nil. Any help would be appreciated. As an example:
Resulting mapped coordinate system from m1 to m2 -
|
Moderator
|
you just have to solve a linear system of equation m1 * result = m2. For instance you can do:
result = m1.inverse() * m2; or: result = m1.lu().solve(m2); For 3x3 matrices I don't know which option is the fastest. In both cases you need to #include <Eigen/LU> |
Registered Member
|
ggael, thanks. Worked like a charm. I'd tried those the other day prior to posting, but had stuffed the data arrays row major and hadn't realized my mistake.
|
Registered Member
|
Just out of interest:
I'd favour solution 2 with LU decomposition over solution 1 due to numerical stability. If the matrix is badly conditioned, the inverse will create more numerical issues than the solving via LU decomposition. Is that view correct or do both solutions exhibit comparable numerical behaviour? |
Registered users: Bing [Bot], Google [Bot], Sogou [Bot]