| 125 | |
| 126 | template<typename T> |
| 127 | Array<int> lu_inplace(Array<T> &in, const bool convert_pivot) { |
| 128 | dim4 iDims = in.dims(); |
| 129 | int M = iDims[0]; |
| 130 | int N = iDims[1]; |
| 131 | |
| 132 | int pivot_dim = min(M, N); |
| 133 | Array<int> pivot = createEmptyArray<int>(af::dim4(pivot_dim, 1, 1, 1)); |
| 134 | if (convert_pivot) { pivot = range<int>(af::dim4(M, 1, 1, 1)); } |
| 135 | |
| 136 | mapped_ptr<T> inPtr = in.getMappedPtr(); |
| 137 | mapped_ptr<int> piPtr = pivot.getMappedPtr(); |
| 138 | |
| 139 | getrf_func<T>()(AF_LAPACK_COL_MAJOR, M, N, inPtr.get(), in.strides()[1], |
| 140 | piPtr.get()); |
| 141 | |
| 142 | if (convert_pivot) { convertPivot(piPtr.get(), M, min(M, N)); } |
| 143 | |
| 144 | return pivot; |
| 145 | } |
| 146 | |
| 147 | #define INSTANTIATE_LU(T) \ |
| 148 | template Array<int> lu_inplace<T>(Array<T> & in, \ |
no test coverage detected