Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions tests/test_pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,10 +923,13 @@ def test_svd_sign_determinism(self, svd_func):
U1, s1, Vt1 = svd_func(X_gpu, k=k, rng=0)
U2, s2, Vt2 = svd_func(X_gpu, k=k, rng=0)

# Results should be identical (atol for GPU floating-point rounding variations)
np.testing.assert_allclose(U1.get(), U2.get(), rtol=1e-10, atol=1e-14)
np.testing.assert_allclose(s1.get(), s2.get(), rtol=1e-10, atol=1e-14)
np.testing.assert_allclose(Vt1.get(), Vt2.get(), rtol=1e-10, atol=1e-14)
# Results should be identical up to cuSPARSE noise: A.T @ u SpMV uses
# atomics with no bitwise-determinism guarantee, and Lanczos restarts
# amplify the ULP differences to ~1e-9 rel / ~5e-14 abs (measured on
# T4 and Blackwell), so tolerances sit 10-20x above that noise floor.
np.testing.assert_allclose(U1.get(), U2.get(), rtol=1e-8, atol=1e-12)
np.testing.assert_allclose(s1.get(), s2.get(), rtol=1e-8, atol=1e-12)
np.testing.assert_allclose(Vt1.get(), Vt2.get(), rtol=1e-8, atol=1e-12)

def test_mean_centered_operator(self):
"""Test that the mean-centered operator works correctly."""
Expand Down
Loading