skcuda.linalg.cholesky

skcuda.linalg.cholesky(a_gpu, uplo='L', lib='cusolver')[source]

Cholesky factorization.

Performs an in-place Cholesky factorization on the matrix a such that a = x*x.T or x.T*x, if the lower=’L’ or upper=’U’ triangle of a is used, respectively. All other entries in a are set to 0.

Parameters:
  • a_gpu (pycuda.gpuarray.GPUArray) – Input matrix of shape (m, m) to decompose.
  • uplo ({'U', 'L'}) – Use upper or lower (default) triangle of ‘a_gpu’
  • lib (str) – Library to use. May be either ‘cula’ or ‘cusolver’.

Notes

If using CULA, double precision is only supported if the standard version of the CULA Dense toolkit is installed.

Examples

>>> import pycuda.gpuarray as gpuarray
>>> import pycuda.autoinit
>>> import numpy as np
>>> import scipy.linalg
>>> import skcuda.linalg as linalg
>>> linalg.init()
>>> a = np.array([[3.0,0.0],[0.0,7.0]])
>>> a = np.asarray(a, np.float64)
>>> a_gpu = gpuarray.to_gpu(a)
>>> cholesky(a_gpu)
>>> np.allclose(a_gpu.get(), scipy.linalg.cholesky(a)[0])
True