Help us improve
Share bugs, ideas, or general feedback.
From blas_lapack
Provides complete CBLAS/LAPACKE API reference for LAPACK v3.12.1 covering 1284 BLAS/LAPACK functions for numerical linear algebra in C/C++: matrix ops, solvers, eigenvalues, SVD. Use for API lookup, code generation, linking, solver selection.
npx claudepluginhub datathings/marketplace --plugin blas_lapackHow this skill is triggered — by the user, by Claude, or both
Slash command
/blas_lapack:blas_lapackThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Complete C API documentation for **BLAS** (Basic Linear Algebra Subprograms) and **LAPACK** (Linear Algebra PACKage), version **3.12.1**.
Provides MATLAB/Octave syntax and examples for numerical computing: matrices, linear algebra, ODEs, signal processing, optimization, statistics, scientific visualization.
Guides MATLAB/Octave numerical computing: matrix operations, linear algebra, data analysis, visualization, and scientific computing. Helps with syntax and converting to Python.
Guides symbolic mathematics in Python with SymPy for algebra, calculus, equation solving, matrices, physics calculations, and code generation to LaTeX or other formats.
Share bugs, ideas, or general feedback.
Complete C API documentation for BLAS (Basic Linear Algebra Subprograms) and LAPACK (Linear Algebra PACKage), version 3.12.1.
cblas.h and lapacke.h from Reference-LAPACK v3.12.1#include <cblas.h> // BLAS operations
#include <lapacke.h> // LAPACK operations
# GCC/Clang
gcc myprogram.c -o myprogram -llapacke -llapack -lcblas -lblas -lm
# With pkg-config (if available)
gcc myprogram.c -o myprogram $(pkg-config --cflags --libs lapacke)
# With OpenBLAS (optimized)
gcc myprogram.c -o myprogram -lopenblas -lm
# With Intel MKL
gcc myprogram.c -o myprogram -lmkl_rt -lm
info return value (0 = success, <0 = bad argument, >0 = numerical issue)Every routine comes in up to 4 precision types:
| Prefix | Type | C Type | Description |
|---|---|---|---|
s | Single real | float | 32-bit floating point |
d | Double real | double | 64-bit floating point |
c | Single complex | void* (lapack_complex_float) | 2x32-bit complex |
z | Double complex | void* (lapack_complex_double) | 2x64-bit complex |
Example: cblas_sgemm (float), cblas_dgemm (double), cblas_cgemm (complex float), cblas_zgemm (complex double)
typedef enum CBLAS_LAYOUT { CblasRowMajor=101, CblasColMajor=102 } CBLAS_LAYOUT;
typedef enum CBLAS_TRANSPOSE { CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113 } CBLAS_TRANSPOSE;
typedef enum CBLAS_UPLO { CblasUpper=121, CblasLower=122 } CBLAS_UPLO;
typedef enum CBLAS_DIAG { CblasNonUnit=131, CblasUnit=132 } CBLAS_DIAG;
typedef enum CBLAS_SIDE { CblasLeft=141, CblasRight=142 } CBLAS_SIDE;
#define LAPACK_ROW_MAJOR 101
#define LAPACK_COL_MAJOR 102
The leading dimension specifies the stride between consecutive columns (column-major) or rows (row-major) in memory:
lda = number of columns allocated (>= N for an M×N matrix)lda = number of rows allocated (>= M for an M×N matrix)All LAPACKE driver routines return lapack_int info:
| Value | Meaning |
|---|---|
0 | Success |
< 0 | The -info-th argument had an illegal value |
> 0 | Routine-specific failure (e.g., singular matrix, no convergence) |
| Storage | Description | When to Use |
|---|---|---|
| Full (GE) | Dense M×N array | General matrices |
| Symmetric (SY/HE) | Only upper or lower triangle stored | Symmetric/Hermitian matrices |
| Triangular (TR) | Only upper or lower triangle | Triangular matrices |
| Banded (GB/SB/HB/TB) | Band storage, KL sub + KU super diagonals | Banded matrices |
| Packed (SP/HP/TP/PP) | Upper or lower triangle packed into 1D array | Memory-efficient symmetric/triangular |
| Tridiagonal (GT/PT/ST) | Three diagonals stored as vectors | Tridiagonal systems |
| RFP | Rectangular Full Packed | Cache-friendly packed format |
LAPACKE_<precision><operation>
^ ^
s/d/c/z 2-6 char code describing the operation
Common operation codes:
gesv = GEneral SolVeposv = POsitive definite SolVesyev = SYmmetric EigenValuesgesvd = GEneral Singular Value Decompositiongetrf = GEneral TRiangular Factorization (LU)potrf = POsitive definite TRiangular Factorization (Cholesky)| Reference | Functions | Description |
|---|---|---|
| blas-level1.md | ~50 | Vector operations: dot, nrm2, asum, axpy, swap, copy, rot, scal |
| blas-level2.md | ~66 | Matrix-vector: gemv, gbmv, trmv, trsv, symv, hemv, ger, syr, her |
| blas-level3.md | ~36 | Matrix-matrix: gemm, symm, hemm, syrk, herk, trmm, trsm |
| Reference | Description |
|---|---|
| lapacke-linear-systems.md | Solve Ax=b: gesv, gbsv, posv, sysv, hesv + expert/refinement |
| lapacke-least-squares.md | Least squares: gels, gelsd + QR/LQ factorizations |
| lapacke-eigenvalues.md | Eigenvalues: syev, heev, geev, gees + generalized + Schur |
| lapacke-svd.md | SVD: gesvd, gesdd, gesvj + bidiagonal + CS decomposition |
| lapacke-factorizations.md | LU, Cholesky, LDL, triangular + storage conversions |
| lapacke-auxiliary.md | Norms, generators, orthogonal transforms, utilities |
| Reference | Description |
|---|---|
| workflows.md | 15 complete C examples with compile commands |
| Matrix Type | Simple | Expert (with error bounds) |
|---|---|---|
| General | gesv | gesvx |
| General banded | gbsv | gbsvx |
| General tridiagonal | gtsv | gtsvx |
| Symmetric positive definite | posv | posvx |
| SPD banded | pbsv | pbsvx |
| SPD tridiagonal | ptsv | ptsvx |
| Symmetric indefinite | sysv | sysvx |
| Hermitian indefinite | hesv | hesvx |
| Matrix Type | Fastest | Most Accurate | Subset |
|---|---|---|---|
| Symmetric | syevd | syevr | syevx |
| Hermitian | heevd | heevr | heevx |
| General | geev | geevx | - |
| Generalized symmetric | sygvd | - | sygvx |
| Need | Routine | Notes |
|---|---|---|
| All singular values/vectors | gesdd | Fastest (divide & conquer) |
| Standard SVD | gesvd | Classic algorithm |
| Selected values/vectors | gesvdx | Subset by index or range |
| High accuracy | gesvj / gejsv | Jacobi methods |
layout parameter; be consistent throughout your codelapack_complex_float / lapack_complex_double or pass void* to C arrays of float[2]/double[2]cblas_dgemm# Make sure you link in the right order (dependent libs first)
gcc prog.c -llapacke -llapack -lcblas -lblas -lm -lgfortran
# Or use OpenBLAS which bundles everything
gcc prog.c -lopenblas -lm
LAPACK is natively column-major (Fortran). When using LAPACK_ROW_MAJOR, LAPACKE transposes internally. For maximum performance, use LAPACK_COL_MAJOR and store matrices in column-major order.
The matrix is singular (or nearly singular). info = i means U(i,i) is exactly zero in the LU factorization. Use gesvx for condition number estimation.
Parameter -info has an illegal value. Common causes:
matrix_layout constantlda too small (must be >= N for row-major, >= M for column-major)uplo, trans, or diag characterA[lda * N] not A[M * N] when lda > Mipiv arrays, allocate at least min(M, N) elementsN elementsgemmtr - Triangular matrix-matrix multiply (new BLAS Level 3 extension)gesvdq - SVD with QR preconditioning for high accuracygetsqrhrt - Tall-skinny QR with Householder reconstructiontrsyl3 - Level 3 Sylvester equation solver*_64 variants - 64-bit integer API for large matricesgelq/geqr - Tall-skinny and short-wide QR/LQ