Skip to content

Commit

Permalink
bugfix: svd criterion
Browse files Browse the repository at this point in the history
  • Loading branch information
sarah-quinones committed Sep 23, 2024
1 parent 988acab commit a7c9d07
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/draft-pdf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
journal: joss
paper-path: paper.md
- name: Upload
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: paper
path: paper.pdf
11 changes: 6 additions & 5 deletions src/linalg/svd/bidiag_real_svd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1224,13 +1224,15 @@ fn bidiag_svd_qr_algorithm_impl<E: RealField>(
} = self;
let n = diag.len();
let arch = E::Simd::default();
let epsilon2 = E::faer_mul(epsilon, epsilon);

for iter in 0..max_iter {
let _ = iter;
for i in 0..n - 1 {
if subdiag[i].faer_abs()
<= epsilon.faer_mul(diag[i].faer_abs().faer_add(diag[i + 1].faer_abs()))
|| subdiag[i].faer_abs() <= epsilon
if subdiag[i].faer_abs2()
<= epsilon2
.faer_mul(E::faer_mul(diag[i].faer_abs(), diag[i + 1].faer_abs()))
+ consider_zero_threshold
{
subdiag[i] = E::faer_zero();
}
Expand All @@ -1242,8 +1244,7 @@ fn bidiag_svd_qr_algorithm_impl<E: RealField>(
}

let mut end = n;
while end > 1 && subdiag[end - 2].faer_abs() <= consider_zero_threshold.faer_sqrt()
{
while end > 1 && subdiag[end - 2].faer_abs2() <= consider_zero_threshold {
end -= 1;
}

Expand Down

0 comments on commit a7c9d07

Please sign in to comment.