| 22 | namespace opencl { |
| 23 | |
| 24 | Array<int> convertPivot(int *ipiv, int in_sz, int out_sz) { |
| 25 | std::vector<int> out(out_sz); |
| 26 | |
| 27 | for (int i = 0; i < out_sz; i++) { out[i] = i; } |
| 28 | |
| 29 | for (int j = 0; j < in_sz; j++) { |
| 30 | // 1 indexed in pivot |
| 31 | std::swap(out[j], out[ipiv[j] - 1]); |
| 32 | } |
| 33 | |
| 34 | Array<int> res = createHostDataArray(dim4(out_sz), &out[0]); |
| 35 | |
| 36 | return res; |
| 37 | } |
| 38 | |
| 39 | template<typename T> |
| 40 | void lu(Array<T> &lower, Array<T> &upper, Array<int> &pivot, |
no test coverage detected