Replace hard-coded floating-point constants with existing named
constants in the drvrf3 and drvrfp test drivers. This keeps the test
initialization code consistent with surrounding LAPACK test style.
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).
Replace external function references to SCABS1 and DCABS1 with a local
statement function CABS1 in CAXPY and ZAXPY respectively, eliminating
the dependency on those auxiliary routines.
Turn on test options that were left disabled in several TESTING input files.
Set "Put T to test the driver routines" to T in cgg.in, dgg.in, sgg.in,
and zgg.in so the generalized nonsymmetric eigenvalue driver tests are run.
Also set "Put T to test the error exits" to T in cbb.in, dbb.in, sbb.in,
and zbb.in to restore the corresponding error-exit checks.
Turn on test options that were left disabled in several TESTING input files.
Set "Put T to test the driver routines" to T in cgg.in, dgg.in, sgg.in,
and zgg.in so the generalized nonsymmetric eigenvalue driver tests are run.
Also set "Put T to test the error exits" to T in cbb.in, dbb.in, sbb.in,
and zbb.in to restore the corresponding error-exit checks.
In cdrvsg2stg.f, ddrvsg2stg.f, sdrvsg2stg.f, and zdrvsg2stg.f, the
three RANGE='A'/'V'/'I' calls to CHPGVX, DSPGVX, SSPGVX, and ZHPGVX
were passing INFO as the output error argument instead of IINFO.
The error-check block immediately following each call tests IINFO.NE.0,
but IINFO was never updated by the routine, so errors were silently
ignored. Additionally, the block sets INFO = ABS(IINFO), which would
overwrite the value ZHPGVX/xSPGVX had written into INFO with the
stale value of IINFO.
All other driver calls in these files (ZHEGV, ZHEGVD, ZHEGVX, ZHPGV,
ZHPGVD, ZHBGV, ZHBGVD, ZHBGVX and their s/d/c equivalents) correctly
use IINFO. This commit brings the xSPGVX/xHPGVX calls into line with
the established pattern.
Affected routines (3 call sites each):
CHPGVX in cdrvsg2stg.f
DSPGVX in ddrvsg2stg.f
SSPGVX in sdrvsg2stg.f
ZHPGVX in zdrvsg2stg.f
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 ddrvst.f, ddrvst2stg.f, and dlatm4.f, DBLE() was applied to
DOUBLE PRECISION array elements assigned to DOUBLE PRECISION
variables ― a no-op conversion. Similarly, in sdrvst.f,
sdrvst2stg.f, and slatm4.f, REAL() was applied to REAL array
elements assigned to REAL variables.
Remove these 168 redundant calls. Integer-to-real conversions
(e.g., DBLE(N), DBLE(KLEN-1), REAL(MAX(1,N))) are retained as
they are semantically necessary.
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 four TESTING/LIN routines currently document ISEED as an
INTEGER array of dimension (4), but their dummy argument
declarations use ISEED(*).
All four routines pass ISEED to CLARND or ZLARND, whose interfaces
require ISEED(4) and document that the fourth element must be odd.
Replace the assumed-size declaration with an explicit size of 4 in
both the commented argument declarations and the actual dummy
argument declarations, so that the source matches the documented
contract and the callee interfaces.
No functional change is intended.