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

Cholesky solver.

Solve a system of equations via Cholesky factorization, i.e. a*x = b. Overwrites b to give inv(a)*b, and overwrites the chosen triangle of a with factorized triangle.

  • a (pycuda.gpuarray.GPUArray) – Input matrix of shape (m, m) to decompose.
  • b (pycuda.gpuarray.GPUArray) – Input matrix of shape (m, 1) to decompose.
  • uplo (chr) – Use the upper=’U’ or lower=’L’ (default) triangle of a.
  • 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, 7]]).asarray(np.float64)
>>> a_gpu = gpuarray.to_gpu(a)
>>> b = np.array([11, 19]).astype(np.float64)
>>> b_gpu  = gpuarray.to_gpu(b)
>>> cho_solve(a_gpu, b_gpu)
>>> np.allclose(b_gpu.get(), scipy.linalg.cho_solve(scipy.linalg.cho_factor(a), b))