| 43 | } |
| 44 | |
| 45 | af_err af_lu(af_array *lower, af_array *upper, af_array *pivot, |
| 46 | const af_array in) { |
| 47 | try { |
| 48 | const ArrayInfo &i_info = getInfo(in); |
| 49 | |
| 50 | if (i_info.ndims() > 2) { |
| 51 | AF_ERROR("lu can not be used in batch mode", AF_ERR_BATCH); |
| 52 | } |
| 53 | |
| 54 | af_dtype type = i_info.getType(); |
| 55 | |
| 56 | ARG_ASSERT(0, lower != nullptr); |
| 57 | ARG_ASSERT(1, upper != nullptr); |
| 58 | ARG_ASSERT(2, pivot != nullptr); |
| 59 | ARG_ASSERT(3, i_info.isFloating()); // Only floating and complex types |
| 60 | |
| 61 | if (i_info.ndims() == 0) { |
| 62 | AF_CHECK(af_create_handle(lower, 0, nullptr, type)); |
| 63 | AF_CHECK(af_create_handle(upper, 0, nullptr, type)); |
| 64 | AF_CHECK(af_create_handle(pivot, 0, nullptr, type)); |
| 65 | return AF_SUCCESS; |
| 66 | } |
| 67 | |
| 68 | switch (type) { |
| 69 | case f32: lu<float>(lower, upper, pivot, in); break; |
| 70 | case f64: lu<double>(lower, upper, pivot, in); break; |
| 71 | case c32: lu<cfloat>(lower, upper, pivot, in); break; |
| 72 | case c64: lu<cdouble>(lower, upper, pivot, in); break; |
| 73 | default: TYPE_ERROR(1, type); |
| 74 | } |
| 75 | } |
| 76 | CATCHALL; |
| 77 | |
| 78 | return AF_SUCCESS; |
| 79 | } |
| 80 | |
| 81 | af_err af_lu_inplace(af_array *pivot, af_array in, const bool is_lapack_piv) { |
| 82 | try { |
no test coverage detected