Commit a75921e
test: move the matrix-function tests into the TestSuite
The four matrix functions were tested by hand-written, CPU-only top-level
files plus per-backend duplicates under `test/genericschur/` and
`test/genericlinearalgebra/`, while every decomposition lives in
`test/testsuite/` as array-type-parameterized functions driven by a thin
`test/<area>/<name>.jl`. Close that gap: `test/testsuite/matrixfunctions/`
now holds the bodies and `test/matrixfunctions/` the drivers.
Assertions become invariants rather than comparisons against
`LinearAlgebra`, so one body serves host, CUDA, ROCm and downstream array
types: `sqrtA * sqrtA ≈ A`, `exponential(logA) ≈ A`, `exp(A) * exp(-A) ≈ I`,
and elementwise spectrum mapping via `eigh_vals`. Reference cross-checks
against `LinearAlgebra` are kept, but confined to `test_*_reference`, which
the drivers only call for host arrays.
GPU coverage now falls out of the array-type parameterization, so the
bespoke `test_*_gpu` functions are gone. Three new instantiators
(`instantiate_offaxis_matrix`, `instantiate_posdef_matrix`,
`instantiate_hermitian_spectrum`) give the controlled spectra these
functions need, reusing `instantiate_unitary` and the `Diagonal` handling
already in the suite.
The domain rules differ per function and are now encoded rather than
approximated: a roundoff-negative eigenvalue clamps for `squareroot` and
positive fractional `power`, but still throws for `logarithm`, where
clamping onto zero leaves the matrix singular. `MatrixFunctionViaLA`
inspects only the realness of its result, so it accepts singular input that
the spectrum-based algorithms reject; the `eigh`-based algorithms reject a
negative eigenvalue whatever the scalar type, since the root of a hermitian
matrix with a negative eigenvalue is not hermitian.
Also drops the deprecated `LAPACK_Simple`/`LAPACK_QRIteration`/
`GS_QRIteration`/`GLA_QRIteration` spellings, which accounted for the
deprecation warnings these tests emitted. Generic eltypes name their driver
explicitly (`QRIteration(; driver = GS())`), since with both generic
packages loaded `default_driver` resolves `QRIteration` to GLA, which
provides no `geev!`.
Full suite: 93826 passing, up from 90917.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 4e7465f commit a75921e
21 files changed
Lines changed: 1089 additions & 896 deletions
File tree
- test
- genericlinearalgebra
- genericschur
- matrixfunctions
- testsuite
- matrixfunctions
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
0 commit comments