bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / linalg / _decomp / cdf2rdf
function
scipy.linalg._decomp:cdf2rdf
source: build-install/usr/lib/python3.14/site-packages/scipy/linalg/_decomp.py:1527
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 @ vrcontinues 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_likeComplex 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_likeComplex or real eigenvectors, a square array or stack of square arrays.
Returns
wr: (..., M, M) ndarrayReal diagonal block form of eigenvalues
vr: (..., M, M) ndarrayReal 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✓
array([[ 1, 2, 3],
[ 0, 4, 5],
[ 0, -5, 4]])
from scipy import linalg w, v = linalg.eig(X)✓
w v✗
array([[ 1. +0.j , -0.02-0.4j , -0.02+0.4j ],
[ 0. +0.j , 0. -0.65j, 0. +0.65j],
[ 0. +0.j , 0.65+0.j , 0.65-0.j ]])
wr, vr = linalg.cdf2rdf(w, v) wr✓
array([[ 1., 0., 0.],
[ 0., 4., 5.],
[ 0., -5., 4.]])
vr
✗array([[ 1. , 0.4 , -0.02],
[ 0. , 0.65, 0. ],
[ 0. , 0. , 0.65]])
vr @ wr X @ vr✗
array([[ 1. , 1.7 , 1.92],
[ 0. , 2.59, 3.24],
[ 0. , -3.24, 2.59]])
See also
Aliases
scipy.linalg.cdf2rdf