vander#
- class brainunit.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 aQuantity.N (
bool|None) – Number of columns in the output. IfNis not specified, a square array is returned (N = len(x)).increasing (
bool|None) – Order of the powers of the columns. IfTrue, the powers increase from left to right; ifFalse(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
xcarries 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)