Skip to content

Conversation

angsch
Copy link
Collaborator

@angsch angsch commented Feb 25, 2024

Two small fixes of bdsqr:

  1. In Update dbdsqr.f #234 only the documentation of dbdsqr was updated. This updates the documentation of the remaining precisions.

  2. bdsqr can return -ZERO as a singular value. For example, [d,z]bdsqr on

D = [ -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0]
E = [ 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]

returns D(10) = -ZERO. This adds a branch enforcing that all singular values follow the definition and are non-negative, i.e., -ZERO is converted into +ZERO. Note that this is already enforced in lasq1 (used for the singular-values-only path).

In Reference-LAPACK#234
only dbdsqr was updated. This updates the documentation
of the other precisions.
[D,Z]BDSQR returns for

D = [ -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0]
E = [ 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]

as singular value  D(10) = -ZERO. By definition, singular values
are non-negative. LASQ1 already fixes the sign and returns +ZERO.
Copy link

codecov bot commented Feb 25, 2024

Codecov Report

Attention: Patch coverage is 0% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 0.00%. Comparing base (c6bc401) to head (230b8c4).

Files Patch % Lines
SRC/cbdsqr.f 0.00% 2 Missing ⚠️
SRC/dbdsqr.f 0.00% 2 Missing ⚠️
SRC/sbdsqr.f 0.00% 2 Missing ⚠️
SRC/zbdsqr.f 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #989   +/-   ##
=======================================
  Coverage    0.00%    0.00%           
=======================================
  Files        1929     1929           
  Lines      190627   190635    +8     
=======================================
- Misses     190627   190635    +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@thijssteel
Copy link
Collaborator

I approve of this change. However, @langou and I were recently discussing something similar about -ZERO and ZERO. Since we cannot normally distinguish between the two, for example:

  • -0. == 0. evaluates to true.

However, sign(1., -0.) == -1.0 in gfortran, which could definitely cause problems so I support this change.

@langou langou merged commit fe843f9 into Reference-LAPACK:master Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants