# cblas

Bindings to a **reference CBLAS** implementation — OpenBLAS, Netlib, or MKL —
the cross-platform CPU numerics path. Where [accelerate](/docs/packages/accelerate)
is the Apple-only BLAS that ships in every macOS binary, `cblas` is the portable
sibling: link it against whatever CBLAS your platform provides. For the full
backend picture, see [GPU & numerics](/docs/gpu-numerics).

The surface is standard CBLAS, with typed `Order` (RowMajor / ColMajor) and
`Transpose` (NoTrans / Trans / ConjTrans) enums instead of `char` flags:

- **Level 1** — `sdot`, `saxpy`, `sscal`, `snrm2`, `sasum` (vector dot, scaled
  add, scale, 2-norm, sum of magnitudes).
- **Level 2** — `sgemv` (matrix-vector).
- **Level 3** — `sgemm` (matrix-matrix).
- Each has its `d`-variant for `f64`.

```cplus
import "cblas/cblas" as cblas;

let x: [f32; 3] = [1.0f32, 2.0f32, 3.0f32];
let y: [f32; 3] = [4.0f32, 5.0f32, 6.0f32];
let dot: f32 = cblas::sdot(
    3 as i32,
    unsafe { #addr_of(x) as *f32 }, 1 as i32,
    unsafe { #addr_of(y) as *f32 }, 1 as i32,
);   // 32.0
```

## Linking

Point the manifest at your CBLAS install if it lives outside the default search
path (a custom OpenBLAS prefix, an MKL directory):

```toml
[link]
search-paths = ["/opt/openblas/lib"]
```

The entry becomes both `-L<dir>` and `-Wl,-rpath,<dir>`, so the library resolves
at link and run time without `LD_LIBRARY_PATH`.

For NVIDIA GPU acceleration of the same routines, see
[cuda](/docs/packages/cuda).
