bundles / scipy 1.17.1 / scipy / linalg / _decomp / hessenberg
function
scipy.linalg._decomp:hessenberg
source: /scipy/linalg/_decomp.py :1405
Signature
def hessenberg ( a , calc_q = False , overwrite_a = False , check_finite = True ) Summary
Compute Hessenberg form of a matrix.
Extended Summary
The Hessenberg decomposition is
A = Q H Q^Hwhere Q is unitary/orthogonal and H has only zero elements below the first sub-diagonal.
The documentation is written assuming array arguments are of specified "core" shapes. However, 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. Note that calls with zero-size batches are unsupported and will raise a ValueError.
Parameters
a: (M, M) array_likeMatrix to bring into Hessenberg form.
calc_q: bool, optionalWhether to compute the transformation matrix. Default is False.
overwrite_a: bool, optionalWhether to overwrite
a; may improve performance. Default is False.check_finite: bool, optionalWhether to check that the input matrix contains only finite numbers. Disabling may give a performance gain, but may result in problems (crashes, non-termination) if the inputs do contain infinities or NaNs.
Returns
H: (M, M) ndarrayHessenberg form of
a.Q: (M, M) ndarrayUnitary/orthogonal similarity transformation matrix
A = Q H Q^H. Only returned ifcalc_q=True.
Examples
import numpy as np from scipy.linalg import hessenberg A = np.array([[2, 5, 8, 7], [5, 2, 2, 8], [7, 5, 6, 6], [5, 4, 4, 8]]) H, Q = hessenberg(A, calc_q=True)✓
H
✗np.allclose(Q @ H @ Q.conj().T - A, np.zeros((4, 4)))
✓Aliases
-
scipy.linalg.hessenberg