packages feed

keel-linalg-0.1.1.0: README.md

# keel-linalg

Dense linear algebra with zero build-time native dependencies: CBLAS
level-3 and LAPACKE drivers over `Storable` vectors, resolved at run
time from an OpenBLAS shared library through
[keel-dyn](https://hackage.haskell.org/package/keel-dyn).

```haskell
import Data.Vector.Storable qualified as VS
import Keel.Linalg

main :: IO ()
main = do
  Right be <- openBackend
  -- row-major dgemm: C := A(2x3) * B(3x2)
  let a, b :: VS.Vector Double
      a = VS.fromList [1, 2, 3, 4, 5, 6]
      b = VS.fromList [7, 8, 9, 10, 11, 12]
  c <- dgemm be NoTrans NoTrans 2 2 3 1.0 a b
  print c
```

The backend is located by the documented keel search policy
(`KEEL_OPENBLAS` env override, the per-user keel data dir — populated
by `keel setup blas` from the umbrella package — then the system
search path), probed for ILP64 misconfiguration via
`openblas_get_config`, and pinned immutably in a `Backend` handle:
no global state, no backend swapping under a pure API.

Every driver except `ddot`, `dpotri`, `dgeqrf` and `dorgqr` is checked
against numpy oracles in the test suite (GEMM, LU/solve/inverse,
Cholesky, SVD, symmetric and general eigenvalues, least squares —
agreement within 1e-10); QR is gated on orthogonality and
reconstruction, and `ddot`/`dpotri` analytically in the smoke suite.

Part of the keel workspace — see the
[project repository](https://github.com/skymanbp/keel).