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
+97-20
Original file line number
Diff line number
Diff line change
@@ -185,7 +185,7 @@ to the original.
185
185
186
186
### Status
187
187
188
-
Experimental
188
+
Stable
189
189
190
190
### Description
191
191
@@ -231,7 +231,7 @@ Returns a diagonal array or a vector with the extracted diagonal elements.
231
231
232
232
### Status
233
233
234
-
Experimental
234
+
Stable
235
235
236
236
### Class
237
237
@@ -282,7 +282,7 @@ A = eye(2,2)/2.0 !! A == diag([0.5, 0.5])
282
282
283
283
### Status
284
284
285
-
Experimental
285
+
Stable
286
286
287
287
### Description
288
288
@@ -605,7 +605,7 @@ Specifically, upper Hessenberg matrices satisfy `a_ij = 0` when `j < i-1`, and l
605
605
606
606
### Status
607
607
608
-
Experimental
608
+
Stable
609
609
610
610
### Description
611
611
@@ -655,7 +655,7 @@ If `err` is not present, exceptions trigger an `error stop`.
655
655
656
656
### Status
657
657
658
-
Experimental
658
+
Stable
659
659
660
660
### Description
661
661
@@ -708,7 +708,7 @@ If `err` is not present, exceptions trigger an `error stop`.
708
708
709
709
### Status
710
710
711
-
Experimental
711
+
Stable
712
712
713
713
### Description
714
714
@@ -752,7 +752,7 @@ Exceptions trigger an `error stop`.
752
752
753
753
### Status
754
754
755
-
Experimental
755
+
Stable
756
756
757
757
### Description
758
758
@@ -806,7 +806,7 @@ Exceptions trigger an `error stop`.
806
806
807
807
### Status
808
808
809
-
Experimental
809
+
Stable
810
810
811
811
### Description
812
812
@@ -832,7 +832,7 @@ This subroutine computes the internal working space requirements for the least-s
832
832
833
833
### Status
834
834
835
-
Experimental
835
+
Stable
836
836
837
837
### Description
838
838
@@ -872,7 +872,7 @@ Exceptions are returned to the `err` argument if provided; an `error stop` is tr
872
872
873
873
### Status
874
874
875
-
Experimental
875
+
Stable
876
876
877
877
### Description
878
878
@@ -902,14 +902,91 @@ Exceptions trigger an `error stop`.
902
902
{!example/linalg/example_determinant2.f90!}
903
903
```
904
904
905
-
## `eig` - Eigenvalues and Eigenvectors of a Square Matrix
905
+
## `qr` - Compute the QR factorization of a matrix
906
906
907
907
### Status
908
908
909
909
Experimental
910
910
911
911
### Description
912
912
913
+
This subroutine computes the QR factorization of a `real` or `complex` matrix: \( A = Q R \) where \( Q \)
914
+
is orthonormal and \( R \) is upper-triangular. Matrix \( A \) has size `[m,n]`, with \( m \ge n \).
915
+
916
+
The results are returned in output matrices \( Q \) and \(R \), that have the same type and kind as \( A \).
917
+
Given `k = min(m,n)`, one can write \( A = \( Q_1 Q_2 \) \cdot \( \frac{R_1}{0}\)\).
918
+
Because the lower rows of \( R \) are zeros, a reduced problem \( A = Q_1 R_1 \) may be solved. The size of
919
+
the input arguments determines what problem is solved: on full matrices (`shape(Q)==[m,m]`, `shape(R)==[m,n]`),
920
+
the full problem is solved. On reduced matrices (`shape(Q)==[m,k]`, `shape(R)==[k,n]`), the reduced problem is solved.
921
+
922
+
### Syntax
923
+
924
+
`call `[[stdlib_linalg(module):qr(interface)]]`(a, q, r, [, storage] [, overwrite_a] [, err])`
925
+
926
+
### Arguments
927
+
928
+
`a`: Shall be a rank-2 `real` or `complex` array containing the coefficient matrix of size `[m,n]`. It is an `intent(in)` argument, if `overwrite_a=.false.`. Otherwise, it is an `intent(inout)` argument, and is destroyed upon return.
929
+
930
+
`q`: Shall be a rank-2 array of the same kind as `a`, containing the orthonormal matrix `q`. It is an `intent(out)` argument. It should have a shape equal to either `[m,m]` or `[m,k]`, whether the full or the reduced problem is sought for.
931
+
932
+
`r`: Shall be a rank-2 array of the same kind as `a`, containing the upper triangular matrix `r`. It is an `intent(out)` argument. It should have a shape equal to either `[m,n]` or `[k,n]`, whether the full or the reduced problem is sought for.
933
+
934
+
`storage` (optional): Shall be a rank-1 array of the same type and kind as `a`, providing working storage for the solver. Its minimum size can be determined with a call to [[stdlib_linalg(module):qr_space(interface)]]. It is an `intent(out)` argument.
935
+
936
+
`overwrite_a` (optional): Shall be an input `logical` flag (default: `.false.`). If `.true.`, input matrix `a` will be used as temporary storage and overwritten. This avoids internal data allocation. It is an `intent(in)` argument.
937
+
938
+
`err` (optional): Shall be a `type(linalg_state_type)` value. It is an `intent(out)` argument.
939
+
940
+
### Return value
941
+
942
+
Returns the QR factorization matrices into the \( Q \) and \( R \) arguments.
943
+
944
+
Raises `LINALG_VALUE_ERROR` if any of the matrices has invalid or unsuitable size for the full/reduced problem.
945
+
Raises `LINALG_ERROR` on insufficient user storage space.
946
+
If the state argument `err` is not present, exceptions trigger an `error stop`.
947
+
948
+
### Example
949
+
950
+
```fortran
951
+
{!example/linalg/example_qr.f90!}
952
+
```
953
+
954
+
## `qr_space` - Compute internal working space requirements for the QR factorization.
955
+
956
+
### Status
957
+
958
+
Experimental
959
+
960
+
### Description
961
+
962
+
This subroutine computes the internal working space requirements for the QR factorization, [[stdlib_linalg(module):qr(interface)]] .
`a`: Shall be a rank-2 `real` or `complex` array containing the coefficient matrix. It is an `intent(in)` argument.
971
+
972
+
`lwork`: Shall be an `integer` scalar, that returns the minimum array size required for the working storage in [[stdlib_linalg(module):qr(interface)]] to factorize `a`.
973
+
974
+
`err` (optional): Shall be a `type(linalg_state_type)` value. This is an `intent(out)` argument.
975
+
976
+
### Example
977
+
978
+
```fortran
979
+
{!example/linalg/example_qr_space.f90!}
980
+
```
981
+
982
+
## `eig` - Eigenvalues and Eigenvectors of a Square Matrix
983
+
984
+
### Status
985
+
986
+
Stable
987
+
988
+
### Description
989
+
913
990
This subroutine computes the solution to the eigenproblem \( A \cdot \bar{v} - \lambda \cdot \bar{v} \), where \( A \) is a square, full-rank, `real` or `complex` matrix.
914
991
915
992
Result array `lambda` returns the eigenvalues of \( A \). The user can request eigenvectors to be returned: if provided, on output `left` will contain the left eigenvectors, `right` the right eigenvectors of \( A \).
@@ -951,7 +1028,7 @@ If `err` is not present, exceptions trigger an `error stop`.
951
1028
952
1029
### Status
953
1030
954
-
Experimental
1031
+
Stable
955
1032
956
1033
### Description
957
1034
@@ -1000,7 +1077,7 @@ If `err` is not present, exceptions trigger an `error stop`.
1000
1077
1001
1078
### Status
1002
1079
1003
-
Experimental
1080
+
Stable
1004
1081
1005
1082
### Description
1006
1083
@@ -1028,7 +1105,6 @@ Raises `LINALG_ERROR` if the calculation did not converge.
1028
1105
Raises `LINALG_VALUE_ERROR` if any matrix or arrays have invalid/incompatible sizes.
1029
1106
If `err` is not present, exceptions trigger an `error stop`.
1030
1107
1031
-
1032
1108
### Example
1033
1109
1034
1110
```fortran
@@ -1039,7 +1115,7 @@ If `err` is not present, exceptions trigger an `error stop`.
1039
1115
1040
1116
### Status
1041
1117
1042
-
Experimental
1118
+
Stable
1043
1119
1044
1120
### Description
1045
1121
@@ -1080,7 +1156,7 @@ If `err` is not present, exceptions trigger an `error stop`.
1080
1156
1081
1157
### Status
1082
1158
1083
-
Experimental
1159
+
Stable
1084
1160
1085
1161
### Description
1086
1162
@@ -1096,6 +1172,7 @@ If requested, `vt` contains the right singular vectors, as rows of \( V^T \).
1096
1172
`call `[[stdlib_linalg(module):svd(interface)]]`(a, s, [, u, vt, overwrite_a, full_matrices, err])`
1097
1173
1098
1174
### Class
1175
+
1099
1176
Subroutine
1100
1177
1101
1178
### Arguments
@@ -1134,7 +1211,7 @@ Exceptions trigger an `error stop`, unless argument `err` is present.
1134
1211
1135
1212
### Status
1136
1213
1137
-
Experimental
1214
+
Stable
1138
1215
1139
1216
### Description
1140
1217
@@ -1266,7 +1343,7 @@ Exceptions trigger an `error stop`, unless argument `err` is present.
1266
1343
1267
1344
### Status
1268
1345
1269
-
Experimental
1346
+
Stable
1270
1347
1271
1348
### Description
1272
1349
@@ -1301,7 +1378,7 @@ interfaces.
1301
1378
1302
1379
### Status
1303
1380
1304
-
Experimental
1381
+
Stable
1305
1382
1306
1383
### Description
1307
1384
@@ -1350,7 +1427,7 @@ If `err` is not present, exceptions trigger an `error stop`.
0 commit comments