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
+96Lines changed: 96 additions & 0 deletions
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.
@@ -898,3 +900,97 @@ Exceptions trigger an `error stop`.
898
900
```fortran
899
901
{!example/linalg/example_determinant2.f90!}
900
902
```
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:
915
+
on output `left` may contain the left eigenvectors, `right` the right eigenvectors of \( A \).
916
+
Each eigenvector is returned as a column of `left` of `right`.
`a` : `real` or `complex` square array containing the coefficient matrix. It is normally an `intent(in)` argument. If `overwrite_a=.true.`, it is an `intent(inout)` argument and is destroyed by the call.
926
+
927
+
`lambda`: Shall be a `complex` rank-1 array of the same kind as `a`, containing the eigenvalues. It is an `intent(out)` argument.
928
+
929
+
`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.
930
+
931
+
`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.
932
+
933
+
`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.
934
+
935
+
`err` (optional): Shall be a `type(linalg_state_type)` value. This is an `intent(out)` argument.
936
+
937
+
### Return value
938
+
939
+
Raises `LINALG_ERROR` if the matrix is singular to working precision.
940
+
Raises `LINALG_VALUE_ERROR` if any matrix or arrays have invalid/incompatible sizes.
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 columns.
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 normally 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 kind 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 used 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 matrix is singular to working precision.
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`.
0 commit comments