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
+176-1
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.
@@ -899,6 +901,180 @@ Exceptions trigger an `error stop`.
899
901
{!example/linalg/example_determinant2.f90!}
900
902
```
901
903
904
+
## `eig` - Eigenvalues and Eigenvectors of a Square Matrix
905
+
906
+
### Status
907
+
908
+
Experimental
909
+
910
+
### Description
911
+
912
+
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.
913
+
914
+
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 \).
915
+
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.
925
+
926
+
`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.
927
+
928
+
`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.
929
+
930
+
`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.
931
+
932
+
`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.
933
+
934
+
`err` (optional): Shall be a `type(linalg_state_type)` value. This is an `intent(out)` argument.
935
+
936
+
### Return value
937
+
938
+
Raises `LINALG_ERROR` if the calculation did not converge.
939
+
Raises `LINALG_VALUE_ERROR` if any matrix or arrays have invalid/incompatible sizes.
940
+
Raises `LINALG_VALUE_ERROR` if the `real` component is only requested, but the eigenvalues have non-trivial imaginary parts.
941
+
If `err` is not present, exceptions trigger an `error stop`.
942
+
943
+
### Example
944
+
945
+
```fortran
946
+
{!example/linalg/example_eig.f90!}
947
+
```
948
+
949
+
## `eigh` - Eigenvalues and Eigenvectors of a Real symmetric or Complex Hermitian Square Matrix
950
+
951
+
### Status
952
+
953
+
Experimental
954
+
955
+
### Description
956
+
957
+
This subroutine computes the solution to the eigendecomposition \( A \cdot \bar{v} - \lambda \cdot \bar{v} \),
958
+
where \( A \) is a square, full-rank, `real` symmetric \( A = A^T \) or `complex` Hermitian \( A = A^H \) matrix.
959
+
960
+
Result array `lambda` returns the `real` eigenvalues of \( A \). The user can request the orthogonal eigenvectors
961
+
to be returned: on output `vectors` may contain the matrix of eigenvectors, returned as a column.
962
+
963
+
Normally, only the lower triangular part of \( A \) is accessed. On input, `logical` flag `upper_a`
964
+
allows the user to request what triangular part of the matrix should be used.
965
+
966
+
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.
975
+
976
+
`lambda`: Shall be a `complex` rank-1 array of the same precision as `a`, containing the eigenvalues. It is an `intent(out)` argument.
977
+
978
+
`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.
979
+
980
+
`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.
981
+
982
+
`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.
983
+
984
+
`err` (optional): Shall be a `type(linalg_state_type)` value. This is an `intent(out)` argument.
985
+
986
+
### Return value
987
+
988
+
Raises `LINALG_ERROR` if the calculation did not converge.
989
+
Raises `LINALG_VALUE_ERROR` if any matrix or arrays have invalid/incompatible sizes.
990
+
If `err` is not present, exceptions trigger an `error stop`.
991
+
992
+
### Example
993
+
994
+
```fortran
995
+
{!example/linalg/example_eigh.f90!}
996
+
```
997
+
998
+
## `eigvals` - Eigenvalues of a Square Matrix
999
+
1000
+
### Status
1001
+
1002
+
Experimental
1003
+
1004
+
### Description
1005
+
1006
+
This function returns the eigenvalues to matrix \( A \): a square, full-rank, `real` or `complex` matrix.
1007
+
The eigenvalues are solutions to the eigenproblem \( A \cdot \bar{v} - \lambda \cdot \bar{v} \).
1008
+
1009
+
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.
1059
+
1060
+
`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.
1061
+
1062
+
`err` (optional): Shall be a `type(linalg_state_type)` value. This is an `intent(out)` argument.
1063
+
1064
+
### Return value
1065
+
1066
+
Returns a `real` array containing the eigenvalues of `a`.
1067
+
1068
+
Raises `LINALG_ERROR` if the calculation did not converge.
1069
+
Raises `LINALG_VALUE_ERROR` if any matrix or arrays have invalid/incompatible sizes.
1070
+
If `err` is not present, exceptions trigger an `error stop`.
1071
+
1072
+
### Example
1073
+
1074
+
```fortran
1075
+
{!example/linalg/example_eigvalsh.f90!}
1076
+
```
1077
+
902
1078
## `svd` - Compute the singular value decomposition of a rank-2 array (matrix).
903
1079
904
1080
### Status
@@ -989,4 +1165,3 @@ Exceptions trigger an `error stop`, unless argument `err` is present.
0 commit comments