| 133 | } |
| 134 | |
| 135 | AF_BATCH_KIND identifyBatchKind(const dim4 &sDims, const dim4 &fDims, |
| 136 | const int baseDim) { |
| 137 | dim_t sn = sDims.ndims(); |
| 138 | dim_t fn = fDims.ndims(); |
| 139 | |
| 140 | if (sn == baseDim && fn == baseDim) { return AF_BATCH_NONE; } |
| 141 | if (sn == baseDim && (fn > baseDim && fn <= AF_MAX_DIMS)) { |
| 142 | return AF_BATCH_RHS; |
| 143 | } |
| 144 | if ((sn > baseDim && sn <= AF_MAX_DIMS) && fn == baseDim) { |
| 145 | return AF_BATCH_LHS; |
| 146 | } else if ((sn > baseDim && sn <= AF_MAX_DIMS) && |
| 147 | (fn > baseDim && fn <= AF_MAX_DIMS)) { |
| 148 | bool doesDimensionsMatch = true; |
| 149 | bool isInterleaved = true; |
| 150 | for (dim_t i = baseDim; i < AF_MAX_DIMS; i++) { |
| 151 | doesDimensionsMatch &= (sDims[i] == fDims[i]); |
| 152 | isInterleaved &= |
| 153 | (sDims[i] == 1 || fDims[i] == 1 || sDims[i] == fDims[i]); |
| 154 | } |
| 155 | if (doesDimensionsMatch) { return AF_BATCH_SAME; } |
| 156 | return (isInterleaved ? AF_BATCH_DIFF : AF_BATCH_UNSUPPORTED); |
| 157 | } else { |
| 158 | return AF_BATCH_UNSUPPORTED; |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | af_err fft_convolve(af_array *out, const af_array signal, const af_array filter, |
| 163 | const bool expand, const int baseDim) { |