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

Matrix division or solving for matrix

Tags: None
(comma "," separated)
ronalde
Registered Member
Posts
3
Karma
0

Matrix division or solving for matrix

Sun May 12, 2013 10:04 pm
Hi,

I have 2xM matrices A and B and want to find 2x2 rotation matrix R, such that R*A = B. Basically I have vectors in columns of A and B and I want to find best rotation R that would rotate these vectors between two frames.

In MATLAB, B/A gives me the matrix I am looking for.
I hoped that the following code would give me the same answer with Eigen, but it does not:
Code: Select all
   
JacobiSVD<MatrixXf> svd(A.transpose(), ComputeFullU | ComputeFullV);
Matrix2f R_trps = svd.solve(B.transpose());


Can I achieve this with Eigen? How?
One shortcoming of my data is that vectors of A can be colinear, but MATLAB seems to be fine with that.

My linear algebra knowledge isn't that good.. Excuse me if I ask something that is already explained in the doc, but I did not understand it.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
This should give you similar results, except that you are using float, while Matlab uses doubles. Anyway, in both cases it is unlikely to give you a rotation matrix. You then have to perform a polar decomposition of the result to extract a pure rotation. See Transform::rotation() (http://eigen.tuxfamily.org/dox-devel/cl ... d8104367ac), e.g.:

Affine2f T(R_trps.transpose());
Matrix2f R = T.rotation();


Bookmarks



Who is online

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