Files
mql5-skills/skills/mql5/references/docs/06-matrix/0448-matrix-openblas-eigen-values-tridiagonalmatrices-eigentridiagdcq.md
T
2026-06-23 21:47:51 +08:00

96 lines
4.1 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# EigenTridiagonalDCQ
Compute eigenvalues and eigenvectors of a symmetric tridiagonal matrix using the divide-and-conquer algorithm (LAPACK function [STEDC](https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-fortran/2025-2/stedc.html)). Unlike [EigenTridiagonalDC](/en/docs/matrix/openblas/eigen_values/tridiagonalmatrices/eigentridiagposdefq), this method can be used to compute the eigenvectors of the original symmetric matrix. A symmetric matrix can be reduced to tridiagonal form using the [ReduceSymmetricToTridiagonal](/en/docs/matrix/openblas/matrixtransforms/reducesymmetrictotridiagonal) method. The orthogonal matrix Q obtained from this transformation is then used to compute the eigenvectors of the original symmetric matrix.
Computing for type matrix<double>
```
bool  matrix::EigenTridiagonalDCQ(
   ENUM_EIGTRIDIAG_Z     compv,              // compute eigenvectors or not
   matrix&               Q,                  // orthogonal matrix used in the reduction to tridiagonal form
   vector&               eigen_values,       // vector of computed eigenvalues
   matrix&               eigen_vectors       // matrix of computed eigenvectors
   );
```
Computing for type matrix<float>
```
bool  matrixf::EigenTridiagonalDCQ(
   ENUM_EIGTRIDIAG_Z     compv,              // compute eigenvectors or not
   matrixf&              Q,                  // orthogonal matrix used in the reduction to tridiagonal form
   vectorf&              eigen_values,       // vector of computed eigenvalues
   matrixf&              eigen_vectors       // matrix of computed eigenvectors
   );
```
Computing for type matrix<complex>
```
bool  matrixc::EigenTridiagonalDCQ(
   ENUM_EIGTRIDIAG_Z     compv,              // compute eigenvectors or not
   matrixc&              Q,                  // orthogonal matrix used in the reduction to tridiagonal form
   vector&               eigen_values,       // vector of computed eigenvalues
   matrixc&              eigen_vectors       // matrix of computed eigenvectors
   );
```
Computing for type matrix<complexf>
```
bool  matrixcf::EigenTridiagonalDCQ(
   ENUM_EIGTRIDIAG_Z     compv,              // compute eigenvectors or not
   matrixcf&             Q,                  // orthogonal matrix used in the reduction to tridiagonal form
   vectorf&              eigen_values,       // vector of computed eigenvalues
   matrixcf&             eigen_vectors       // matrix of computed eigenvectors
   );
```
Parameters
compv
[in]  ENUM_EIGTRIDIAG_Z enumeration value which determines the method for computing eigenvectors.
Q
[in]  Orthogonal matrix Q produced by method [ReflectTridiagonalToQ](/en/docs/matrix/openblas/matrixtransforms/reflecttridiagonaltoq).
eigen_values
[out] Vector of eigenvalues.
eigen_vectors
[out] Matrix of eigenvectors.
Return Value
Return true if successful, otherwise false in case of an [error](/en/docs/constants/errorswarnings/errorcodes).
Note
Computation depends on the value of the compv parameter.
When compv = EIGCOMPZ_N, compute eigenvalues only, eigenvectors are not calculated.
If EIGCOMPZ_V is set, eigenvalues are computed and eigenvectors of original symmetric matrix are calculated also.
If EIGCOMPZ_I is set, eigenvalues are computed and eigenvectors of tridiagonal matrix are calculated also.
The input must be a symmetric matrix in the tridiagonal form.
ENUM_EIGTRIDIAG_Z
An enumeration that specifies whether to calculate eigenvectors.
| ID | Description |
| --- | --- |
| EIGCOMPZ_N | 'N': Compute eigenvalues only |
| EIGCOMPZ_V | 'V': Compute eigenvectors of original symmetric matrix also |
| EIGCOMPZ_I | 'I': Compute eigenvectors of tridiagonal matrix also |