You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had a bug in my physics simulation (not rapier) that I tracked down to relying on svd to provide singular values in sorted order. The doc for svd states:
Computes the Singular Value Decomposition using implicit shift. The singular values are guaranteed to be sorted in descending order. If this order is not required consider using svd_unordered.
But the singular values I was getting were not sorted. Here is a test that reproduces the bug:
#[test]fnsvd3_sorted(){let mat = Matrix3::<f32>::new(1.0,0.0,0.0,0.0,0.99999994,0.0,0.0,
-0.00000054691924,1.0000005,);let svd = mat.svd(true,true);assert!(
svd.singular_values[2] <= svd.singular_values[1]
&& svd.singular_values[1] <= svd.singular_values[0],
"Singular values are not sorted in descending order: {}",
svd.singular_values
);}
This results in:
thread 'svd3_sorted' panicked at 'Singular values are not sorted in descending order:
┌ ┐
│ 1.0000005 │
│ 0.99999994 │
│ 1 │
└ ┘
I am using nalgebra version 0.32.1.
The text was updated successfully, but these errors were encountered:
There is a typo in svd3.rs:45 where rho0 is swapped with rho2 but it should be rho1 that is swapped with rho2. I don't think this is the cause of the bug though.
I had a bug in my physics simulation (not rapier) that I tracked down to relying on svd to provide singular values in sorted order. The doc for
svd
states:But the singular values I was getting were not sorted. Here is a test that reproduces the bug:
This results in:
I am using nalgebra version 0.32.1.
The text was updated successfully, but these errors were encountered: