Skip to content

Commit 56d89a8

Browse files
committed
specs: eigvals, eigvalsh
1 parent f9279b3 commit 56d89a8

File tree

1 file changed

+81
-2
lines changed

1 file changed

+81
-2
lines changed

doc/specs/stdlib_linalg.md

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ The solver is based on LAPACK's `*GEEV` backends.
936936

937937
### Return value
938938

939-
Raises `LINALG_ERROR` if the matrix is singular to working precision.
939+
Raises `LINALG_ERROR` if the calculation did not converge.
940940
Raises `LINALG_VALUE_ERROR` if any matrix or arrays have invalid/incompatible sizes.
941941
If `err` is not present, exceptions trigger an `error stop`.
942942

@@ -985,7 +985,7 @@ The solver is based on LAPACK's `*SYEV` and `*HEEV` backends.
985985

986986
### Return value
987987

988-
Raises `LINALG_ERROR` if the matrix is singular to working precision.
988+
Raises `LINALG_ERROR` if the calculation did not converge.
989989
Raises `LINALG_VALUE_ERROR` if any matrix or arrays have invalid/incompatible sizes.
990990
If `err` is not present, exceptions trigger an `error stop`.
991991

@@ -994,3 +994,82 @@ If `err` is not present, exceptions trigger an `error stop`.
994994
```fortran
995995
{!example/linalg/example_eigh.f90!}
996996
```
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 \).
1010+
The solver is based on LAPACK's `*GEEV` backends.
1011+
1012+
### Syntax
1013+
1014+
`lambda = ` [[stdlib_linalg(module):eigvals(interface)]] `(a, [,err])`
1015+
1016+
### Arguments
1017+
1018+
`a` : `real` or `complex` square array containing the coefficient matrix. It is normally an `intent(in)` argument.
1019+
1020+
`err` (optional): Shall be a `type(linalg_state_type)` value. This is an `intent(out)` argument.
1021+
1022+
### Return value
1023+
1024+
Returns a `complex` array containing the eigenvalues of `a`.
1025+
1026+
Raises `LINALG_ERROR` if the calculation did not converge.
1027+
Raises `LINALG_VALUE_ERROR` if any matrix or arrays have invalid/incompatible sizes.
1028+
If `err` is not present, exceptions trigger an `error stop`.
1029+
1030+
### Example
1031+
1032+
```fortran
1033+
{!example/linalg/example_eigvals.f90!}
1034+
```
1035+
1036+
## `eigvalsh` - Eigenvalues of a Real Symmetric or Complex Hermitian Square Matrix
1037+
1038+
### Status
1039+
1040+
Experimental
1041+
1042+
### Description
1043+
1044+
This function returns the eigenvalues to matrix \( A \): a where \( A \) is a square, full-rank,
1045+
`real` symmetric \( A = A^T \) or `complex` Hermitian \( A = A^H \) matrix.
1046+
The eigenvalues are solutions to the eigenproblem \( A \cdot \bar{v} - \lambda \cdot \bar{v} \).
1047+
1048+
Result array `lambda` is `real`, and returns the eigenvalues of \( A \).
1049+
The solver is based on LAPACK's `*SYEV` and `*HEEV` backends.
1050+
1051+
### Syntax
1052+
1053+
`lambda = ` [[stdlib_linalg(module):eigvalsh(interface)]] `(a, [, upper_a] [,err])`
1054+
1055+
### Arguments
1056+
1057+
`a` : `real` or `complex` square array containing the coefficient matrix. It is normally an `intent(in)` argument.
1058+
1059+
`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.
1060+
1061+
`err` (optional): Shall be a `type(linalg_state_type)` value. This is an `intent(out)` argument.
1062+
1063+
### Return value
1064+
1065+
Returns a `real` array containing the eigenvalues of `a`.
1066+
1067+
Raises `LINALG_ERROR` if the calculation did not converge.
1068+
Raises `LINALG_VALUE_ERROR` if any matrix or arrays have invalid/incompatible sizes.
1069+
If `err` is not present, exceptions trigger an `error stop`.
1070+
1071+
### Example
1072+
1073+
```fortran
1074+
{!example/linalg/example_eigvalsh.f90!}
1075+
```

0 commit comments

Comments
 (0)