{ } Raw JSON

bundles / scipy 1.17.1 / scipy / linalg / _decomp / cdf2rdf

function

scipy.linalg._decomp:cdf2rdf

source: /scipy/linalg/_decomp.py :1498

Signature

def   cdf2rdf ( w v )

Summary

Complex diagonal form to real diagonal block form.

Extended Summary

Converts complex eigenvalues w and eigenvectors v to real eigenvalues in a block diagonal form wr and the associated real eigenvectors vr, such that

vr @ wr = X @ vr

continues to hold, where X is the original array for which w and v are the eigenvalues and eigenvectors.

Array argument(s) of this function may have additional "batch" dimensions prepended to the core shape. In this case, the array is treated as a batch of lower-dimensional slices; see linalg_batch for details.

Parameters

w : (..., M) array_like

Complex or real eigenvalues, an array or stack of arrays

Conjugate pairs must not be interleaved, else the wrong result will be produced. So [1+1j, 1, 1-1j] will give a correct result, but [1+1j, 2+1j, 1-1j, 2-1j] will not.

v : (..., M, M) array_like

Complex or real eigenvectors, a square array or stack of square arrays.

Returns

wr : (..., M, M) ndarray

Real diagonal block form of eigenvalues

vr : (..., M, M) ndarray

Real eigenvectors associated with wr

Notes

w, v must be the eigenstructure for some real matrix X. For example, obtained by w, v = scipy.linalg.eig(X) or w, v = numpy.linalg.eig(X) in which case X can also represent stacked arrays.

Examples

import numpy as np
X = np.array([[1, 2, 3], [0, 4, 5], [0, -5, 4]])
X
from scipy import linalg
w, v = linalg.eig(X)
w
v
wr, vr = linalg.cdf2rdf(w, v)
wr
vr
vr @ wr
X @ vr

See also

eig

Eigenvalues and right eigenvectors for non-symmetric arrays

rsf2csf

Convert real Schur form to complex Schur form

Aliases

  • scipy.linalg.cdf2rdf

Referenced by

This package