You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/specs/stdlib_linalg.md
+170
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,176 @@ title: linalg
6
6
7
7
[TOC]
8
8
9
+
The `stdlib` linear algebra library provides high-level APIs for dealing with common linear algebra operations.
10
+
11
+
## BLAS and LAPACK
12
+
13
+
### Status
14
+
15
+
Experimental
16
+
17
+
### Description
18
+
19
+
`BLAS` and `LAPACK` backends provide efficient low level implementations of many linear algebra algorithms, and are employed for non-trivial operators.
20
+
A Modern Fortran version of the [Reference-LAPACK 3.10.1](http://github.com/reference-LAPACK) implementation is provided as a backend.
21
+
Modern Fortran modules with full explicit typing features are provided after an
-[stdlib_linalg_blas(module)], [stdlib_linalg_lapack(module)] provide kind-agnostic interfaces to all functions.
25
+
- Both libraries are available for 32- (`sp`), 64- (`dp`) and 128-bit (`qp`) `real` and `complex` numbers (the latter if available in the current build)
26
+
- Free format, lower-case style
27
+
-`implicit none(type, external)` applied to all procedures and modules
28
+
-`intent` added and all `pure` procedures where possible
29
+
-`stdlib` provides all procedures in two different flavors: (a) original BLAS/LAPACK names with a prefix `stdlib_?<name>` (ex: `stdlib_dgemv`, `stdlib_sgemv`); (b) A generic, kind agnostic `<name>`, i.e. `gemv`.
30
+
- F77-style `parameter`s removed, and all numeric constants have been generalized with KIND-dependent Fortran intrinsics.
31
+
- preprocessor-based OpenMP directives retained.
32
+
The single-source module structure hopefully allows for cross-procedural inlining which is otherwise impossible without link-time optimization.
33
+
34
+
When available, highly optimized libraries that take advantage of specialized processor instructions should be preferred over the `stdlib` implementation.
35
+
Examples of such libraries are: OpenBLAS, MKL (TM), Accelerate, and ATLAS. In order to enable their usage, simply ensure that the following pre-processor macros are defined:
36
+
37
+
-`STDLIB_EXTERNAL_BLAS` wraps all BLAS procedures (except for the 128-bit ones) to an external library
38
+
-`STDLIB_EXTERNAL_LAPACK` wraps all LAPACK procedures (except for the 128-bit ones) to an external library
39
+
40
+
These can be enabled during the build process. For example, with CMake, one can enable these preprocessor directives using `add_compile_definitions(STDLIB_EXTERNAL_BLAS STDLIB_EXTERNAL_LAPACK)`.
41
+
The same is possible from the `fpm` branch, where the `cpp` preprocessor is enabled by default. For example, the macros can be added to the project's manifest:
42
+
43
+
```toml
44
+
[dependencies]
45
+
stdlib="*"
46
+
47
+
# Macros are only needed if using an external library
0 commit comments