scikits.cuda.linalg.cho_factor

scikits.cuda.linalg.cho_factor(a_gpu, uplo='L')[source]

Cholesky factorisation

Performs an in-place cholesky factorisation 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.

Parameters:

a : pycuda.gpuarray.GPUArray

Input matrix of shape (m, m) to decompose.

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