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
+175-1Lines changed: 175 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -687,6 +687,8 @@ Expert (`Pure`) interface:
687
687
688
688
`overwrite_a` (optional): Shall be an input logical flag. if `.true.`, input matrix `a` will be used as temporary storage and overwritten. This avoids internal data allocation. This is an `intent(in)` argument.
689
689
690
+
`err` (optional): Shall be a `type(linalg_state_type)` value. This is an `intent(out)` argument.
691
+
690
692
### Return value
691
693
692
694
For a full-rank matrix, returns an array value that represents the solution to the linear system of equations.
@@ -975,6 +977,179 @@ This subroutine computes the internal working space requirements for the QR fact
975
977
{!example/linalg/example_qr_space.f90!}
976
978
```
977
979
980
+
## `eig` - Eigenvalues and Eigenvectors of a Square Matrix
981
+
982
+
### Status
983
+
984
+
Experimental
985
+
986
+
### Description
987
+
988
+
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.
989
+
990
+
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 \).
991
+
Both `left` and `right` are rank-2 arrays, where eigenvectors are stored as columns.
`a` : `real` or `complex` square array containing the coefficient matrix. If `overwrite_a=.false.`, it is an `intent(in)` argument. Otherwise, it is an `intent(inout)` argument and is destroyed by the call.
1001
+
1002
+
`lambda`: Shall be a `complex` or `real` rank-1 array of the same kind as `a`, containing the eigenvalues, or their `real` component only. It is an `intent(out)` argument.
1003
+
1004
+
`right` (optional): Shall be a `complex` rank-2 array of the same size and kind as `a`, containing the right eigenvectors of `a`. It is an `intent(out)` argument.
1005
+
1006
+
`left` (optional): Shall be a `complex` rank-2 array of the same size and kind as `a`, containing the left eigenvectors of `a`. It is an `intent(out)` argument.
1007
+
1008
+
`overwrite_a` (optional): Shall be an input logical flag. if `.true.`, input matrix `a` will be used as temporary storage and overwritten. This avoids internal data allocation. This is an `intent(in)` argument.
1009
+
1010
+
`err` (optional): Shall be a `type(linalg_state_type)` value. This is an `intent(out)` argument.
1011
+
1012
+
### Return value
1013
+
1014
+
Raises `LINALG_ERROR` if the calculation did not converge.
1015
+
Raises `LINALG_VALUE_ERROR` if any matrix or arrays have invalid/incompatible sizes.
1016
+
Raises `LINALG_VALUE_ERROR` if the `real` component is only requested, but the eigenvalues have non-trivial imaginary parts.
1017
+
If `err` is not present, exceptions trigger an `error stop`.
1018
+
1019
+
### Example
1020
+
1021
+
```fortran
1022
+
{!example/linalg/example_eig.f90!}
1023
+
```
1024
+
1025
+
## `eigh` - Eigenvalues and Eigenvectors of a Real symmetric or Complex Hermitian Square Matrix
1026
+
1027
+
### Status
1028
+
1029
+
Experimental
1030
+
1031
+
### Description
1032
+
1033
+
This subroutine computes the solution to the eigendecomposition \( A \cdot \bar{v} - \lambda \cdot \bar{v} \),
1034
+
where \( A \) is a square, full-rank, `real` symmetric \( A = A^T \) or `complex` Hermitian \( A = A^H \) matrix.
1035
+
1036
+
Result array `lambda` returns the `real` eigenvalues of \( A \). The user can request the orthogonal eigenvectors
1037
+
to be returned: on output `vectors` may contain the matrix of eigenvectors, returned as a column.
1038
+
1039
+
Normally, only the lower triangular part of \( A \) is accessed. On input, `logical` flag `upper_a`
1040
+
allows the user to request what triangular part of the matrix should be used.
1041
+
1042
+
The solver is based on LAPACK's `*SYEV` and `*HEEV` backends.
`a` : `real` or `complex` square array containing the coefficient matrix. It is an `intent(in)` argument. If `overwrite_a=.true.`, it is an `intent(inout)` argument and is destroyed by the call.
1051
+
1052
+
`lambda`: Shall be a `complex` rank-1 array of the same precision as `a`, containing the eigenvalues. It is an `intent(out)` argument.
1053
+
1054
+
`vectors` (optional): Shall be a rank-2 array of the same type, size and kind as `a`, containing the eigenvectors of `a`. It is an `intent(out)` argument.
1055
+
1056
+
`upper_a` (optional): Shall be an input `logical` flag. If `.true.`, the upper triangular part of `a` will be accessed. Otherwise, the lower triangular part will be accessed. It is an `intent(in)` argument.
1057
+
1058
+
`overwrite_a` (optional): Shall be an input `logical` flag. If `.true.`, input matrix `a` will be used as temporary storage and overwritten. This avoids internal data allocation. This is an `intent(in)` argument.
1059
+
1060
+
`err` (optional): Shall be a `type(linalg_state_type)` value. This is an `intent(out)` argument.
1061
+
1062
+
### Return value
1063
+
1064
+
Raises `LINALG_ERROR` if the calculation did not converge.
1065
+
Raises `LINALG_VALUE_ERROR` if any matrix or arrays have invalid/incompatible sizes.
1066
+
If `err` is not present, exceptions trigger an `error stop`.
1067
+
1068
+
### Example
1069
+
1070
+
```fortran
1071
+
{!example/linalg/example_eigh.f90!}
1072
+
```
1073
+
1074
+
## `eigvals` - Eigenvalues of a Square Matrix
1075
+
1076
+
### Status
1077
+
1078
+
Experimental
1079
+
1080
+
### Description
1081
+
1082
+
This function returns the eigenvalues to matrix \( A \): a square, full-rank, `real` or `complex` matrix.
1083
+
The eigenvalues are solutions to the eigenproblem \( A \cdot \bar{v} - \lambda \cdot \bar{v} \).
1084
+
1085
+
Result array `lambda` is `complex`, and returns the eigenvalues of \( A \).
`a` : `real` or `complex` square array containing the coefficient matrix. It is an `intent(in)` argument.
1134
+
1135
+
`upper_a` (optional): Shall be an input logical flag. If `.true.`, the upper triangular part of `a` will be used accessed. Otherwise, the lower triangular part will be accessed (default). It is an `intent(in)` argument.
1136
+
1137
+
`err` (optional): Shall be a `type(linalg_state_type)` value. This is an `intent(out)` argument.
1138
+
1139
+
### Return value
1140
+
1141
+
Returns a `real` array containing the eigenvalues of `a`.
1142
+
1143
+
Raises `LINALG_ERROR` if the calculation did not converge.
1144
+
Raises `LINALG_VALUE_ERROR` if any matrix or arrays have invalid/incompatible sizes.
1145
+
If `err` is not present, exceptions trigger an `error stop`.
1146
+
1147
+
### Example
1148
+
1149
+
```fortran
1150
+
{!example/linalg/example_eigvalsh.f90!}
1151
+
```
1152
+
978
1153
## `svd` - Compute the singular value decomposition of a rank-2 array (matrix).
979
1154
980
1155
### Status
@@ -1066,4 +1241,3 @@ Exceptions trigger an `error stop`, unless argument `err` is present.
0 commit comments