1 | /** |
---|
2 | * @file TightDataPointStorageF.h |
---|
3 | * @author Sheng Di and Dingwen Tao |
---|
4 | * @date Aug, 2016 |
---|
5 | * @brief Header file for the tight data point storage (TDPS). |
---|
6 | * (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory. |
---|
7 | * See COPYRIGHT in top-level directory. |
---|
8 | */ |
---|
9 | |
---|
10 | #ifndef _TightDataPointStorageF_H |
---|
11 | #define _TightDataPointStorageF_H |
---|
12 | |
---|
13 | #ifdef __cplusplus |
---|
14 | extern "C" { |
---|
15 | #endif |
---|
16 | |
---|
17 | #include <stdio.h> |
---|
18 | |
---|
19 | typedef struct TightDataPointStorageF |
---|
20 | { |
---|
21 | size_t dataSeriesLength; |
---|
22 | int allSameData; |
---|
23 | double realPrecision; //it's used as the pwrErrBoundRatio when errBoundMode==PW_REL |
---|
24 | float medianValue; |
---|
25 | char reqLength; |
---|
26 | char radExpo; //used to compute reqLength based on segmented precisions in "pw_rel_compression" |
---|
27 | |
---|
28 | int stateNum; |
---|
29 | int allNodes; |
---|
30 | |
---|
31 | size_t exactDataNum; |
---|
32 | float reservedValue; |
---|
33 | |
---|
34 | unsigned char* rtypeArray; |
---|
35 | size_t rtypeArray_size; |
---|
36 | |
---|
37 | unsigned char* typeArray; //its size is dataSeriesLength/4 (or xxx/4+1) |
---|
38 | size_t typeArray_size; |
---|
39 | |
---|
40 | unsigned char* leadNumArray; //its size is exactDataNum/4 (or exactDataNum/4+1) |
---|
41 | size_t leadNumArray_size; |
---|
42 | |
---|
43 | unsigned char* exactMidBytes; |
---|
44 | size_t exactMidBytes_size; |
---|
45 | |
---|
46 | unsigned char* residualMidBits; |
---|
47 | size_t residualMidBits_size; |
---|
48 | |
---|
49 | unsigned int intervals; //quantization_intervals |
---|
50 | |
---|
51 | unsigned char isLossless; //a mark to denote whether it's lossless compression (1 is yes, 0 is no) |
---|
52 | |
---|
53 | size_t segment_size; |
---|
54 | |
---|
55 | unsigned char* pwrErrBoundBytes; |
---|
56 | int pwrErrBoundBytes_size; |
---|
57 | |
---|
58 | } TightDataPointStorageF; |
---|
59 | |
---|
60 | void new_TightDataPointStorageF_Empty(TightDataPointStorageF **self); |
---|
61 | int new_TightDataPointStorageF_fromFlatBytes(TightDataPointStorageF **self, unsigned char* flatBytes, size_t flatBytesLength); |
---|
62 | |
---|
63 | void new_TightDataPointStorageF(TightDataPointStorageF **self, |
---|
64 | size_t dataSeriesLength, size_t exactDataNum, |
---|
65 | int* type, unsigned char* exactMidBytes, size_t exactMidBytes_size, |
---|
66 | unsigned char* leadNumIntArray, //leadNumIntArray contains readable numbers.... |
---|
67 | unsigned char* resiMidBits, size_t resiMidBits_size, |
---|
68 | unsigned char resiBitLength, |
---|
69 | double realPrecision, float medianValue, char reqLength, unsigned int intervals, |
---|
70 | unsigned char* pwrErrBoundBytes, size_t pwrErrBoundBytes_size, unsigned char radExpo); |
---|
71 | |
---|
72 | /** |
---|
73 | * This function is designed for first-version of the point-wise relative error bound (developed by Sheng Di for TPDS18 paper) |
---|
74 | * |
---|
75 | * */ |
---|
76 | void new_TightDataPointStorageF2(TightDataPointStorageF **self, |
---|
77 | size_t dataSeriesLength, size_t exactDataNum, |
---|
78 | int* type, unsigned char* exactMidBytes, size_t exactMidBytes_size, |
---|
79 | unsigned char* leadNumIntArray, //leadNumIntArray contains readable numbers.... |
---|
80 | unsigned char* resiMidBits, size_t resiMidBits_size, |
---|
81 | unsigned char* resiBitLength, size_t resiBitLengthSize, |
---|
82 | double realPrecision, float medianValue, char reqLength, unsigned int intervals, |
---|
83 | unsigned char* pwrErrBoundBytes, size_t pwrErrBoundBytes_size, unsigned char radExpo); |
---|
84 | |
---|
85 | void convertTDPStoBytes_float(TightDataPointStorageF* tdps, unsigned char* bytes, unsigned char* dsLengthBytes, unsigned char sameByte); |
---|
86 | void convertTDPStoBytes_float_reserve(TightDataPointStorageF* tdps, unsigned char* bytes, unsigned char* dsLengthBytes, unsigned char sameByte); |
---|
87 | void convertTDPStoFlatBytes_float(TightDataPointStorageF *tdps, unsigned char** bytes, size_t *size); |
---|
88 | void convertTDPStoFlatBytes_float_args(TightDataPointStorageF *tdps, unsigned char* bytes, size_t *size); |
---|
89 | |
---|
90 | void free_TightDataPointStorageF(TightDataPointStorageF *tdps); |
---|
91 | void free_TightDataPointStorageF2(TightDataPointStorageF *tdps); |
---|
92 | |
---|
93 | #ifdef __cplusplus |
---|
94 | } |
---|
95 | #endif |
---|
96 | |
---|
97 | #endif /* ----- #ifndef _TightDataPointStorageF_H ----- */ |
---|