jax.scipy.linalg.invpascal

Contents

jax.scipy.linalg.invpascal#

jax.scipy.linalg.invpascal(n, kind=None)[source]#

Compute the inverse of the Pascal matrix of order n.

JAX implementation of scipy.linalg.invpascal().

The inverses of the lower and upper Pascal matrices have a simple closed form,

\[L^{-1}_{ij} = (-1)^{i - j} \binom{i}{j}, \qquad U^{-1} = (L^{-1})^T,\]

and the symmetric inverse satisfies \(P_S^{-1} = U^{-1} L^{-1}\).

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

  • kind (str | None) – (optional) must be one of lower, upper, or symmetric (default).

Returns:

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

Return type:

Array

Note

Unlike scipy.linalg.invpascal(), this function does not support exact=True. The entries are computed in floating point through gammaln()-based binomial coefficients.

Examples

>>> with jnp.printoptions(precision=3, suppress=True):
...   print(jax.scipy.linalg.invpascal(4, kind="lower"))
...   print(jax.scipy.linalg.invpascal(5))
[[ 1. -0.  0. -0.]
 [-1.  1. -0.  0.]
 [ 1. -2.  1. -0.]
 [-1.  3. -3.  1.]]
[[  5. -10.  10.  -5.   1.]
 [-10.  30. -35.  19.  -4.]
 [ 10. -35.  46. -27.   6.]
 [ -5.  19. -27.  17.  -4.]
 [  1.  -4.   6.  -4.   1.]]