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
This interface provides methods for computing the eigenvalues and eigenvectors of a real or complex matrix.
93
+
It supports both standard and generalized eigenvalue problems, allowing for the decomposition of a matrix `A` alone or a pair of matrices `(A, B)` in the generalized case.
94
+
95
+
Given a square matrix \f$ A \f$, this routine computes its eigenvalues \f$ \lambda \f$ and, optionally, its right or left eigenvectors:
96
+
97
+
\f[
98
+
A v = \lambda v
99
+
\f]
100
+
101
+
where \f$ v \f$ represents an eigenvector corresponding to eigenvalue \f$ \lambda \f$.
102
+
103
+
In the generalized eigenvalue problem case, the routine solves:
104
+
105
+
\f[
106
+
A v = \lambda B v
107
+
\f]
108
+
109
+
The computation supports both `real` and `complex` matrices. If requested, eigenvectors are returned as additional output arguments. The function provides options to allow in-place modification of `A` and `B` for performance optimization.
110
+
111
+
**Note:** The solution is based on LAPACK's [GEEV](@ref la_lapack::geev) and [GGEV](@ref la_lapack::ggev) routines.
112
+
113
+
### Arguments
114
+
115
+
-`a`: A `real` or `complex` matrix of size \f$[n,n]\f$, representing the input matrix to be decomposed.
116
+
-`b` (optional): A `real` or `complex` matrix of size \f$[n,n]\f$, same type and kind as `a`, representing the second matrix in the generalized eigenvalue problem.
117
+
-`lambda`: A `complex` or `real` array of length \f$ n \f$, containing the computed eigenvalues.
118
+
-`right` (optional): A `complex` matrix of size \f$[n,n]\f$ containing the right eigenvectors as columns.
119
+
-`left` (optional): A `complex` matrix of size \f$[n,n]\f$ containing the left eigenvectors as columns.
120
+
-`overwrite_a` (optional): A logical flag indicating whether `A` can be overwritten for performance optimization.
121
+
-`overwrite_b` (optional): A logical flag indicating whether `B` can be overwritten (only in the generalized case).
122
+
-`err` (optional): A [type(la_state)](@ref la_state_type::la_state) variable to handle errors. If not provided, execution will stop on errors.
123
+
124
+
### Errors
125
+
126
+
- Raises [LINALG_VALUE_ERROR](@ref la_state_type::linalg_value_error) if the matrices have invalid/incompatible sizes.
127
+
- Raises [LINALG_ERROR](@ref la_state_type::linalg_error) if the eigendecomposition fails.
128
+
- If `err` is not provided, exceptions will trigger an `error stop`.
129
+
130
+
### Notes
131
+
132
+
- The computed eigenvectors are normalized.
133
+
- If computing real eigenvalues, an error is returned if eigenvalues have nonzero imaginary parts.
134
+
- This routine is based on LAPACK's [GEEV](@ref la_lapack::geev) and [GGEV](@ref la_lapack::ggev) routines.
135
+
- Overwriting `A` or `B` can improve performance but destroys the original matrix data.
136
+
137
+
## [eigh](@ref la_eig::eigh) - Eigendecomposition of a real symmetric or complex Hermitian matrix.
This interface provides methods for computing the eigenvalues and optionally the eigenvectors of a real symmetric or complex Hermitian matrix.
146
+
147
+
Given a real symmetric or complex Hermitian matrix \f$ A \f$, this routine computes its eigenvalues \f$ \lambda \f$ and, optionally, its right eigenvectors:
148
+
149
+
\f[
150
+
A v = \lambda v
151
+
\f]
152
+
153
+
where \f$ v \f$ represents an eigenvector corresponding to eigenvalue \f$ \lambda \f$.
154
+
155
+
The computation supports both real and complex matrices, and the eigenvectors, if requested, are returned as orthonormal vectors.
156
+
157
+
**Note:** The solution is based on LAPACK's [SYEVD](@ref la_lapack::syevd) and [HEEVD](@ref la_lapack::heevd) routines.
158
+
159
+
### Arguments
160
+
161
+
-`a`: A `real` or `complex` matrix of size \f$[n,n]\f$, representing the input matrix to be decomposed. The matrix is overwritten with the eigenvalues on output.
162
+
-`lambda`: A `real` array of length \f$ n \f$, with the same kind as `a`, containing the computed eigenvalues.
163
+
-`vectors` (optional): A matrix of size \f$[n,n]\f$, with the same type and kind as `a`, containing the right eigenvectors stored as columns.
164
+
-`overwrite_a` (optional): A logical flag indicating whether the matrix `A` can be overwritten for performance optimization.
165
+
-`upper_a` (optional): A logical flag indicating whether the upper half of matrix `A` should be used for computation (default is the lower half).
166
+
-`err` (optional): A [type(la_state)](@ref la_state_type::la_state) variable to handle errors. If not provided, execution will stop on errors.
167
+
168
+
### Errors
169
+
170
+
- Raises [LINALG_VALUE_ERROR](@ref la_state_type::linalg_value_error) if the matrices have invalid/incompatible sizes.
171
+
- Raises [LINALG_ERROR](@ref la_state_type::linalg_error) if the eigendecomposition fails.
172
+
- If `err` is not provided, exceptions will trigger an `error stop`.
173
+
174
+
### Notes
175
+
176
+
- The computed eigenvectors are orthonormal.
177
+
- Eigenvalues are real for symmetric or Hermitian matrices.
178
+
- This routine is based on LAPACK's [SYEVD](@ref la_lapack::syevd) and [HEEVD](@ref la_lapack::heevd) routines.
179
+
- Overwriting the matrix `A` can improve performance but destroys the original matrix data.
180
+
181
+
## [eigvals](@ref la_eig::eigvals) - Eigenvalues of a square matrix (interface).
182
+
183
+
### Syntax
184
+
185
+
`lambda = eigvals(a [, b] [, err])`
186
+
187
+
### Description
188
+
189
+
This interface provides methods for computing the eigenvalues of a real or complex square matrix.
190
+
It supports both standard and generalized eigenvalue problems.
191
+
192
+
- In the standard eigenvalue problem, the function computes the eigenvalues \f$\lambda\f$ of the matrix \f$A\f$ such that:
193
+
194
+
\f[
195
+
A v = \lambda v
196
+
\f]
197
+
198
+
where \f$v\f$ is the eigenvector corresponding to eigenvalue \f$\lambda\f$.
199
+
200
+
- In the generalized eigenvalue problem, the function solves:
201
+
202
+
\f[
203
+
A v = \lambda B v
204
+
\f]
205
+
206
+
where \f$A\f$ and \f$B\f$ are the input matrices and \f$\lambda\f$ is the eigenvalue.
207
+
208
+
The function returns an array of eigenvalues computed for the input matrix \f$A\f$, and optionally the matrix \f$B\f$ for the generalized case.
209
+
210
+
**Note:** The solution is based on LAPACK's [GEEV](@ref la_lapack::geev) and [GGEV](@ref la_lapack::ggev) routines.
211
+
212
+
### Arguments
213
+
214
+
-`a`: A `real` or `complex` matrix of size \f$[n,n]\f$, representing the input matrix to be decomposed.
215
+
-`b` (optional, generalized case): A matrix of size \f$[n,n]\f$ and same type and kind as `a`, representing the second matrix in the generalized eigenvalue problem.
216
+
-`err` (optional): A [type(la_state)](@ref la_state_type::la_state) variable to handle errors. If not provided, execution will stop on errors.
217
+
218
+
### Return value
219
+
220
+
-`lambda`: A `complex` array of eigenvalues, computed from the input matrix \f$A\f$ (and \f$B\f$ if in the generalized case).
221
+
222
+
### Errors
223
+
224
+
- Raises [LINALG_VALUE_ERROR](@ref la_state_type::linalg_value_error) if the matrices have invalid/incompatible sizes.
225
+
- Raises [LINALG_ERROR](@ref la_state_type::linalg_error) if the eigendecomposition fails.
226
+
- If `err` is not provided, exceptions will trigger an `error stop`.
227
+
228
+
### Notes
229
+
230
+
- The eigenvalues are returned in a complex array, even for real matrices.
231
+
- For the generalized eigenvalue problem, matrix \f$B\f$ must be provided and will be modified in-place.
232
+
- This routine is based on LAPACK's [GEEV](@ref la_lapack::geev) and [GGEV](@ref la_lapack::ggev) routines.
233
+
234
+
## [eigvalsh](@ref la_eig::eigvalsh) - Eigenvalues of a real symmetric or complex Hermitian matrix.
235
+
236
+
### Syntax
237
+
238
+
`lambda = eigvalsh(a [, upper_a] [, err])`
239
+
240
+
### Description
241
+
242
+
This interface provides methods for computing the eigenvalues of a real symmetric or complex Hermitian matrix.
243
+
The function computes the eigenvalues of the matrix \f$A\f$, and returns them in an array.
244
+
The user can specify whether to use the upper or lower half of the matrix for computation.
245
+
246
+
- The function solves the eigenvalue problem:
247
+
248
+
\f[
249
+
A v = \lambda v
250
+
\f]
251
+
252
+
where \f$v\f$ is the eigenvector corresponding to eigenvalue \f$\lambda\f$.
253
+
254
+
- The computation supports both real and complex matrices. Regardless, due to symmetry the eigenvalues are returned as an array of `real` values.
255
+
256
+
The user can specify whether to use the upper or lower half of the matrix \f$A\f$ for the computation (default: lower half).
257
+
258
+
**Note:** The solution is based on LAPACK's [SYEV](@ref la_lapack::syev) and [HEEV](@ref la_lapack::heev) routines.
259
+
260
+
### Arguments
261
+
262
+
-`a`: A `real` or `complex` matrix of size \f$[n,n]\f$, representing the real symmetric or complex Hermitian matrix to be decomposed.
263
+
-`upper_a` (optional): A logical flag indicating whether to use the upper half (`.true.`) or the lower half (`.false.`) of \f$A\f$ for the computation. The default is lower.
264
+
-`err` (optional): A [type(la_state)](@ref la_state_type::la_state) variable to handle errors. If not provided, execution will stop on errors.
265
+
266
+
### Return value
267
+
268
+
-`lambda`: A `real` array containing the computed eigenvalues of the matrix \f$A\f$.
269
+
270
+
### Errors
271
+
272
+
- Raises [LINALG_VALUE_ERROR](@ref la_state_type::linalg_value_error) if the matrix has invalid size.
273
+
- Raises [LINALG_ERROR](@ref la_state_type::linalg_error) if the eigendecomposition fails.
274
+
- If `err` is not provided, execution will stop on errors.
275
+
276
+
### Notes
277
+
278
+
- The eigenvalues are returned in a `real` array, with the same kind as the input matrix `a`.
279
+
- This routine is based on LAPACK's [SYEV](@ref la_lapack::syev) and [HEEV](@ref la_lapack::heev) routines.
280
+
84
281
## [solve](@ref la_solve::solve) - Solve a linear matrix equation or a linear system of equations.
85
282
86
283
### Syntax
@@ -472,40 +669,6 @@ The function returns a matrix of size \f$m \times n\f$ (or \f$m \times m\f$ if \
472
669
- The `mold` scalar is used to provide a function return type.
473
670
- If the `err` parameter is provided, the error state of the function will be returned.
474
671
475
-
476
-
## `eigvals(A)`
477
-
**Type**: Function
478
-
**Description**: Eigenvalues of matrix $A$.
479
-
**Optional arguments**:
480
-
-`err`: State handler.
481
-
482
-
## `eig(A, lambda)`
483
-
**Type**: Subroutine
484
-
**Description**: Eigenproblem of matrix $A`.
485
-
**Optional arguments**:
486
-
-`left`: Output left eigenvector matrix.
487
-
-`right`: Output right eigenvector matrix.
488
-
-`overwrite_a`: Option to let A be destroyed.
489
-
-`err`: Return state handler.
490
-
491
-
## `eigvalsh(A)`
492
-
**Type**: Function
493
-
**Description**: Eigenvalues of symmetric or Hermitian matrix $A$.
494
-
**Optional arguments**:
495
-
-`upper_a`: Choose to use upper or lower triangle.
496
-
-`err`: State handler.
497
-
498
-
## `eigh(A, lambda)`
499
-
**Type**: Subroutine
500
-
**Description**: Eigenproblem of symmetric or Hermitian matrix $A`.
501
-
**Optional arguments**:
502
-
-`vector`: Output eigenvectors.
503
-
-`upper_a`: Choose to use upper or lower triangle.
504
-
-`overwrite_a`: Option to let A be destroyed.
505
-
-`err`: Return state handler.
506
-
507
-
508
-
509
672
## [qr](@ref la_qr::qr) - QR factorization of a matrix.
0 commit comments