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

Function af_upper

src/api/c/data.cpp:387–415  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

385}
386
387af_err af_upper(af_array *out, const af_array in, bool is_unit_diag) {
388 try {
389 const ArrayInfo &info = getInfo(in);
390 af_dtype type = info.getType();
391
392 if (info.ndims() == 0) { return af_retain_array(out, in); }
393
394 af_array res = nullptr;
395 switch (type) {
396 case f32: res = triangle<float>(in, true, is_unit_diag); break;
397 case f64: res = triangle<double>(in, true, is_unit_diag); break;
398 case c32: res = triangle<cfloat>(in, true, is_unit_diag); break;
399 case c64: res = triangle<cdouble>(in, true, is_unit_diag); break;
400 case s32: res = triangle<int>(in, true, is_unit_diag); break;
401 case u32: res = triangle<uint>(in, true, is_unit_diag); break;
402 case s64: res = triangle<intl>(in, true, is_unit_diag); break;
403 case u64: res = triangle<uintl>(in, true, is_unit_diag); break;
404 case s16: res = triangle<short>(in, true, is_unit_diag); break;
405 case u16: res = triangle<ushort>(in, true, is_unit_diag); break;
406 case s8: res = triangle<schar>(in, true, is_unit_diag); break;
407 case u8: res = triangle<uchar>(in, true, is_unit_diag); break;
408 case b8: res = triangle<char>(in, true, is_unit_diag); break;
409 case f16: res = triangle<half>(in, true, is_unit_diag); break;
410 }
411 std::swap(*out, res);
412 }
413 CATCHALL
414 return AF_SUCCESS;
415}
416
417template<typename T>
418inline af_array pad(const af_array in, const dim4 &lPad, const dim4 &uPad,

Callers 1

upperFunction · 0.50

Calls 4

swapFunction · 0.85
af_retain_arrayFunction · 0.70
getTypeMethod · 0.45
ndimsMethod · 0.45

Tested by

no test coverage detected