Table of Contents
Shortcuts

# torch.linalg.vander

torch.linalg.vander(x, N=None) → Tensor

  Generates a Vandermonde matrix.

  Returns the Vandermonde matrix V V V

  V=(1 x 1 x 1 2…x 1 N−1 1 x 2 x 2 2…x 2 N−1 1 x 3 x 3 2…x 3 N−1⋮⋮⋮⋱⋮1 x n x n 2…x n N−1).V = \begin{pmatrix} 1 & x_1 & x_1^2 & \dots & x_1^{N-1}\\ 1 & x_2 & x_2^2 & \dots & x_2^{N-1}\\ 1 & x_3 & x_3^2 & \dots & x_3^{N-1}\\ \vdots & \vdots & \vdots & \ddots &\vdots \\ 1 & x_n & x_n^2 & \dots & x_n^{N-1} \end{pmatrix}.V=
  ​1 1 1⋮1​x 1​x 2​x 3​⋮x n​​x 1 2​x 2 2​x 3 2​⋮x n 2​​………⋱…​x 1 N−1​x 2 N−1​x 3 N−1​⋮x n N−1​​
  ​.

  for N > 1. If `N`= None, then N = x.size(-1) so that the output is a square matrix.

  Supports inputs of float, double, cfloat, cdouble, and integral dtypes. Also supports batches of vectors, and if `x` is a batch of vectors then the output has the same batch dimensions.

  Differences with numpy.vander:

  - Unlike numpy.vander, this function returns the powers of `x` in ascending order. To get them in the reverse order call `linalg.vander(x, N).flip(-1)`.

  Parameters:

    x (Tensor) – tensor of shape (*, n) where * is zero or more batch dimensions consisting of vectors.

  Keyword Arguments:

    N (int, optional) – Number of columns in the output. Default: x.size(-1)

  Example:

      >>> x = torch.tensor([1, 2, 3, 5])
      >>> linalg.vander(x)
      tensor([[  1,   1,   1,   1],
              [  1,   2,   4,   8],
              [  1,   3,   9,  27],
              [  1,   5,  25, 125]])
      >>> linalg.vander(x, N=3)
      tensor([[ 1,  1,  1],
              [ 1,  2,  4],
              [ 1,  3,  9],
              [ 1,  5, 25]])

## Docs

Access comprehensive developer documentation for PyTorch

View Docs

## Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

## Resources

Find development resources and get your questions answered

View Resources

To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.