skcuda.linalg.vander

skcuda.linalg.vander(a_gpu, n=None, handle=None)[source]

Generate a Vandermonde matrix.

A Vandermonde matrix (named for Alexandre- Theophile Vandermonde) is a matrix where the columns are powers of the input vector, i.e., the i-th column is the input vector raised element-wise to the power of i.

Parameters:
  • a_gpu (pycuda.gpuarray.GPUArray) – Real/complex 1-D input array of shape (m, 1).
  • n (int, optional) – Number of columns in the Vandermonde matrix. If n is not specified, a square array is returned (m,m).
Returns:

vander_gpu – Vandermonde matrix of shape (m,n).

Return type:

pycuda.gpuarray

Examples

>>> import pycuda.autoinit
>>> import pycuda.gpuarray as gpuarray
>>> import numpy as np
>>> import skcuda.linalg as linalg
>>> a = np.array(np.array([1, 2, 3]), np.float32, order='F')
>>> a_gpu = gpuarray.to_gpu(a)
>>> v_gpu = linalg.vander(a_gpu, n=4)
>>> np.allclose(v_gpu.get(), np.fliplr(np.vander(a, 4)), atol=1e-6)
True