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

Function af_unwrap

src/api/c/unwrap.cpp:37–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37af_err af_unwrap(af_array* out, const af_array in, const dim_t wx,
38 const dim_t wy, const dim_t sx, const dim_t sy, const dim_t px,
39 const dim_t py, const bool is_column) {
40 try {
41 const ArrayInfo& info = getInfo(in);
42 af_dtype type = info.getType();
43 af::dim4 idims = info.dims();
44
45 ARG_ASSERT(2, wx > 0 && wx <= idims[0] + 2 * px);
46 ARG_ASSERT(3, wy > 0 && wy <= idims[1] + 2 * py);
47 ARG_ASSERT(4, sx > 0);
48 ARG_ASSERT(5, sy > 0);
49 ARG_ASSERT(6, px >= 0 && px < wx);
50 ARG_ASSERT(7, py >= 0 && py < wy);
51
52 af_array output;
53
54 switch (type) {
55 case f32:
56 output = unwrap<float>(in, wx, wy, sx, sy, px, py, is_column);
57 break;
58 case f64:
59 output = unwrap<double>(in, wx, wy, sx, sy, px, py, is_column);
60 break;
61 case c32:
62 output = unwrap<cfloat>(in, wx, wy, sx, sy, px, py, is_column);
63 break;
64 case c64:
65 output = unwrap<cdouble>(in, wx, wy, sx, sy, px, py, is_column);
66 break;
67 case s32:
68 output = unwrap<int>(in, wx, wy, sx, sy, px, py, is_column);
69 break;
70 case u32:
71 output = unwrap<uint>(in, wx, wy, sx, sy, px, py, is_column);
72 break;
73 case s64:
74 output = unwrap<intl>(in, wx, wy, sx, sy, px, py, is_column);
75 break;
76 case u64:
77 output = unwrap<uintl>(in, wx, wy, sx, sy, px, py, is_column);
78 break;
79 case s16:
80 output = unwrap<short>(in, wx, wy, sx, sy, px, py, is_column);
81 break;
82 case u16:
83 output = unwrap<ushort>(in, wx, wy, sx, sy, px, py, is_column);
84 break;
85 case s8:
86 output = unwrap<schar>(in, wx, wy, sx, sy, px, py, is_column);
87 break;
88 case u8:
89 output = unwrap<uchar>(in, wx, wy, sx, sy, px, py, is_column);
90 break;
91 case b8:
92 output = unwrap<char>(in, wx, wy, sx, sy, px, py, is_column);
93 break;
94 default: TYPE_ERROR(1, type);

Callers 2

unwrapTestFunction · 0.50
unwrapFunction · 0.50

Calls 3

swapFunction · 0.85
getTypeMethod · 0.45
dimsMethod · 0.45

Tested by

no test coverage detected