48 #ifndef __DATA_UTILS_H__ 49 #define __DATA_UTILS_H__ 54 #include "services/daal_defines.h" 58 namespace data_management
63 namespace data_feature_utils
83 const int NumOfIndexNumTypes = (int)DAAL_OTHER_T;
85 enum InternalNumType { DAAL_SINGLE = 0, DAAL_DOUBLE = 1, DAAL_INT32 = 2, DAAL_OTHER = 0xfffffff };
86 enum PMMLNumType { DAAL_GEN_FLOAT = 0, DAAL_GEN_DOUBLE = 1, DAAL_GEN_INTEGER = 2, DAAL_GEN_BOOLEAN = 3,
87 DAAL_GEN_STRING = 4, DAAL_GEN_UNKNOWN = 0xfffffff
89 enum FeatureType { DAAL_CATEGORICAL = 0, DAAL_ORDINAL = 1, DAAL_CONTINUOUS = 2 };
95 template<
typename T>
inline IndexNumType getIndexNumType() {
return DAAL_OTHER_T; }
96 template<>
inline IndexNumType getIndexNumType<float>() {
return DAAL_FLOAT32; }
97 template<>
inline IndexNumType getIndexNumType<double>() {
return DAAL_FLOAT64; }
98 template<>
inline IndexNumType getIndexNumType<int>() {
return DAAL_INT32_S; }
99 template<>
inline IndexNumType getIndexNumType<unsigned int>() {
return DAAL_INT32_U; }
100 template<>
inline IndexNumType getIndexNumType<DAAL_INT64>() {
return DAAL_INT64_S; }
101 template<>
inline IndexNumType getIndexNumType<DAAL_UINT64>() {
return DAAL_INT64_U; }
102 template<>
inline IndexNumType getIndexNumType<char>() {
return DAAL_INT8_S; }
103 template<>
inline IndexNumType getIndexNumType<unsigned char>() {
return DAAL_INT8_U; }
104 template<>
inline IndexNumType getIndexNumType<short>() {
return DAAL_INT16_S; }
105 template<>
inline IndexNumType getIndexNumType<unsigned short>() {
return DAAL_INT16_U; }
107 template<>
inline IndexNumType getIndexNumType<long>()
108 {
return (IndexNumType)(DAAL_INT32_S + (
sizeof(long) / 4 - 1) * 2); }
110 #if (defined(__APPLE__) || defined(__MACH__)) && !defined(__x86_64__) 111 template<>
inline IndexNumType getIndexNumType<unsigned long>()
112 {
return (IndexNumType)(DAAL_INT32_U + (
sizeof(
unsigned long) / 4 - 1) * 2); }
115 #if !(defined(_WIN32) || defined(_WIN64)) && defined(__x86_64__) 116 template<>
inline IndexNumType getIndexNumType<size_t>()
117 {
return (IndexNumType)(DAAL_INT32_U + (
sizeof(size_t) / 4 - 1) * 2); }
124 inline InternalNumType getInternalNumType() {
return DAAL_OTHER; }
126 inline InternalNumType getInternalNumType<int>() {
return DAAL_INT32; }
128 inline InternalNumType getInternalNumType<double>() {
return DAAL_DOUBLE; }
130 inline InternalNumType getInternalNumType<float>() {
return DAAL_SINGLE; }
136 inline PMMLNumType getPMMLNumType() {
return DAAL_GEN_UNKNOWN; }
138 inline PMMLNumType getPMMLNumType<int>() {
return DAAL_GEN_INTEGER; }
140 inline PMMLNumType getPMMLNumType<double>() {
return DAAL_GEN_DOUBLE; }
142 inline PMMLNumType getPMMLNumType<float>() {
return DAAL_GEN_FLOAT; }
144 inline PMMLNumType getPMMLNumType<bool>() {
return DAAL_GEN_BOOLEAN; }
146 inline PMMLNumType getPMMLNumType<char *>() {
return DAAL_GEN_STRING; }
148 inline PMMLNumType getPMMLNumType<std::string>() {
return DAAL_GEN_STRING; }
150 typedef void(*vectorConvertFuncType)(
size_t n,
void *src,
void *dst);
151 typedef void(*vectorStrideConvertFuncType)(
size_t n,
void *src,
size_t srcByteStride,
void *dst,
size_t dstByteStride);
153 DAAL_EXPORT data_feature_utils::vectorConvertFuncType getVectorUpCast(
int,
int);
154 DAAL_EXPORT data_feature_utils::vectorConvertFuncType getVectorDownCast(
int,
int);
156 DAAL_EXPORT data_feature_utils::vectorStrideConvertFuncType getVectorStrideUpCast(
int,
int);
157 DAAL_EXPORT data_feature_utils::vectorStrideConvertFuncType getVectorStrideDownCast(
int,
int);
162 #define DataFeatureUtils data_feature_utils daal
Definition: algorithm_base_common.h:57
daal::data_management::data_feature_utils::getInternalNumType
InternalNumType getInternalNumType()
Definition: data_utils.h:124
daal::data_management::data_feature_utils::getPMMLNumType
PMMLNumType getPMMLNumType()
Definition: data_utils.h:136
daal::data_management::data_feature_utils::getIndexNumType
IndexNumType getIndexNumType()
Definition: data_utils.h:95