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
+75Lines changed: 75 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -979,6 +979,81 @@ This subroutine computes the internal working space requirements for the QR fact
979
979
{!example/linalg/example_qr_space.f90!}
980
980
```
981
981
982
+
## `schur` - Compute the Schur decomposition of a matrix
983
+
984
+
### Status
985
+
986
+
Experimental
987
+
988
+
### Description
989
+
990
+
This subroutine computes the Schur decomposition of a `real` or `complex` matrix: \( A = Z T Z^H \), where \( Z \) is unitary (orthonormal) and \( T \) is upper-triangular (for complex matrices) or quasi-upper-triangular (for real matrices, with possible \( 2 \times 2 \) blocks on the diagonal). Matrix \( A \) has size `[n,n]`.
991
+
992
+
The results are returned in output matrices \( T \) and \( Z \). Matrix \( T \) is the Schur form, and matrix \( Z \) is the unitary transformation matrix such that \( A = Z T Z^H \). If requested, the eigenvalues of \( T \) can also be returned as a `complex` array of size `[n]`.
-`a`: Shall be a rank-2 `real` or `complex` array containing the matrix to be decomposed. It is an `intent(inout)` argument if `overwrite_a = .true.`; otherwise, it is an `intent(in)` argument.
1001
+
1002
+
-`t`: Shall be a rank-2 array of the same kind as `a`, containing the Schur form \( T \) of the matrix. It is an `intent(out)` argument and should have a shape of `[n,n]`.
1003
+
1004
+
-`z`: Shall be a rank-2 array of the same kind as `a`, containing the unitary matrix \( Z \). It is an `intent(out)` argument and is optional. If provided, it should have the shape `[n,n]`.
1005
+
1006
+
-`eigvals` (optional): Shall be a rank-1 `complex` array containing the eigenvalues of \( A \) (the diagonal elements of \( T \)). The array must be of size `[n]`. If not provided, the eigenvalues are not returned.
1007
+
1008
+
-`overwrite_a` (optional): Shall be a `logical` flag (default: `.false.`). If `.true.`, the input matrix `a` will be overwritten and destroyed upon return, avoiding internal data allocation. It is an `intent(in)` argument.
1009
+
1010
+
-`storage` (optional): Shall be a rank-1 array of the same type and kind as `a`, providing working storage for the solver. Its minimum size can be determined with a call to [[stdlib_linalg(module):schur_space(interface)]]. It is an `intent(inout)` argument.
1011
+
1012
+
-`err` (optional): Shall be a `type(linalg_state_type)` value. It is an `intent(out)` argument. If not provided, exceptions trigger an `error stop`.
1013
+
1014
+
### Return value
1015
+
1016
+
Returns the Schur decomposition matrices into the \( T \) and \( Z \) arguments. If `eigvals` is provided, it will also return the eigenvalues of the matrix \( A \).
1017
+
1018
+
Raises `LINALG_VALUE_ERROR` if any of the matrices have invalid or unsuitable size for the decomposition.
1019
+
Raises `LINALG_ERROR` on insufficient user storage space.
1020
+
If the state argument `err` is not present, exceptions trigger an `error stop`.
1021
+
1022
+
### Example
1023
+
1024
+
```fortran
1025
+
{!example/linalg/example_schur_eigvals.f90!}
1026
+
```
1027
+
1028
+
---
1029
+
1030
+
## `schur_space` - Compute internal working space requirements for the Schur decomposition
1031
+
1032
+
### Status
1033
+
1034
+
Experimental
1035
+
1036
+
### Description
1037
+
1038
+
This subroutine computes the internal working space requirements for the Schur decomposition, [[stdlib_linalg(module):schur(interface)]].
-`a`: Shall be a rank-2 `real` or `complex` array containing the matrix to be decomposed. It is an `intent(in)` argument.
1047
+
1048
+
-`lwork`: Shall be an `integer` scalar that returns the minimum array size required for the working storage in [[stdlib_linalg(module):schur(interface)]] to decompose `a`.
1049
+
1050
+
-`err` (optional): Shall be a `type(linalg_state_type)` value. It is an `intent(out)` argument.
1051
+
1052
+
### Return value
1053
+
1054
+
Returns the required working storage size `lwork` for the Schur decomposition. This value can be used to pre-allocate a workspace array in case multiple Schur decompositions of the same matrix size are needed. If pre-allocated working arrays are provided, no internal memory allocations will take place during the decomposition.
1055
+
1056
+
982
1057
## `eig` - Eigenvalues and Eigenvectors of a Square Matrix
0 commit comments