extendr_api::prelude::modules::evd

Function compute_evd_real

pub fn compute_evd_real<E>(
    matrix: MatRef<'_, E>,
    s_re: ColMut<'_, E>,
    s_im: ColMut<'_, E>,
    u: Option<MatMut<'_, E>>,
    parallelism: Parallelism<'_>,
    stack: PodStack<'_>,
    params: EvdParams,
)
where E: RealField,
Expand description

Computes the eigenvalue decomposition of a square real matrix.

s_re and s_im respectively represent the real and imaginary parts of the diagonal of the matrix $S$, and must have size equal to the dimension of the matrix.

If u is None, then only the eigenvalues are computed. Otherwise, the eigenvectors are computed and stored in u.

The eigenvectors are stored as follows, for each real eigenvalue, the corresponding column of the eigenvector matrix is the corresponding eigenvector.

For each complex eigenvalue pair $a + ib$ and $a - ib$ at indices k and k + 1, the eigenvalues are stored consecutively. And the real and imaginary parts of the eigenvector corresponding to the eigenvalue $a + ib$ are stored at indices k and k+1. The eigenvector corresponding to $a - ib$ can be computed as the conjugate of that vector.

ยงPanics

Panics if any of the conditions described above is violated, or if the type E does not have a fixed precision at compile time, e.g. a dynamic multiprecision floating point type.

This can also panic if the provided memory in stack is insufficient (see compute_evd_req).