Commit Graph
19 Commits
Author SHA1 Message Date
NAKATA Maho 25d74b31a7 TESTING/LIN: use named constants in drvrf tests
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.
2026-04-11 20:29:54 +09:00
NAKATA Maho 1ed1f080da clargv,zlargv: rename local ABS1 helper to CABSMAX
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.
2026-03-28 16:55:08 +09:00
NAKATA Maho ac82605ea9 refactor: rename ABS1 statement function to CABS1 for consistency
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).
2026-03-28 14:46:42 +09:00
NAKATA Maho 0843d3ed4b BLAS: inline SCABS1/DCABS1 into CAXPY/ZAXPY as statement function CABS1
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.
2026-03-28 14:10:56 +09:00
NAKATA Maho 33ec2a652c Fix typos in comment strings of [csdzd]chkdmd.f90
- intial/inital -> initial (K_traj loop and K_TRAJ==2 branch)
- eigencalues -> eigenvalues (GEDMD and GEDMDQ comment blocks)
- Rezidual -> Residual (WRITE output strings)
- rayleigh -> Rayleigh (proper noun, z/s/dchkdmd.f90)
- aigenvectors -> eigenvectors (s/dchkdmd.f90)
- localy -> locally (s/dchkdmd.f90 MKL note)
- whith -> with (s/dchkdmd.f90 MKL note)
- worksapce -> workspace (s/dchkdmd.f90 MKL note)
- ZGEDMDQ -> CGEDMDQ in comment blocks (cchkdmd.f90)
- ZGEDMD and ZGEDMDQ -> CGEDMD and CGEDMDQ in WRITE string (cchkdmd.f90)
2026-03-25 13:50:09 +09:00
NAKATA Maho ca938b93df Enable disabled test options in LAPACK TESTING input files
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.
2026-03-25 10:34:36 +09:00
NAKATA Maho 4486765327 Enable disabled test options in LAPACK TESTING input files
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.
2026-03-25 10:24:35 +09:00
NAKATA Maho 4e013d710c fix(eig): pass IINFO instead of INFO to xSPGVX/xHPGVX in *drvsg2stg
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
2026-03-24 18:21:30 +09:00
NAKATA Maho 989ffdd779 Fix LDSWORK being overwritten during workspace query in xTRSYL3
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).
2026-03-24 13:22:39 +09:00
NAKATA Maho 8b1494be8c Remove redundant DBLE()/REAL() type conversions in TESTING
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.
2026-03-24 11:37:16 +09:00
NAKATA Maho 94f05be6c3 Fix incorrect INFO return codes from xSTEBZ in driver routines
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
2026-03-23 13:58:37 +09:00
NAKATA Maho c2023d8f93 Use ROUNDUP_LWORK and remove redundant type conversions in *gvd routines
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.
2026-03-23 10:12:30 +09:00
NAKATA Maho 4f13bb0d6c Fix 72-column violation in {c,d,s,z}laqp2rk.f
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.
2026-03-23 09:47:29 +09:00
NAKATA Maho bdbce3ebd3 fix(xlaqp2rk): introduce KBOUND to avoid modifying [in] argument KMAX
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.
2026-03-21 09:12:26 +09:00
Nakata Maho 507c1dd7c9 fix: correct trailing routine comment in dgemmtr 2026-03-07 14:41:49 +09:00
Nakata Maho fa23a2dc2d TESTING/LIN: declare ISEED as dimension(4) in clatsp/clatsy/zlatsp/zlatsy
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.
2026-03-07 11:10:10 +09:00
NAKATA Maho fd3552ba58 se2.in causes infinite loop when dsyevr_2stage or dsyevr failed. 2021-07-21 22:29:24 +09:00
NAKATA Maho 9463d5bf3c se2.in causes infinite loop when dsyevr or dsyevr_2stage failed. 2021-07-21 22:23:25 +09:00
Maho Nakata f0f6c880b4 Fix the number of matrices to test. 2021-06-29 16:54:11 +09:00