vander

Contents

vander#

class saiunit.math.vander(x, N=None, increasing=False, unit=Unit('1'))#

Generate a Vandermonde matrix.

The columns of the output matrix are powers of the input vector.

Parameters:
  • x (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – 1-D input array. Must be dimensionless if a Quantity.

  • N (bool | None) – Number of columns in the output. If N is not specified, a square array is returned (N = len(x)).

  • increasing (bool | None) – Order of the powers of the columns. If True, the powers increase from left to right; if False (the default), they are reversed.

  • unit (saiunit.Unit) – Unit of the returned Quantity.

Returns:

out – Vandermonde matrix.

Return type:

saiunit.Quantity | Array

Raises:

TypeError – If x carries a non-trivial unit.

Examples

>>> import saiunit as u
>>> import jax.numpy as jnp
>>> u.math.vander(jnp.array([1, 2, 3]), 3)
Array([[1, 1, 1],
       [4, 2, 1],
       [9, 3, 1]], dtype=int32)