22 #ifndef __DATA_UTILS_H__
23 #define __DATA_UTILS_H__
28 #include "services/daal_defines.h"
32 namespace data_management
37 namespace data_feature_utils
57 const int NumOfIndexNumTypes = (int)DAAL_OTHER_T;
59 enum InternalNumType { DAAL_SINGLE = 0, DAAL_DOUBLE = 1, DAAL_INT32 = 2, DAAL_OTHER = 0xfffffff };
60 enum PMMLNumType { DAAL_GEN_FLOAT = 0, DAAL_GEN_DOUBLE = 1, DAAL_GEN_INTEGER = 2, DAAL_GEN_BOOLEAN = 3,
61 DAAL_GEN_STRING = 4, DAAL_GEN_UNKNOWN = 0xfffffff
63 enum FeatureType { DAAL_CATEGORICAL = 0, DAAL_ORDINAL = 1, DAAL_CONTINUOUS = 2 };
69 template<
typename T>
inline IndexNumType getIndexNumType() {
return DAAL_OTHER_T; }
70 template<>
inline IndexNumType getIndexNumType<float>() {
return DAAL_FLOAT32; }
71 template<>
inline IndexNumType getIndexNumType<double>() {
return DAAL_FLOAT64; }
72 template<>
inline IndexNumType getIndexNumType<int>() {
return DAAL_INT32_S; }
73 template<>
inline IndexNumType getIndexNumType<unsigned int>() {
return DAAL_INT32_U; }
74 template<>
inline IndexNumType getIndexNumType<DAAL_INT64>() {
return DAAL_INT64_S; }
75 template<>
inline IndexNumType getIndexNumType<DAAL_UINT64>() {
return DAAL_INT64_U; }
76 template<>
inline IndexNumType getIndexNumType<char>() {
return DAAL_INT8_S; }
77 template<>
inline IndexNumType getIndexNumType<unsigned char>() {
return DAAL_INT8_U; }
78 template<>
inline IndexNumType getIndexNumType<short>() {
return DAAL_INT16_S; }
79 template<>
inline IndexNumType getIndexNumType<unsigned short>() {
return DAAL_INT16_U; }
81 template<>
inline IndexNumType getIndexNumType<long>()
82 {
return (IndexNumType)(DAAL_INT32_S + (
sizeof(long) / 4 - 1) * 2); }
84 #if (defined(__APPLE__) || defined(__MACH__)) && !defined(__x86_64__)
85 template<>
inline IndexNumType getIndexNumType<unsigned long>()
86 {
return (IndexNumType)(DAAL_INT32_U + (
sizeof(
unsigned long) / 4 - 1) * 2); }
89 #if !(defined(_WIN32) || defined(_WIN64)) && defined(__x86_64__)
90 template<>
inline IndexNumType getIndexNumType<size_t>()
91 {
return (IndexNumType)(DAAL_INT32_U + (
sizeof(size_t) / 4 - 1) * 2); }
98 inline InternalNumType getInternalNumType() {
return DAAL_OTHER; }
100 inline InternalNumType getInternalNumType<int>() {
return DAAL_INT32; }
102 inline InternalNumType getInternalNumType<double>() {
return DAAL_DOUBLE; }
104 inline InternalNumType getInternalNumType<float>() {
return DAAL_SINGLE; }
110 inline PMMLNumType getPMMLNumType() {
return DAAL_GEN_UNKNOWN; }
112 inline PMMLNumType getPMMLNumType<int>() {
return DAAL_GEN_INTEGER; }
114 inline PMMLNumType getPMMLNumType<double>() {
return DAAL_GEN_DOUBLE; }
116 inline PMMLNumType getPMMLNumType<float>() {
return DAAL_GEN_FLOAT; }
118 inline PMMLNumType getPMMLNumType<bool>() {
return DAAL_GEN_BOOLEAN; }
120 inline PMMLNumType getPMMLNumType<char *>() {
return DAAL_GEN_STRING; }
122 inline PMMLNumType getPMMLNumType<std::string>() {
return DAAL_GEN_STRING; }
124 typedef void(*vectorConvertFuncType)(
size_t n,
void *src,
void *dst);
125 typedef void(*vectorStrideConvertFuncType)(
size_t n,
void *src,
size_t srcByteStride,
void *dst,
size_t dstByteStride);
127 DAAL_EXPORT data_feature_utils::vectorConvertFuncType getVectorUpCast(
int,
int);
128 DAAL_EXPORT data_feature_utils::vectorConvertFuncType getVectorDownCast(
int,
int);
130 DAAL_EXPORT data_feature_utils::vectorStrideConvertFuncType getVectorStrideUpCast(
int,
int);
131 DAAL_EXPORT data_feature_utils::vectorStrideConvertFuncType getVectorStrideDownCast(
int,
int);
136 #define DataFeatureUtils data_feature_utils
daal
Definition: algorithm_base_common.h:31
daal::data_management::data_feature_utils::getInternalNumType
InternalNumType getInternalNumType()
Definition: data_utils.h:98
daal::data_management::data_feature_utils::getPMMLNumType
PMMLNumType getPMMLNumType()
Definition: data_utils.h:110
daal::data_management::data_feature_utils::getIndexNumType
IndexNumType getIndexNumType()
Definition: data_utils.h:69