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) – The 1-D input tensor.

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

Returns

Tensor

Supported Platforms:

Ascend GPU CPU

Examples

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