Comments (4)
Normalized eigenvectors are not generally unique. As you've observed, you can arbitrarily change their signs while still retaining a valid eigendecomposition for the matrix. For example, we can check that we still get the original matrix back if we recompose the matrix from its eigendecomposition, as I've done here (note that due to limited precision of f32
, the zero blocks don't "look" very close to zero to a human eye).
As far as I can tell, nalgebra
appears to be doing the right thing, and the discrepancy between Eigen and nalgebra
is just due to implementation details. I don't quite understand how you can have an algorithm that fails because the sign is "wrong" - perhaps you can elaborate on this if you think there might still be more to the story.
I'll close this issue for now but feel free to re-open or follow up if you think there is more to address here. Hope this helps!
from nalgebra.
@Andlon thanks a lot for a quick response! Yes, indeed there is an algorithm, which is sensitive to this - the alignment of two molecular structures in terms of minimal RMSD.
In this algorithm one computes the eigenvectors of the 6x6 matrix and takes two eigenvectors with the largest eigenvalues (vectors 4 and 5 since they are sorted ascending). After that parts of these vectors are used to construct the transformation matrix that aligns one point cloud to the other.
The algorithm is here, look for rot_transform_matrix
.
I'm not an expert in this algorithm, I've copy-pasted it initially from old C-code and adapted for Eigen in C++. Now I translated it literally to nalgebra and have found an issue with the sign on 4-th eigenvector.
Currently I've just put "-" to invert the offending vector, but this looks like an unreliable hack because I can't guarantee that it will work for all matrices consistently (somehow, for Eigen and older C code it always just works).
I really don't like this kind of "black magic", so I'd be very grateful for any suggestions how to adapt the things to nalgebra way of computing eigenvectors.
from nalgebra.
I don't see a way to re-open an issue, btw.
from nalgebra.
And there is yet another bug candidate :)
If I compute the eigenvalues of this matrix with nalgebra::SymmetricEigen
I get this:
val =
┌ ┐
│ -39261.336 │
│ -58575.883 │
│ -17988.87 │
│ 17988.875 │
│ 39261.33 │
│ 58575.883 │
└ ┘
Two first values are not in correct ascending order.
If I do this with with nalgebra_lapack::SymmetricEigen
I get this:
val =
┌ ┐
│ -58575.8 │
│ -39261.313 │
│ -17988.877 │
│ 17988.863 │
│ 39261.305 │
│ 58575.83 │
└ ┘
Now everything is sorted correctly.
This is weird to say the least.
from nalgebra.
Related Issues (20)
- matrix literals or const constructors HOT 1
- `normalize` docs need expansion HOT 1
- Test flake in `f64::symmetric_eigen`
- Unit Quaternion logarithm inconsistent with exp HOT 1
- Matrix Views: non contiguous/regular slices
- Minimizing trait bound complexity when working with dimensional generics HOT 3
- SVD Computes Wrong Singular Values for Very Small-Valued Matrices HOT 1
- Make nalgebra_lapack::qr::QRScalar trait public
- Homographic transform via SVD/DLT - is it broken or am I doing it wrong?
- Inconsistency between Numpy/MATLAB and and nalgebra HOT 2
- Export crates used in public APIs
- unit quaternions and orthonormal matrices are only closed under successive multiplications in theory HOT 1
- Memory leak in generic_resize/reallocate_copy
- Inverting a 4x4 matrix with `try_inverse_mut` doesn't leave `self` unchanged if the inversion fails.
- Numerically vulnerable axis calculation in Rotation3
- How to construct a symmetric matrix in nalgebra? HOT 3
- `from_iter` implementation may run indefinitely HOT 8
- Request: Allow the multiplication of matrices of matrices
- Owned MatrixView Lifetime issues
- GAT in Allocator Trait HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nalgebra.