Skip to content

Commit f9279b3

Browse files
committed
specs: eig, eigh
1 parent 1ebf374 commit f9279b3

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

doc/specs/stdlib_linalg.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,8 @@ Expert (`Pure`) interface:
687687

688688
`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.
689689

690+
`err` (optional): Shall be a `type(linalg_state_type)` value. This is an `intent(out)` argument.
691+
690692
### Return value
691693

692694
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`.
898900
```fortran
899901
{!example/linalg/example_determinant2.f90!}
900902
```
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`.
917+
The solver is based on LAPACK's `*GEEV` backends.
918+
919+
### Syntax
920+
921+
`call ` [[stdlib_linalg(module):eig(interface)]] `(a, lambda [, right] [,left] [,overwrite_a] [,err])`
922+
923+
### Arguments
924+
925+
`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.
967+
968+
### Syntax
969+
970+
`call ` [[stdlib_linalg(module):eigh(interface)]] `(a, lambda [, vectors] [, upper_a] [, overwrite_a] [,err])`
971+
972+
### Arguments
973+
974+
`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`.
991+
992+
### Example
993+
994+
```fortran
995+
{!example/linalg/example_eigh.f90!}
996+
```

0 commit comments

Comments
 (0)