MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / cholesky_inplace

Function cholesky_inplace

src/backend/oneapi/cholesky.cpp:26–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24
25template<typename T>
26int cholesky_inplace(Array<T> &in, const bool is_upper) {
27 dim4 iDims = in.dims();
28 dim4 iStrides = in.strides();
29 int64_t N = iDims[0];
30 int64_t LDA = iStrides[1];
31
32 int64_t lwork = 0;
33
34 ::oneapi::mkl::uplo uplo = ::oneapi::mkl::uplo::lower;
35 if (is_upper) { uplo = ::oneapi::mkl::uplo::upper; }
36
37 lwork = ::oneapi::mkl::lapack::potrf_scratchpad_size<compute_t<T>>(
38 getQueue(), uplo, N, LDA);
39
40 auto workspace = memAlloc<compute_t<T>>(std::max<int64_t>(lwork, 1));
41 sycl::buffer<compute_t<T>> in_buffer =
42 in.template getBufferWithOffset<compute_t<T>>();
43
44 try {
45 ::oneapi::mkl::lapack::potrf(getQueue(), uplo, N, in_buffer, LDA,
46 *workspace, workspace->size());
47 } catch (::oneapi::mkl::lapack::exception const &e) {
48 AF_ERROR(
49 "Unexpected exception caught during synchronous\
50 call to LAPACK API",
51 AF_ERR_RUNTIME);
52 return e.info();
53 }
54
55 return 0;
56}
57
58template<typename T>
59Array<T> cholesky(int *info, const Array<T> &in, const bool is_upper) {

Callers 1

choleskyFunction · 0.70

Calls 3

getQueueFunction · 0.50
dimsMethod · 0.45
stridesMethod · 0.45

Tested by

no test coverage detected