25 Commits
Author SHA1 Message Date
David Heffernan ffe8b242c7 C_LAPACK: take the float format from <float.h> in dlamch/slamch
INSTALL/dlamch.c and INSTALL/slamch.c are f2c translations of the deprecated
dlamchf77.f and slamchf77.f, which determine the floating point format at run
time by probing in dlamc1/dlamc2 rather than reading it from the environment.
The current dlamch.f and slamch.f use the Fortran 90 inquiry intrinsics
(EPSILON, TINY, HUGE, DIGITS, MINEXPONENT, MAXEXPONENT, RADIX) instead, but f2c
cannot translate those, so the C LAPACK selected by NOFORTRAN=1 has been left
with the older probing implementation.

The probe is only correct if double intermediates are genuinely rounded to
double. That does not hold on x87. Building 32 bit for a target without SSE2,
so with -mfpmath=387, and with gcc 16, the intermediates stay in registers and
the probe measures the 80 bit register format: it reports emin/emax as
-16381/16384, and a mantissa width that follows the caller's x87 precision
control bits (64 at extended precision, 53 at double). Written back as doubles,
rmin underflows to 0 and rmax overflows to +Inf, so dlamch('S') and dlamch('U')
return 0 and dlamch('O') returns +Inf.

Everything that scales by those values is then wrong, mostly silently. The
first symptom to surface was a floating point exception rather than a wrong
answer: dsbevx computes

    safmin = dlamch('S')
    eps    = dlamch('P')
    smlnum = safmin / eps
    bignum = 1 / smlnum

so a zero safe minimum makes smlnum zero and the next line divides by zero.
Callers that unmask the divide by zero exception get a hard failure there;
callers that do not get whatever the wrong scaling produces.

Replace the probe with the <float.h> constants, mirroring the values the
current dlamch.f and slamch.f return. This fixes two lesser problems at the
same time: rmach was left uninitialised when cmach matched nothing, where
dlamch.f returns zero; and the cached static results made both routines
unsafe to call concurrently on first use.

dlamc1-dlamc5 and slamc1-slamc5 are left in place. They become unreachable
from dlamch/slamch, but dlamc3 and slamc3 have callers of their own in dlaed3,
dlaed9, dlals0, dlasd3, dlasd8 and their complex equivalents, where they serve
as optimiser barriers.
2026-08-17 10:55:05 +01:00
Martin Kroeker b6df159a67 Avoid computing ONE/HUGE unless needed (Reference-LAPACK PR 1331) 2026-07-22 17:49:20 +02:00
Martin Kroeker 578f0f9590 Update version number to 3.12.0 2023-11-25 18:53:16 +01:00
Martin Kroeker 3d9e20f614 Update version to 3.12.0 2023-11-25 18:51:54 +01:00
Martin Kroeker 4041b7fb42 fix function prototypes in f2c-converted files 2023-10-07 22:33:08 +02:00
Martin Kroeker 7f7d3896dd Fix missing type declaration for main 2023-08-25 18:07:47 +02:00
Martin Kroeker e6e2a63650 Update LAPACK version number to 3.11.0 2022-11-22 14:02:21 +01:00
Martin Kroeker 8408357bab Update LAPACK version number to 3.11.0 2022-11-22 14:01:48 +01:00
martin-frbg cf61d48470 fix C_LAPACK build options for files that must be built unoptimized 2022-05-12 09:43:23 +02:00
martin-frbg ee7f42217b Add dummy C versions of ?roundup_lwork for C_LAPACK 2022-04-22 12:28:15 +02:00
martin-frbg 329cdc31b3 Update LAPACK/LAPACKE to Reference-LAPACK 3.10.1 2022-04-21 20:39:29 +02:00
Martin Kroeker 18b19d135b C_LAPACK: Fixes to make it compile with MSVC (#3605)
* Fix f2c-like support functions to compile with MSVC, and
re-enable C_LAPACK for MSVC in CMAKE

* Add MSVC&flang build to Azure CI in order to check C_LAPACK correctness
2022-04-17 17:49:38 +02:00
Martin Kroeker b7873605d4 Use f2c translations of LAPACK when no Fortran compiler is available (#3539)
* Add C equivalents of the Fortran routines from Reference-LAPACK as fallbacks, and C_LAPACK variable to trigger their use
2022-04-09 22:38:58 +02:00
Martin Kroeker 375b1875c8 [WIP] Update LAPACK to 3.9.0 (#2353)
* Update make.inc entries for LAPACK 3.9.0

Reference-LAPACK PR 347 changed some variable names and relative paths

* Update LAPACK to 3.9.0

* Add new functions from LAPACK 3.9.0

* Add new functions from LAPACK 3.9.0

* Restore LOADER command 

as it makes it easier to specify pthread as needed

* Restore LOADER

* Restore EIG/LIN prefixes in cmdbase

* add binary path to lapack_testing.py call

* Restore OpenMP version check

* Restore OpenMP version check

* Restore fix for out-of-bounds array accesses

from #2096
2020-01-01 13:18:53 +01:00
martin 3be5c3d343 Update LAPACK to 3.8.0 2017-11-23 18:13:35 +01:00
Werner Saar d35baf30cf added lapack 3.7.0 with latest patches from git 2017-01-06 11:48:40 +01:00
Werner Saar 8cd46acebb removed lapack 3.6.0 2017-01-06 11:44:57 +01:00
Martin Koehler 6f58271190 Move remaining OpenBLAS related changes from 3.6.0 to 3.6.1 2016-10-26 21:43:41 +02:00
Martin Köhler 4c29d20108 Import LAPACK: INSTALL directory 2016-10-26 15:04:39 +02:00
Werner Saar a8516c5b47 fixes for cross compile 2015-11-21 10:48:37 +01:00
Werner Saar c40538eaeb bugfix for cross compiling 2015-11-20 13:47:22 +01:00
Werner Saar 33e37d01b3 added lapack-3.6.0 2015-11-20 09:45:46 +01:00
Werner Saar 64db4576e6 removed lapack-3.5.0 2015-11-20 09:41:59 +01:00
Zhang Xianyi 0f6e79f918 Refs #324. Upgrade LAPACK to 3.5.0 version. 2013-12-09 16:50:02 +08:00
Zhang Xianyi 3eb5af1955 Refs #247. Included lapack source codes. Avoid downloading tar.gz from netlib.org
Based on 3.4.2 version, apply patch.for_lapack-3.4.2.
2013-07-09 18:13:48 +08:00