jax.scipy.linalg.invhilbert

Contents

jax.scipy.linalg.invhilbert#

jax.scipy.linalg.invhilbert(n)[source]#

Compute the inverse of the Hilbert matrix of order n.

JAX implementation of scipy.linalg.invhilbert().

The entries are given by a closed-form expression in terms of binomial coefficients:

\[H^{-1}_{ij} = (-1)^{i + j} (i + j + 1) \binom{n + i}{n - j - 1} \binom{n + j}{n - i - 1} \binom{i + j}{i}^2\]

for \(0 \le i, j < n\).

Parameters:

n (int) – the size of the matrix to create.

Returns:

The inverse of the Hilbert matrix of shape (n, n).

Return type:

Array

Note

Unlike scipy.linalg.invhilbert(), this function does not support exact=True. The result is computed in floating point using comb(); for large n the entries quickly exceed the dynamic range of finite-precision floats.

Examples

>>> with jnp.printoptions(precision=3, suppress=True):
...   print(jax.scipy.linalg.invhilbert(2))
...   print(jax.scipy.linalg.invhilbert(3))
[[ 4. -6.]
 [-6. 12.]]
[[   9.  -36.   30.]
 [ -36.  192. -180.]
 [  30. -180.  180.]]