| 79 | } |
| 80 | |
| 81 | af_err af_lu_inplace(af_array *pivot, af_array in, const bool is_lapack_piv) { |
| 82 | try { |
| 83 | const ArrayInfo &i_info = getInfo(in); |
| 84 | af_dtype type = i_info.getType(); |
| 85 | |
| 86 | if (i_info.ndims() > 2) { |
| 87 | AF_ERROR("lu can not be used in batch mode", AF_ERR_BATCH); |
| 88 | } |
| 89 | |
| 90 | ARG_ASSERT(1, i_info.isFloating()); // Only floating and complex types |
| 91 | ARG_ASSERT(0, pivot != nullptr); |
| 92 | |
| 93 | if (i_info.ndims() == 0) { |
| 94 | return af_create_handle(pivot, 0, nullptr, type); |
| 95 | } |
| 96 | |
| 97 | af_array out; |
| 98 | switch (type) { |
| 99 | case f32: out = lu_inplace<float>(in, is_lapack_piv); break; |
| 100 | case f64: out = lu_inplace<double>(in, is_lapack_piv); break; |
| 101 | case c32: out = lu_inplace<cfloat>(in, is_lapack_piv); break; |
| 102 | case c64: out = lu_inplace<cdouble>(in, is_lapack_piv); break; |
| 103 | default: TYPE_ERROR(1, type); |
| 104 | } |
| 105 | std::swap(*pivot, out); |
| 106 | } |
| 107 | CATCHALL; |
| 108 | |
| 109 | return AF_SUCCESS; |
| 110 | } |
| 111 | |
| 112 | af_err af_is_lapack_available(bool *out) { |
| 113 | try { |
no test coverage detected