The local ABS1 statement function in CLARGV and ZLARGV does not compute
the usual complex ABS1/CABS1 quantity. It returns
max(abs(real(z)), abs(aimag(z)))
and is used only as a scaling helper in the same algorithmic path as
CLARTG/ZLARTG.
Rename the helper to CABSMAX so that the name matches its actual
behavior and does not suggest CABS1 semantics.
No numerical behavior is changed.
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 #1200).
Remove the erroneous "LDSWORK = 2" assignment inside the LQUERY branch
of STRSYL3, DTRSYL3, CTRSYL3, and ZTRSYL3. The assignment overwrites
the caller's input argument, which is declared as intent(in) in the
documentation. The assignment was unnecessary because SWORK(1,1) and
SWORK(2,1) access column 1 only, making the leading dimension
irrelevant for these stores (offset = (i-1) + (j-1)*LDSWORK, j=1).
In 26 driver routines across all four precisions (S, D, C, Z),
xSTEBZ was called writing directly to INFO, which was then
silently overwritten by xSTEIN. Two bugs are fixed:
1. xSTEBZ errors were not propagated to the caller at all.
2. When xSTEBZ returned INFO > 0, eigenvectors were computed
with an incomplete or empty eigenvalue set (INFO=2,3,4) or
with reduced accuracy (INFO=1), producing silently wrong
results.
Fix: route xSTEBZ return value through IINFO. For INFO != 1,
skip xSTEIN entirely via GO TO. For INFO == 1 (bisection
convergence warning), xSTEIN is still called since M eigenvalues
are available; the warning is preserved in INFO.
The xSTEBZ error is encoded as INFO = N + IINFO to distinguish
it from xSTEIN failures (1..N), matching the convention already
used for xPBSTF errors in the xBGVX routines. For the four
xBGVX routines, which already use INFO = N+i for xPBSTF, the
xSTEBZ error is encoded as INFO = 2*N + IINFO.
Update INFO documentation in all 26 files accordingly.
Also add IINFO to the INTEGER declaration in dstevx.f and
sstevx.f where it was missing.
Files modified (26):
SRC/chbevx.f, SRC/chbevx_2stage.f, SRC/chbgvx.f,
SRC/cheevx.f, SRC/cheevx_2stage.f, SRC/chpevx.f,
SRC/dsbevx.f, SRC/dsbevx_2stage.f, SRC/dsbgvx.f,
SRC/dspevx.f, SRC/dstevx.f, SRC/dsyevx.f, SRC/dsyevx_2stage.f,
SRC/ssbevx.f, SRC/ssbevx_2stage.f, SRC/ssbgvx.f,
SRC/sspevx.f, SRC/sstevx.f, SRC/ssyevx.f, SRC/ssyevx_2stage.f,
SRC/zhbevx.f, SRC/zhbevx_2stage.f, SRC/zhbgvx.f,
SRC/zheevx.f, SRC/zheevx_2stage.f, SRC/zhpevx.f
Fix workspace size handling in {s,d,c,z}{sy,sp,he,hp}gvd:
1. Workspace readback: remove redundant REAL()/DBLE() casts on INTEGER
and same-type operands in the post-CHEEVD/ZHEEVD/etc. MAX expressions.
The old pattern INT(MAX(REAL(int_var), REAL(fp_var))) needlessly
round-tripped integers through floating-point; for IWORK (already
INTEGER) the conversion was entirely spurious and risks precision
loss when 5*N+3 exceeds the 23-bit (single) or 52-bit (double)
significand.
2. WORK(1) writes: use SROUNDUP_LWORK/DROUNDUP_LWORK in dspgvd, dsygvd,
zhegvd, zhpgvd where the optimal workspace size was previously stored
via bare assignment (WORK(1) = LOPT), losing the ceiling guarantee
that ROUNDUP_LWORK provides.
3. RWORK(1) writes: replace REAL(LROPT) with SROUNDUP_LWORK (chegvd,
chpgvd) or DROUNDUP_LWORK (zhegvd, zhpgvd). The zhegvd/zhpgvd case
was a latent bug: RWORK is DOUBLE PRECISION but REAL() truncated to
single precision before storing.
4. Add DROUNDUP_LWORK declarations (type + EXTERNAL) to the four
double-precision / complex-16 routines that lacked them. Remove
now-unused REAL/DBLE from INTRINSIC lists where applicable.
The INTEGER declaration line added by PR #1202 exceeds column 72,
causing 'MINMNFACT' to extend into the sequence number field
(columns 73-80). In fixed-form Fortran, compilers silently truncate
at column 72, so 'MINMNFACT' is parsed as 'MINMNF', leaving the
actual variable undeclared.
Move KBOUND, MINMNFACT to the continuation line to keep all code
within columns 1-72.
In all four variants (SLAQP2RK, DLAQP2RK, CLAQP2RK, ZLAQP2RK),
KMAX was declared as [in] in the documentation but was overwritten
internally via:
KMAX = MIN( KMAX, MINMNFACT )
This is a bug in the reference LAPACK implementation: the Fortran
calling convention silently tolerates this when the caller passes
a temporary expression, but the intent annotation is violated and
C/C++ translations fail to compile (cannot bind rvalue to non-const
reference).
Introduce local variable KBOUND to hold the clamped value:
KBOUND = MIN( KMAX, MINMNFACT )
and replace all subsequent uses of KMAX in the executable section
(loop bound and final assignment K = KBOUND) with KBOUND.
KMAX itself is no longer modified.
The modulefile la_xisnan.F90 depends on the modulefile
la_constants.f90 but this dependency is not expressed in the CMake
rules. In some parallel builds we have observed failures where
compilation of objects that depend on la_constants.mod starts before
compilation of la_constants.f90 has finished.
This patch modifies CMakeLists.txt to ensure that la_constants.mod is
built before any other object or modulefile that depends on it.