fn
vander
→Tensorvander(x: Tensor, N: int | None = None, increasing: bool = False)Construct a Vandermonde matrix from a 1-D vector.
Given a 1-D input , returns the matrix whose -th column is a power of :
Vandermonde matrices arise naturally in polynomial fitting and interpolation: the columns are the basis evaluated at the data points.
Parameters
xTensor1-D input of length .
Nint or None= NoneNumber of columns. Defaults to (square output).
increasingbool= FalseIf
True powers increase left-to-right (column 0 is
). Default False matches the classical
convention used in polynomial regression.Returns
TensorVandermonde matrix.
Notes
Vandermonde matrices become highly ill-conditioned as grows (condition number grows exponentially) — for polynomial regression beyond degree prefer an orthogonal-polynomial basis or QR-based fitting.
Examples
>>> import lucid
>>> from lucid.linalg import vander
>>> vander(lucid.tensor([1.0, 2.0, 3.0]), N=3, increasing=True)
Tensor([[1.0000, 1.0000, 1.0000],
[1.0000, 2.0000, 4.0000],
[1.0000, 3.0000, 9.0000]])