jax.scipy.linalg.hessenberg#

jax.scipy.linalg.hessenberg(a: ArrayLike, *, calc_q: Literal[False], overwrite_a: bool = False, check_finite: bool = True) Array[源代码]#
jax.scipy.linalg.hessenberg(a: ArrayLike, *, calc_q: Literal[True], overwrite_a: bool = False, check_finite: bool = True) tuple[Array, Array]

计算矩阵的Hessenberg形式

scipy.linalg.hessenberg()的JAX实现。

矩阵A的Hessenberg形式H满足

\[A = Q H Q^H\]

其中Q是酉矩阵,而H在第一个子对角线下方为零。

参数:
  • a – 形状为(..., N, N)的数组

  • calc_q – 如果为True,则计算Q矩阵(默认值:False)

  • overwrite_a – JAX 未使用

  • check_finite – JAX未使用

返回:

如果calc_q为True,则为数组(H, Q)的元组,否则为数组H

  • H的形状为(..., N, N),并且是a的Hessenberg形式

  • Q的形状为(..., N, N),并且是关联的酉矩阵

示例

计算4x4矩阵的Hessenberg形式

>>> a = jnp.array([[1., 2., 3., 4.],
...                [1., 4., 2., 3.],
...                [3., 2., 1., 4.],
...                [2., 3., 2., 2.]])
>>> H, Q = jax.scipy.linalg.hessenberg(a, calc_q=True)
>>> with jnp.printoptions(suppress=True, precision=3):
...   print(H)
[[ 1.    -5.078  1.167  1.361]
 [-3.742  5.786 -3.613 -1.825]
 [ 0.    -2.992  2.493 -0.577]
 [ 0.     0.    -0.043 -1.279]]

请注意子对角线位置中的零。可以使用Q向量重建原始矩阵

>>> a_reconstructed = Q @ H @ Q.conj().T
>>> jnp.allclose(a_reconstructed, a)
Array(True, dtype=bool)