Great news: the Fortran stdlib project has garnered over 1000 stars on GitHub!
Currently stdlib
includes many utilities (hash maps , strings , IO , logging ,…), sorting procedures ), and many mathematics-related procedures (linear algebra , statistics , random numbers ),…).
The largest and most recent addition to stdlib is indubiously the whole set of BLAS/LAPACK procedures, a project led by @FedericoPerini .
Thank you to all the contributors! I strongly believe that stdlib
, in combination with fpm, makes Fortran even more accessible!
More to come soon!
33 Likes
And today the Fortran Discourse has exactly 1600 registered users.
14 Likes
Thank you @jeremie.vandenplas and congrats to all the stdlib developers for the achievement!
Excited to share that after the BLAS/LAPACK modernization, now a nearly NumPy-full set of dense linear algebra functions is being made available via stdlib:
Determinant
API
Stdlib
x = det(A [, overwrite_A=.false.] [, err=state])
x = .det.A ! can be chained
NumPy
x = det(A)
SciPy
x = det(A [, overwrite_A=False] [, check_finite=True])
Singular Value Decomposition
API
Stdlib
call svd(a,s [,u] [,vt] [,overwrite_a] [,full_matrices] [,err]) ! whole svd
S = svdvals(a [, err]) ! values only
NumPy
U,S,Vh = svd(a, full_matrices=True, compute_uv=True, hermitian=False)
S = svdvals(a)
SciPy
U,S,Vh = svd(a, full_matrices=True, compute_uv=True, overwrite_a=False, check_finite=True, lapack_driver="gesdd")
S = svdvals(a [,overwrite_A=False] [, check_finite=True])
Linear System (LU)
API
Stdlib
x = solve(A, b [, overwrite_A=.false.] [, err=state])
call solve_lu(A, b, x [, pivot] [, overwrite_A] [, err])
NumPy
x = solve(A, b)
SciPy
x = solve(A [, lower=False] [, overwrite_A=False] [, overwrite_b=False] [, check_finite=True] [,assume_a=’gen’] [,transposed=False])
Least Squares
API
Stdlib
x = lstsq(A, b [, cond] [, overwrite_A=.false.] [, err=state])
call solve_lstsq(A, b, x [, real_storage] [, int_storage] [, cmpl_storage] [, cond] [, singvals] [,overwrite_a] [, rank] [, err])
call lstsq_space(a, b, lrwork, liwork, lcwork)
NumPy
x = lstsq(A, b [, rcond])
SciPy
x = lstsq(A, b [, cond=None] [,overwrite_a=False] [,overwrite_b=False] [, check_finite=True] [, lapack_driver=None])
Eigendecomposition
API
Stdlib
lambda = eigvals(a [, err])
call eig (a, lambda [,right] [,left] [,overwrite_a] [,err])
NumPy
lambda, v = eig(a)
lambda = eigvals(a)
SciPy
lambda = eig(a, b=None, left=False, right=True, overwrite_a=False, overwrite_b=False, check_finite=True, homogeneous_eigvals=False)
Matrix inverse
API
Stdlib
Am1 = inv(A [, err])
call invert (a [,pivot] [,err])
call invert (a, Am1 [,pivot] [,err])
Am1 = .inv.A
NumPy
x = inv(A)
SciPy
x = inv(A [, overwrite_A=False] [, check_finite=True])
QR factorization
API
Stdlib
call qr (a,q,r [,overwrite_a] [,storage] [,err])
call qr_space(a, lwork [,err])
NumPy
Q, R = qr(a [, mode=’reduced’])
SciPy
Q, R, p = qr(a [, overwrite_a=False] [, lwork=None] [, mode='full'] [, pivoting=False] [, check_finite=True])
Cholesky factorization
API
Stdlib
call cholesky (a, lower [, other_zeroed=.true.] [,err])
call cholesky (a, c, lower [, other_zeroed=.true.] [,err])
L = chol(a, lower [, other_zeroed=.true.])
NumPy
L = cholesky(a, /, *, upper=False)
SciPy
L = cholesky(a, lower=False, overwrite_a=False, check_finite=True)
Most of the interfaces are pure
, such as most BLAS/LAPACK backends
All operations work for real
and complex
matrices
All KIND
s supported: 32, 64, 80 and 128 bits
Enable fast external BLAS/LAPACK with 1 preprocessor macro
18 Likes
Steve
June 28, 2024, 9:53pm
4
Congratulations!
LLVM Flang top-of-tree is compiling stdlib pretty well but not yet perfect.
...
The following tests FAILED:
9 - hash_functions (Failed)
37 - mean (SEGFAULT)
55 - string_to_string (Failed)
Errors while running CTest
5 Likes
septc
July 2, 2024, 6:57pm
5
This is really a nice addition! And I am wondering if this can be tested possibly online somehow…? (e.g. Compiler Explorer + adding stdlib option…?) (even if no, no problem at all)
thank you @septc . https://godbolt.org/ provides stdlib-fpm
as a library.
3 Likes
As mentioned by @jeremie.vandenplas you can find stdlib along with some other fpm packages on compiler explorer. Keep in mind however that stdlib on compiler explorer lives at HEAD (i.e. it’s the latest commit on the main
branch, and you can’t select a specific version).
2 Likes