本文整理汇总了C++中ArrayInfo::isReal方法的典型用法代码示例。如果您正苦于以下问题:C++ ArrayInfo::isReal方法的具体用法?C++ ArrayInfo::isReal怎么用?C++ ArrayInfo::isReal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayInfo
的用法示例。
在下文中一共展示了ArrayInfo::isReal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: af_sort_by_key
af_err af_sort_by_key(af_array *out_keys, af_array *out_values,
const af_array keys, const af_array values,
const unsigned dim, const bool isAscending)
{
try {
ArrayInfo kinfo = getInfo(keys);
af_dtype ktype = kinfo.getType();
ArrayInfo vinfo = getInfo(values);
DIM_ASSERT(4, kinfo.dims() == vinfo.dims());
if(kinfo.elements() == 0) {
dim_t my_dims[] = {0, 0, 0, 0};
AF_CHECK(af_create_handle(out_keys, AF_MAX_DIMS, my_dims, ktype));
AF_CHECK(af_create_handle(out_values, AF_MAX_DIMS, my_dims, ktype));
return AF_SUCCESS;
}
TYPE_ASSERT(kinfo.isReal());
af_array oKey;
af_array oVal;
switch(ktype) {
case f32: sort_by_key_tmplt<float >(&oKey, &oVal, keys, values, dim, isAscending); break;
case f64: sort_by_key_tmplt<double >(&oKey, &oVal, keys, values, dim, isAscending); break;
case s32: sort_by_key_tmplt<int >(&oKey, &oVal, keys, values, dim, isAscending); break;
case u32: sort_by_key_tmplt<uint >(&oKey, &oVal, keys, values, dim, isAscending); break;
case s16: sort_by_key_tmplt<short >(&oKey, &oVal, keys, values, dim, isAscending); break;
case u16: sort_by_key_tmplt<ushort >(&oKey, &oVal, keys, values, dim, isAscending); break;
case s64: sort_by_key_tmplt<intl >(&oKey, &oVal, keys, values, dim, isAscending); break;
case u64: sort_by_key_tmplt<uintl >(&oKey, &oVal, keys, values, dim, isAscending); break;
case u8: sort_by_key_tmplt<uchar >(&oKey, &oVal, keys, values, dim, isAscending); break;
case b8: sort_by_key_tmplt<char >(&oKey, &oVal, keys, values, dim, isAscending); break;
default: TYPE_ERROR(1, ktype);
}
std::swap(*out_keys , oKey);
std::swap(*out_values , oVal);
}
CATCHALL;
return AF_SUCCESS;
}