mindspore.ops.vander

mindspore.ops.vander(x, N=None)[source]

Generates a Vandermonde matrix. The columns of the output matrix are powers of the input vector. The i-th output column is the input vector raised element-wise to the power of \(N - i - 1\).

Parameters
  • x (Tensor) – 1-D input array.

  • N (int, optional) – Number of columns in the output. Default: None, N will be assigned as \(len(x)\).

Returns

Tensor, the columns are \(x^0, x^1, ..., x^{(N-1)}\).

Raises
Supported Platforms:

Ascend GPU CPU

Examples

>>> from mindspore import Tensor, ops
>>> a = Tensor([1., 2., 3., 5.])
>>> print(ops.vander(a, N=3))
[[1.   1.   1.]
 [4.   2.   1.]
 [9.   3.   1.]
 [25.  5.   1.]]
>>> a = Tensor([1., 2., 3., 5.])
>>> print(ops.vander(a))
[[1.    1.   1.   1.]
 [8.    4.   2.   1.]
 [27.   9.   3.   1.]
 [125.  25.  5.   1.]]