Skip to content

refactor: rename ABS1 statement function to CABS1 for consistency#1219

Merged
langou merged 1 commit intoReference-LAPACK:masterfrom
nakatamaho:refactor/unify-abs1-to-cabs1
Mar 28, 2026
Merged

refactor: rename ABS1 statement function to CABS1 for consistency#1219
langou merged 1 commit intoReference-LAPACK:masterfrom
nakatamaho:refactor/unify-abs1-to-cabs1

Conversation

@nakatamaho
Copy link
Copy Markdown
Contributor

Closes #1217

Summary

Several LAPACK, BLAS, and CBLAS source files defined a local statement function named ABS1 for the complex 1-norm approximation:

ABS1( X ) = ABS( REAL( X ) ) + ABS( AIMAG( X ) )
ABS1( X ) = ABS( DBLE( X ) ) + ABS( DIMAG( X ) )

The majority of the codebase already uses CABS1 for this identical purpose. This PR renames ABS1 to CABS1 in all remaining files — definition line, declaration line, and all call sites within the same file — to make the naming consistent across the repository.

Details

A small number of fixed-form lines required continuation-line splits to stay within the 72-column limit after the rename.

No numerical change. Statement functions are file-local in Fortran, so there is no ABI or interface impact.

Motivation

This is a preparatory cleanup before inlining these statement functions, as discussed in #1200.

Several LAPACK, BLAS, and CBLAS source files defined a local statement
function named ABS1 for the complex 1-norm approximation:

    ABS1( X ) = ABS( REAL( X ) ) + ABS( AIMAG( X ) )
    ABS1( X ) = ABS( DBLE( X ) ) + ABS( DIMAG( X ) )

The majority of the codebase already uses CABS1 for this identical
purpose. This commit renames ABS1 to CABS1 in all remaining files
(definition line, declaration line, and all call sites within the
same file) to make the naming consistent across the repository.

A small number of fixed-form lines required continuation-line splits
to stay within the 72-column limit after the rename.

No numerical change. Statement functions are file-local in Fortran,
so there is no ABI or interface impact.

This is a preparatory cleanup before inlining these statement
functions (see issue Reference-LAPACK#1200).
nakatamaho added a commit to nakatamaho/mplapack that referenced this pull request Mar 28, 2026
…k#1219, #1220)

Upstream lapack#1219 renames the local ABS1 statement function to CABS1
in BLAS/LAPACK/CBLAS sources where it computes |Re(z)| + |Im(z)|.
Upstream lapack#1220 further handles Clargv/Zlargv, whose local ABS1
helper actually computes max(|Re(z)|, |Im(z)|) and must not be renamed
to CABS1; rename it to CABSMAX instead.

Apply both to the MPLAPACK C++ codebase:

- Add patch-cabs1_unification and patch-cabsmax to
  external/lapack/Makefile.am.
- Update mplapack/reference/Clargv.cpp: add inline cabsmax(), replace
  the two cabs1() call sites with cabsmax().
- Regenerate fable/3.12.1/lapack/patch-Clargv.cpp: introduce cabsmax
  inline helper and drop the erroneous lvalue ABS1 statement removal.
- Remove now-superfluous patches from fable/patch_lapack_3.12.1.sh:
  Cggev, Cggev3, Cggevx, Ctgevc, Clags2, Chgeqz were previously
  patched for ABS1->CABS1 and are subsumed by lapack#1219.
- Remove from fable/patch_lapack_test_3.12.1.sh: Cdrges, Cdrges3,
  Cget52 for the same reason.
- Simplify patch-Cdrgsx.cpp: the abs1->cabs1 hunks are no longer
  needed after lapack#1219.

No numerical change.

cf. Reference-LAPACK/lapack#1220
Reference-LAPACK/lapack#1219
@langou langou merged commit 9130566 into Reference-LAPACK:master Mar 28, 2026
12 checks passed
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.

refactor: rename ABS1 statement function to CABS1 for consistency`

2 participants