Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect output from computeMatrixSqrt #52

Open
hengli opened this issue Mar 19, 2014 · 5 comments
Open

Incorrect output from computeMatrixSqrt #52

hengli opened this issue Mar 19, 2014 · 5 comments

Comments

@hengli
Copy link

hengli commented Mar 19, 2014

The computeMatrixSqrt function in https://github.com/ethz-asl/Schweizer-Messer/blob/master/sm_eigen/include/sm/eigen/matrix_sqrt.hpp outputs incorrect results.

In contrast, the operatorSqrt function in the SelfAdjointEigenSolver class does the same work, but returns correct results.

@simonlynen
Copy link
Contributor

@hengli Thanks for the heads up. Can you make a pull-request for that change. I would however prefer solving this via an LLT instead of using the EigenSolver which is terribly slow in Eigen.

@furgalep
Copy link
Contributor

Hi Lionel, In what way are the results incorrect? Always? In a particular case?

@hengli
Copy link
Author

hengli commented Mar 20, 2014

Hi Paul,

I was applying the function to the precision matrix for both the odometry data and chessboard data, and the function failed each time, returning a triangular matrix, B where B != A * A^T and A is the precision matrix.

Here is an example precision matrix for the odometry data:
879853.40 -524626.08 190716.10
-524626.08 2665040.52 212751.35
190716.10 212751.35 3184398.77

The function returns the following result:
106.87 -330.05 871.49
119.22 1628.14 0.00
1784.49 0.00 0.00

@furgalep
Copy link
Contributor

Maybe this was right all along:

In [4]: np.array([[106.87, -330.05, 871.49],[119.22, 1628.14, 0.00],[1784.49, 0.00, 0.00]])
Out[4]: 
array([[  106.87,  -330.05,   871.49],
       [  119.22,  1628.14,     0.  ],
       [ 1784.49,     0.  ,     0.  ]])

In [5]: U = np.array([[106.87, -330.05, 871.49],[119.22, 1628.14, 0.00],[1784.49, 0.00, 0.00]])

In [6]: np.dot(U,U.T)
Out[6]: 
array([[  879849.0195,  -524626.5656,   190708.4463],
       [ -524626.5656,  2665053.268 ,   212746.8978],
       [  190708.4463,   212746.8978,  3184404.5601]])

@furgalep furgalep reopened this May 10, 2014
@HannesSommer
Copy link
Contributor

Are you sure you checked it the right way? B != A * A^T is comletely normel (except some special cases), becaue the defining equation is A = BB^T. (for the Cholesky type square root B of A).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants