jax.scipy.linalg.leslie

Contents

jax.scipy.linalg.leslie#

jax.scipy.linalg.leslie(f, s)[source]#

Construct a Leslie matrix.

JAX implementation of scipy.linalg.leslie().

Given fecundity coefficients f of shape (..., N) and survival coefficients s of shape (..., N - 1), the Leslie matrix has f as its first row, s along its first sub-diagonal, and zeros elsewhere.

Parameters:
  • f (ArrayLike) – array of shape (..., N) with N >= 2 containing the fecundity coefficients.

  • s (ArrayLike) – array of shape (..., N - 1) containing the survival coefficients.

Returns:

A Leslie matrix of shape (..., N, N).

Return type:

Array

Examples

>>> jax.scipy.linalg.leslie(jnp.array([0.1, 2.0, 1.0, 0.1]),
...                         jnp.array([0.2, 0.8, 0.7]))
Array([[0.1, 2. , 1. , 0.1],
       [0.2, 0. , 0. , 0. ],
       [0. , 0.8, 0. , 0. ],
       [0. , 0. , 0.7, 0. ]], dtype=float32)