Numerical Libraries
Naming: first letter = precision (s single, d double, c complex, z double complex), next two = matrix type (ge general, sy symmetric, po positive-definite, tr triangular), rest = operation.
32.1 BLAS & LAPACK
daxpy, ddot, dnrm2, dscal BLAS level 1 (vector) BLAS level 2 (matrix–vector)
BLAS level 3 (matrix–matrix) — the most optimized kernel in computing dgesv, dgetrf/dgetrs general linear systems (LU) dposv, dpotrf symmetric positive-definite (Cholesky) dsyev, dsyevd, dgeev dgesvd, dgesdd singular value decomposition
Naming: first letter = precision (s single, d double, c complex, z double complex), next two = matrix type (ge general, sy symmetric, po positive-definite, tr triangular), rest = operation. Optimized implementations: OpenBLAS, Intel MKL, AOCL (AMD), Apple Accelerate, BLIS, cuBLAS (GPU).
program lapack_demo
implicit none
integer, parameter :: n = 3
real(8) :: A(n, n), b(n)
integer :: ipiv(n), info
A = reshape([4d0, 2d0, 1d0, 2d0, 5d0, 3d0, 1d0, 3d0, 6d0], [n, n])
b = [1d0, 2d0, 3d0]
call dgesv(n, 1, A, n, ipiv, b, n, info) ! solve Ax = b (LU with partial pivoting)
if (info /= 0) error stop "dgesv failed"
print '(3f12.6)', b
end program lapack_demogfortran lapack_demo.f90 -llapack -lblas -o lapack_demo # or link OpenBLAS / Intel MKL32.2 Other classic & modern libraries
Fortran stdlib (fortran-lang/stdlib) community standard library: strings, sorting, stats, linalg, hashmaps, I/O, logging, quadrature, random FFTW (fftw3.f03) fast Fourier transforms
ScaLAPACK, PETSc, Trilinos (ForTrilinos), hypre, MUMPS parallel linear algebra & solvers large sparse eigenproblems SUNDIALS (Fortran interfaces) ODE/DAE solvers
MINPACK, QUADPACK, ODEPACK, SLATEC (modernized versions on GitHub) nonlinear equations, quadrature, ODEs NetCDF-Fortran, HDF5 scientific data I/O json-fortran, toml-f config/data formats NAG Library, IMSL commercial numerical libraries GNU Scientific Library bindings
32.3 Using stdlib with fpm
# fpm.toml
[dependencies]
stdlib = "*"use stdlib_sorting, only: sort
use stdlib_stats, only: mean, var
use stdlib_linalg, only: eye, diag, solve, det
use stdlib_strings, only: to_string, starts_with
call sort(x)
print *, mean(x), var(x), to_string(3.14_dp)