skcuda.linalg.cho_factor(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.

  • 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’.


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


>>> 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)
>>> cho_factor(a_gpu)
>>> np.allclose(a_gpu.get(), scipy.linalg.cho_factor(a)[0])