scikits.cuda.linalg.add_diag

scikits.cuda.linalg.add_diag(d_gpu, a_gpu, overwrite=True, handle=None)[source]

Adds a vector to the diagonal of an array.

This is the same as A + diag(D), but faster.

Parameters:

d_gpu : pycuda.gpuarray.GPUArray

Array of length N corresponding to the vector to be added to the diagonal.

a_gpu : pycuda.gpuarray.GPUArray

Summand array with shape (N, N).

overwrite : bool

If true, save the result in a_gpu (default: True).

handle : int

CUBLAS context. If no context is specified, the default handle from scikits.cuda.misc._global_cublas_handle is used.

Returns:

r_gpu : pycuda.gpuarray.GPUArray

The computed sum product.

Notes

d_gpu and a_gpu must have the same precision data type.