scikits.cuda.linalg.cho_solve

scikits.cuda.linalg.cho_solve(a_gpu, b_gpu, uplo='L')[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

Parameters:

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.

Returns:

a: pycuda.gpuarray.GPUArray

Cholesky factorised matrix

Notes

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 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)
>>> b = np.array([11.,19.])
>>> b = np.asarray(b, 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))
True