(a_gpu, n=None, handle=None)
return vander_gpu
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 : pycuda.gpuarray
         Vandermonde matrix of shape `(m,n)`.

     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
Generate a Vandermonde matrix.
Generate a Vandermonde matrix .
def vander(a_gpu, n=None, handle=None):
     """
     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 : pycuda.gpuarray
         Vandermonde matrix of shape `(m,n)`.

     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
     """

     if handle is None:
         handle = misc._global_cublas_handle

     alloc = misc._global_cublas_allocator

     data_type = a_gpu.dtype.type
     if a_gpu.dtype == np.float32:
         use_double = 0
         use_complex = 0
     elif a_gpu.dtype == np.float64:
         use_double = 1
         use_complex = 0
     elif a_gpu.dtype == np.complex64:
         use_double = 0
         use_complex = 1
     elif a_gpu.dtype == np.complex128:
         use_double = 1
         use_complex = 1
     else:
         raise ValueError('unrecognized type')

     m = a_gpu.shape[0]
     if n == None: n = m

     vander_gpu = gpuarray.empty((m, n), data_type, order='F', allocator=alloc)
     vander_gpu[ : , 0 ] = vander_gpu[ : , 0 ] * 0  + 1

     # Get block/grid sizes:
     dev = misc.get_current_device()
     block_dim, grid_dim = misc.select_block_grid_sizes(dev, vander_gpu.shape)

     # Allocate Vandermonde matrix:
     vander = _get_vander_kernel(use_double, use_complex, rows=m, cols=n)

     # Call kernel:
     vander(vander_gpu, a_gpu,
            np.uint32(m), np.uint32(n),
            block=block_dim,
            grid=grid_dim)

     # Return
     return vander_gpu
def vander ( a_gpu , n = None , handle = None ) : if handle is None : handle = misc . _global_cublas_handle alloc = misc . _global_cublas_allocator data_type = a_gpu . dtype . type if a_gpu . dtype == np . float32 : use_double = 0 use_complex = 0 elif a_gpu . dtype == np . float64 : use_double = 1 use_complex = 0 elif a_gpu . dtype == np . complex64 : use_double = 0 use_complex = 1 elif a_gpu . dtype == np . complex128 : use_double = 1 use_complex = 1 else : raise ValueError ( 'unrecognized type' ) m = a_gpu . shape [ 0 ] if n == None : n = m vander_gpu = gpuarray . empty ( ( m , n ) , data_type , order = 'F' , allocator = alloc ) vander_gpu [ : , 0 ] = vander_gpu [ : , 0 ] * 0 + 1 # Get block/grid sizes: dev = misc . get_current_device ( ) block_dim , grid_dim = misc . select_block_grid_sizes ( dev , vander_gpu . shape ) # Allocate Vandermonde matrix: vander = _get_vander_kernel ( use_double , use_complex , rows = m , cols = n ) # Call kernel: vander ( vander_gpu , a_gpu , np . uint32 ( m ) , np . uint32 ( n ) , block = block_dim , grid = grid_dim ) # Return return vander_gpu