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

Function convertPivot

src/backend/oneapi/lu.cpp:24–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22namespace oneapi {
23
24Array<int> convertPivot(sycl::buffer<int64_t> &pivot, int in_sz, int out_sz,
25 bool convert_pivot) {
26 std::vector<int> d_po(out_sz);
27 for (int i = 0; i < out_sz; i++) { d_po[i] = i; }
28
29 auto d_pi = pivot.get_host_access();
30
31 if (convert_pivot) {
32 for (int j = 0; j < in_sz; j++) {
33 // 1 indexed in pivot
34 std::swap(d_po[j], d_po[d_pi[j] - 1]);
35 }
36
37 Array<int> res = createHostDataArray(dim4(out_sz), &d_po[0]);
38 return res;
39 } else {
40 d_po.resize(in_sz);
41 for (int j = 0; j < in_sz; j++) { d_po[j] = static_cast<int>(d_pi[j]); }
42 }
43 Array<int> res = createHostDataArray(dim4(in_sz), &d_po[0]);
44 return res;
45}
46
47template<typename T>
48void lu(Array<T> &lower, Array<T> &upper, Array<int> &pivot,

Callers 1

lu_inplaceFunction · 0.70

Calls 3

swapFunction · 0.85
createHostDataArrayFunction · 0.70
dim4Class · 0.50

Tested by

no test coverage detected