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

Function af_range

src/api/c/data.cpp:190–217  ·  view source on GitHub ↗

Strong Exception Guarantee

Source from the content-addressed store, hash-verified

188
189// Strong Exception Guarantee
190af_err af_range(af_array *result, const unsigned ndims, const dim_t *const dims,
191 const int seq_dim, const af_dtype type) {
192 try {
193 af_array out;
194 AF_CHECK(af_init());
195
196 if (ndims <= 0) { return af_create_handle(result, 0, nullptr, type); }
197 dim4 d = verifyDims(ndims, dims);
198
199 switch (type) {
200 case f32: out = range_<float>(d, seq_dim); break;
201 case f64: out = range_<double>(d, seq_dim); break;
202 case s32: out = range_<int>(d, seq_dim); break;
203 case u32: out = range_<uint>(d, seq_dim); break;
204 case s64: out = range_<intl>(d, seq_dim); break;
205 case u64: out = range_<uintl>(d, seq_dim); break;
206 case s16: out = range_<short>(d, seq_dim); break;
207 case u16: out = range_<ushort>(d, seq_dim); break;
208 case s8: out = range_<schar>(d, seq_dim); break;
209 case u8: out = range_<uchar>(d, seq_dim); break;
210 case f16: out = range_<half>(d, seq_dim); break;
211 default: TYPE_ERROR(4, type);
212 }
213 std::swap(*result, out);
214 }
215 CATCHALL
216 return AF_SUCCESS;
217}
218
219template<typename T>
220static inline af_array iota_(const dim4 &dims, const dim4 &tile_dims) {

Callers 4

TESTFunction · 0.50
rangeTestFunction · 0.50
iotaTestFunction · 0.50
rangeFunction · 0.50

Calls 4

verifyDimsFunction · 0.85
swapFunction · 0.85
af_initFunction · 0.70
af_create_handleFunction · 0.70

Tested by

no test coverage detected