Skip to content

Commit 34b1452

Browse files
committed
2 parents c5f043e + c36d8b7 commit 34b1452

File tree

1 file changed

+34
-13
lines changed

1 file changed

+34
-13
lines changed

README.md

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
# *** WORK IN PROGRESS ***
1+
# fortran-lapack
2+
This package provides precision-agnostic, high-level linear algebra APIs for `real` and `complex` arguments in Modern Fortran. The APIs are similar to NumPy/SciPy operations, and leverage a Modern Fortran implementation of the [Reference-LAPACK](http://github.com/reference-LAPACK) library.
23

34
# Current API
5+
6+
[The documentation site](https://perazz.github.io/fortran-lapack/index.html) contains full documentation for the library.
7+
48
Procedure | Type | Description | Optional arguments
59
--- | --- | --- | ---
610
`solve(A,b)` | function | Solve linear systems - one (`b(:)`) or many (`b(:,:)`) | `solve(A,b,overwrite_a,err)`: option to let A be destroyed, return state handler `err`
@@ -25,10 +29,9 @@ Procedure | Type | Description | Optional arguments
2529

2630
All procedures work with all types (`real`, `complex`) and kinds (32, 64, 128-bit floats).
2731

28-
# fortran-lapack
29-
This package contains a Modern Fortran implementation of the [Reference-LAPACK](http://github.com/reference-LAPACK) library.
30-
The reference Fortran-77 library is automatically downloaded from its master repository, and processed to create Modern Fortran modules with full explicit typing features.
31-
Release 3.10.1 is currently targeted. Function interfaces are unchanged from the original implementation, and allow future extension to handle its usage through external implementations.
32+
# BLAS, LAPACK
33+
Modern Fortran modules with full explicit typing features are available as modules `la_blas` and `la_lapack`.
34+
The reference Fortran-77 library, forked from Release 3.10.1, was automatically processed and modernized.
3235
The following refactorings are applied:
3336
- All datatypes and accuracy constants standardized into a module (`stdlib`-compatible names)
3437
- Both libraries available for 32, 64 and 128-bit floats
@@ -54,13 +57,32 @@ To add fortran-lapack to your project, simply add it as a dependency:
5457
[dependencies]
5558
fortran-lapack = { git="https://github.com/perazz/fortran-lapack.git" }
5659
```
60+
61+
`fortran-lapack` is compatible with the LAPACK API. If high-performance external BLAS/LAPACK libraries are available, it is sufficient to define macros
62+
63+
```
64+
[dependencies]
65+
fortran-lapack = { git="https://github.com/perazz/fortran-lapack.git", preprocess.cpp.macros=["LA_EXTERNAL_BLAS", "LA_EXTERNAL_LAPACK"] }
66+
```
67+
5768
# Extension to external BLAS/LAPACK libraries
5869

59-
This task is in progress. The names of all procedures have been prefixed not to pollute the original BLAS/LAPACK namespace, so that handling of external libraries can be accomplished via a preprocessor flag. For example:
70+
Generic interfaces to most BLAS/LAPACK functions are exposed to modules `la_blas` and `la_lapack`. These interfaces drop the initial letter to wrap a precision-agnostic version. For example, `axpy` is a precision-agnostic interface to `saxpy`, `daxpy`, `caxpy`, `zaxpy`, `qaxpy`, `waxpy`.
71+
The naming convention is:
72+
73+
Type | 32-bit | 64-bit | 128-bit
74+
--- | --- | --- | ---
75+
real | `s` | `d` | `q`
76+
complex | `c` | `z` | `w`
77+
78+
All public interfaces in `la_blas` and `la_lapack` allow seamless linking against external libraries via a simple pre-processor flag.
79+
When an external library is available, just define macros `LA_EXTERNAL_BLAS` and `LA_EXTERNAL_LAPACK`. The kind-agnostic interface
80+
will just point to the external function. All such interfaces follow this template:
6081

6182
```fortran
62-
#ifdef EXTERNAL_BLAS
63-
interface
83+
interface axpy
84+
#ifdef LA_EXTERNAL_BLAS
85+
! Use external library
6486
pure subroutine saxpy(n, a, x, incx, y, incy)
6587
import :: ik, sp
6688
integer, parameter :: wp = sp
@@ -71,12 +93,11 @@ interface
7193
real(wp), intent(inout) :: y(*)
7294
integer(ik), intent(in) :: incy
7395
end subroutine saxpy
74-
end interface
7596
#else
76-
interface saxpy
77-
module procedure stdlib_saxpy
78-
end interface
97+
! Use internal implementation
98+
module procedure la_saxpy
7999
#endif
100+
end interface
80101
```
81102

82103
# Licensing
@@ -86,4 +107,4 @@ The license used for the software is the [modified BSD license](https://www.netl
86107
According to the original license, we changed the name of the routines and commented the changes made to the original.
87108

88109
# Acknowledgments
89-
The development of this package is supported by the [Sovereign Tech Fund](https://www.sovereigntechfund.de).
110+
Part of this work was supported by the [Sovereign Tech Fund](https://www.sovereigntechfund.de).

0 commit comments

Comments
 (0)