Commit 75eda45
committed
Fix eigenvector sign ambiguity in Eigen SVD PCA implementation
The switch from VNL's vnl_symmetric_eigensystem to Eigen's BDCSVD
introduced test failures due to eigenvector sign ambiguity. In PCA,
eigenvectors are only determined up to a sign (both v and -v are
valid), and different libraries may return either arbitrarily.
Add a consistent sign convention: make the first element of each
eigenvector positive. This ensures deterministic results regardless of
the underlying linear algebra implementation.
Update test baselines to match the new consistent sign convention.
This way if we switch to another implementation later, we can keep the
results consistent.1 parent e9d84e9 commit 75eda45
File tree
5 files changed
+405
-393
lines changed- Libs/Particles
- Testing/data
- reconstruct_pca_python
- shapeworksTests/analyze
5 files changed
+405
-393
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
305 | | - | |
| 305 | + | |
| 306 | + | |
306 | 307 | | |
307 | 308 | | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
308 | 312 | | |
309 | 313 | | |
310 | 314 | | |
| |||
330 | 334 | | |
331 | 335 | | |
332 | 336 | | |
333 | | - | |
| 337 | + | |
| 338 | + | |
334 | 339 | | |
335 | 340 | | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
336 | 344 | | |
337 | 345 | | |
338 | 346 | | |
| |||
592 | 600 | | |
593 | 601 | | |
594 | 602 | | |
595 | | - | |
| 603 | + | |
| 604 | + | |
596 | 605 | | |
597 | 606 | | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
598 | 610 | | |
599 | 611 | | |
600 | 612 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
0 commit comments