| 22 | namespace oneapi { |
| 23 | |
| 24 | Array<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 | |
| 47 | template<typename T> |
| 48 | void lu(Array<T> &lower, Array<T> &upper, Array<int> &pivot, |
no test coverage detected