jax.scipy.linalg.pascal — JAX documentation (original) (raw)

jax.scipy.linalg.pascal#

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

Create a Pascal matrix approximation of order n.

JAX implementation of scipy.linalg.pascal().

The elements of the Pascal matrix approximate the binomial coefficents. This implementation is not exact as JAX does not support exact factorials.

Parameters:

Returns:

A Pascal matrix of shape (n, n)

Return type:

Array

Examples

with jnp.printoptions(precision=3): ... print(jax.scipy.linalg.pascal(3, kind="lower")) ... print(jax.scipy.linalg.pascal(4, kind="upper")) ... print(jax.scipy.linalg.pascal(5)) [[1. 0. 0.] [1. 1. 0.] [1. 2. 1.]] [[1. 1. 1. 1.] [0. 1. 2. 3.] [0. 0. 1. 3.] [0. 0. 0. 1.]] [[ 1. 1. 1. 1. 1.] [ 1. 2. 3. 4. 5.] [ 1. 3. 6. 10. 15.] [ 1. 4. 10. 20. 35.] [ 1. 5. 15. 35. 70.]]