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

Function lu_inplace

src/backend/oneapi/lu.cpp:67–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65
66template<typename T>
67Array<int> lu_inplace(Array<T> &in, const bool convert_pivot) {
68 dim4 iDims = in.dims();
69 dim4 iStrides = in.strides();
70 int64_t M = iDims[0];
71 int64_t N = iDims[1];
72 int64_t MN = std::min(M, N);
73 int64_t LDA = iStrides[1];
74
75 std::int64_t scratchpad_size =
76 ::oneapi::mkl::lapack::getrf_scratchpad_size<T>(getQueue(), M, N, LDA);
77
78 auto ipiv = memAlloc<int64_t>(MN);
79 auto scratchpad = memAlloc<compute_t<T>>(scratchpad_size);
80
81 sycl::buffer<compute_t<T>> in_buffer =
82 in.template getBufferWithOffset<compute_t<T>>();
83 ::oneapi::mkl::lapack::getrf(getQueue(), M, N, in_buffer, LDA, *ipiv,
84 *scratchpad, scratchpad->size());
85
86 Array<int> pivot = convertPivot(*ipiv, MN, M, convert_pivot);
87 return pivot;
88}
89
90bool isLAPACKAvailable() { return true; }
91

Callers 1

luFunction · 0.70

Calls 5

minFunction · 0.70
convertPivotFunction · 0.70
getQueueFunction · 0.50
dimsMethod · 0.45
stridesMethod · 0.45

Tested by

no test coverage detected