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

Function af_create_array

src/api/c/array.cpp:67–129  ·  view source on GitHub ↗

Strong Exception Guarantee

Source from the content-addressed store, hash-verified

65
66// Strong Exception Guarantee
67af_err af_create_array(af_array *result, const void *const data,
68 const unsigned ndims, const dim_t *const dims,
69 const af_dtype type) {
70 try {
71 af_array out;
72 AF_CHECK(af_init());
73
74 dim4 d = verifyDims(ndims, dims);
75
76 switch (type) {
77 case f32:
78 out = createHandleFromData(d, static_cast<const float *>(data));
79 break;
80 case c32:
81 out =
82 createHandleFromData(d, static_cast<const cfloat *>(data));
83 break;
84 case f64:
85 out =
86 createHandleFromData(d, static_cast<const double *>(data));
87 break;
88 case c64:
89 out =
90 createHandleFromData(d, static_cast<const cdouble *>(data));
91 break;
92 case b8:
93 out = createHandleFromData(d, static_cast<const char *>(data));
94 break;
95 case s32:
96 out = createHandleFromData(d, static_cast<const int *>(data));
97 break;
98 case u32:
99 out = createHandleFromData(d, static_cast<const uint *>(data));
100 break;
101 case s8:
102 out = createHandleFromData(d, static_cast<const schar *>(data));
103 break;
104 case u8:
105 out = createHandleFromData(d, static_cast<const uchar *>(data));
106 break;
107 case s64:
108 out = createHandleFromData(d, static_cast<const intl *>(data));
109 break;
110 case u64:
111 out = createHandleFromData(d, static_cast<const uintl *>(data));
112 break;
113 case s16:
114 out = createHandleFromData(d, static_cast<const short *>(data));
115 break;
116 case u16:
117 out =
118 createHandleFromData(d, static_cast<const ushort *>(data));
119 break;
120 case f16:
121 out = createHandleFromData(d, static_cast<const half *>(data));
122 break;
123 default: TYPE_ERROR(4, type);
124 }

Callers 15

readImageFunction · 0.70
af_translateFunction · 0.70
af_scaleFunction · 0.70
af_skewFunction · 0.70
readImage_tFunction · 0.70
approx1TestFunction · 0.50
approx1CubicTestFunction · 0.50
approx1ArgsTestFunction · 0.50
approx1ArgsTestPrecisionFunction · 0.50
setTestDataMethod · 0.50
SetUpMethod · 0.50
hammingMatcherTestFunction · 0.50

Calls 4

verifyDimsFunction · 0.85
createHandleFromDataFunction · 0.85
swapFunction · 0.85
af_initFunction · 0.70

Tested by 1

conv_imageFunction · 0.40