Skip to content

cleanup: first batch of named-constant normalization in LAPACK sources#1226

Open
nakatamaho wants to merge 2 commits intoReference-LAPACK:masterfrom
nakatamaho:cleanup/bbcsd-constants
Open

cleanup: first batch of named-constant normalization in LAPACK sources#1226
nakatamaho wants to merge 2 commits intoReference-LAPACK:masterfrom
nakatamaho:cleanup/bbcsd-constants

Conversation

@nakatamaho
Copy link
Copy Markdown
Contributor

Summary

This PR collects a small first batch of no-functional-change cleanup
in LAPACK sources by normalizing scalar constant spelling.

In particular, it replaces typed literal 1 values with the existing
routine-local named constant ONE in the {s,d,c,z}bbcsd family.

Rationale

These routines already define named scalar parameters such as ZERO,
ONE, and TEN. Using those names consistently improves readability,
keeps the precision variants aligned, and avoids mixing routine-local
named constants with ad hoc typed literals.

Scope

This PR is intentionally limited to mechanical consistency changes:

  • replace existing scalar literals with already-defined named constants
  • keep the s/d/c/z variants in sync
  • no algorithmic or numerical behavior changes intended

Non-goals

This PR does not:

  • change convergence logic
  • change thresholds or iteration behavior
  • alter test expectations
  • introduce algorithmic fixes

Notes

This is intended as a small cleanup-first PR rather than a broad
refactor. If this direction is acceptable, similar purely mechanical
normalizations can be submitted in follow-up PRs.

Replace the literal `1.0` in the `SQRT(1 - NU**2)` path of
{c,d,s,z}bbcsd with the existing typed constant `ONE` for
consistency with the surrounding code.

This keeps the real and complex variants aligned and avoids
mixing a literal constant with the routine's named parameters.
No intended functional change.
SRC/cbbcsd.f Outdated
PARAMETER ( HUNDRED = 100.0E0, MEIGHTH = -0.125E0,
$ ONE = 1.0E0, TEN = 10.0E0, ZERO = 0.0E0 )
$ ONE = 1.0E0, TEN = 10.0E0, TWO = 2.0E0,
$ ZERO = 0.0E0 )
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to commit this change? (So declaring TWO and defining TWO as a parameter = 2.0e0?)

I do not think you meant this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right — this change was unnecessary. It came from an MPLAPACK-side change where
PIOVER2 was replaced with pi(zero) / two:

-    const REAL piover2 = 1.5707963267948966192313216916397514421;
+    const REAL two = 2.0;
+    const REAL piover2 = pi(zero) / two;

So introducing TWO here did not serve any real purpose. I'll fix it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, please check my newer commit, thank you very much.

ELSE
NU = SIGMA21
MU = SQRT( 1.0 - NU**2 )
MU = SQRT( ONE - NU**2 )
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is all good with me.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you very much!

Drop the unused TWO parameter from the BBCSD routines and reorder
the remaining named constants for consistency between the type
declaration and PARAMETER statement.

No functional change intended.
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.

2 participants