MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / padArray

Function padArray

src/backend/cpu/kernel/fftconvolve.hpp:57–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55
56template<typename To, typename Ti>
57void padArray(Param<To> out, const af::dim4 od, const af::dim4 os,
58 CParam<Ti> in, const dim_t offset) {
59 To* out_ptr = out.get() + offset;
60 const af::dim4 id = in.dims();
61 const af::dim4 is = in.strides();
62 const Ti* in_ptr = in.get();
63
64 for (int d3 = 0; d3 < (int)od[3]; d3++) {
65 for (int d2 = 0; d2 < (int)od[2]; d2++) {
66 for (int d1 = 0; d1 < (int)od[1]; d1++) {
67 for (int d0 = 0; d0 < (int)od[0] / 2; d0++) {
68 const dim_t oidx =
69 d3 * os[3] + d2 * os[2] + d1 * os[1] + d0 * 2;
70
71 if (d0 < (int)id[0] && d1 < (int)id[1] && d2 < (int)id[2] &&
72 d3 < (int)id[3]) {
73 // Copy input elements to real elements, set imaginary
74 // elements to 0
75 const dim_t iidx =
76 d3 * is[3] + d2 * is[2] + d1 * is[1] + d0;
77 out_ptr[oidx] = (To)in_ptr[iidx];
78 out_ptr[oidx + 1] = (To)0;
79 } else {
80 // Pad remaining of the matrix to 0s
81 out_ptr[oidx] = (To)0;
82 out_ptr[oidx + 1] = (To)0;
83 }
84 }
85 }
86 }
87 }
88}
89
90template<typename T>
91void complexMultiply(Param<T> packed, const af::dim4 sig_dims,

Callers 2

packDataHelperFunction · 0.85
packDataHelperFunction · 0.85

Calls 3

getMethod · 0.45
dimsMethod · 0.45
stridesMethod · 0.45

Tested by

no test coverage detected