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