vander#
- ivy.vander(x, /, *, N=None, increasing=False, out=None)[source]#
Generate a Vandermonde matrix. The columns of the output matrix are elementwise powers of the input vector x^{(N-1)}, x^{(N-2)}, …, x^0x. If increasing is True, the order of the columns is reversed x^0, x^1, …, x^{(N-1)}. Such a matrix with a geometric progression in each row is named for Alexandre-Theophile Vandermonde.
- Parameters:
x (
Union
[Array
,NativeArray
]) – 1-D input array.N (
Optional
[int
], default:None
) – Number of columns in the output. If N is not specified, a square array is returned (N = len(x))increasing (
bool
, default:False
) – Order of the powers of the columns. If True, the powers increase from left to right, if False (the default) they are reversed.out (
Optional
[Array
], default:None
) – optional output array, for writing the result to.
- Return type:
- Returns:
ret – Vandermonde matrix.
Examples
With
ivy.Array
inputs:>>> x = ivy.array([1, 2, 3, 5]) >>> ivy.vander(x) ivy.array( [[ 1, 1, 1, 1], [ 8, 4, 2, 1], [ 27, 9, 3, 1], [125, 25, 5, 1]] )
>>> x = ivy.array([1, 2, 3, 5]) >>> ivy.vander(x, N=3) ivy.array( [[ 1, 1, 1], [ 4, 2, 1], [ 9, 3, 1], [25, 5, 1]] )
>>> x = ivy.array([1, 2, 3, 5]) >>> ivy.vander(x, N=3, increasing=True) ivy.array( [[ 1, 1, 1], [ 1, 2, 4], [ 1, 3, 9], [ 1, 5, 25]] )
- Array.vander(self, /, *, N=None, increasing=False, out=None)[source]#
ivy.Array instance method variant of ivy.vander. This method Returns the Vandermonde matrix of the input array.
- Parameters:
self (
Array
) – 1-D input array.N (
Optional
[int
], default:None
) – Number of columns in the output. If N is not specified, a square array is returned (N = len(x))increasing (
bool
, default:False
) – Order of the powers of the columns. If True, the powers increase from left to right, if False (the default) they are reversed.out (
Optional
[Array
], default:None
) – optional output array, for writing the result to.
- Return type:
Array
- Returns:
ret – an array containing the Vandermonde matrix.
Examples
>>> x = ivy.array([1, 2, 3, 5]) >>> ivy.vander(x) ivy.array( [[ 1, 1, 1, 1], [ 8, 4, 2, 1], [ 27, 9, 3, 1], [125, 25, 5, 1]] )
>>> x = ivy.array([1, 2, 3, 5]) >>> ivy.vander(x, N=3) ivy.array( [[ 1, 1, 1], [ 4, 2, 1], [ 9, 3, 1], [25, 5, 1]] )
>>> x = ivy.array([1, 2, 3, 5]) >>> ivy.vander(x, N=3, increasing=True) ivy.array( [[ 1, 1, 1], [ 1, 2, 4], [ 1, 3, 9], [ 1, 5, 25]] )
- Container.vander(self, /, *, N=None, increasing=False, out=None)[source]#
ivy.Container instance method variant of ivy.vander. This method Returns the Vandermonde matrix of the input array.
- Parameters:
self (
Container
) – 1-D input array.N (
Optional
[Union
[int
,Container
]], default:None
) – Number of columns in the output. If N is not specified, a square array is returned (N = len(x))increasing (
Union
[bool
,Container
], default:False
) – Order of the powers of the columns. If True, the powers increase from left to right, if False (the default) they are reversed.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – an container containing the Vandermonde matrices of the arrays included in the input container.
Examples
With
ivy.Container
inputs:>>> x = ivy.Container( a = ivy.array([1, 2, 3, 5]) b = ivy.array([6, 7, 8, 9]) ) >>> x.vander() { a: ivy.array( [[ 1, 1, 1, 1], [ 8, 4, 2, 1], [ 27, 9, 3, 1], [125, 25, 5, 1]] ), b: ivy.array( [[216, 36, 6, 1], [343, 49, 7, 1], [512, 64, 8, 1], [729, 81, 9, 1]] ) }