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
@@ -5,29 +5,163 @@ A full and standardized implementation of the present library has been integrate
5
5
6
6
# Current API
7
7
8
-
[The documentation site](https://perazz.github.io/fortran-lapack/index.html) contains full documentation for the library.
9
-
10
-
Procedure | Type | Description | Optional arguments
11
-
--- | --- | --- | ---
12
-
`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`
13
-
`lstsq(A,b)` | function | Solve non-square systems in a least squares sense - one (`b(:)`) or many (`b(:,:)`) | `lstsq(A,b,cond,overwrite_a,rank,err)`: `cond` is optional SVD cutoff; `rank` to return matrix rank, `err` to return state handler
14
-
`det(A)` | function | Determinant of a scalar or square matrix | `det(A,overwrite_a,err=err)`: option to let A be destroyed, return state handler `err`
15
-
`inv(A)` | function | Inverse of a scalar or square matrix | `inv(A,err=err)`: A is not destroyed; return state handler `err`
16
-
`pinv(A)` | function | Moore-Penrose Pseudo-Inverse of a matrix | `pinv(A,rtol,err=err)`: A is not destroyed; optional singular value threshold `rtol`; return state handler `err`
17
-
`invert(A)` | subroutine | In-place inverse of a scalar or square matrix | `call invert(A,err=err)`: A is replaced with $A^{-1}$, return state handler `err`
18
-
`.inv.A` | operator | Inverse of a scalar or square matrix | A is replaced with $A^{-1}$
19
-
`.pinv.A` | operator | Moore-Penrose Pseudo-Inverse | A is replaced with $A^{-1}$
20
-
`svd(A)` | subroutine | Singular value decomposition of $A = U S V^t$ | `call svd(A,s,u,vt,full_matrices=.false.,err=state)`, all optional arguments but `A,s`
21
-
`svdvals(A)` | function | Singular values $S$ from $A = U S V^t$ | `s = svdvals(A)`, real array with same precision as `A`
`eigvalsh(A)` | function | Eigenvalues of symmetric or hermitian matrix $A$ | `eigvalsh(A,upper_a,err)`: Choose to use upper or lower triangle; optional state handler `err`
26
-
`eigh(A,lambda)` | subroutine | Eigenproblem of symmetric or hermitianmatrix $A$ | `eigh(A,lambda,vector,upper_a,overwrite_a,err)`: optional output eigenvectors
27
-
`diag(n,source)` | function | Diagonal matrix from scalar input value | `diag(n,source,err)`: Optional error handler
28
-
`diag(source)` | function | Diagonal matrix from array input values | `diag(source,err)`: Optional error handler
29
-
`qr(A,Q,R)` | subroutine | QR factorization | `qr(A,Q,R,storage=work,err=err)`: Optional pre-allocated working storage, error handler
30
-
`qr_space(A,lwork)` | subroutine | QR Working space size | `qr_space(A,lwork,err)`: Optional error handler
8
+
## [`solve`](@ref la_solve::solve) - Solves a linear matrix equation or a linear system of equations.
9
+
10
+
### Syntax
11
+
12
+
`x = solve(a, b [, overwrite_a] [, err])`
13
+
14
+
### Description
15
+
16
+
Solve linear systems - one (`b(:)`) or many (`b(:,:)`).
17
+
18
+
### Arguments
19
+
20
+
-`a`: A `real` or `complex` coefficient matrix. If `overwrite_a=.true.`, it is destroyed by the call.
21
+
-`b`: A rank-1 (one system) or rank-2 (many systems) array of the same kind as `a`, containing the right-hand-side vector(s).
22
+
-`overwrite_a` (optional, default = `.false.`): If `.true.`, input matrix `a` will be used as temporary storage and overwritten, to avoid internal data allocation.
23
+
-`err` (optional): A [`type(la_state)`](@ref la_state_type::la_state) variable.
24
+
25
+
### Return value
26
+
27
+
For a full-rank matrix, returns an array value that represents the solution to the linear system of equations.
28
+
29
+
### Errors
30
+
31
+
- Raises [`LINALG_ERROR`](@ref la_state_type::linalg_error) if the matrix is singular to working precision.
32
+
- Raises [`LINALG_VALUE_ERROR`](@ref la_state_type::linalg_value_error) if the matrix and rhs vectors have invalid/incompatible sizes.
33
+
- If `err` is not present, exceptions trigger an `error stop`.
34
+
35
+
36
+
## `lstsq(A, b)`
37
+
**Type**: Function
38
+
**Description**: Solve non-square systems in a least squares sense - one (`b(:)`) or many (`b(:,:)`).
39
+
**Optional arguments**:
40
+
-`cond`: Optional SVD cutoff.
41
+
-`overwrite_a`: Option to let A be destroyed.
42
+
-`rank`: Return matrix rank.
43
+
-`err`: Return state handler.
44
+
45
+
## `det(A)`
46
+
**Type**: Function
47
+
**Description**: Determinant of a scalar or square matrix.
48
+
**Optional arguments**:
49
+
-`overwrite_a`: Option to let A be destroyed.
50
+
-`err`: Return state handler.
51
+
52
+
## `inv(A)`
53
+
**Type**: Function
54
+
**Description**: Inverse of a scalar or square matrix.
55
+
**Optional arguments**:
56
+
-`err`: Return state handler.
57
+
58
+
## `pinv(A)`
59
+
**Type**: Function
60
+
**Description**: Moore-Penrose Pseudo-Inverse of a matrix.
61
+
**Optional arguments**:
62
+
-`rtol`: Optional singular value threshold.
63
+
-`err`: Return state handler.
64
+
65
+
## `invert(A)`
66
+
**Type**: Subroutine
67
+
**Description**: In-place inverse of a scalar or square matrix.
68
+
**Optional arguments**:
69
+
-`err`: Return state handler.
70
+
71
+
**Usage**: `call invert(A, err=err)` where `A` is replaced with $A^{-1}$.
72
+
73
+
## `.inv.A`
74
+
**Type**: Operator
75
+
**Description**: Inverse of a scalar or square matrix.
76
+
77
+
**Effect**: `A` is replaced with $A^{-1}$.
78
+
79
+
## `.pinv.A`
80
+
**Type**: Operator
81
+
**Description**: Moore-Penrose Pseudo-Inverse.
82
+
83
+
**Effect**: `A` is replaced with $A^{-1}$.
84
+
85
+
## `svd(A)`
86
+
**Type**: Subroutine
87
+
**Description**: Singular value decomposition of $A = U S V^t$.
88
+
**Optional arguments**:
89
+
-`s`: Singular values.
90
+
-`u`: Left singular vectors.
91
+
-`vt`: Right singular vectors.
92
+
-`full_matrices`: Defaults to `.false.`.
93
+
-`err`: State handler.
94
+
95
+
**Usage**: `call svd(A, s, u, vt, full_matrices=.false., err=state)`.
96
+
97
+
## `svdvals(A)`
98
+
**Type**: Function
99
+
**Description**: Singular values $S$ from $A = U S V^t$.
100
+
**Usage**: `s = svdvals(A)` where `s` is a real array with the same precision as `A`.
101
+
102
+
## `eye(m)`
103
+
**Type**: Function
104
+
**Description**: Identity matrix of size `m`.
105
+
**Optional arguments**:
106
+
-`n`: Optional column size.
107
+
-`mold`: Optional datatype (default: real64).
108
+
-`err`: Error handler.
109
+
110
+
## `eigvals(A)`
111
+
**Type**: Function
112
+
**Description**: Eigenvalues of matrix $A$.
113
+
**Optional arguments**:
114
+
-`err`: State handler.
115
+
116
+
## `eig(A, lambda)`
117
+
**Type**: Subroutine
118
+
**Description**: Eigenproblem of matrix $A`.
119
+
**Optional arguments**:
120
+
-`left`: Output left eigenvector matrix.
121
+
-`right`: Output right eigenvector matrix.
122
+
-`overwrite_a`: Option to let A be destroyed.
123
+
-`err`: Return state handler.
124
+
125
+
## `eigvalsh(A)`
126
+
**Type**: Function
127
+
**Description**: Eigenvalues of symmetric or Hermitian matrix $A$.
128
+
**Optional arguments**:
129
+
-`upper_a`: Choose to use upper or lower triangle.
130
+
-`err`: State handler.
131
+
132
+
## `eigh(A, lambda)`
133
+
**Type**: Subroutine
134
+
**Description**: Eigenproblem of symmetric or Hermitian matrix $A`.
135
+
**Optional arguments**:
136
+
-`vector`: Output eigenvectors.
137
+
-`upper_a`: Choose to use upper or lower triangle.
138
+
-`overwrite_a`: Option to let A be destroyed.
139
+
-`err`: Return state handler.
140
+
141
+
## `diag(n, source)`
142
+
**Type**: Function
143
+
**Description**: Diagonal matrix from scalar input value.
144
+
**Optional arguments**:
145
+
-`err`: Error handler.
146
+
147
+
## `diag(source)`
148
+
**Type**: Function
149
+
**Description**: Diagonal matrix from array input values.
150
+
**Optional arguments**:
151
+
-`err`: Error handler.
152
+
153
+
## `qr(A, Q, R)`
154
+
**Type**: Subroutine
155
+
**Description**: QR factorization.
156
+
**Optional arguments**:
157
+
-`storage`: Pre-allocated working storage.
158
+
-`err`: Error handler.
159
+
160
+
## `qr_space(A, lwork)`
161
+
**Type**: Subroutine
162
+
**Description**: QR Working space size.
163
+
**Optional arguments**:
164
+
-`err`: Error handler.
31
165
32
166
All procedures work with all types (`real`, `complex`) and kinds (32, 64, 128-bit floats).
0 commit comments