brainunit.math.vander#
- 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 (
Quantity|Array|ndarray|number|bool) – 1-D input array. Must be dimensionless if aQuantity.N (
int|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 (
Unit) – Unit of the returnedQuantity.
- Returns:
out – Vandermonde matrix.
- Return type:
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)