Index: thirdparty/SZ/sz/include/ByteToolkit.h
===================================================================
--- thirdparty/SZ/sz/include/ByteToolkit.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/ByteToolkit.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,79 @@
+/**
+ *  @file ByteToolkit.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the ByteToolkit.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _ByteToolkit_H
+#define _ByteToolkit_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+//ByteToolkit.c
+
+unsigned short bytesToUInt16_bigEndian(unsigned char* bytes);
+unsigned int bytesToUInt32_bigEndian(unsigned char* bytes);
+unsigned long bytesToUInt64_bigEndian(unsigned char* b);
+
+short bytesToInt16_bigEndian(unsigned char* bytes);
+int bytesToInt32_bigEndian(unsigned char* bytes);
+long bytesToInt64_bigEndian(unsigned char* b);
+int bytesToInt_bigEndian(unsigned char* bytes);
+
+void intToBytes_bigEndian(unsigned char *b, unsigned int num);
+
+void int64ToBytes_bigEndian(unsigned char *b, uint64_t num);
+void int32ToBytes_bigEndian(unsigned char *b, uint32_t num);
+void int16ToBytes_bigEndian(unsigned char *b, uint16_t num);
+
+long bytesToLong_bigEndian(unsigned char* b);
+void longToBytes_bigEndian(unsigned char *b, unsigned long num);
+long doubleToOSEndianLong(double value);
+int floatToOSEndianInt(float value);
+short getExponent_float(float value);
+short getPrecisionReqLength_float(float precision);
+short getExponent_double(double value);
+short getPrecisionReqLength_double(double precision);
+unsigned char numberOfLeadingZeros_Int(int i);
+unsigned char numberOfLeadingZeros_Long(long i);
+unsigned char getLeadingNumbers_Int(int v1, int v2);
+unsigned char getLeadingNumbers_Long(long v1, long v2);
+short bytesToShort(unsigned char* bytes);
+void shortToBytes(unsigned char* b, short value);
+int bytesToInt(unsigned char* bytes);
+long bytesToLong(unsigned char* bytes);
+float bytesToFloat(unsigned char* bytes);
+void floatToBytes(unsigned char *b, float num);
+double bytesToDouble(unsigned char* bytes);
+void doubleToBytes(unsigned char *b, double num);
+int extractBytes(unsigned char* byteArray, size_t k, int validLength);
+int getMaskRightCode(int m);
+int getLeftMovingCode(int kMod8);
+int getRightMovingSteps(int kMod8, int resiBitLength);
+int getRightMovingCode(int kMod8, int resiBitLength);
+short* convertByteDataToShortArray(unsigned char* bytes, size_t byteLength);
+unsigned short* convertByteDataToUShortArray(unsigned char* bytes, size_t byteLength);
+
+void convertShortArrayToBytes(short* states, size_t stateLength, unsigned char* bytes);
+void convertUShortArrayToBytes(unsigned short* states, size_t stateLength, unsigned char* bytes);
+void convertIntArrayToBytes(int* states, size_t stateLength, unsigned char* bytes);
+void convertUIntArrayToBytes(unsigned int* states, size_t stateLength, unsigned char* bytes);
+void convertLongArrayToBytes(int64_t* states, size_t stateLength, unsigned char* bytes);
+void convertULongArrayToBytes(uint64_t* states, size_t stateLength, unsigned char* bytes);
+
+size_t bytesToSize(unsigned char* bytes);
+void sizeToBytes(unsigned char* outBytes, size_t size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _ByteToolkit_H  ----- */
+
Index: thirdparty/SZ/sz/include/CompressElement.h
===================================================================
--- thirdparty/SZ/sz/include/CompressElement.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/CompressElement.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,75 @@
+/**
+ *  @file CompressElement.h
+ *  @author Sheng Di
+ *  @date April, 2016
+ *  @brief Header file for Compress Elements such as DoubleCompressELement.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include <stdint.h>
+
+#ifndef _CompressElement_H
+#define _CompressElement_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct DoubleValueCompressElement
+{
+	double data;
+	long curValue;
+	unsigned char curBytes[8]; //big_endian
+	int reqBytesLength;
+	int resiBitsLength;
+} DoubleValueCompressElement;
+
+typedef struct FloatValueCompressElement
+{
+	float data;
+	int curValue;
+	unsigned char curBytes[4]; //big_endian
+	int reqBytesLength;
+	int resiBitsLength;
+} FloatValueCompressElement;
+
+typedef struct LossyCompressionElement
+{
+	int leadingZeroBytes; //0,1,2,or 3
+	unsigned char integerMidBytes[8];
+	int integerMidBytes_Length; //they are mid_bits actually
+	//char curBytes[8];
+	//int curBytes_Length; //4 for single_precision or 8 for double_precision	
+	int resMidBitsLength;
+	int residualMidBits;
+} LossyCompressionElement;
+
+char* decompressGroupIDArray(unsigned char* bytes, size_t dataLength);
+
+short computeGroupNum_float(float value);
+short computeGroupNum_double(double value);
+
+void listAdd_double(double last3CmprsData[3], double value);
+void listAdd_float(float last3CmprsData[3], float value);
+void listAdd_int(int64_t last3CmprsData[3], int64_t value);
+void listAdd_float_group(float *groups, int *flags, char groupNum, float oriValue, float decValue, char* curGroupID);
+void listAdd_double_group(double *groups, int *flags, char groupNum, double oriValue, double decValue, char* curGroupID);
+
+int validPrediction_double(double minErr, double precision);
+int validPrediction_float(float minErr, float precision);
+double* generateGroupErrBounds(int errorBoundMode, double realPrecision, double pwrErrBound);
+int generateGroupMaxIntervalCount(double* groupErrBounds);
+
+void new_LossyCompressionElement(LossyCompressionElement *lce, int leadingNum, unsigned char* intMidBytes, 
+		int intMidBytes_Length, int resiMidBitsLength, int resiBits);
+void updateLossyCompElement_Double(unsigned char* curBytes, unsigned char* preBytes, 
+		int reqBytesLength, int resiBitsLength,  LossyCompressionElement *lce);
+void updateLossyCompElement_Float(unsigned char* curBytes, unsigned char* preBytes, 
+		int reqBytesLength, int resiBitsLength,  LossyCompressionElement *lce);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _CompressElement_H  ----- */
Index: thirdparty/SZ/sz/include/DynamicByteArray.h
===================================================================
--- thirdparty/SZ/sz/include/DynamicByteArray.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/DynamicByteArray.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,36 @@
+/**
+ *  @file DynamicByteArray.h
+ *  @author Sheng Di
+ *  @date April, 2016
+ *  @brief Header file for Dynamic Byte Array.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _DynamicByteArray_H
+#define _DynamicByteArray_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+typedef struct DynamicByteArray
+{	
+	unsigned char* array;
+	size_t size;
+	size_t capacity;
+} DynamicByteArray;
+
+void new_DBA(DynamicByteArray **dba, size_t cap);
+void convertDBAtoBytes(DynamicByteArray *dba, unsigned char** bytes);
+void free_DBA(DynamicByteArray *dba);
+unsigned char getDBA_Data(DynamicByteArray *dba, size_t pos);
+void addDBA_Data(DynamicByteArray *dba, unsigned char value);
+void memcpyDBA_Data(DynamicByteArray *dba, unsigned char* data, size_t length);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _DynamicByteArray_H  ----- */
Index: thirdparty/SZ/sz/include/DynamicDoubleArray.h
===================================================================
--- thirdparty/SZ/sz/include/DynamicDoubleArray.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/DynamicDoubleArray.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,36 @@
+/**
+ *  @file DynamicDoubleArray.h
+ *  @author Sheng Di
+ *  @date April, 2016
+ *  @brief Header file for Dynamic Double Array.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _DynamicDoubleArray_H
+#define _DynamicDoubleArray_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+typedef struct DynamicDoubleArray
+{	
+	double* array;
+	size_t size;
+	double capacity;
+} DynamicDoubleArray;
+
+void new_DDA(DynamicDoubleArray **dda, size_t cap);
+void convertDDAtoDoubles(DynamicDoubleArray *dba, double **data);
+void free_DDA(DynamicDoubleArray *dda);
+double getDDA_Data(DynamicDoubleArray *dda, size_t pos);
+void addDDA_Data(DynamicDoubleArray *dda, double value);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _DynamicDoubleArray_H  ----- */
Index: thirdparty/SZ/sz/include/DynamicFloatArray.h
===================================================================
--- thirdparty/SZ/sz/include/DynamicFloatArray.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/DynamicFloatArray.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,35 @@
+/**
+ *  @file DynamicFloatArray.h
+ *  @author Sheng Di
+ *  @date April, 2016
+ *  @brief Header file for Dynamic Float Array.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _DynamicFloatArray_H
+#define _DynamicFloatArray_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+typedef struct DynamicFloatArray
+{	
+	float* array;
+	size_t size;
+	size_t capacity;
+} DynamicFloatArray;
+
+void new_DFA(DynamicFloatArray **dfa, size_t cap);
+void convertDFAtoFloats(DynamicFloatArray *dfa, float **data);
+void free_DFA(DynamicFloatArray *dfa);
+float getDFA_Data(DynamicFloatArray *dfa, size_t pos);
+void addDFA_Data(DynamicFloatArray *dfa, float value);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _DynamicFloatArray_H  ----- */
Index: thirdparty/SZ/sz/include/DynamicIntArray.h
===================================================================
--- thirdparty/SZ/sz/include/DynamicIntArray.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/DynamicIntArray.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,35 @@
+/**
+ *  @file DynamicIntArray.h
+ *  @author Sheng Di
+ *  @date April, 2016
+ *  @brief Header file for Dynamic Int Array.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _DynamicIntArray_H
+#define _DynamicIntArray_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+typedef struct DynamicIntArray
+{	
+	unsigned char* array; //char* (one byte) is enough, don't have to be int*
+	size_t size;
+	size_t capacity;
+} DynamicIntArray;
+
+void new_DIA(DynamicIntArray **dia, size_t cap);
+void convertDIAtoInts(DynamicIntArray *dia, unsigned char **data);
+void free_DIA(DynamicIntArray *dia);
+int getDIA_Data(DynamicIntArray *dia, size_t pos);
+void addDIA_Data(DynamicIntArray *dia, int value);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _DynamicIntArray_H  ----- */
Index: thirdparty/SZ/sz/include/Huffman.h
===================================================================
--- thirdparty/SZ/sz/include/Huffman.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/Huffman.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,69 @@
+/**
+ *  @file Huffman.h
+ *  @author Sheng Di
+ *  @date Aug., 2016
+ *  @brief Header file for the exponential segment constructor.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _Huffman_H
+#define _Huffman_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//Note: when changing the following settings, intvCapacity in sz.h should be changed as well.
+//#define allNodes 131072
+//#define stateNum 65536
+
+typedef struct node_t {
+	struct node_t *left, *right;
+	size_t freq;
+	char t; //in_node:0; otherwise:1
+	unsigned int c;
+} *node;
+
+typedef struct HuffmanTree {
+	int stateNum;
+	int allNodes;
+	struct node_t* pool;
+	node *qqq, *qq; //the root node of the HuffmanTree is qq[1]
+	int n_nodes; //n_nodes is for compression
+	int qend; 
+	unsigned long **code;
+	unsigned char *cout;
+	int n_inode; //n_inode is for decompression
+} HuffmanTree;
+
+HuffmanTree* createHuffmanTree(int stateNum);
+HuffmanTree* createDefaultHuffmanTree();
+
+node new_node(HuffmanTree *huffmanTree, size_t freq, unsigned int c, node a, node b);
+node new_node2(HuffmanTree *huffmanTree, unsigned int c, unsigned char t);
+void qinsert(HuffmanTree *huffmanTree, node n);
+node qremove(HuffmanTree *huffmanTree);
+void build_code(HuffmanTree *huffmanTree, node n, int len, unsigned long out1, unsigned long out2);
+void init(HuffmanTree *huffmanTree, int *s, size_t length);
+void encode(HuffmanTree *huffmanTree, int *s, size_t length, unsigned char *out, size_t *outSize);
+void decode(unsigned char *s, size_t targetLength, node t, int *out);
+void pad_tree_uchar(HuffmanTree* huffmanTree, unsigned char* L, unsigned char* R, unsigned int* C, unsigned char* t, unsigned int i, node root);
+void pad_tree_ushort(HuffmanTree* huffmanTree, unsigned short* L, unsigned short* R, unsigned int* C, unsigned char* t, unsigned int i, node root);
+void pad_tree_uint(HuffmanTree* huffmanTree, unsigned int* L, unsigned int* R, unsigned int* C, unsigned char* t, unsigned int i, node root);
+unsigned int convert_HuffTree_to_bytes_anyStates(HuffmanTree* huffmanTree, int nodeCount, unsigned char** out);
+void unpad_tree_uchar(HuffmanTree* huffmanTree, unsigned char* L, unsigned char* R, unsigned int* C, unsigned char *t, unsigned int i, node root);
+void unpad_tree_ushort(HuffmanTree* huffmanTree, unsigned short* L, unsigned short* R, unsigned int* C, unsigned char* t, unsigned int i, node root);
+void unpad_tree_uint(HuffmanTree* huffmanTree, unsigned int* L, unsigned int* R, unsigned int* C, unsigned char* t, unsigned int i, node root);
+node reconstruct_HuffTree_from_bytes_anyStates(HuffmanTree *huffmanTree, unsigned char* bytes, int nodeCount);
+
+void encode_withTree(HuffmanTree* huffmanTree, int *s, size_t length, unsigned char **out, size_t *outSize);
+void decode_withTree(HuffmanTree* huffmanTree, unsigned char *s, size_t targetLength, int *out);
+
+void SZ_ReleaseHuffman(HuffmanTree* huffmanTree);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Index: thirdparty/SZ/sz/include/TightDataPointStorageD.h
===================================================================
--- thirdparty/SZ/sz/include/TightDataPointStorageD.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/TightDataPointStorageD.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,90 @@
+/**
+ *  @file TightDataPointStorageD.h
+ *  @author Sheng Di
+ *  @date April, 2016
+ *  @brief Header file for the tight data point storage (TDPS).
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _TightDataPointStorageD_H
+#define _TightDataPointStorageD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct TightDataPointStorageD
+{
+	size_t dataSeriesLength;
+	int allSameData;
+	double realPrecision;
+	double medianValue;
+	char reqLength;	
+	char radExpo; //used to compute reqLength based on segmented precisions in "pw_rel_compression"
+
+	int stateNum;
+	int allNodes;
+
+	size_t exactDataNum;
+	double reservedValue;
+	
+	unsigned char* rtypeArray;
+	size_t rtypeArray_size;
+	
+	unsigned char* typeArray; //its size is dataSeriesLength/4 (or xxx/4+1) 
+	size_t typeArray_size;
+	
+	unsigned char* leadNumArray; //its size is exactDataNum/4 (or exactDataNum/4+1)
+	size_t leadNumArray_size;
+	
+	unsigned char* exactMidBytes;
+	size_t exactMidBytes_size;
+	
+	unsigned char* residualMidBits;
+	size_t residualMidBits_size;
+	
+	unsigned int intervals;
+	
+	unsigned char isLossless; //a mark to denote whether it's lossless compression (1 is yes, 0 is no)
+	
+	size_t segment_size;
+	
+	unsigned char* pwrErrBoundBytes;
+	int pwrErrBoundBytes_size;
+} TightDataPointStorageD;
+
+void new_TightDataPointStorageD_Empty(TightDataPointStorageD **self);
+int new_TightDataPointStorageD_fromFlatBytes(TightDataPointStorageD **self, unsigned char* flatBytes, size_t flatBytesLength);
+
+void new_TightDataPointStorageD(TightDataPointStorageD **self, 
+		size_t dataSeriesLength, size_t exactDataNum, 
+		int* type, unsigned char* exactMidBytes, size_t exactMidBytes_size,
+		unsigned char* leadNumIntArray,  //leadNumIntArray contains readable numbers....
+		unsigned char* resiMidBits, size_t resiMidBits_size,
+		unsigned char resiBitLength, 
+		double realPrecision, double medianValue, char reqLength, unsigned int intervals, 
+		unsigned char* pwrErrBoundBytes, size_t pwrErrBoundBytes_size, unsigned char radExpo);
+
+void new_TightDataPointStorageD2(TightDataPointStorageD **self, 
+		size_t dataSeriesLength, size_t exactDataNum, 
+		int* type, unsigned char* exactMidBytes, size_t exactMidBytes_size,
+		unsigned char* leadNumIntArray,  //leadNumIntArray contains readable numbers....
+		unsigned char* resiMidBits, size_t resiMidBits_size,
+		unsigned char* resiBitLength, size_t resiBitLengthSize,
+		double realPrecision, double medianValue, char reqLength, unsigned int intervals,
+		unsigned char* pwrErrBoundBytes, size_t pwrErrBoundBytes_size, unsigned char radExpo);
+
+void convertTDPStoBytes_double(TightDataPointStorageD* tdps, unsigned char* bytes, unsigned char* dsLengthBytes, unsigned char sameByte);
+void convertTDPStoBytes_double_reserve(TightDataPointStorageD* tdps, unsigned char* bytes, unsigned char* dsLengthBytes, unsigned char sameByte);
+void convertTDPStoFlatBytes_double(TightDataPointStorageD *tdps, unsigned char** bytes, size_t *size);
+void convertTDPStoFlatBytes_double_args(TightDataPointStorageD *tdps, unsigned char* bytes, size_t *size);
+
+void free_TightDataPointStorageD(TightDataPointStorageD *tdps);
+void free_TightDataPointStorageD2(TightDataPointStorageD *tdps);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _TightDataPointStorageD_H  ----- */
Index: thirdparty/SZ/sz/include/TightDataPointStorageF.h
===================================================================
--- thirdparty/SZ/sz/include/TightDataPointStorageF.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/TightDataPointStorageF.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,97 @@
+/**
+ *  @file TightDataPointStorageF.h
+ *  @author Sheng Di and Dingwen Tao
+ *  @date Aug, 2016
+ *  @brief Header file for the tight data point storage (TDPS).
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _TightDataPointStorageF_H
+#define _TightDataPointStorageF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h> 
+
+typedef struct TightDataPointStorageF
+{
+	size_t dataSeriesLength;
+	int allSameData;
+	double realPrecision; //it's used as the pwrErrBoundRatio when errBoundMode==PW_REL
+	float medianValue;
+	char reqLength;
+	char radExpo; //used to compute reqLength based on segmented precisions in "pw_rel_compression"
+	
+	int stateNum;
+	int allNodes;
+	
+	size_t exactDataNum;
+	float reservedValue;
+	
+	unsigned char* rtypeArray;
+	size_t rtypeArray_size;
+	
+	unsigned char* typeArray; //its size is dataSeriesLength/4 (or xxx/4+1) 
+	size_t typeArray_size;
+	
+	unsigned char* leadNumArray; //its size is exactDataNum/4 (or exactDataNum/4+1)
+	size_t leadNumArray_size;
+	
+	unsigned char* exactMidBytes;
+	size_t exactMidBytes_size;
+	
+	unsigned char* residualMidBits;
+	size_t residualMidBits_size;
+	
+	unsigned int intervals; //quantization_intervals
+	
+	unsigned char isLossless; //a mark to denote whether it's lossless compression (1 is yes, 0 is no)
+	
+	size_t segment_size;
+	
+	unsigned char* pwrErrBoundBytes;
+	int pwrErrBoundBytes_size;
+	
+} TightDataPointStorageF;
+
+void new_TightDataPointStorageF_Empty(TightDataPointStorageF **self);
+int new_TightDataPointStorageF_fromFlatBytes(TightDataPointStorageF **self, unsigned char* flatBytes, size_t flatBytesLength);
+
+void new_TightDataPointStorageF(TightDataPointStorageF **self,
+		size_t dataSeriesLength, size_t exactDataNum,
+		int* type, unsigned char* exactMidBytes, size_t exactMidBytes_size,
+		unsigned char* leadNumIntArray,  //leadNumIntArray contains readable numbers....
+		unsigned char* resiMidBits, size_t resiMidBits_size,
+		unsigned char resiBitLength,
+		double realPrecision, float medianValue, char reqLength, unsigned int intervals, 
+		unsigned char* pwrErrBoundBytes, size_t pwrErrBoundBytes_size, unsigned char radExpo);
+
+/**
+ * This function is designed for first-version of the point-wise relative error bound (developed by Sheng Di for TPDS18 paper)
+ * 
+ * */
+void new_TightDataPointStorageF2(TightDataPointStorageF **self,
+		size_t dataSeriesLength, size_t exactDataNum, 
+		int* type, unsigned char* exactMidBytes, size_t exactMidBytes_size,
+		unsigned char* leadNumIntArray,  //leadNumIntArray contains readable numbers....
+		unsigned char* resiMidBits, size_t resiMidBits_size,
+		unsigned char* resiBitLength, size_t resiBitLengthSize, 
+		double realPrecision, float medianValue, char reqLength, unsigned int intervals, 
+		unsigned char* pwrErrBoundBytes, size_t pwrErrBoundBytes_size, unsigned char radExpo);
+
+void convertTDPStoBytes_float(TightDataPointStorageF* tdps, unsigned char* bytes, unsigned char* dsLengthBytes, unsigned char sameByte);
+void convertTDPStoBytes_float_reserve(TightDataPointStorageF* tdps, unsigned char* bytes, unsigned char* dsLengthBytes, unsigned char sameByte);
+void convertTDPStoFlatBytes_float(TightDataPointStorageF *tdps, unsigned char** bytes, size_t *size);
+void convertTDPStoFlatBytes_float_args(TightDataPointStorageF *tdps, unsigned char* bytes, size_t *size);
+
+void free_TightDataPointStorageF(TightDataPointStorageF *tdps);
+void free_TightDataPointStorageF2(TightDataPointStorageF *tdps);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _TightDataPointStorageF_H  ----- */
Index: thirdparty/SZ/sz/include/TightDataPointStorageI.h
===================================================================
--- thirdparty/SZ/sz/include/TightDataPointStorageI.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/TightDataPointStorageI.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,65 @@
+/**
+ *  @file TightDataPointStorageI.h
+ *  @author Sheng Di and Dingwen Tao
+ *  @date Aug, 2017
+ *  @brief Header file for the tight data point storage (TDPS).
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _TightDataPointStorageI_H
+#define _TightDataPointStorageI_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h> 
+
+typedef struct TightDataPointStorageI
+{
+	size_t dataSeriesLength;
+	int allSameData;
+	double realPrecision; //it's used as the pwrErrBoundRatio when errBoundMode==PW_REL
+	size_t exactDataNum;
+	long minValue;
+	int exactByteSize;
+	int dataTypeSize; //the size of data type, e.g., it's 4 when data type is int32_t
+	
+	int stateNum;
+	int allNodes;
+	
+	unsigned char* typeArray; //its size is dataSeriesLength/4 (or xxx/4+1) 
+	size_t typeArray_size;
+	
+	unsigned char* exactDataBytes;
+	size_t exactDataBytes_size;
+	
+	unsigned int intervals; //quantization_intervals
+	
+	unsigned char isLossless; //a mark to denote whether it's lossless compression (1 is yes, 0 is no)
+
+} TightDataPointStorageI;
+
+int computeRightShiftBits(int exactByteSize, int dataType);
+int convertDataTypeSizeCode(int dataTypeSizeCode);
+int convertDataTypeSize(int dataTypeSize);
+
+void new_TightDataPointStorageI_Empty(TightDataPointStorageI **self);
+int new_TightDataPointStorageI_fromFlatBytes(TightDataPointStorageI **self, unsigned char* flatBytes, size_t flatBytesLength);
+void new_TightDataPointStorageI(TightDataPointStorageI **self,
+		size_t dataSeriesLength, size_t exactDataNum, int byteSize, 
+		int* type, unsigned char* exactDataBytes, size_t exactDataBytes_size,
+		double realPrecision, long minValue, int intervals, int dataType);
+
+void convertTDPStoBytes_int(TightDataPointStorageI* tdps, unsigned char* bytes, unsigned char* dsLengthBytes, unsigned char sameByte);
+void convertTDPStoFlatBytes_int(TightDataPointStorageI *tdps, unsigned char** bytes, size_t *size);
+void convertTDPStoFlatBytes_int_args(TightDataPointStorageI *tdps, unsigned char* bytes, size_t *size);
+void free_TightDataPointStorageI(TightDataPointStorageI *tdps);
+void free_TightDataPointStorageI2(TightDataPointStorageI *tdps);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _TightDataPointStorageI_H  ----- */
Index: thirdparty/SZ/sz/include/TypeManager.h
===================================================================
--- thirdparty/SZ/sz/include/TypeManager.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/TypeManager.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,38 @@
+/**
+ *  @file TypeManager.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the TypeManager.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _TypeManager_H
+#define _TypeManager_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+#include <stdint.h>
+
+//TypeManager.c
+size_t convertIntArray2ByteArray_fast_1b(unsigned char* intArray, size_t intArrayLength, unsigned char **result);
+void convertByteArray2IntArray_fast_1b(size_t intArrayLength, unsigned char* byteArray, size_t byteArrayLength, unsigned char **intArray);
+size_t convertIntArray2ByteArray_fast_2b(unsigned char* timeStepType, size_t timeStepTypeLength, unsigned char **result);
+void convertByteArray2IntArray_fast_2b(size_t stepLength, unsigned char* byteArray, size_t byteArrayLength, unsigned char **intArray);
+size_t convertIntArray2ByteArray_fast_3b(unsigned char* timeStepType, size_t timeStepTypeLength, unsigned char **result);
+void convertByteArray2IntArray_fast_3b(size_t stepLength, unsigned char* byteArray, size_t byteArrayLength, unsigned char **intArray);
+int getLeftMovingSteps(size_t k, unsigned char resiBitLength);
+size_t convertIntArray2ByteArray_fast_dynamic(unsigned char* timeStepType, unsigned char resiBitLength, size_t nbEle, unsigned char **bytes);
+size_t convertIntArray2ByteArray_fast_dynamic2(unsigned char* timeStepType, unsigned char* resiBitLength, size_t resiBitLengthLength, unsigned char **bytes);
+int computeBitNumRequired(size_t dataLength);
+void decompressBitArraybySimpleLZ77(int** result, unsigned char* bytes, size_t bytesLength, size_t totalLength, int validLength);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _TypeManager_H  ----- */
+
Index: thirdparty/SZ/sz/include/VarSet.h
===================================================================
--- thirdparty/SZ/sz/include/VarSet.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/VarSet.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,77 @@
+/**
+ *  @file VarSet.h
+ *  @author Sheng Di
+ *  @date July, 2016
+ *  @brief Header file for the Variable.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _VarSet_H
+#define _VarSet_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+typedef struct sz_multisteps
+{
+	char compressionType;
+	int predictionMode;
+	int lastSnapshotStep; //the previous snapshot step
+	unsigned int currentStep; //current time step of the execution/simulation
+	void* hist_data; //historical data in past time steps
+} sz_multisteps;
+
+typedef struct SZ_Variable
+{
+	char* varName;
+	char compressType; //102 means HZ; 101 means SZ 
+	int dataType; //SZ_FLOAT or SZ_DOUBLE
+	size_t r5;
+	size_t r4;
+	size_t r3;
+	size_t r2;
+	size_t r1;
+	int errBoundMode;
+	double absErrBound;
+	double relBoundRatio;
+	double pwRelBoundRatio;
+	void* data;
+	sz_multisteps *multisteps;
+	unsigned char* compressedBytes;
+	size_t compressedSize;
+	struct SZ_Variable* next;
+} SZ_Variable;
+
+typedef struct SZ_VarSet
+{
+	unsigned short count;
+	struct SZ_Variable *header;
+	struct SZ_Variable *lastVar;
+} SZ_VarSet;
+
+void free_Variable_keepOriginalData(SZ_Variable* v);
+void free_Variable_keepCompressedBytes(SZ_Variable* v);
+void free_Variable_all(SZ_Variable* v);
+void SZ_batchAddVar(char* varName, int dataType, void* data, 
+			int errBoundMode, double absErrBound, double relBoundRatio, double pwRelBoundRatio,
+			size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
+int SZ_batchDelVar_vset(SZ_VarSet* vset, char* varName);
+int SZ_batchDelVar(char* varName);
+
+SZ_Variable* SZ_searchVar(char* varName);
+void* SZ_getVarData(char* varName, size_t *r5, size_t *r4, size_t *r3, size_t *r2, size_t *r1);
+
+void free_VarSet_vset(SZ_VarSet *vset, int mode);
+void SZ_freeVarSet(int mode);
+
+void free_multisteps(sz_multisteps* multisteps);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _VarSet_H  ----- */
Index: thirdparty/SZ/sz/include/callZlib.h
===================================================================
--- thirdparty/SZ/sz/include/callZlib.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/callZlib.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,42 @@
+/**
+ *  @file callZlib.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the callZlib.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _CallZlib_H
+#define _CallZlib_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//#define SZ_ZLIB_BUFFER_SIZE 1048576	
+#define SZ_ZLIB_BUFFER_SIZE 65536
+
+#include <stdio.h>
+
+//callZlib.c
+unsigned long zlib_compress(unsigned char* data, unsigned long dataLength, unsigned char** compressBytes, int level);
+unsigned long zlib_compress2(unsigned char* data, unsigned long dataLength, unsigned char** compressBytes, int level);
+unsigned long zlib_compress3(unsigned char* data, unsigned long dataLength, unsigned char* compressBytes, int level);
+unsigned long zlib_compress4(unsigned char* data, unsigned long dataLength, unsigned char** compressBytes, int level);
+unsigned long zlib_compress5(unsigned char* data, unsigned long dataLength, unsigned char** compressBytes, int level);
+
+unsigned long zlib_uncompress4(unsigned char* compressBytes, unsigned long cmpSize, unsigned char** oriData, unsigned long targetOriSize);
+unsigned long zlib_uncompress5(unsigned char* compressBytes, unsigned long cmpSize, unsigned char** oriData, unsigned long targetOriSize);
+unsigned long zlib_uncompress(unsigned char* compressBytes, unsigned long cmpSize, unsigned char** oriData, unsigned long targetOriSize);
+unsigned long zlib_uncompress2(unsigned char* compressBytes, unsigned long cmpSize, unsigned char** oriData, unsigned long targetOriSize);
+unsigned long zlib_uncompress3(unsigned char* compressBytes, unsigned long cmpSize, unsigned char** oriData, unsigned long targetOriSize);
+
+unsigned long zlib_uncompress65536bytes(unsigned char* compressBytes, unsigned long cmpSize, unsigned char** oriData);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _CallZlib_H  ----- */
+
Index: thirdparty/SZ/sz/include/conf.h
===================================================================
--- thirdparty/SZ/sz/include/conf.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/conf.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,33 @@
+/**
+ *  @file conf.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the conf.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _Conf_H
+#define _Conf_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+//conf.c
+void updateQuantizationInfo(int quant_intervals);
+int SZ_ReadConf(const char* sz_cfgFile);
+int SZ_LoadConf(const char* sz_cfgFile);
+int checkVersion(char* version);
+void initSZ_TSC();
+unsigned int roundUpToPowerOf2(unsigned int base);
+double computeABSErrBoundFromPSNR(double psnr, double threshold, double value_range);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _Conf_H  ----- */
+
Index: thirdparty/SZ/sz/include/dataCompression.h
===================================================================
--- thirdparty/SZ/sz/include/dataCompression.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/dataCompression.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,85 @@
+/**
+ *  @file dataCompression.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the dataCompression.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _DataCompression_H
+#define _DataCompression_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "sz.h"
+#include <stdio.h>
+
+#define computeMinMax(data) \
+        for(i=1;i<size;i++)\
+        {\
+                data_ = data[i];\
+                if(min>data_)\
+                        min = data_;\
+                else if(max<data_)\
+                        max = data_;\
+        }\
+
+
+//dataCompression.c
+int computeByteSizePerIntValue(long valueRangeSize);
+long computeRangeSize_int(void* oriData, int dataType, size_t size, int64_t* valueRangeSize);
+double computeRangeSize_double(double* oriData, size_t size, double* valueRangeSize, double* medianValue);
+float computeRangeSize_float(float* oriData, size_t size, float* valueRangeSize, float* medianValue);
+float computeRangeSize_double_subblock(double* oriData, double* valueRangeSize, double* medianValue,
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1,
+size_t s5, size_t s4, size_t s3, size_t s2, size_t s1,
+size_t e5, size_t e4, size_t e3, size_t e2, size_t e1);
+float computeRangeSize_float_subblock(float* oriData, float* valueRangeSize, float* medianValue,
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1,
+size_t s5, size_t s4, size_t s3, size_t s2, size_t s1,
+size_t e5, size_t e4, size_t e3, size_t e2, size_t e1);
+double min_d(double a, double b);
+double max_d(double a, double b);
+float min_f(float a, float b);
+float max_f(float a, float b);
+double getRealPrecision_double(double valueRangeSize, int errBoundMode, double absErrBound, double relBoundRatio, int *status);
+double getRealPrecision_float(float valueRangeSize, int errBoundMode, double absErrBound, double relBoundRatio, int *status);
+double getRealPrecision_int(long valueRangeSize, int errBoundMode, double absErrBound, double relBoundRatio, int *status);
+void symTransform_8bytes(unsigned char data[8]);
+void symTransform_2bytes(unsigned char data[2]);
+void symTransform_4bytes(unsigned char data[4]);
+
+void compressInt8Value(int8_t tgtValue, int8_t minValue, int byteSize, unsigned char* bytes);
+void compressInt16Value(int16_t tgtValue, int16_t minValue, int byteSize, unsigned char* bytes);
+void compressInt32Value(int32_t tgtValue, int32_t minValue, int byteSize, unsigned char* bytes);
+void compressInt64Value(int64_t tgtValue, int64_t minValue, int byteSize, unsigned char* bytes);
+
+void compressUInt8Value(uint8_t tgtValue, uint8_t minValue, int byteSize, unsigned char* bytes);
+void compressUInt16Value(uint16_t tgtValue, uint16_t minValue, int byteSize, unsigned char* bytes);
+void compressUInt32Value(uint32_t tgtValue, uint32_t minValue, int byteSize, unsigned char* bytes);
+void compressUInt64Value(uint64_t tgtValue, uint64_t minValue, int byteSize, unsigned char* bytes);
+
+void compressSingleFloatValue(FloatValueCompressElement *vce, float tgtValue, float precision, float medianValue, 
+		int reqLength, int reqBytesLength, int resiBitsLength);
+void compressSingleDoubleValue(DoubleValueCompressElement *vce, double tgtValue, double precision, double medianValue, 
+		int reqLength, int reqBytesLength, int resiBitsLength);
+int compIdenticalLeadingBytesCount_double(unsigned char* preBytes, unsigned char* curBytes);
+int compIdenticalLeadingBytesCount_float(unsigned char* preBytes, unsigned char* curBytes);
+void addExactData(DynamicByteArray *exactMidByteArray, DynamicIntArray *exactLeadNumArray, 
+		DynamicIntArray *resiBitArray, LossyCompressionElement *lce);
+
+int getPredictionCoefficients(int layers, int dimension, int **coeff_array, int *status);
+
+int computeBlockEdgeSize_3D(int segmentSize);
+int computeBlockEdgeSize_2D(int segmentSize);
+int initRandomAccessBytes(unsigned char* raBytes);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _DataCompression_H  ----- */
+
Index: thirdparty/SZ/sz/include/dictionary.h
===================================================================
--- thirdparty/SZ/sz/include/dictionary.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/dictionary.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,172 @@
+
+/*-------------------------------------------------------------------------*/
+/**
+   @file    dictionary.h
+   @author  N. Devillard
+   @brief   Implements a dictionary for string variables.
+
+   This module implements a simple dictionary object, i.e. a list
+   of string/string associations. This object is useful to store e.g.
+   informations retrieved from a configuration file (ini files).
+*/
+/*--------------------------------------------------------------------------*/
+
+#ifndef _DICTIONARY_H_
+#define _DICTIONARY_H_
+
+/*---------------------------------------------------------------------------
+                                Includes
+ ---------------------------------------------------------------------------*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+/*---------------------------------------------------------------------------
+                                New types
+ ---------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Dictionary object
+
+  This object contains a list of string/string associations. Each
+  association is identified by a unique string key. Looking up values
+  in the dictionary is speeded up by the use of a (hopefully collision-free)
+  hash function.
+ */
+/*-------------------------------------------------------------------------*/
+typedef struct _dictionary_ {
+    int             n ;     /** Number of entries in dictionary */
+    int             size ;  /** Storage size */
+    char        **  val ;   /** List of string values */
+    char        **  key ;   /** List of string keys */
+    unsigned     *  hash ;  /** List of hash values for keys */
+} dictionary ;
+
+
+/*---------------------------------------------------------------------------
+                            Function prototypes
+ ---------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Compute the hash key for a string.
+  @param    key     Character string to use for key.
+  @return   1 unsigned int on at least 32 bits.
+
+  This hash function has been taken from an Article in Dr Dobbs Journal.
+  This is normally a collision-free function, distributing keys evenly.
+  The key is stored anyway in the struct so that collision can be avoided
+  by comparing the key itself in last resort.
+ */
+/*--------------------------------------------------------------------------*/
+unsigned dictionary_hash(const char * key);
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Create a new dictionary object.
+  @param    size    Optional initial size of the dictionary.
+  @return   1 newly allocated dictionary objet.
+
+  This function allocates a new dictionary object of given size and returns
+  it. If you do not know in advance (roughly) the number of entries in the
+  dictionary, give size=0.
+ */
+/*--------------------------------------------------------------------------*/
+dictionary * dictionary_new(int size);
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Delete a dictionary object
+  @param    d   dictionary object to deallocate.
+  @return   void
+
+  Deallocate a dictionary object and all memory associated to it.
+ */
+/*--------------------------------------------------------------------------*/
+void dictionary_del(dictionary * vd);
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Get a value from a dictionary.
+  @param    d       dictionary object to search.
+  @param    key     Key to look for in the dictionary.
+  @param    def     Default value to return if key not found.
+  @return   1 pointer to internally allocated character string.
+
+  This function locates a key in a dictionary and returns a pointer to its
+  value, or the passed 'def' pointer if no such key can be found in
+  dictionary. The returned character pointer points to data internal to the
+  dictionary object, you should not try to free it or modify it.
+ */
+/*--------------------------------------------------------------------------*/
+char * dictionary_get(dictionary * d, const char * key, char * def);
+
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Set a value in a dictionary.
+  @param    d       dictionary object to modify.
+  @param    key     Key to modify or add.
+  @param    val     Value to add.
+  @return   int     0 if Ok, anything else otherwise
+
+  If the given key is found in the dictionary, the associated value is
+  replaced by the provided one. If the key cannot be found in the
+  dictionary, it is added to it.
+
+  It is Ok to provide a NULL value for val, but NULL values for the dictionary
+  or the key are considered as errors: the function will return immediately
+  in such a case.
+
+  Notice that if you dictionary_set a variable to NULL, a call to
+  dictionary_get will return a NULL value: the variable will be found, and
+  its value (NULL) is returned. In other words, setting the variable
+  content to NULL is equivalent to deleting the variable from the
+  dictionary. It is not possible (in this implementation) to have a key in
+  the dictionary without value.
+
+  This function returns non-zero in case of failure.
+ */
+/*--------------------------------------------------------------------------*/
+int dictionary_set(dictionary * vd, const char * key, const char * val);
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Delete a key in a dictionary
+  @param    d       dictionary object to modify.
+  @param    key     Key to remove.
+  @return   void
+
+  This function deletes a key in a dictionary. Nothing is done if the
+  key cannot be found.
+ */
+/*--------------------------------------------------------------------------*/
+void dictionary_unset(dictionary * d, const char * key);
+
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Dump a dictionary to an opened file pointer.
+  @param    d   Dictionary to dump
+  @param    f   Opened file pointer.
+  @return   void
+
+  Dumps a dictionary onto an opened file pointer. Key pairs are printed out
+  as @c [Key]=[Value], one per line. It is Ok to provide stdout or stderr as
+  output file pointers.
+ */
+/*--------------------------------------------------------------------------*/
+void dictionary_dump(dictionary * d, FILE * out);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Index: thirdparty/SZ/sz/include/iniparser.h
===================================================================
--- thirdparty/SZ/sz/include/iniparser.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/iniparser.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,321 @@
+
+/*-------------------------------------------------------------------------*/
+/**
+   @file    iniparser.h
+   @author  N. Devillard
+   @brief   Parser for ini files.
+*/
+/*--------------------------------------------------------------------------*/
+
+#ifndef _INIPARSER_H_
+#define _INIPARSER_H_
+
+/*---------------------------------------------------------------------------
+                                Includes
+ ---------------------------------------------------------------------------*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/*
+ * The following #include is necessary on many Unixes but not Linux.
+ * It is not needed for Windows platforms.
+ * Uncomment it if needed.
+ */
+/* #include <unistd.h> */
+
+#include "dictionary.h"
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Get number of sections in a dictionary
+  @param    d   Dictionary to examine
+  @return   int Number of sections found in dictionary
+
+  This function returns the number of sections found in a dictionary.
+  The test to recognize sections is done on the string stored in the
+  dictionary: a section name is given as "section" whereas a key is
+  stored as "section:key", thus the test looks for entries that do not
+  contain a colon.
+
+  This clearly fails in the case a section name contains a colon, but
+  this should simply be avoided.
+
+  This function returns -1 in case of error.
+ */
+/*--------------------------------------------------------------------------*/
+
+int iniparser_getnsec(dictionary * d);
+
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Get name for section n in a dictionary.
+  @param    d   Dictionary to examine
+  @param    n   Section number (from 0 to nsec-1).
+  @return   Pointer to char string
+
+  This function locates the n-th section in a dictionary and returns
+  its name as a pointer to a string statically allocated inside the
+  dictionary. Do not free or modify the returned string!
+
+  This function returns NULL in case of error.
+ */
+/*--------------------------------------------------------------------------*/
+
+char * iniparser_getsecname(dictionary * d, int n);
+
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Save a dictionary to a loadable ini file
+  @param    d   Dictionary to dump
+  @param    f   Opened file pointer to dump to
+  @return   void
+
+  This function dumps a given dictionary into a loadable ini file.
+  It is Ok to specify @c stderr or @c stdout as output files.
+ */
+/*--------------------------------------------------------------------------*/
+
+void iniparser_dump_ini(dictionary * d, FILE * f);
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Save a dictionary section to a loadable ini file
+  @param    d   Dictionary to dump
+  @param    s   Section name of dictionary to dump
+  @param    f   Opened file pointer to dump to
+  @return   void
+
+  This function dumps a given section of a given dictionary into a loadable ini
+  file.  It is Ok to specify @c stderr or @c stdout as output files.
+ */
+/*--------------------------------------------------------------------------*/
+
+void iniparser_dumpsection_ini(dictionary * d, char * s, FILE * f);
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Dump a dictionary to an opened file pointer.
+  @param    d   Dictionary to dump.
+  @param    f   Opened file pointer to dump to.
+  @return   void
+
+  This function prints out the contents of a dictionary, one element by
+  line, onto the provided file pointer. It is OK to specify @c stderr
+  or @c stdout as output files. This function is meant for debugging
+  purposes mostly.
+ */
+/*--------------------------------------------------------------------------*/
+void iniparser_dump(dictionary * d, FILE * f);
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Get the number of keys in a section of a dictionary.
+  @param    d   Dictionary to examine
+  @param    s   Section name of dictionary to examine
+  @return   Number of keys in section
+ */
+/*--------------------------------------------------------------------------*/
+int iniparser_getsecnkeys(dictionary * d, char * s);
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Get the number of keys in a section of a dictionary.
+  @param    d   Dictionary to examine
+  @param    s   Section name of dictionary to examine
+  @return   pointer to statically allocated character strings
+
+  This function queries a dictionary and finds all keys in a given section.
+  Each pointer in the returned char pointer-to-pointer is pointing to
+  a string allocated in the dictionary; do not free or modify them.
+
+  This function returns NULL in case of error.
+ */
+/*--------------------------------------------------------------------------*/
+char ** iniparser_getseckeys(dictionary * d, char * s);
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Get the string associated to a key
+  @param    d       Dictionary to search
+  @param    key     Key string to look for
+  @param    def     Default value to return if key not found.
+  @return   pointer to statically allocated character string
+
+  This function queries a dictionary for a key. A key as read from an
+  ini file is given as "section:key". If the key cannot be found,
+  the pointer passed as 'def' is returned.
+  The returned char pointer is pointing to a string allocated in
+  the dictionary, do not free or modify it.
+ */
+/*--------------------------------------------------------------------------*/
+char * iniparser_getstring(dictionary * d, const char * key, char * def);
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Get the string associated to a key, convert to an int
+  @param    d Dictionary to search
+  @param    key Key string to look for
+  @param    notfound Value to return in case of error
+  @return   integer
+
+  This function queries a dictionary for a key. A key as read from an
+  ini file is given as "section:key". If the key cannot be found,
+  the notfound value is returned.
+
+  Supported values for integers include the usual C notation
+  so decimal, octal (starting with 0) and hexadecimal (starting with 0x)
+  are supported. Examples:
+
+  - "42"      ->  42
+  - "042"     ->  34 (octal -> decimal)
+  - "0x42"    ->  66 (hexa  -> decimal)
+
+  Warning: the conversion may overflow in various ways. Conversion is
+  totally outsourced to strtol(), see the associated man page for overflow
+  handling.
+
+  Credits: Thanks to A. Becker for suggesting strtol()
+ */
+/*--------------------------------------------------------------------------*/
+int iniparser_getint(dictionary * d, const char * key, int notfound);
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Get the string associated to a key, convert to a long
+  @param    d Dictionary to search
+  @param    key Key string to look for
+  @param    notfound Value to return in case of error
+  @return   long
+
+  Credits: This function bases completely on int iniparser_getint and was
+  slightly modified to return long instead of int.
+ */
+/*--------------------------------------------------------------------------*/
+long iniparser_getlint(dictionary * d, const char * key, int notfound);
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Get the string associated to a key, convert to a double
+  @param    d Dictionary to search
+  @param    key Key string to look for
+  @param    notfound Value to return in case of error
+  @return   double
+
+  This function queries a dictionary for a key. A key as read from an
+  ini file is given as "section:key". If the key cannot be found,
+  the notfound value is returned.
+ */
+/*--------------------------------------------------------------------------*/
+double iniparser_getdouble(dictionary * d, const char * key, double notfound);
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Get the string associated to a key, convert to a boolean
+  @param    d Dictionary to search
+  @param    key Key string to look for
+  @param    notfound Value to return in case of error
+  @return   integer
+
+  This function queries a dictionary for a key. A key as read from an
+  ini file is given as "section:key". If the key cannot be found,
+  the notfound value is returned.
+
+  A true boolean is found if one of the following is matched:
+
+  - A string starting with 'y'
+  - A string starting with 'Y'
+  - A string starting with 't'
+  - A string starting with 'T'
+  - A string starting with '1'
+
+  A false boolean is found if one of the following is matched:
+
+  - A string starting with 'n'
+  - A string starting with 'N'
+  - A string starting with 'f'
+  - A string starting with 'F'
+  - A string starting with '0'
+
+  The notfound value returned if no boolean is identified, does not
+  necessarily have to be 0 or 1.
+ */
+/*--------------------------------------------------------------------------*/
+int iniparser_getboolean(dictionary * d, const char * key, int notfound);
+
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Set an entry in a dictionary.
+  @param    ini     Dictionary to modify.
+  @param    entry   Entry to modify (entry name)
+  @param    val     New value to associate to the entry.
+  @return   int 0 if Ok, -1 otherwise.
+
+  If the given entry can be found in the dictionary, it is modified to
+  contain the provided value. If it cannot be found, -1 is returned.
+  It is Ok to set val to NULL.
+ */
+/*--------------------------------------------------------------------------*/
+int iniparser_set(dictionary * ini, const char * entry, const char * val);
+
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Delete an entry in a dictionary
+  @param    ini     Dictionary to modify
+  @param    entry   Entry to delete (entry name)
+  @return   void
+
+  If the given entry can be found, it is deleted from the dictionary.
+ */
+/*--------------------------------------------------------------------------*/
+void iniparser_unset(dictionary * ini, const char * entry);
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Finds out if a given entry exists in a dictionary
+  @param    ini     Dictionary to search
+  @param    entry   Name of the entry to look for
+  @return   integer 1 if entry exists, 0 otherwise
+
+  Finds out if a given entry exists in the dictionary. Since sections
+  are stored as keys with NULL associated values, this is the only way
+  of querying for the presence of sections in a dictionary.
+ */
+/*--------------------------------------------------------------------------*/
+int iniparser_find_entry(dictionary * ini, const char * entry) ;
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Parse an ini file and return an allocated dictionary object
+  @param    ininame Name of the ini file to read.
+  @return   Pointer to newly allocated dictionary
+
+  This is the parser for ini files. This function is called, providing
+  the name of the file to be read. It returns a dictionary object that
+  should not be accessed directly, but through accessor functions
+  instead.
+
+  The returned dictionary must be freed using iniparser_freedict().
+ */
+/*--------------------------------------------------------------------------*/
+dictionary * iniparser_load(const char * ininame);
+
+/*-------------------------------------------------------------------------*/
+/**
+  @brief    Free all memory associated to an ini dictionary
+  @param    d Dictionary to free
+  @return   void
+
+  Free all memory associated to an ini dictionary.
+  It is mandatory to call this function before the dictionary object
+  gets out of the current context.
+ */
+/*--------------------------------------------------------------------------*/
+void iniparser_freedict(dictionary * d);
+
+#endif
Index: thirdparty/SZ/sz/include/pastri.h
===================================================================
--- thirdparty/SZ/sz/include/pastri.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/pastri.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,140 @@
+//CHECK:
+//What happens when ECQBits==1, or ECQBits==0 or ECQBits<0?
+//Rounding? Scale originalEb by 0.99?
+
+//Possible improvement: Change GAMESS format: {i i i i d} -> {i}{i}{i}{i}{d}
+//Possible improvement: Optimize bookkeeping bits
+//Possible improvement: Guess the type (C/UC, Sparse/Not)
+//Possible improvement: Get rid of writing/reading some of the indexes to in/out buffers
+//Possible improvement: Get rid of all debug stuff, including Makefile debug flags
+//Possible improvement: Get rid of "compressedBytes"
+//Possible improvement: SparseCompressed, ECQBits=2: 1's and -1's can be represented by just 0 and 1, instead 10 and 11. 
+//Possible improvement: SparseCompressed, ECQBits>2: Again: 1: 10, -1:11, Others: 0XX...XX 
+//Possible improvement: WriteBitsFast: maybe remove some masks?
+//Possible improvement: WriteBitsFast: Get rid of multiple calls!
+//Possible improvement: UCSparse: Indexes use 64 bits. It can be lowered to _1DIdxBits
+//Possible improvement: Parameters: Smaller data sizes may be possible!
+
+
+
+#ifndef PASTRI_H
+#define PASTRI_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <math.h>
+#include <assert.h> //Just for debugging purposes!
+
+//#define DATASIZE 8 //Bytes per input data point.
+//We have only 1 double per data point, so it is 8 bytes.
+
+#define MAX_PS_SIZE 100
+#define MAX_BLOCK_SIZE 10000
+#define MAX_BUFSIZE 160000  //Should be a multiple of 8
+#define D_W 0 //Debug switch: Write (input block)
+#define D_R 0 //Debug switch: Read (compressed block)
+#define D_G 0 //Debug switch: General
+#define D_G2 0 //Debug switch: General 2 (a little more detail)
+#define D_C 0 //Debug switch: C
+//#define DEBUG 1 //Debug switch
+
+//#define BOOKKEEPINGBITS 0 //Currently unused
+//#define BOOKKEEPINGBITS 120 //Includes: mode, indexOffsets, compressedBytes, Pb_, ECQBits_ (8+64+32+8+8) 
+//BOOKKEEPINGBITS is defined here, because if P & S is going to be used, they appear just after the bookkeeping part.
+//This allows us to write P and S directly onto using outBuf.
+  
+
+// IMPORTANT NOTE:
+//Read/Write up to 56 bits.
+//More than that is not supported!
+
+
+/********************************************************************/
+//Datatype Declarations:
+/********************************************************************/
+typedef struct pastri_params{
+  double originalEb; //Error Bound entered by the user
+  double usedEb; //Error Bound used during compression/deceompression
+  
+  int numBlocks; //Number of blocks to be compressed
+  int dataSize; //8(=Double) or 4(=Float)
+  
+  int bf[4]; //Orbital types (basis function types). Typically in range [0,3]
+  int idxRange[4];  //Ranges of indexes. idxRange[i]=(bf[i]+1)*(bf[i]+2)/2;
+  
+  int sbSize; //=idxRange[2]*idxRange[3];
+  int sbNum;  //=idxRange[0]*idxRange[1];
+  int bSize; //=sbSize*sbNum;
+  
+  //uint16_t idxOffset[4]; //Index offset values. No longer used.
+  
+}pastri_params;
+
+//Block-specific stuff:
+typedef struct pastri_blockParams{
+  uint16_t nonZeros;
+  //int ECQ0s; //= p->bSize - numOutliers //OR: p->bSize=ECQ0s+ECQ1s+ECQOthers
+  int ECQ1s;
+  int ECQOthers;
+  int numOutliers; //=ECQ1s+ECQOthers
+  int patternBits;
+  int scaleBits;
+  double binSize;
+  double scalesBinSize;
+  uint64_t ECQExt;
+  int ECQBits;
+  int _1DIdxBits;
+}pastri_blockParams;
+
+typedef union u_UI64I64D{
+  uint64_t ui64;
+  int64_t i64;
+  double d;
+} u_UI64I64D;
+
+/********************************************************************/
+//Function Prototypes:
+/********************************************************************/
+void SZ_pastriReadParameters(char paramsFilename[512],pastri_params *paramsPtr);
+//Read the basic PaSTRI parameters from a file, speficied by paramsFilename.
+
+void SZ_pastriPreprocessParameters(pastri_params *p);
+//Using basic PaSTRI parameters, generate the others.
+//For example, block and sub-block sizes are generated by using basis function types.
+
+void SZ_pastriCompressBatch(pastri_params *p,unsigned char *originalBuf, unsigned char** compressedBufP,size_t *compressedBytes);
+//INPUTS: p, originalBuf
+//OUTPUTS: compressedBufP, compressedBytes
+//Using the inputs, compressedBufP is allocated and populated by the compressed data. Compressed size is written into compressedBytes.
+//Parameters are also stored at the beginning part of the compressedBuf
+
+void SZ_pastriDecompressBatch(unsigned char*compressedBuf, pastri_params *p, unsigned char** decompressedBufP ,size_t *decompressedBytes);
+//INPUTS: compressedBuf
+//OUTPUTS: p, decompressedBufP, decompressedBytes
+//First, parameters are read from compressedBuf and written into p.
+//Then, decompressedBufP is allocated and populated by the decompressed data. Decompressed size is written into decompressedBytes.
+
+void SZ_pastriCheckBatch(pastri_params *p,unsigned char*originalBuf,unsigned char*decompressedBuf); 
+//INPUTS: p, originalBuf, decompressedBuf
+//OUTPUTS: None (Just some on-screen messages)
+//Compares originalBuf with decompressedBuf. Checks whether the absolute error condition is satisfied or not.
+
+/********************************************************************/
+//Other Includes:
+/********************************************************************/
+
+
+
+#include "pastriGeneral.h"  //General tools
+#include "pastriD.h"  //Compression/Decompression for Double data
+#include "pastriF.h"  //Compression/Decompression for Float data
+
+
+#endif
+
+
+
+
+
Index: thirdparty/SZ/sz/include/pastriD.h
===================================================================
--- thirdparty/SZ/sz/include/pastriD.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/pastriD.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,911 @@
+#ifndef PASTRID_H
+#define PASTRID_H
+
+static inline int64_t pastri_double_quantize(double x, double binSize){
+  //Add or sub 0.5, depending on the sign:
+  x=x/binSize;
+  
+  u_UI64I64D u1,half;
+  u1.d=x;
+  
+  half.d=0.5;
+  
+  //printf("pastri_double_quantize:\nx=%lf  x=0x%lx\n",x,(*((uint64_t *)(&x))));
+  //printf("sign(x):0x%lx\n", x);
+  //printf("0.5:0x%lx\n", (*((uint64_t *)(&half))));
+  half.ui64 |= (u1.ui64 & (uint64_t)0x8000000000000000);
+  //printf("sign(x)*0.5:0x%lx\n", (*((uint64_t *)(&half))));
+  return (int64_t)(x + half.d);
+}
+
+static inline void pastri_double_PatternMatch(double*data,pastri_params* p,pastri_blockParams* bp,int64_t* patternQ,int64_t *scalesQ, int64_t* ECQ){
+  //Find the pattern.
+  //First, find the extremum point:
+  double absExt=0; //Absolute value of Extremum
+  int extIdx=-1; //Index of Extremum
+  bp->nonZeros=0;
+  int i,sb;
+  for(i=0;i<p->bSize;i++){
+    //printf("data[%d] = %.16lf\n",i,data[i]);//DEBUG
+    if(abs_FastD(data[i])>p->usedEb){
+      bp->nonZeros++;
+      //if(DEBUG)printf("data[%d]:%.6e\n",i,data[i]); //DEBUG
+    }
+    if(abs_FastD(data[i])>absExt){
+      absExt=abs_FastD(data[i]);
+      extIdx=i;
+    }
+  }
+  int patternIdx; //Starting Index of Pattern
+  patternIdx=(extIdx/p->sbSize)*p->sbSize;
+  
+  double patternExt=data[extIdx];
+  bp->binSize=2*p->usedEb;
+  
+  //if(DEBUG){printf("Extremum  : data[%d] = %.6e\n",extIdx,patternExt);} //DEBUG
+  //if(DEBUG){printf("patternIdx: %d\n",patternIdx);} //DEBUG
+  
+  //if(DEBUG){for(i=0;i<p->sbSize;i++){printf("pattern[%d]=data[%d]=%.6e Quantized:%d\n",i,patternIdx+i,data[patternIdx+i],pastri_double_quantize(data[patternIdx+i]/binSize)  );}   }//DEBUG
+  
+  //int64_t *patternQ=(int64_t*)(outBuf+15);  //Possible Improvement!
+
+  
+  for(i=0;i<p->sbSize;i++){
+    patternQ[i]=pastri_double_quantize(data[patternIdx+i],bp->binSize);
+    if(D_W){printf("patternQ[%d]=%ld\n",i,patternQ[i]);}
+  }
+  
+  bp->patternBits=bitsNeeded_double((abs_FastD(patternExt)/bp->binSize)+1)+1;
+  bp->scaleBits=bp->patternBits;
+  bp->scalesBinSize=1/(double)(((uint64_t)1<<(bp->scaleBits-1))-1);
+  //if(DEBUG){printf("(patternExt/binSize)+1: %.6e\n",(patternExt/binSize)+1);} //DEBUG
+  //if(DEBUG){printf("scaleBits=patternBits: %d\n",scaleBits);} //DEBUG
+  if(D_W){printf("scalesBinSize: %.6e\n",bp->scalesBinSize);} //DEBUG
+  
+  //Calculate Scales.
+  //The index part of the input buffer will be reused to hold Scale, Pattern, etc. values.
+  int localExtIdx=extIdx%p->sbSize; //Local extremum index. This is not the actual extremum of the current sb, but rather the index that correspond to the global (block) extremum.
+  //int64_t *scalesQ=(int64_t*)(outBuf+15+p->sbSize*8);  //Possible Improvement!
+  int patternExtZero=(patternExt==0);
+  //if(DEBUG){printf("patternExtZero: %d\n",patternExtZero);} //DEBUG
+  for(sb=0;sb<p->sbNum;sb++){
+    //scales[sb]=data[sb*p->sbSize+localExtIdx]/patternExt;
+    //scales[sb]=patternExtZero ? 0 : data[sb*p->sbSize+localExtIdx]/patternExt;
+    //assert(scales[sb]<=1);
+    scalesQ[sb]=pastri_double_quantize((patternExtZero ? 0 : data[sb*p->sbSize+localExtIdx]/patternExt),bp->scalesBinSize);
+    if(D_W){printf("scalesQ[%d]=%ld\n",sb,scalesQ[sb]);}
+  }
+  //if(DEBUG){for(i=0;i<p->sbSize;i++){printf("scalesQ[%d]=%ld \n",i,scalesQ[i]);}} //DEBUG
+
+  //int64_t *ECQ=(int64_t*)(outBuf+p->bSize*8); //ECQ is written into outBuf, just be careful when handling it.
+
+  //uint64_t wVal;
+  bp->ECQExt=0;
+  int _1DIdx;
+  bp->ECQ1s=0;
+  bp->ECQOthers=0;
+  double PS_binSize=bp->scalesBinSize*bp->binSize;
+  for(sb=0;sb<p->sbNum;sb++){
+    for(i=0;i<p->sbSize;i++){
+      _1DIdx=sb*p->sbSize+i;
+      ECQ[_1DIdx]=pastri_double_quantize( (scalesQ[sb]*patternQ[i]*PS_binSize-data[_1DIdx]),bp->binSize );
+      double absECQ=abs_FastD(ECQ[_1DIdx]);
+      if(absECQ > bp->ECQExt)
+        bp->ECQExt=absECQ;
+      //if(DEBUG){printf("EC[%d]: %.6e Quantized:%ld \n",_1DIdx,(scalesQ[sb]*patternQ[i]*scalesBinSize*binSize-data[_1DIdx]),ECQ[_1DIdx]);} //DEBUG
+      switch (ECQ[_1DIdx]){
+        case 0:
+          //ECQ0s++; //Currently not needed
+          break;
+        case 1:
+          bp->ECQ1s++;
+          break;
+        case -1:
+          bp->ECQ1s++;
+          break;
+        default:
+          bp->ECQOthers++;
+          break;
+      }
+    }
+  }
+  
+  /*
+  //DEBUG: Self-check. Remove this later.
+  for(sb=0;sb<p->sbNum;sb++){
+    for(i=0;i<p->sbSize;i++){
+      _1DIdx=sb*p->sbSize+i;
+      double decompressed=scalesQ[sb]*patternQ[i]*scalesBinSize*binSize-ECQ[_1DIdx]*binSize;
+      if(abs_FastD(decompressed-data[_1DIdx])>(p->usedEb)){
+        printf("p->usedEb=%.6e\n",p->usedEb);
+        printf("data[%d]=%.6e decompressed[%d]=%.6e diff=%.6e\n",_1DIdx,data[_1DIdx],_1DIdx,decompressed,abs_FastD(data[_1DIdx]-decompressed));
+        assert(0);
+      }
+    }
+  }
+  */
+}
+
+static inline void pastri_double_Encode(double *data,int64_t* patternQ,int64_t* scalesQ,int64_t* ECQ,pastri_params *p,pastri_blockParams* bp,unsigned char* outBuf,int *numOutBytes){
+  bp->ECQBits=bitsNeeded_UI64(bp->ECQExt)+1;
+  bp->_1DIdxBits=bitsNeeded_UI64(p->bSize);
+  //(*numOutBytes)=0;
+  
+  int i;
+  
+  //Encode: 3 options:
+  //Compressed, Sparse ECQ
+  //Compressed, Non-Sparse ECQ
+  //Uncompressed, Sparse Data
+  //Uncompressed, Non-spsarse Data
+  
+  unsigned int UCSparseBits;  //Uncompressed, Sparse bits. Just like the original GAMESS data. Includes: mode, nonZeros, {indexes, data}
+  unsigned int UCNonSparseBits;  //Uncompressed, NonSparse bits. Includes: mode, data
+  unsigned int CSparseBits;  //Includes: mode, compressedBytes, patternBits, ECQBits,numOutliers,P, S, {Indexes(Sparse), ECQ}
+  unsigned int CNonSparseBits;  //Includes: mode, compressedBytes, patternBits, ECQBits,P, S, {ECQ}
+  //int BOOKKEEPINGBITS=120; //Includes: mode, compressedBytes, patternBits, ECQBits (8+64+32+8+8) //Moved to much earlier!
+    
+  //Consider: ECQ0s, ECQ1s, ECQOthers. Number of following values in ECQ: {0}, {1,-1}, { val<=-2, val>=2}
+  //ECQ0s is actually not needed, but others are needed.
+
+  UCSparseBits = p->dataSize*(1 + 2 + bp->nonZeros*16);  //64 bits for 4 indexes, 64 bit for data.
+  UCNonSparseBits = p->dataSize*(1 + p->bSize*8);
+  bp->numOutliers=bp->ECQ1s+bp->ECQOthers;
+  if(bp->ECQBits==2){
+    CSparseBits = p->dataSize*(1+4+1+1+2) + bp->patternBits*p->sbSize + bp->scaleBits*p->sbNum + bp->ECQ1s*(1+bp->_1DIdxBits);
+    CNonSparseBits = p->dataSize*(1+4+1+1) + bp->patternBits*p->sbSize + bp->scaleBits*p->sbNum + p->bSize + bp->ECQ1s ;  //Or: ECQ0s+ECQ1s*2;
+  }else{ //ECQBits>2
+    CSparseBits = p->dataSize*(1+4+1+1+2) + bp->patternBits*p->sbSize + bp->scaleBits*p->sbNum + bp->ECQ1s*(2+bp->_1DIdxBits) + bp->ECQOthers*(1+bp->_1DIdxBits+bp->ECQBits);
+    //CNonSparseBits = 8+32+8+8+ patternBits*p->sbSize + scaleBits*p->sbNum + p->bSize + ECQ0s + ECQ1s*3 + ECQOthers*(2+ECQBits);
+    CNonSparseBits = p->dataSize*(1+4+1+1)+ bp->patternBits*p->sbSize + bp->scaleBits*p->sbNum + p->bSize + bp->ECQ1s*2 + bp->ECQOthers*(1+bp->ECQBits);
+  }
+  
+  int UCSparseBytes=(UCSparseBits+7)/8; 
+  int UCNonSparseBytes=(UCNonSparseBits+7)/8; 
+  int CSparseBytes=(CSparseBits+7)/8; 
+  int CNonSparseBytes=(CNonSparseBits+7)/8; 
+  uint64_t bitPos=0;
+  uint64_t bytePos=0;
+  int i0,i1,i2,i3;
+  int _1DIdx;
+  
+  //*(uint16_t*)(&outBuf[1])=p->idxOffset[0];
+  //*(uint16_t*)(&outBuf[3])=p->idxOffset[1];
+  //*(uint16_t*)(&outBuf[5])=p->idxOffset[2];
+  //*(uint16_t*)(&outBuf[7])=p->idxOffset[3];
+    
+  if(D_W){printf("ECQ0s:%d ECQ1s:%d ECQOthers:%d Total:%d\n",p->bSize-bp->ECQ1s-bp->ECQOthers,bp->ECQ1s,bp->ECQOthers,p->bSize);} //DEBUG
+  if(D_W){printf("numOutliers:%d\n",bp->numOutliers);} //DEBUG
+  
+  //****************************************************************************************
+  //if(0){ //DEBUG
+  //W:UCSparse
+  if((UCSparseBytes<UCNonSparseBytes) && (UCSparseBytes<CSparseBytes) && (UCSparseBytes<CNonSparseBytes) ){ 
+    //Uncompressed, Sparse bits. Just like the original GAMESS data. Includes: mode, indexOffsets, nonZeros, indexes, data
+    *numOutBytes=UCSparseBytes;
+    if(D_G){printf("UCSparse\n");} //DEBUG
+    if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG
+    outBuf[0]=0; //mode
+    
+    //*(uint16_t*)(&outBuf[9])=nonZeros;
+    //bytePos=11;//0:mode, 1-8:indexOffsets 9-10:NonZeros. So start from 11.
+    *(uint16_t*)(&outBuf[1])=bp->nonZeros;
+    bytePos=3;//0:mode, 2-3:NonZeros. So start from 3.
+    
+    for(i0=0;i0<p->idxRange[0];i0++)
+      for(i1=0;i1<p->idxRange[1];i1++)
+        for(i2=0;i2<p->idxRange[2];i2++)
+          for(i3=0;i3<p->idxRange[3];i3++){
+            _1DIdx=p->idxRange[3]*(i2+p->idxRange[2]*(i1+i0*p->idxRange[1]))+i3;
+            if(abs_FastD(data[_1DIdx])>p->usedEb){
+              //*(uint16_t*)(&outBuf[bytePos])=i0+1+p->idxOffset[0];
+              *(uint16_t*)(&outBuf[bytePos])=i0;
+              bytePos+=2;
+              //*(uint16_t*)(&outBuf[bytePos])=i1+1+p->idxOffset[1];
+              *(uint16_t*)(&outBuf[bytePos])=i1;
+              bytePos+=2;
+              //*(uint16_t*)(&outBuf[bytePos])=i2+1+p->idxOffset[2];
+              *(uint16_t*)(&outBuf[bytePos])=i2;
+              bytePos+=2;
+              //*(uint16_t*)(&outBuf[bytePos])=i3+1+p->idxOffset[3];
+              *(uint16_t*)(&outBuf[bytePos])=i3;
+              bytePos+=2;
+              
+              *(double*)(&outBuf[bytePos])=data[_1DIdx];
+              bytePos+=p->dataSize;
+            }
+          }
+    
+    if(D_G)printf("UCSparseBytes:%d \n",UCSparseBytes); //DEBUG
+    
+  //****************************************************************************************
+  //}else if(0){ //DEBUG
+  //W:UCNonSparse
+  }else if((UCNonSparseBytes<UCSparseBytes) && (UCNonSparseBytes<CSparseBytes) && (UCNonSparseBytes<CNonSparseBytes) ){ 
+    //Uncompressed, NonSparse bits. Includes: mode, indexOffsets, data
+    *numOutBytes=UCNonSparseBytes;
+    if(D_G){printf("UCNonSparse\n");} //DEBUG
+    if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG
+    outBuf[0]=1; //mode
+    
+    //memcpy(&outBuf[9], &inBuf[p->bSize*8], UCNonSparseBytes-9);
+    memcpy(&outBuf[1], data, p->bSize*p->dataSize);
+    
+    if(D_G)printf("UCNonSparseBytes:%d \n",UCNonSparseBytes); //DEBUG
+    /*
+    for(i=0;i<UCNonSparseBytes-17;i++){
+      printf("%d ",inBuf[p->bSize*8+i]);
+    }
+    printf("\n");
+    for(i=0;i<UCNonSparseBytes-17;i++){
+      printf("%d ",outBuf[17+i]);
+    }
+    printf("\n");
+    */
+  //****************************************************************************************
+  //}else if(1){ //DEBUG
+  //W:CSparse
+  }else if((CSparseBytes<UCNonSparseBytes) && (CSparseBytes<UCSparseBytes) && (CSparseBytes<CNonSparseBytes) ){ 
+    //Includes: mode, indexOffsets, compressedBytes, patternBits, ECQBits,numOutliers,P, S, {Indexes(Sparse), ECQ}
+    *numOutBytes=CSparseBytes;
+    if(D_G){printf("CSparse\n");} //DEBUG
+    if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG
+    //if(DEBUG){printf("patternBits:%d _1DIdxBits:%d\n",patternBits,_1DIdxBits);} //DEBUG
+    outBuf[0]=2; //mode
+    
+    ////outBuf bytes [1:8] are indexOffsets, which are already written. outBuf bytes [9:12] are reserved for compressedBytes.
+    //outBuf[13]=patternBits;
+    //outBuf[14]=ECQBits;
+    ////Currently, we are at the end of 15th byte.
+    //*(uint16_t*)(&outBuf[15])=numOutliers;
+    //bitPos=17*8; //Currently, we are at the end of 17th byte.
+    
+    //outBuf bytes [1:4] are reserved for compressedBytes.
+    outBuf[5]=bp->patternBits;
+    outBuf[6]=bp->ECQBits;
+    //Currently, we are at the end of 7th byte.
+    
+    *(uint16_t*)(&outBuf[7])=bp->numOutliers; 
+    //Now, we are at the end of 9th byte.
+    bitPos=9*8; 
+    
+    //if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG
+
+    for(i=0;i<p->sbSize;i++){
+      writeBits_Fast(outBuf,&bitPos,bp->patternBits,patternQ[i]);//Pattern point
+    }
+    //if(DEBUG){printf("bitPos_P:%ld\n",bitPos);} //DEBUG
+    for(i=0;i<p->sbNum;i++){
+      writeBits_Fast(outBuf,&bitPos,bp->scaleBits,scalesQ[i]);//Scale
+    }
+    //if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG
+    //if(DEBUG)printf("ECQBits:%d\n",ECQBits);
+    switch(bp->ECQBits){
+      case 2:
+        for(i=0;i<p->bSize;i++){
+          switch(ECQ[i]){
+            case 0:
+              break;
+            case 1:
+              //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x0\n",i,ECQ[i]); //DEBUG
+              writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i);
+              //writeBits_Fast(outBuf,&bitPos,2,0x10);
+              //writeBits_Fast(outBuf,&bitPos,2,0);//0x00
+              //writeBits_Fast(outBuf,&bitPos,2,0);//0x00
+              writeBits_Fast(outBuf,&bitPos,1,0);//0x00
+              break;
+            case -1:
+              //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1\n",i,ECQ[i]); //DEBUG
+              writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i);
+              //writeBits_Fast(outBuf,&bitPos,2,0x11);
+              //writeBits_Fast(outBuf,&bitPos,2,1);//0x01
+              //writeBits_Fast(outBuf,&bitPos,1,0);
+              writeBits_Fast(outBuf,&bitPos,1,1);
+              break;
+            default:
+              assert(0);
+              break;
+          }
+        }
+        break;
+      default: //ECQBits>2
+      for(i=0;i<p->bSize;i++){
+        switch(ECQ[i]){
+          case 0:
+            break;
+          case 1:
+            //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x00\n",i,ECQ[i]); //DEBUG
+            writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i);
+            //writeBits_Fast(outBuf,&bitPos,3,0);//0x000
+            //writeBits_Fast(outBuf,&bitPos,1,0);
+            writeBits_Fast(outBuf,&bitPos,1,0);
+            writeBits_Fast(outBuf,&bitPos,1,0);
+            break;
+          case -1:
+            //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x01\n",i,ECQ[i]); //DEBUG
+            writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i);
+            //writeBits_Fast(outBuf,&bitPos,3,1);//0x001
+            //writeBits_Fast(outBuf,&bitPos,1,0);
+            writeBits_Fast(outBuf,&bitPos,1,0);
+            writeBits_Fast(outBuf,&bitPos,1,1);
+            break;
+          default:
+            //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1 0x%lx\n",i,ECQ[i],ECQ[i]); //DEBUG
+            writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i);
+            //writeBits_Fast(outBuf,&bitPos,2+ECQBits,((uint64_t)0x11<<ECQBits)|ECQ[i]);
+            //writeBits_Fast(outBuf,&bitPos,2+ECQBits,(ECQ[i]&((uint64_t)0x00<<ECQBits))|((uint64_t)0x01<<ECQBits));
+            //writeBits_Fast(outBuf,&bitPos,1,0);
+            writeBits_Fast(outBuf,&bitPos,1,1);
+            writeBits_Fast(outBuf,&bitPos,bp->ECQBits,ECQ[i]);
+            break;
+        }
+      }
+      break;
+    }
+    
+    //if(DEBUG){printf("bitPos_E:%ld\n",bitPos);} //DEBUG
+    if(D_C){if(!((bp->ECQBits>=2)||((bp->ECQBits==1) && (bp->numOutliers==0)))){printf("ERROR: ECQBits:%d numOutliers:%d This should not have happened!\n",bp->ECQBits,bp->numOutliers);assert(0);}} //DEBUG
+          
+
+    uint32_t bytePos=(bitPos+7)/8;
+    //*(uint32_t*)(&outBuf[9])=bytePos;
+    *(uint32_t*)(&outBuf[1])=bytePos;
+    
+    if(D_G)printf("bitPos:%ld CSparseBits:%d bytePos:%d CSparseBytes:%d\n",bitPos,CSparseBits,bytePos,CSparseBytes); //DEBUG
+    if(D_G){assert(bitPos==CSparseBits);}
+    
+  //****************************************************************************************
+  //W:CNonSparse
+  }else { 
+    //Includes: mode, indexOffsets, compressedBytes, patternBits, ECQBits,P, S, {ECQ}
+    *numOutBytes=CNonSparseBytes;
+    if(D_G){printf("CNonSparse\n");} //DEBUG
+    if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG
+    //if(DEBUG){printf("patternBits:%d _1DIdxBits:%d\n",patternBits,_1DIdxBits);} //DEBUG
+    outBuf[0]=3; //mode
+    
+    ////outBuf bytes [1:8] are indexOffsets, which are already written. outBuf bytes [9:12] are reserved for compressedBytes.
+    //outBuf[13]=patternBits;
+    //outBuf[14]=ECQBits;
+    //bitPos=15*8; //Currently, we are at the end of 15th byte.
+    
+    //outBuf bytes [1:4] are reserved for compressedBytes.
+    outBuf[5]=bp->patternBits;
+    outBuf[6]=bp->ECQBits;
+    bitPos=7*8; //Currently, we are at the end of 7th byte.
+    
+    //if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG
+
+    for(i=0;i<p->sbSize;i++){
+      writeBits_Fast(outBuf,&bitPos,bp->patternBits,patternQ[i]);//Pattern point
+    }
+    //if(DEBUG){printf("bitPos_P:%ld\n",bitPos);} //DEBUG
+    for(i=0;i<p->sbNum;i++){
+      writeBits_Fast(outBuf,&bitPos,bp->scaleBits,scalesQ[i]);//Scale
+    }
+    //if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG
+    //if(DEBUG)printf("ECQBits:%d\n",ECQBits);
+    switch(bp->ECQBits){
+      case 2:
+        for(i=0;i<p->bSize;i++){
+          switch(ECQ[i]){
+            case 0:
+              //if(DEBUG)printf("Index:%d ECQ:%d Written:0x1\n",i,ECQ[i]); //DEBUG
+              writeBits_Fast(outBuf,&bitPos,1,1);//0x1
+              break;
+            case 1:
+              //if(DEBUG)printf("Index:%d ECQ:%d Written:0x00\n",i,ECQ[i]); //DEBUG
+              //writeBits_Fast(outBuf,&bitPos,2,0);//0x00
+              writeBits_Fast(outBuf,&bitPos,1,0);
+              writeBits_Fast(outBuf,&bitPos,1,0);
+              break;
+            case -1:
+              //if(DEBUG)printf("Index:%d ECQ:%d Written:0x01\n",i,ECQ[i]); //DEBUG
+              //writeBits_Fast(outBuf,&bitPos,2,2); //0x01
+              writeBits_Fast(outBuf,&bitPos,1,0);
+              writeBits_Fast(outBuf,&bitPos,1,1);
+              break;
+            default:
+              assert(0);
+              break;
+          }
+        }
+        break;
+      default: //ECQBits>2
+        //if(DEBUG) printf("AMG_W1:bitPos:%ld\n",bitPos); //DEBUG
+        for(i=0;i<p->bSize;i++){
+          //if(DEBUG){printf("AMG_W3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG
+          //if(DEBUG) printf("AMG_W2:bitPos:%ld\n",bitPos); //DEBUG
+          //if(DEBUG) printf("ECQ[%d]:%ld\n",i,ECQ[i]); //DEBUG
+          switch(ECQ[i]){
+            case 0:
+              //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1\n",i,ECQ[i]); //DEBUG
+              //if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG
+              //temp1=bitPos;
+              writeBits_Fast(outBuf,&bitPos,1,1);  //0x1
+              //wVal=1; writeBits_Fast(outBuf,&bitPos,1,wVal); //0x1
+              //if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG
+              break;
+            case 1:
+              //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x000\n",i,ECQ[i]); //DEBUG
+              //if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG
+              //temp1=bitPos;
+              //writeBits_Fast(outBuf,&bitPos,3,0); //0x000
+              writeBits_Fast(outBuf,&bitPos,1,0);
+              writeBits_Fast(outBuf,&bitPos,1,0);
+              writeBits_Fast(outBuf,&bitPos,1,0);
+              //wVal=0; writeBits_Fast(outBuf,&bitPos,3,wVal); //0x000
+              //if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG
+              break;
+            case -1:
+              //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x001\n",i,ECQ[i]); //DEBUG
+              //if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG
+              //temp1=bitPos;
+              //writeBits_Fast(outBuf,&bitPos,3,8); //0x001
+              writeBits_Fast(outBuf,&bitPos,1,0); 
+              writeBits_Fast(outBuf,&bitPos,1,0); 
+              writeBits_Fast(outBuf,&bitPos,1,1); 
+              //wVal=8; writeBits_Fast(outBuf,&bitPos,3,wVal); //0x001
+              //if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG
+              break;
+            default:
+              //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x01 0x%lx\n",i,ECQ[i]); //DEBUG
+              //if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG
+              //temp1=bitPos;
+              //writeBits_Fast(outBuf,&bitPos,2,2); //0x01
+              writeBits_Fast(outBuf,&bitPos,1,0); 
+              writeBits_Fast(outBuf,&bitPos,1,1); 
+              //wVal=2; writeBits_Fast(outBuf,&bitPos,2,wVal); //0x01
+              writeBits_Fast(outBuf,&bitPos,bp->ECQBits,ECQ[i]);
+              //if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG
+              break;
+          }
+        }
+        break;
+    }
+    
+    //if(DEBUG){printf("bitPos_E:%ld\n",bitPos);} //DEBUG
+    if(D_C){if(!((bp->ECQBits>=2)||((bp->ECQBits==1) && (bp->numOutliers==0)))){printf("ERROR: ECQBits:%d numOutliers:%d This should not have happened!\n",bp->ECQBits,bp->numOutliers);assert(0);}} //DEBUG
+    
+          
+
+    uint32_t bytePos=(bitPos+7)/8;
+    //*(uint32_t*)(&outBuf[9])=bytePos;
+    *(uint32_t*)(&outBuf[1])=bytePos;
+    
+    if(D_G)printf("bitPos:%ld CNonSparseBits:%d bytePos:%d CNonSparseBytes:%d\n",bitPos,CNonSparseBits,bytePos,CNonSparseBytes); //DEBUG
+    if(D_G){assert(bitPos==CNonSparseBits);}
+    
+  }
+  //for(i=213;i<233;i++)if(DEBUG)printf("AMG_WE:bitPos:%d buffer[%d]=0x%lx\n",i*8,i,*(uint64_t*)(&outBuf[i])); //DEBUG
+  
+}
+static inline int pastri_double_Compress(unsigned char*inBuf,pastri_params *p,unsigned char*outBuf,int *numOutBytes){
+  pastri_blockParams bp;
+
+  if(D_G2){printf("Parameters: dataSize:%d\n",p->dataSize);}  //DEBUG
+  if(D_G2){printf("Parameters: bfs:%d %d %d %d originalEb:%.3e\n",p->bf[0],p->bf[1],p->bf[2],p->bf[3],p->usedEb);}  //DEBUG
+  if(D_G2){printf("Parameters: idxRanges:%d %d %d %d\n",p->idxRange[0],p->idxRange[1],p->idxRange[2],p->idxRange[3]);} //DEBUG
+  if(D_G2){printf("Parameters: sbSize:%d sbNum:%d bSize:%d\n",p->sbSize,p->sbNum,p->bSize); }//DEBUG
+  
+  int64_t patternQ[MAX_PS_SIZE];
+  int64_t scalesQ[MAX_PS_SIZE];
+  int64_t ECQ[MAX_BLOCK_SIZE];
+
+  double *data;
+  data=(double*)inBuf;
+  
+  //STEP 0: PREPROCESSING:
+  //This step can include flattening the block, determining the period, etc.
+  //Currently not needed.
+  
+  //STEP 1: PATTERN MATCH
+  pastri_double_PatternMatch(data,p,&bp,patternQ,scalesQ,ECQ);
+  
+  //STEP 2: ENCODING(Include QUANTIZE)
+  pastri_double_Encode(data,patternQ,scalesQ,ECQ,p,&bp,outBuf,numOutBytes);
+  
+
+  return 0;
+}
+
+static inline double pastri_double_InverseQuantization(int64_t q, double binSize){
+  return q*binSize;
+}
+
+static inline void pastri_double_PredictData(pastri_params *p,pastri_blockParams *bp,double *data,int64_t* patternQ,int64_t* scalesQ,int64_t* ECQ){
+  int j;
+  double PS_binSize=bp->scalesBinSize*bp->binSize;
+  for(j=0;j<p->bSize;j++){
+    //data[j]=scalesQ[j/p->sbSize]*patternQ[j%p->sbSize]*PS_binSize - ECQ[j]*bp->binSize;
+    data[j]=pastri_double_InverseQuantization(scalesQ[j/p->sbSize]*patternQ[j%p->sbSize],PS_binSize) - pastri_double_InverseQuantization(ECQ[j],bp->binSize);
+  }
+}
+
+static inline void pastri_double_Decode(unsigned char*inBuf,pastri_params *p,pastri_blockParams *bp,unsigned char*outBuf,int *numReadBytes,int64_t* patternQ,int64_t* scalesQ,int64_t* ECQ){
+  int j;
+  bp->_1DIdxBits=bitsNeeded_UI64(p->bSize);
+  //double *data=(double*)(outBuf+p->bSize*8);
+  double *data=(double*)(outBuf);
+  int i0,i1,i2,i3;
+  //uint16_t *idx0,*idx1,*idx2,*idx3;
+  int _1DIdx;
+
+  int64_t ECQTemp;
+  uint64_t bytePos=0;
+  uint64_t bitPos=0;
+  uint64_t temp,temp2;
+  //int sb,localIdx;
+
+  
+  //idx0=(uint16_t*)(outBuf           );
+  //idx1=(uint16_t*)(outBuf+p->bSize*2);
+  //idx2=(uint16_t*)(outBuf+p->bSize*4);
+  //idx3=(uint16_t*)(outBuf+p->bSize*6);
+  //p->idxOffset[0]=*(uint32_t*)(&inBuf[1]);
+  //p->idxOffset[1]=*(uint32_t*)(&inBuf[3]);
+  //p->idxOffset[2]=*(uint32_t*)(&inBuf[5]);
+  //p->idxOffset[3]=*(uint32_t*)(&inBuf[7]);
+  /*
+  for(i0=0;i0<p->idxRange[0];i0++)
+    for(i1=0;i1<p->idxRange[1];i1++)
+      for(i2=0;i2<p->idxRange[2];i2++)
+        for(i3=0;i3<p->idxRange[3];i3++){
+            //_1DIdx=i0*p->idxRange[1]*p->idxRange[2]*p->idxRange[3]+i1*p->idxRange[2]*p->idxRange[3]+i2*p->idxRange[3]+i3;
+            _1DIdx=p->idxRange[3]*(i2+p->idxRange[2]*(i1+i0*p->idxRange[1]))+i3;
+            idx0[_1DIdx]=i0+1+p->idxOffset[0];
+            idx1[_1DIdx]=i1+1+p->idxOffset[1];
+            idx2[_1DIdx]=i2+1+p->idxOffset[2];
+            idx3[_1DIdx]=i3+1+p->idxOffset[3];
+        }
+  */
+  
+  //*numOutBytes=p->bSize*16;  
+  
+  //inBuf[0] is "mode"
+  switch(inBuf[0]){
+    //R:UCSparse
+    case 0:
+      if(D_G){printf("\nDC:UCSparse\n");} //DEBUG
+      //bp->nonZeros=*(uint16_t*)(&inBuf[9]);
+      //bytePos=11;
+      bp->nonZeros=*(uint16_t*)(&inBuf[1]);
+      bytePos=3;
+      for(j=0;j<p->bSize;j++){
+          data[j]=0;
+      }
+      for(j=0;j<bp->nonZeros;j++){
+        //i0=*(uint16_t*)(&inBuf[bytePos])-1-p->idxOffset[0]; //i0
+        i0=*(uint16_t*)(&inBuf[bytePos]); //i0
+        bytePos+=2;
+        //i1=*(uint16_t*)(&inBuf[bytePos])-1-p->idxOffset[1]; //i1
+        i1=*(uint16_t*)(&inBuf[bytePos]); //i1
+        bytePos+=2;
+        //i2=*(uint16_t*)(&inBuf[bytePos])-1-p->idxOffset[2]; //i2
+        i2=*(uint16_t*)(&inBuf[bytePos]); //i2
+        bytePos+=2;
+        //i3=*(uint16_t*)(&inBuf[bytePos])-1-p->idxOffset[3]; //i3
+        i3=*(uint16_t*)(&inBuf[bytePos]); //i3
+        bytePos+=2;
+        _1DIdx=p->idxRange[3]*(i2+p->idxRange[2]*(i1+i0*p->idxRange[1]))+i3;
+        data[_1DIdx]=*(double*)(&inBuf[bytePos]);
+        bytePos+=8; 
+      }
+      if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG
+      break;
+    //R:UCNonSparse
+    case 1:
+      if(D_G){printf("\nDC:UCNonSparse\n");} //DEBUG
+      //memcpy(&outBuf[p->bSize*8], &inBuf[9], p->bSize*8);
+      memcpy(data, &inBuf[1], p->bSize*8);
+      bytePos=p->bSize*8;
+      if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG
+      break;
+    //R:CSparse
+    case 2:
+      if(D_G){printf("\nDC:CSparse\n");} //DEBUG
+      //for(j=0;j<p->bSize;j++){
+      //  data[j]=0;
+      //}
+      
+      //bp->patternBits=inBuf[13];
+      //bp->ECQBits=inBuf[14];      
+      
+      bp->patternBits=inBuf[5];
+      bp->ECQBits=inBuf[6];
+      
+      if(D_R){printf("bp->patternBits:%d bp->ECQBits:%d bp->_1DIdxBits:%d\n",bp->patternBits,bp->ECQBits,bp->_1DIdxBits);} //DEBUG
+      
+      //bp->numOutliers=*(uint16_t*)(&inBuf[15]);
+      //bitPos=17*8;
+      bp->numOutliers=*(uint16_t*)(&inBuf[7]);
+      bitPos=9*8;
+      if(D_R){printf("bp->numOutliers:%d\n",bp->numOutliers);} //DEBUG
+
+      bp->scalesBinSize=1/(double)(((uint64_t)1<<(bp->patternBits-1))-1);
+  
+      bp->binSize=p->usedEb*2;
+      
+      if(D_R){printf("bp->scalesBinSize:%.6e bp->binSize:%.6e bp->scalesBinSize*bp->binSize:%.6e\n",bp->scalesBinSize,bp->binSize,bp->scalesBinSize*bp->binSize);} //DEBUG
+
+      for(j=0;j<p->sbSize;j++){
+        patternQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Pattern point
+        if(D_R){printf("R:patternQ[%d]=%ld\n",j,patternQ[j]);}
+      }
+      for(j=0;j<p->sbNum;j++){
+        scalesQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Scale
+        if(D_R){printf("R:scalesQ[%d]=%ld\n",j,scalesQ[j]);}
+      }
+      
+      /* //Splitting
+      for(j=0;j<p->bSize;j++){
+        data[j]=scalesQ[j/p->sbSize]*patternQ[j%p->sbSize]*bp->scalesBinSize*bp->binSize;
+      }
+      */
+      for(j=0;j<p->bSize;j++){
+        ECQ[j]=0;
+      }
+      switch(bp->ECQBits){
+        case 2:
+          for(j=0;j<bp->numOutliers;j++){
+            //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG
+            //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG
+            
+            _1DIdx=readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits);
+            ECQTemp=readBits_I64(inBuf,&bitPos,1);
+            ECQTemp= ((ECQTemp<<63)>>63)|(uint64_t)0x1;
+            //if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp);
+            //continue;
+            //sb=_1DIdx/p->sbSize; 
+            //localIdx=_1DIdx%p->sbSize;
+            
+            ////data[_1DIdx]-=ECQTemp*bp->binSize;//Splitting
+            ECQ[_1DIdx]=ECQTemp;
+            
+            //if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG
+          }
+          break;
+        default: //bp->ECQBits>2
+          if(D_C){if(!((bp->ECQBits>=2)||((bp->ECQBits==1) && (bp->numOutliers==0)))){printf("ERROR: bp->ECQBits:%d bp->numOutliers:%d This should not have happened!\n",bp->ECQBits,bp->numOutliers);assert(0);}} //DEBUG
+    
+          for(j=0;j<bp->numOutliers;j++){
+            _1DIdx=readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits);
+            //sb=_1DIdx/p->sbSize; 
+            //localIdx=_1DIdx%p->sbSize;
+            temp=readBits_UI64(inBuf,&bitPos,1);
+            //if(DEBUG){printf("temp:%ld\n",temp);} //DEBUG
+            switch(temp){
+              case 0:  //+-1
+                ECQTemp=readBits_I64(inBuf,&bitPos,1);
+                ECQTemp= ((ECQTemp<<63)>>63)|(uint64_t)0x1;
+                //if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG
+                //if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp);
+                break;
+              case 1: //Others
+                ECQTemp=readBits_I64(inBuf,&bitPos,bp->ECQBits);
+                //if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG
+                //if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp);
+                break;
+              //default:
+              //  printf("ERROR: Bad 2-bit value: 0x%lx",temp);
+              // assert(0); //AMG
+              //  break;
+            }
+            
+            //data[_1DIdx]-=ECQTemp*bp->binSize;//Splitting
+            ECQ[_1DIdx]=ECQTemp;
+            
+            //if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG
+          }
+          break;
+      }
+      //static inline uint64_t readBits_UI64(unsigned char* buffer,uint64_t *bitPosPtr,uint64_t numBits){ // numBits must be in range [0:56]
+      //patternQ=(int64_t*)(inBuf+15); 
+      //scalesQ=(int64_t*)(inBuf+15+p->sbSize*8);
+      
+      bytePos=(bitPos+7)/8;
+      if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG
+      
+      //STEP 2: PREDICT DATA(Includes INVERSE QUANTIZATION)
+      pastri_double_PredictData(p,bp,data,patternQ,scalesQ,ECQ);
+
+      break;
+    //R:CNonSparse
+    case 3:
+      if(D_G){printf("\nDC:CNonSparse\n");} //DEBUG
+      
+      //for(j=0;j<p->bSize;j++){
+      //  data[j]=0;
+      //}
+      
+      //bp->patternBits=inBuf[13];
+      //bp->ECQBits=inBuf[14];
+      
+      bp->patternBits=inBuf[5];
+      bp->ECQBits=inBuf[6];
+      
+      if(D_R){printf("bp->patternBits:%d bp->ECQBits:%d bp->_1DIdxBits:%d\n",bp->patternBits,bp->ECQBits,bp->_1DIdxBits);} //DEBUG
+      
+      //bitPos=15*8;
+      bitPos=7*8;
+
+      bp->scalesBinSize=1/(double)(((uint64_t)1<<(bp->patternBits-1))-1);
+      bp->binSize=p->usedEb*2;
+      
+      if(D_R){printf("bp->scalesBinSize:%.6e bp->binSize:%.6e bp->scalesBinSize*bp->binSize:%.6e\n",bp->scalesBinSize,bp->binSize,bp->scalesBinSize*bp->binSize);} //DEBUG
+
+      for(j=0;j<p->sbSize;j++){
+        patternQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Pattern point
+        if(D_R){printf("R:patternQ[%d]=%ld\n",j,patternQ[j]);}
+      }
+      for(j=0;j<p->sbNum;j++){
+        scalesQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Scale
+        if(D_R){printf("R:scalesQ[%d]=%ld\n",j,scalesQ[j]);}
+      }
+      /* //Splitting
+      for(j=0;j<p->bSize;j++){
+        data[j]=scalesQ[j/p->sbSize]*patternQ[j%p->sbSize]*bp->scalesBinSize*bp->binSize;
+        //if(DEBUG){printf("DC:PS[%d]=%.6e\n",j,data[j]);}
+      }
+      */
+      switch(bp->ECQBits){
+        case 2:
+          for(j=0;j<p->bSize;j++){
+            //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG
+            //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG
+            //_1DIdx=readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits);
+            temp=readBits_UI64(inBuf,&bitPos,1);
+            switch(temp){
+              case 0:
+                ECQTemp=readBits_I64(inBuf,&bitPos,1);
+                ECQTemp= ((ECQTemp<<63)>>63)|(uint64_t)0x1;
+                break;
+              case 1:
+                ECQTemp=0;
+                break;
+              default:
+                assert(0);
+                break;
+            }
+            
+            //if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG
+            //continue;
+            //sb=_1DIdx/p->sbSize; 
+            //localIdx=_1DIdx%p->sbSize;
+            
+            //data[j]-=ECQTemp*bp->binSize; //Splitting
+            ECQ[j]=ECQTemp;
+            
+            //if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG
+          }
+          break;
+        default: //bp->ECQBits>2
+          //if(DEBUG)printf("AMG_R1:bitPos: %ld\n",bitPos);
+          
+          for(j=0;j<p->bSize;j++){
+            //if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG
+            //if(DEBUG)printf("AMG_R2:bitPos: %ld\n",bitPos);
+
+            //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG
+            //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG
+            //_1DIdx=readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits);
+            temp=readBits_UI64(inBuf,&bitPos,1);
+            //if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG
+            switch(temp){
+              case 0:
+                //if(DEBUG)printf("Read:0");
+                temp2=readBits_UI64(inBuf,&bitPos,1);
+                switch(temp2){
+                  case 0:
+                    //if(DEBUG)printf("0");
+                    ECQTemp=readBits_I64(inBuf,&bitPos,1);
+                    //if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG
+                    //if(DEBUG)printf("R:ECQTemp:%ld\n",ECQTemp);
+                    ECQTemp= ((ECQTemp<<63)>>63)|(uint64_t)0x1;
+                    //if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp);
+                    break;
+                  case 1:
+                    //if(DEBUG)printf("1\n");
+                    ECQTemp=readBits_I64(inBuf,&bitPos,bp->ECQBits);
+                    //if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG
+                    //if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp);
+                    break;
+                  default:
+                    assert(0);
+                    break;
+                }
+                break;
+              case 1:
+                //if(DEBUG)printf("Read:1\n");
+                ECQTemp=0;
+                //if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp);
+                break;
+              default:
+                assert(0);
+                break;
+            }
+            
+            //if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG
+            //continue;
+            //sb=_1DIdx/p->sbSize; 
+            //localIdx=_1DIdx%p->sbSize;
+            
+            //data[j]-=ECQTemp*bp->binSize; //Splitting
+            ECQ[j]=ECQTemp;
+            
+            //if(DEBUG){printf("DC:data[%d]:%.6e\n",j,data[j]);} //DEBUG
+          }
+          break;
+      }
+      //static inline uint64_t readBits_UI64(unsigned char* buffer,uint64_t *bitPosPtr,uint64_t numBits){ // numBits must be in range [0:56]
+      //patternQ=(int64_t*)(inBuf+15); 
+      //scalesQ=(int64_t*)(inBuf+15+p->sbSize*8);
+      bytePos=(bitPos+7)/8;
+      if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG
+      
+      //STEP 2: PREDICT DATA(Includes INVERSE QUANTIZATION)
+      pastri_double_PredictData(p,bp,data,patternQ,scalesQ,ECQ);
+      break;
+      
+    default:
+      assert(0);
+      break;
+  } 
+  (*numReadBytes)=bytePos;
+}
+
+static inline void pastri_double_Decompress(unsigned char*inBuf,int dataSize,pastri_params *p,unsigned char*outBuf,int *numReadBytes){
+  int64_t patternQ[MAX_PS_SIZE]; 
+  int64_t scalesQ[MAX_PS_SIZE];
+  int64_t ECQ[MAX_BLOCK_SIZE];
+  
+  pastri_blockParams bp;
+  
+  //STEP 1: DECODE (Includes PREDICT DATA(Includes INVERSE QUANTIZATION))
+  //(Further steps are called inside pastri_double_Decode function)
+  pastri_double_Decode(inBuf,p,&bp,outBuf,numReadBytes,patternQ,scalesQ,ECQ);
+
+  return;
+}
+
+//inBuf vs Decompressed
+static inline int pastri_double_Check(unsigned char*inBuf,int dataSize,unsigned char*DC,pastri_params *p){
+  int i;
+  
+  double *data=(double*)(inBuf);
+  double *data_dc=(double*)(DC);
+  
+  //Comparing Indexes:
+  /*
+  for(i=0;i<p->bSize;i++){
+    if(idx0[i]!=idx0_dc[i]){
+      printf("idx0[%d]=%d  !=  %d=idx0_dc[%d]",i,idx0[i],idx0_dc[i],i);
+      assert(0);
+    }
+    if(idx1[i]!=idx1_dc[i]){
+      printf("idx1[%d]=%d  !=  %d=idx1_dc[%d]",i,idx1[i],idx1_dc[i],i);
+      assert(0);
+    }
+    if(idx2[i]!=idx2_dc[i]){
+      printf("idx2[%d]=%d  !=  %d=idx2_dc[%d]",i,idx2[i],idx2_dc[i],i);
+      assert(0);
+    }
+    if(idx3[i]!=idx3_dc[i]){
+      printf("idx3[%d]=%d  !=  %d=idx3_dc[%d]",i,idx3[i],idx3_dc[i],i);
+      assert(0);
+    }
+  }
+  */
+  
+  //Comparing Data:
+  for(i=0;i<p->bSize;i++){
+    if(abs_FastD(data[i]-data_dc[i])>p->usedEb){
+      printf("|data[%d]-data_dc[%d]|>originalEb : %.3e - %.3e = %.3e > %.3e\n",i,i,data[i],data_dc[i],abs_FastD(data[i]-data_dc[i]),p->usedEb);
+      assert(0);
+    }
+  }
+  return 0;
+}
+
+
+#endif
Index: thirdparty/SZ/sz/include/pastriF.h
===================================================================
--- thirdparty/SZ/sz/include/pastriF.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/pastriF.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,911 @@
+#ifndef PASTRIF_H
+#define PASTRIF_H
+
+static inline int64_t pastri_float_quantize(float x, float binSize){
+  //Add or sub 0.5, depending on the sign:
+  x=x/binSize;
+  
+  u_UI64I64D u1,half;
+  u1.d=x;
+  
+  half.d=0.5;
+  
+  //printf("pastri_float_quantize:\nx=%lf  x=0x%lx\n",x,(*((uint64_t *)(&x))));
+  //printf("sign(x):0x%lx\n", x);
+  //printf("0.5:0x%lx\n", (*((uint64_t *)(&half))));
+  half.ui64 |= (u1.ui64 & (uint64_t)0x8000000000000000);
+  //printf("sign(x)*0.5:0x%lx\n", (*((uint64_t *)(&half))));
+  return (int64_t)(x + half.d);
+}
+
+static inline void pastri_float_PatternMatch(float*data,pastri_params* p,pastri_blockParams* bp,int64_t* patternQ,int64_t *scalesQ, int64_t* ECQ){
+  //Find the pattern.
+  //First, find the extremum point:
+  float absExt=0; //Absolute value of Extremum
+  int extIdx=-1; //Index of Extremum
+  bp->nonZeros=0;
+  int i,sb;
+  for(i=0;i<p->bSize;i++){
+    //printf("data[%d] = %.16lf\n",i,data[i]);//DEBUG
+    if(abs_FastD(data[i])>p->usedEb){
+      bp->nonZeros++;
+      //if(DEBUG)printf("data[%d]:%.6e\n",i,data[i]); //DEBUG
+    }
+    if(abs_FastD(data[i])>absExt){
+      absExt=abs_FastD(data[i]);
+      extIdx=i;
+    }
+  }
+  int patternIdx; //Starting Index of Pattern
+  patternIdx=(extIdx/p->sbSize)*p->sbSize;
+  
+  float patternExt=data[extIdx];
+  bp->binSize=2*p->usedEb;
+  
+  //if(DEBUG){printf("Extremum  : data[%d] = %.6e\n",extIdx,patternExt);} //DEBUG
+  //if(DEBUG){printf("patternIdx: %d\n",patternIdx);} //DEBUG
+  
+  //if(DEBUG){for(i=0;i<p->sbSize;i++){printf("pattern[%d]=data[%d]=%.6e Quantized:%d\n",i,patternIdx+i,data[patternIdx+i],pastri_float_quantize(data[patternIdx+i]/binSize)  );}   }//DEBUG
+  
+  //int64_t *patternQ=(int64_t*)(outBuf+15);  //Possible Improvement!
+
+  
+  for(i=0;i<p->sbSize;i++){
+    patternQ[i]=pastri_float_quantize(data[patternIdx+i],bp->binSize);
+    if(D_W){printf("patternQ[%d]=%ld\n",i,patternQ[i]);}
+  }
+  
+  bp->patternBits=bitsNeeded_float((abs_FastD(patternExt)/bp->binSize)+1)+1;
+  bp->scaleBits=bp->patternBits;
+  bp->scalesBinSize=1/(float)(((uint64_t)1<<(bp->scaleBits-1))-1);
+  //if(DEBUG){printf("(patternExt/binSize)+1: %.6e\n",(patternExt/binSize)+1);} //DEBUG
+  //if(DEBUG){printf("scaleBits=patternBits: %d\n",scaleBits);} //DEBUG
+  if(D_W){printf("scalesBinSize: %.6e\n",bp->scalesBinSize);} //DEBUG
+  
+  //Calculate Scales.
+  //The index part of the input buffer will be reused to hold Scale, Pattern, etc. values.
+  int localExtIdx=extIdx%p->sbSize; //Local extremum index. This is not the actual extremum of the current sb, but rather the index that correspond to the global (block) extremum.
+  //int64_t *scalesQ=(int64_t*)(outBuf+15+p->sbSize*8);  //Possible Improvement!
+  int patternExtZero=(patternExt==0);
+  //if(DEBUG){printf("patternExtZero: %d\n",patternExtZero);} //DEBUG
+  for(sb=0;sb<p->sbNum;sb++){
+    //scales[sb]=data[sb*p->sbSize+localExtIdx]/patternExt;
+    //scales[sb]=patternExtZero ? 0 : data[sb*p->sbSize+localExtIdx]/patternExt;
+    //assert(scales[sb]<=1);
+    scalesQ[sb]=pastri_float_quantize((patternExtZero ? 0 : data[sb*p->sbSize+localExtIdx]/patternExt),bp->scalesBinSize);
+    if(D_W){printf("scalesQ[%d]=%ld\n",sb,scalesQ[sb]);}
+  }
+  //if(DEBUG){for(i=0;i<p->sbSize;i++){printf("scalesQ[%d]=%ld \n",i,scalesQ[i]);}} //DEBUG
+
+  //int64_t *ECQ=(int64_t*)(outBuf+p->bSize*8); //ECQ is written into outBuf, just be careful when handling it.
+
+  //uint64_t wVal;
+  bp->ECQExt=0;
+  int _1DIdx;
+  bp->ECQ1s=0;
+  bp->ECQOthers=0;
+  float PS_binSize=bp->scalesBinSize*bp->binSize;
+  for(sb=0;sb<p->sbNum;sb++){
+    for(i=0;i<p->sbSize;i++){
+      _1DIdx=sb*p->sbSize+i;
+      ECQ[_1DIdx]=pastri_float_quantize( (scalesQ[sb]*patternQ[i]*PS_binSize-data[_1DIdx]),bp->binSize );
+      float absECQ=abs_FastD(ECQ[_1DIdx]);
+      if(absECQ > bp->ECQExt)
+        bp->ECQExt=absECQ;
+      //if(DEBUG){printf("EC[%d]: %.6e Quantized:%ld \n",_1DIdx,(scalesQ[sb]*patternQ[i]*scalesBinSize*binSize-data[_1DIdx]),ECQ[_1DIdx]);} //DEBUG
+      switch (ECQ[_1DIdx]){
+        case 0:
+          //ECQ0s++; //Currently not needed
+          break;
+        case 1:
+          bp->ECQ1s++;
+          break;
+        case -1:
+          bp->ECQ1s++;
+          break;
+        default:
+          bp->ECQOthers++;
+          break;
+      }
+    }
+  }
+  
+  /*
+  //DEBUG: Self-check. Remove this later.
+  for(sb=0;sb<p->sbNum;sb++){
+    for(i=0;i<p->sbSize;i++){
+      _1DIdx=sb*p->sbSize+i;
+      float decompressed=scalesQ[sb]*patternQ[i]*scalesBinSize*binSize-ECQ[_1DIdx]*binSize;
+      if(abs_FastD(decompressed-data[_1DIdx])>(p->usedEb)){
+        printf("p->usedEb=%.6e\n",p->usedEb);
+        printf("data[%d]=%.6e decompressed[%d]=%.6e diff=%.6e\n",_1DIdx,data[_1DIdx],_1DIdx,decompressed,abs_FastD(data[_1DIdx]-decompressed));
+        assert(0);
+      }
+    }
+  }
+  */
+}
+
+static inline void pastri_float_Encode(float *data,int64_t* patternQ,int64_t* scalesQ,int64_t* ECQ,pastri_params *p,pastri_blockParams* bp,unsigned char* outBuf,int *numOutBytes){
+  bp->ECQBits=bitsNeeded_UI64(bp->ECQExt)+1;
+  bp->_1DIdxBits=bitsNeeded_UI64(p->bSize);
+  //(*numOutBytes)=0;
+  
+  int i;
+  
+  //Encode: 3 options:
+  //Compressed, Sparse ECQ
+  //Compressed, Non-Sparse ECQ
+  //Uncompressed, Sparse Data
+  //Uncompressed, Non-spsarse Data
+  
+  unsigned int UCSparseBits;  //Uncompressed, Sparse bits. Just like the original GAMESS data. Includes: mode, nonZeros, {indexes, data}
+  unsigned int UCNonSparseBits;  //Uncompressed, NonSparse bits. Includes: mode, data
+  unsigned int CSparseBits;  //Includes: mode, compressedBytes, patternBits, ECQBits,numOutliers,P, S, {Indexes(Sparse), ECQ}
+  unsigned int CNonSparseBits;  //Includes: mode, compressedBytes, patternBits, ECQBits,P, S, {ECQ}
+  //int BOOKKEEPINGBITS=120; //Includes: mode, compressedBytes, patternBits, ECQBits (8+64+32+8+8) //Moved to much earlier!
+    
+  //Consider: ECQ0s, ECQ1s, ECQOthers. Number of following values in ECQ: {0}, {1,-1}, { val<=-2, val>=2}
+  //ECQ0s is actually not needed, but others are needed.
+
+  UCSparseBits = p->dataSize*(1 + 2 + bp->nonZeros*16);  //64 bits for 4 indexes, 64 bit for data.
+  UCNonSparseBits = p->dataSize*(1 + p->bSize*8);
+  bp->numOutliers=bp->ECQ1s+bp->ECQOthers;
+  if(bp->ECQBits==2){
+    CSparseBits = p->dataSize*(1+4+1+1+2) + bp->patternBits*p->sbSize + bp->scaleBits*p->sbNum + bp->ECQ1s*(1+bp->_1DIdxBits);
+    CNonSparseBits = p->dataSize*(1+4+1+1) + bp->patternBits*p->sbSize + bp->scaleBits*p->sbNum + p->bSize + bp->ECQ1s ;  //Or: ECQ0s+ECQ1s*2;
+  }else{ //ECQBits>2
+    CSparseBits = p->dataSize*(1+4+1+1+2) + bp->patternBits*p->sbSize + bp->scaleBits*p->sbNum + bp->ECQ1s*(2+bp->_1DIdxBits) + bp->ECQOthers*(1+bp->_1DIdxBits+bp->ECQBits);
+    //CNonSparseBits = 8+32+8+8+ patternBits*p->sbSize + scaleBits*p->sbNum + p->bSize + ECQ0s + ECQ1s*3 + ECQOthers*(2+ECQBits);
+    CNonSparseBits = p->dataSize*(1+4+1+1)+ bp->patternBits*p->sbSize + bp->scaleBits*p->sbNum + p->bSize + bp->ECQ1s*2 + bp->ECQOthers*(1+bp->ECQBits);
+  }
+  
+  int UCSparseBytes=(UCSparseBits+7)/8; 
+  int UCNonSparseBytes=(UCNonSparseBits+7)/8; 
+  int CSparseBytes=(CSparseBits+7)/8; 
+  int CNonSparseBytes=(CNonSparseBits+7)/8; 
+  uint64_t bitPos=0;
+  uint64_t bytePos=0;
+  int i0,i1,i2,i3;
+  int _1DIdx;
+  
+  //*(uint16_t*)(&outBuf[1])=p->idxOffset[0];
+  //*(uint16_t*)(&outBuf[3])=p->idxOffset[1];
+  //*(uint16_t*)(&outBuf[5])=p->idxOffset[2];
+  //*(uint16_t*)(&outBuf[7])=p->idxOffset[3];
+    
+  if(D_W){printf("ECQ0s:%d ECQ1s:%d ECQOthers:%d Total:%d\n",p->bSize-bp->ECQ1s-bp->ECQOthers,bp->ECQ1s,bp->ECQOthers,p->bSize);} //DEBUG
+  if(D_W){printf("numOutliers:%d\n",bp->numOutliers);} //DEBUG
+  
+  //****************************************************************************************
+  //if(0){ //DEBUG
+  //W:UCSparse
+  if((UCSparseBytes<UCNonSparseBytes) && (UCSparseBytes<CSparseBytes) && (UCSparseBytes<CNonSparseBytes) ){ 
+    //Uncompressed, Sparse bits. Just like the original GAMESS data. Includes: mode, indexOffsets, nonZeros, indexes, data
+    *numOutBytes=UCSparseBytes;
+    if(D_G){printf("UCSparse\n");} //DEBUG
+    if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG
+    outBuf[0]=0; //mode
+    
+    //*(uint16_t*)(&outBuf[9])=nonZeros;
+    //bytePos=11;//0:mode, 1-8:indexOffsets 9-10:NonZeros. So start from 11.
+    *(uint16_t*)(&outBuf[1])=bp->nonZeros;
+    bytePos=3;//0:mode, 2-3:NonZeros. So start from 3.
+    
+    for(i0=0;i0<p->idxRange[0];i0++)
+      for(i1=0;i1<p->idxRange[1];i1++)
+        for(i2=0;i2<p->idxRange[2];i2++)
+          for(i3=0;i3<p->idxRange[3];i3++){
+            _1DIdx=p->idxRange[3]*(i2+p->idxRange[2]*(i1+i0*p->idxRange[1]))+i3;
+            if(abs_FastD(data[_1DIdx])>p->usedEb){
+              //*(uint16_t*)(&outBuf[bytePos])=i0+1+p->idxOffset[0];
+              *(uint16_t*)(&outBuf[bytePos])=i0;
+              bytePos+=2;
+              //*(uint16_t*)(&outBuf[bytePos])=i1+1+p->idxOffset[1];
+              *(uint16_t*)(&outBuf[bytePos])=i1;
+              bytePos+=2;
+              //*(uint16_t*)(&outBuf[bytePos])=i2+1+p->idxOffset[2];
+              *(uint16_t*)(&outBuf[bytePos])=i2;
+              bytePos+=2;
+              //*(uint16_t*)(&outBuf[bytePos])=i3+1+p->idxOffset[3];
+              *(uint16_t*)(&outBuf[bytePos])=i3;
+              bytePos+=2;
+              
+              *(float*)(&outBuf[bytePos])=data[_1DIdx];
+              bytePos+=p->dataSize;
+            }
+          }
+    
+    if(D_G)printf("UCSparseBytes:%d \n",UCSparseBytes); //DEBUG
+    
+  //****************************************************************************************
+  //}else if(0){ //DEBUG
+  //W:UCNonSparse
+  }else if((UCNonSparseBytes<UCSparseBytes) && (UCNonSparseBytes<CSparseBytes) && (UCNonSparseBytes<CNonSparseBytes) ){ 
+    //Uncompressed, NonSparse bits. Includes: mode, indexOffsets, data
+    *numOutBytes=UCNonSparseBytes;
+    if(D_G){printf("UCNonSparse\n");} //DEBUG
+    if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG
+    outBuf[0]=1; //mode
+    
+    //memcpy(&outBuf[9], &inBuf[p->bSize*8], UCNonSparseBytes-9);
+    memcpy(&outBuf[1], data, p->bSize*p->dataSize);
+    
+    if(D_G)printf("UCNonSparseBytes:%d \n",UCNonSparseBytes); //DEBUG
+    /*
+    for(i=0;i<UCNonSparseBytes-17;i++){
+      printf("%d ",inBuf[p->bSize*8+i]);
+    }
+    printf("\n");
+    for(i=0;i<UCNonSparseBytes-17;i++){
+      printf("%d ",outBuf[17+i]);
+    }
+    printf("\n");
+    */
+  //****************************************************************************************
+  //}else if(1){ //DEBUG
+  //W:CSparse
+  }else if((CSparseBytes<UCNonSparseBytes) && (CSparseBytes<UCSparseBytes) && (CSparseBytes<CNonSparseBytes) ){ 
+    //Includes: mode, indexOffsets, compressedBytes, patternBits, ECQBits,numOutliers,P, S, {Indexes(Sparse), ECQ}
+    *numOutBytes=CSparseBytes;
+    if(D_G){printf("CSparse\n");} //DEBUG
+    if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG
+    //if(DEBUG){printf("patternBits:%d _1DIdxBits:%d\n",patternBits,_1DIdxBits);} //DEBUG
+    outBuf[0]=2; //mode
+    
+    ////outBuf bytes [1:8] are indexOffsets, which are already written. outBuf bytes [9:12] are reserved for compressedBytes.
+    //outBuf[13]=patternBits;
+    //outBuf[14]=ECQBits;
+    ////Currently, we are at the end of 15th byte.
+    //*(uint16_t*)(&outBuf[15])=numOutliers;
+    //bitPos=17*8; //Currently, we are at the end of 17th byte.
+    
+    //outBuf bytes [1:4] are reserved for compressedBytes.
+    outBuf[5]=bp->patternBits;
+    outBuf[6]=bp->ECQBits;
+    //Currently, we are at the end of 7th byte.
+    
+    *(uint16_t*)(&outBuf[7])=bp->numOutliers; 
+    //Now, we are at the end of 9th byte.
+    bitPos=9*8; 
+    
+    //if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG
+
+    for(i=0;i<p->sbSize;i++){
+      writeBits_Fast(outBuf,&bitPos,bp->patternBits,patternQ[i]);//Pattern point
+    }
+    //if(DEBUG){printf("bitPos_P:%ld\n",bitPos);} //DEBUG
+    for(i=0;i<p->sbNum;i++){
+      writeBits_Fast(outBuf,&bitPos,bp->scaleBits,scalesQ[i]);//Scale
+    }
+    //if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG
+    //if(DEBUG)printf("ECQBits:%d\n",ECQBits);
+    switch(bp->ECQBits){
+      case 2:
+        for(i=0;i<p->bSize;i++){
+          switch(ECQ[i]){
+            case 0:
+              break;
+            case 1:
+              //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x0\n",i,ECQ[i]); //DEBUG
+              writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i);
+              //writeBits_Fast(outBuf,&bitPos,2,0x10);
+              //writeBits_Fast(outBuf,&bitPos,2,0);//0x00
+              //writeBits_Fast(outBuf,&bitPos,2,0);//0x00
+              writeBits_Fast(outBuf,&bitPos,1,0);//0x00
+              break;
+            case -1:
+              //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1\n",i,ECQ[i]); //DEBUG
+              writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i);
+              //writeBits_Fast(outBuf,&bitPos,2,0x11);
+              //writeBits_Fast(outBuf,&bitPos,2,1);//0x01
+              //writeBits_Fast(outBuf,&bitPos,1,0);
+              writeBits_Fast(outBuf,&bitPos,1,1);
+              break;
+            default:
+              assert(0);
+              break;
+          }
+        }
+        break;
+      default: //ECQBits>2
+      for(i=0;i<p->bSize;i++){
+        switch(ECQ[i]){
+          case 0:
+            break;
+          case 1:
+            //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x00\n",i,ECQ[i]); //DEBUG
+            writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i);
+            //writeBits_Fast(outBuf,&bitPos,3,0);//0x000
+            //writeBits_Fast(outBuf,&bitPos,1,0);
+            writeBits_Fast(outBuf,&bitPos,1,0);
+            writeBits_Fast(outBuf,&bitPos,1,0);
+            break;
+          case -1:
+            //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x01\n",i,ECQ[i]); //DEBUG
+            writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i);
+            //writeBits_Fast(outBuf,&bitPos,3,1);//0x001
+            //writeBits_Fast(outBuf,&bitPos,1,0);
+            writeBits_Fast(outBuf,&bitPos,1,0);
+            writeBits_Fast(outBuf,&bitPos,1,1);
+            break;
+          default:
+            //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1 0x%lx\n",i,ECQ[i],ECQ[i]); //DEBUG
+            writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i);
+            //writeBits_Fast(outBuf,&bitPos,2+ECQBits,((uint64_t)0x11<<ECQBits)|ECQ[i]);
+            //writeBits_Fast(outBuf,&bitPos,2+ECQBits,(ECQ[i]&((uint64_t)0x00<<ECQBits))|((uint64_t)0x01<<ECQBits));
+            //writeBits_Fast(outBuf,&bitPos,1,0);
+            writeBits_Fast(outBuf,&bitPos,1,1);
+            writeBits_Fast(outBuf,&bitPos,bp->ECQBits,ECQ[i]);
+            break;
+        }
+      }
+      break;
+    }
+    
+    //if(DEBUG){printf("bitPos_E:%ld\n",bitPos);} //DEBUG
+    if(D_C){if(!((bp->ECQBits>=2)||((bp->ECQBits==1) && (bp->numOutliers==0)))){printf("ERROR: ECQBits:%d numOutliers:%d This should not have happened!\n",bp->ECQBits,bp->numOutliers);assert(0);}} //DEBUG
+          
+
+    uint32_t bytePos=(bitPos+7)/8;
+    //*(uint32_t*)(&outBuf[9])=bytePos;
+    *(uint32_t*)(&outBuf[1])=bytePos;
+    
+    if(D_G)printf("bitPos:%ld CSparseBits:%d bytePos:%d CSparseBytes:%d\n",bitPos,CSparseBits,bytePos,CSparseBytes); //DEBUG
+    if(D_G){assert(bitPos==CSparseBits);}
+    
+  //****************************************************************************************
+  //W:CNonSparse
+  }else { 
+    //Includes: mode, indexOffsets, compressedBytes, patternBits, ECQBits,P, S, {ECQ}
+    *numOutBytes=CNonSparseBytes;
+    if(D_G){printf("CNonSparse\n");} //DEBUG
+    if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG
+    //if(DEBUG){printf("patternBits:%d _1DIdxBits:%d\n",patternBits,_1DIdxBits);} //DEBUG
+    outBuf[0]=3; //mode
+    
+    ////outBuf bytes [1:8] are indexOffsets, which are already written. outBuf bytes [9:12] are reserved for compressedBytes.
+    //outBuf[13]=patternBits;
+    //outBuf[14]=ECQBits;
+    //bitPos=15*8; //Currently, we are at the end of 15th byte.
+    
+    //outBuf bytes [1:4] are reserved for compressedBytes.
+    outBuf[5]=bp->patternBits;
+    outBuf[6]=bp->ECQBits;
+    bitPos=7*8; //Currently, we are at the end of 7th byte.
+    
+    //if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG
+
+    for(i=0;i<p->sbSize;i++){
+      writeBits_Fast(outBuf,&bitPos,bp->patternBits,patternQ[i]);//Pattern point
+    }
+    //if(DEBUG){printf("bitPos_P:%ld\n",bitPos);} //DEBUG
+    for(i=0;i<p->sbNum;i++){
+      writeBits_Fast(outBuf,&bitPos,bp->scaleBits,scalesQ[i]);//Scale
+    }
+    //if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG
+    //if(DEBUG)printf("ECQBits:%d\n",ECQBits);
+    switch(bp->ECQBits){
+      case 2:
+        for(i=0;i<p->bSize;i++){
+          switch(ECQ[i]){
+            case 0:
+              //if(DEBUG)printf("Index:%d ECQ:%d Written:0x1\n",i,ECQ[i]); //DEBUG
+              writeBits_Fast(outBuf,&bitPos,1,1);//0x1
+              break;
+            case 1:
+              //if(DEBUG)printf("Index:%d ECQ:%d Written:0x00\n",i,ECQ[i]); //DEBUG
+              //writeBits_Fast(outBuf,&bitPos,2,0);//0x00
+              writeBits_Fast(outBuf,&bitPos,1,0);
+              writeBits_Fast(outBuf,&bitPos,1,0);
+              break;
+            case -1:
+              //if(DEBUG)printf("Index:%d ECQ:%d Written:0x01\n",i,ECQ[i]); //DEBUG
+              //writeBits_Fast(outBuf,&bitPos,2,2); //0x01
+              writeBits_Fast(outBuf,&bitPos,1,0);
+              writeBits_Fast(outBuf,&bitPos,1,1);
+              break;
+            default:
+              assert(0);
+              break;
+          }
+        }
+        break;
+      default: //ECQBits>2
+        //if(DEBUG) printf("AMG_W1:bitPos:%ld\n",bitPos); //DEBUG
+        for(i=0;i<p->bSize;i++){
+          //if(DEBUG){printf("AMG_W3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG
+          //if(DEBUG) printf("AMG_W2:bitPos:%ld\n",bitPos); //DEBUG
+          //if(DEBUG) printf("ECQ[%d]:%ld\n",i,ECQ[i]); //DEBUG
+          switch(ECQ[i]){
+            case 0:
+              //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1\n",i,ECQ[i]); //DEBUG
+              //if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG
+              //temp1=bitPos;
+              writeBits_Fast(outBuf,&bitPos,1,1);  //0x1
+              //wVal=1; writeBits_Fast(outBuf,&bitPos,1,wVal); //0x1
+              //if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG
+              break;
+            case 1:
+              //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x000\n",i,ECQ[i]); //DEBUG
+              //if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG
+              //temp1=bitPos;
+              //writeBits_Fast(outBuf,&bitPos,3,0); //0x000
+              writeBits_Fast(outBuf,&bitPos,1,0);
+              writeBits_Fast(outBuf,&bitPos,1,0);
+              writeBits_Fast(outBuf,&bitPos,1,0);
+              //wVal=0; writeBits_Fast(outBuf,&bitPos,3,wVal); //0x000
+              //if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG
+              break;
+            case -1:
+              //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x001\n",i,ECQ[i]); //DEBUG
+              //if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG
+              //temp1=bitPos;
+              //writeBits_Fast(outBuf,&bitPos,3,8); //0x001
+              writeBits_Fast(outBuf,&bitPos,1,0); 
+              writeBits_Fast(outBuf,&bitPos,1,0); 
+              writeBits_Fast(outBuf,&bitPos,1,1); 
+              //wVal=8; writeBits_Fast(outBuf,&bitPos,3,wVal); //0x001
+              //if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG
+              break;
+            default:
+              //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x01 0x%lx\n",i,ECQ[i]); //DEBUG
+              //if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG
+              //temp1=bitPos;
+              //writeBits_Fast(outBuf,&bitPos,2,2); //0x01
+              writeBits_Fast(outBuf,&bitPos,1,0); 
+              writeBits_Fast(outBuf,&bitPos,1,1); 
+              //wVal=2; writeBits_Fast(outBuf,&bitPos,2,wVal); //0x01
+              writeBits_Fast(outBuf,&bitPos,bp->ECQBits,ECQ[i]);
+              //if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG
+              break;
+          }
+        }
+        break;
+    }
+    
+    //if(DEBUG){printf("bitPos_E:%ld\n",bitPos);} //DEBUG
+    if(D_C){if(!((bp->ECQBits>=2)||((bp->ECQBits==1) && (bp->numOutliers==0)))){printf("ERROR: ECQBits:%d numOutliers:%d This should not have happened!\n",bp->ECQBits,bp->numOutliers);assert(0);}} //DEBUG
+    
+          
+
+    uint32_t bytePos=(bitPos+7)/8;
+    //*(uint32_t*)(&outBuf[9])=bytePos;
+    *(uint32_t*)(&outBuf[1])=bytePos;
+    
+    if(D_G)printf("bitPos:%ld CNonSparseBits:%d bytePos:%d CNonSparseBytes:%d\n",bitPos,CNonSparseBits,bytePos,CNonSparseBytes); //DEBUG
+    if(D_G){assert(bitPos==CNonSparseBits);}
+    
+  }
+  //for(i=213;i<233;i++)if(DEBUG)printf("AMG_WE:bitPos:%d buffer[%d]=0x%lx\n",i*8,i,*(uint64_t*)(&outBuf[i])); //DEBUG
+  
+}
+static inline int pastri_float_Compress(unsigned char*inBuf,pastri_params *p,unsigned char*outBuf,int *numOutBytes){
+  pastri_blockParams bp;
+
+  if(D_G2){printf("Parameters: dataSize:%d\n",p->dataSize);}  //DEBUG
+  if(D_G2){printf("Parameters: bfs:%d %d %d %d originalEb:%.3e\n",p->bf[0],p->bf[1],p->bf[2],p->bf[3],p->usedEb);}  //DEBUG
+  if(D_G2){printf("Parameters: idxRanges:%d %d %d %d\n",p->idxRange[0],p->idxRange[1],p->idxRange[2],p->idxRange[3]);} //DEBUG
+  if(D_G2){printf("Parameters: sbSize:%d sbNum:%d bSize:%d\n",p->sbSize,p->sbNum,p->bSize); }//DEBUG
+  
+  int64_t patternQ[MAX_PS_SIZE];
+  int64_t scalesQ[MAX_PS_SIZE];
+  int64_t ECQ[MAX_BLOCK_SIZE];
+
+  float *data;
+  data=(float*)inBuf;
+  
+  //STEP 0: PREPROCESSING:
+  //This step can include flattening the block, determining the period, etc.
+  //Currently not needed.
+  
+  //STEP 1: PATTERN MATCH
+  pastri_float_PatternMatch(data,p,&bp,patternQ,scalesQ,ECQ);
+  
+  //STEP 2: ENCODING(Include QUANTIZE)
+  pastri_float_Encode(data,patternQ,scalesQ,ECQ,p,&bp,outBuf,numOutBytes);
+  
+
+  return 0;
+}
+
+static inline float pastri_float_InverseQuantization(int64_t q, float binSize){
+  return q*binSize;
+}
+
+static inline void pastri_float_PredictData(pastri_params *p,pastri_blockParams *bp,float *data,int64_t* patternQ,int64_t* scalesQ,int64_t* ECQ){
+  int j;
+  float PS_binSize=bp->scalesBinSize*bp->binSize;
+  for(j=0;j<p->bSize;j++){
+    //data[j]=scalesQ[j/p->sbSize]*patternQ[j%p->sbSize]*PS_binSize - ECQ[j]*bp->binSize;
+    data[j]=pastri_float_InverseQuantization(scalesQ[j/p->sbSize]*patternQ[j%p->sbSize],PS_binSize) - pastri_float_InverseQuantization(ECQ[j],bp->binSize);
+  }
+}
+
+static inline void pastri_float_Decode(unsigned char*inBuf,pastri_params *p,pastri_blockParams *bp,unsigned char*outBuf,int *numReadBytes,int64_t* patternQ,int64_t* scalesQ,int64_t* ECQ){
+  int j;
+  bp->_1DIdxBits=bitsNeeded_UI64(p->bSize);
+  //float *data=(float*)(outBuf+p->bSize*8);
+  float *data=(float*)(outBuf);
+  int i0,i1,i2,i3;
+  //uint16_t *idx0,*idx1,*idx2,*idx3;
+  int _1DIdx;
+
+  int64_t ECQTemp;
+  uint64_t bytePos=0;
+  uint64_t bitPos=0;
+  uint64_t temp,temp2;
+  //int sb,localIdx;
+
+  
+  //idx0=(uint16_t*)(outBuf           );
+  //idx1=(uint16_t*)(outBuf+p->bSize*2);
+  //idx2=(uint16_t*)(outBuf+p->bSize*4);
+  //idx3=(uint16_t*)(outBuf+p->bSize*6);
+  //p->idxOffset[0]=*(uint32_t*)(&inBuf[1]);
+  //p->idxOffset[1]=*(uint32_t*)(&inBuf[3]);
+  //p->idxOffset[2]=*(uint32_t*)(&inBuf[5]);
+  //p->idxOffset[3]=*(uint32_t*)(&inBuf[7]);
+  /*
+  for(i0=0;i0<p->idxRange[0];i0++)
+    for(i1=0;i1<p->idxRange[1];i1++)
+      for(i2=0;i2<p->idxRange[2];i2++)
+        for(i3=0;i3<p->idxRange[3];i3++){
+            //_1DIdx=i0*p->idxRange[1]*p->idxRange[2]*p->idxRange[3]+i1*p->idxRange[2]*p->idxRange[3]+i2*p->idxRange[3]+i3;
+            _1DIdx=p->idxRange[3]*(i2+p->idxRange[2]*(i1+i0*p->idxRange[1]))+i3;
+            idx0[_1DIdx]=i0+1+p->idxOffset[0];
+            idx1[_1DIdx]=i1+1+p->idxOffset[1];
+            idx2[_1DIdx]=i2+1+p->idxOffset[2];
+            idx3[_1DIdx]=i3+1+p->idxOffset[3];
+        }
+  */
+  
+  //*numOutBytes=p->bSize*16;  
+  
+  //inBuf[0] is "mode"
+  switch(inBuf[0]){
+    //R:UCSparse
+    case 0:
+      if(D_G){printf("\nDC:UCSparse\n");} //DEBUG
+      //bp->nonZeros=*(uint16_t*)(&inBuf[9]);
+      //bytePos=11;
+      bp->nonZeros=*(uint16_t*)(&inBuf[1]);
+      bytePos=3;
+      for(j=0;j<p->bSize;j++){
+          data[j]=0;
+      }
+      for(j=0;j<bp->nonZeros;j++){
+        //i0=*(uint16_t*)(&inBuf[bytePos])-1-p->idxOffset[0]; //i0
+        i0=*(uint16_t*)(&inBuf[bytePos]); //i0
+        bytePos+=2;
+        //i1=*(uint16_t*)(&inBuf[bytePos])-1-p->idxOffset[1]; //i1
+        i1=*(uint16_t*)(&inBuf[bytePos]); //i1
+        bytePos+=2;
+        //i2=*(uint16_t*)(&inBuf[bytePos])-1-p->idxOffset[2]; //i2
+        i2=*(uint16_t*)(&inBuf[bytePos]); //i2
+        bytePos+=2;
+        //i3=*(uint16_t*)(&inBuf[bytePos])-1-p->idxOffset[3]; //i3
+        i3=*(uint16_t*)(&inBuf[bytePos]); //i3
+        bytePos+=2;
+        _1DIdx=p->idxRange[3]*(i2+p->idxRange[2]*(i1+i0*p->idxRange[1]))+i3;
+        data[_1DIdx]=*(float*)(&inBuf[bytePos]);
+        bytePos+=8; 
+      }
+      if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG
+      break;
+    //R:UCNonSparse
+    case 1:
+      if(D_G){printf("\nDC:UCNonSparse\n");} //DEBUG
+      //memcpy(&outBuf[p->bSize*8], &inBuf[9], p->bSize*8);
+      memcpy(data, &inBuf[1], p->bSize*8);
+      bytePos=p->bSize*8;
+      if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG
+      break;
+    //R:CSparse
+    case 2:
+      if(D_G){printf("\nDC:CSparse\n");} //DEBUG
+      //for(j=0;j<p->bSize;j++){
+      //  data[j]=0;
+      //}
+      
+      //bp->patternBits=inBuf[13];
+      //bp->ECQBits=inBuf[14];      
+      
+      bp->patternBits=inBuf[5];
+      bp->ECQBits=inBuf[6];
+      
+      if(D_R){printf("bp->patternBits:%d bp->ECQBits:%d bp->_1DIdxBits:%d\n",bp->patternBits,bp->ECQBits,bp->_1DIdxBits);} //DEBUG
+      
+      //bp->numOutliers=*(uint16_t*)(&inBuf[15]);
+      //bitPos=17*8;
+      bp->numOutliers=*(uint16_t*)(&inBuf[7]);
+      bitPos=9*8;
+      if(D_R){printf("bp->numOutliers:%d\n",bp->numOutliers);} //DEBUG
+
+      bp->scalesBinSize=1/(float)(((uint64_t)1<<(bp->patternBits-1))-1);
+  
+      bp->binSize=p->usedEb*2;
+      
+      if(D_R){printf("bp->scalesBinSize:%.6e bp->binSize:%.6e bp->scalesBinSize*bp->binSize:%.6e\n",bp->scalesBinSize,bp->binSize,bp->scalesBinSize*bp->binSize);} //DEBUG
+
+      for(j=0;j<p->sbSize;j++){
+        patternQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Pattern point
+        if(D_R){printf("R:patternQ[%d]=%ld\n",j,patternQ[j]);}
+      }
+      for(j=0;j<p->sbNum;j++){
+        scalesQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Scale
+        if(D_R){printf("R:scalesQ[%d]=%ld\n",j,scalesQ[j]);}
+      }
+      
+      /* //Splitting
+      for(j=0;j<p->bSize;j++){
+        data[j]=scalesQ[j/p->sbSize]*patternQ[j%p->sbSize]*bp->scalesBinSize*bp->binSize;
+      }
+      */
+      for(j=0;j<p->bSize;j++){
+        ECQ[j]=0;
+      }
+      switch(bp->ECQBits){
+        case 2:
+          for(j=0;j<bp->numOutliers;j++){
+            //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG
+            //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG
+            
+            _1DIdx=readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits);
+            ECQTemp=readBits_I64(inBuf,&bitPos,1);
+            ECQTemp= ((ECQTemp<<63)>>63)|(uint64_t)0x1;
+            //if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp);
+            //continue;
+            //sb=_1DIdx/p->sbSize; 
+            //localIdx=_1DIdx%p->sbSize;
+            
+            ////data[_1DIdx]-=ECQTemp*bp->binSize;//Splitting
+            ECQ[_1DIdx]=ECQTemp;
+            
+            //if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG
+          }
+          break;
+        default: //bp->ECQBits>2
+          if(D_C){if(!((bp->ECQBits>=2)||((bp->ECQBits==1) && (bp->numOutliers==0)))){printf("ERROR: bp->ECQBits:%d bp->numOutliers:%d This should not have happened!\n",bp->ECQBits,bp->numOutliers);assert(0);}} //DEBUG
+    
+          for(j=0;j<bp->numOutliers;j++){
+            _1DIdx=readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits);
+            //sb=_1DIdx/p->sbSize; 
+            //localIdx=_1DIdx%p->sbSize;
+            temp=readBits_UI64(inBuf,&bitPos,1);
+            //if(DEBUG){printf("temp:%ld\n",temp);} //DEBUG
+            switch(temp){
+              case 0:  //+-1
+                ECQTemp=readBits_I64(inBuf,&bitPos,1);
+                ECQTemp= ((ECQTemp<<63)>>63)|(uint64_t)0x1;
+                //if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG
+                //if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp);
+                break;
+              case 1: //Others
+                ECQTemp=readBits_I64(inBuf,&bitPos,bp->ECQBits);
+                //if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG
+                //if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp);
+                break;
+              //default:
+              //  printf("ERROR: Bad 2-bit value: 0x%lx",temp);
+              // assert(0); //AMG
+              //  break;
+            }
+            
+            //data[_1DIdx]-=ECQTemp*bp->binSize;//Splitting
+            ECQ[_1DIdx]=ECQTemp;
+            
+            //if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG
+          }
+          break;
+      }
+      //static inline uint64_t readBits_UI64(unsigned char* buffer,uint64_t *bitPosPtr,uint64_t numBits){ // numBits must be in range [0:56]
+      //patternQ=(int64_t*)(inBuf+15); 
+      //scalesQ=(int64_t*)(inBuf+15+p->sbSize*8);
+      
+      bytePos=(bitPos+7)/8;
+      if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG
+      
+      //STEP 2: PREDICT DATA(Includes INVERSE QUANTIZATION)
+      pastri_float_PredictData(p,bp,data,patternQ,scalesQ,ECQ);
+
+      break;
+    //R:CNonSparse
+    case 3:
+      if(D_G){printf("\nDC:CNonSparse\n");} //DEBUG
+      
+      //for(j=0;j<p->bSize;j++){
+      //  data[j]=0;
+      //}
+      
+      //bp->patternBits=inBuf[13];
+      //bp->ECQBits=inBuf[14];
+      
+      bp->patternBits=inBuf[5];
+      bp->ECQBits=inBuf[6];
+      
+      if(D_R){printf("bp->patternBits:%d bp->ECQBits:%d bp->_1DIdxBits:%d\n",bp->patternBits,bp->ECQBits,bp->_1DIdxBits);} //DEBUG
+      
+      //bitPos=15*8;
+      bitPos=7*8;
+
+      bp->scalesBinSize=1/(float)(((uint64_t)1<<(bp->patternBits-1))-1);
+      bp->binSize=p->usedEb*2;
+      
+      if(D_R){printf("bp->scalesBinSize:%.6e bp->binSize:%.6e bp->scalesBinSize*bp->binSize:%.6e\n",bp->scalesBinSize,bp->binSize,bp->scalesBinSize*bp->binSize);} //DEBUG
+
+      for(j=0;j<p->sbSize;j++){
+        patternQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Pattern point
+        if(D_R){printf("R:patternQ[%d]=%ld\n",j,patternQ[j]);}
+      }
+      for(j=0;j<p->sbNum;j++){
+        scalesQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Scale
+        if(D_R){printf("R:scalesQ[%d]=%ld\n",j,scalesQ[j]);}
+      }
+      /* //Splitting
+      for(j=0;j<p->bSize;j++){
+        data[j]=scalesQ[j/p->sbSize]*patternQ[j%p->sbSize]*bp->scalesBinSize*bp->binSize;
+        //if(DEBUG){printf("DC:PS[%d]=%.6e\n",j,data[j]);}
+      }
+      */
+      switch(bp->ECQBits){
+        case 2:
+          for(j=0;j<p->bSize;j++){
+            //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG
+            //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG
+            //_1DIdx=readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits);
+            temp=readBits_UI64(inBuf,&bitPos,1);
+            switch(temp){
+              case 0:
+                ECQTemp=readBits_I64(inBuf,&bitPos,1);
+                ECQTemp= ((ECQTemp<<63)>>63)|(uint64_t)0x1;
+                break;
+              case 1:
+                ECQTemp=0;
+                break;
+              default:
+                assert(0);
+                break;
+            }
+            
+            //if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG
+            //continue;
+            //sb=_1DIdx/p->sbSize; 
+            //localIdx=_1DIdx%p->sbSize;
+            
+            //data[j]-=ECQTemp*bp->binSize; //Splitting
+            ECQ[j]=ECQTemp;
+            
+            //if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG
+          }
+          break;
+        default: //bp->ECQBits>2
+          //if(DEBUG)printf("AMG_R1:bitPos: %ld\n",bitPos);
+          
+          for(j=0;j<p->bSize;j++){
+            //if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG
+            //if(DEBUG)printf("AMG_R2:bitPos: %ld\n",bitPos);
+
+            //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG
+            //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG
+            //_1DIdx=readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits);
+            temp=readBits_UI64(inBuf,&bitPos,1);
+            //if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG
+            switch(temp){
+              case 0:
+                //if(DEBUG)printf("Read:0");
+                temp2=readBits_UI64(inBuf,&bitPos,1);
+                switch(temp2){
+                  case 0:
+                    //if(DEBUG)printf("0");
+                    ECQTemp=readBits_I64(inBuf,&bitPos,1);
+                    //if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG
+                    //if(DEBUG)printf("R:ECQTemp:%ld\n",ECQTemp);
+                    ECQTemp= ((ECQTemp<<63)>>63)|(uint64_t)0x1;
+                    //if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp);
+                    break;
+                  case 1:
+                    //if(DEBUG)printf("1\n");
+                    ECQTemp=readBits_I64(inBuf,&bitPos,bp->ECQBits);
+                    //if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG
+                    //if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp);
+                    break;
+                  default:
+                    assert(0);
+                    break;
+                }
+                break;
+              case 1:
+                //if(DEBUG)printf("Read:1\n");
+                ECQTemp=0;
+                //if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp);
+                break;
+              default:
+                assert(0);
+                break;
+            }
+            
+            //if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG
+            //continue;
+            //sb=_1DIdx/p->sbSize; 
+            //localIdx=_1DIdx%p->sbSize;
+            
+            //data[j]-=ECQTemp*bp->binSize; //Splitting
+            ECQ[j]=ECQTemp;
+            
+            //if(DEBUG){printf("DC:data[%d]:%.6e\n",j,data[j]);} //DEBUG
+          }
+          break;
+      }
+      //static inline uint64_t readBits_UI64(unsigned char* buffer,uint64_t *bitPosPtr,uint64_t numBits){ // numBits must be in range [0:56]
+      //patternQ=(int64_t*)(inBuf+15); 
+      //scalesQ=(int64_t*)(inBuf+15+p->sbSize*8);
+      bytePos=(bitPos+7)/8;
+      if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG
+      
+      //STEP 2: PREDICT DATA(Includes INVERSE QUANTIZATION)
+      pastri_float_PredictData(p,bp,data,patternQ,scalesQ,ECQ);
+      break;
+      
+    default:
+      assert(0);
+      break;
+  } 
+  (*numReadBytes)=bytePos;
+}
+
+static inline void pastri_float_Decompress(unsigned char*inBuf,int dataSize,pastri_params *p,unsigned char*outBuf,int *numReadBytes){
+  int64_t patternQ[MAX_PS_SIZE]; 
+  int64_t scalesQ[MAX_PS_SIZE];
+  int64_t ECQ[MAX_BLOCK_SIZE];
+  
+  pastri_blockParams bp;
+  
+  //STEP 1: DECODE (Includes PREDICT DATA(Includes INVERSE QUANTIZATION))
+  //(Further steps are called inside pastri_float_Decode function)
+  pastri_float_Decode(inBuf,p,&bp,outBuf,numReadBytes,patternQ,scalesQ,ECQ);
+
+  return;
+}
+
+//inBuf vs Decompressed
+static inline int pastri_float_Check(unsigned char*inBuf,int dataSize,unsigned char*DC,pastri_params *p){
+  int i;
+  
+  float *data=(float*)(inBuf);
+  float *data_dc=(float*)(DC);
+  
+  //Comparing Indexes:
+  /*
+  for(i=0;i<p->bSize;i++){
+    if(idx0[i]!=idx0_dc[i]){
+      printf("idx0[%d]=%d  !=  %d=idx0_dc[%d]",i,idx0[i],idx0_dc[i],i);
+      assert(0);
+    }
+    if(idx1[i]!=idx1_dc[i]){
+      printf("idx1[%d]=%d  !=  %d=idx1_dc[%d]",i,idx1[i],idx1_dc[i],i);
+      assert(0);
+    }
+    if(idx2[i]!=idx2_dc[i]){
+      printf("idx2[%d]=%d  !=  %d=idx2_dc[%d]",i,idx2[i],idx2_dc[i],i);
+      assert(0);
+    }
+    if(idx3[i]!=idx3_dc[i]){
+      printf("idx3[%d]=%d  !=  %d=idx3_dc[%d]",i,idx3[i],idx3_dc[i],i);
+      assert(0);
+    }
+  }
+  */
+  
+  //Comparing Data:
+  for(i=0;i<p->bSize;i++){
+    if(abs_FastD(data[i]-data_dc[i])>p->usedEb){
+      printf("|data[%d]-data_dc[%d]|>originalEb : %.3e - %.3e = %.3e > %.3e\n",i,i,data[i],data_dc[i],abs_FastD(data[i]-data_dc[i]),p->usedEb);
+      assert(0);
+    }
+  }
+  return 0;
+}
+
+
+#endif
Index: thirdparty/SZ/sz/include/pastriGeneral.h
===================================================================
--- thirdparty/SZ/sz/include/pastriGeneral.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/pastriGeneral.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,205 @@
+#ifndef PASTRIGENERAL_H
+#define PASTRIGENERAL_H
+
+
+static inline double abs_FastD(double x){
+  u_UI64I64D u1;
+  u1.d=x;
+  //(*((uint64_t *)(&x)))&=(int64_t)0x7FFFFFFFFFFFFFFF;
+  u1.ui64&=(int64_t)0x7FFFFFFFFFFFFFFF;
+  return u1.d;
+}
+
+static inline int64_t abs_FastI64(int64_t x){
+  return (x^((x&(int64_t)0x8000000000000000)>>63))+((x&(int64_t)0x8000000000000000)!=0);
+}
+/*
+int abs(int x) {
+   int mask = (x >> (sizeof(int) * CHAR_BIT - 1));
+   return (x + mask) ^ mask;
+}
+*/
+
+
+
+
+//Returns the min. bits needed to represent x.
+//Same as: ceil(log2(abs(x))) 
+//Actually to be completely safe, it correspond to: ceil(log2(abs(i)+1))+0.1
+//+0.1 was for fixing rounding errors
+//REMEMBER: To represent the whole range [-x:x], the number of bits required is bitsNeeded(x)+1
+static inline int bitsNeeded_double(double x){
+  u_UI64I64D u1;
+  u1.d=x;
+  return (((u1.ui64<<1)>>53)-1022) & (((x!=0)<<31)>>31);
+}
+
+//Returns the min. bits needed to represent x.
+//Same as: ceil(log2(abs(x))) 
+//NEEDS OPTIMIZATION!
+static inline int bitsNeeded_float(float x){
+  u_UI64I64D u1;
+  u1.d=x; //Casting to Double!
+  return (((u1.ui64<<1)>>53)-1022) & (((x!=0)<<31)>>31);
+}
+
+static inline int bitsNeeded_UI64(uint64_t x){
+  int shift;
+  int res=0;
+  
+  //Get the absolute value of x:
+  //x=(x^((x&(int64_t)0x8000000000000000)>>63))+((x&(int64_t)0x8000000000000000)!=0);
+  //x=abs_FastI64(x);
+  
+  //printf("%d\n",(x&(uint64_t)0xFFFFFFFF00000000)!=0);
+  shift=(((x&(uint64_t)0xFFFFFFFF00000000)!=0)*32);
+  x>>=shift;
+  res+=shift;
+  
+  //printf("%d\n",(x&(uint64_t)0x00000000FFFF0000)!=0);
+  shift=(((x&(uint64_t)0x00000000FFFF0000)!=0)*16);
+  x>>=shift;
+  res+=shift;
+  
+  //printf("%d\n",(x&(uint64_t)0x000000000000FF00)!=0);
+  shift=(((x&(uint64_t)0x000000000000FF00)!=0)*8);
+  x>>=shift;
+  res+=shift;
+  
+  //printf("%d\n",(x&(uint64_t)0x00000000000000F0)!=0);
+  shift=(((x&(uint64_t)0x00000000000000F0)!=0)*4);
+  x>>=shift;
+  res+=shift;
+  
+  //printf("%d\n",(x&(uint64_t)0x000000000000000C)!=0);
+  shift=(((x&(uint64_t)0x000000000000000C)!=0)*2);
+  x>>=shift;
+  res+=shift;
+  
+  //printf("%d\n",(x&(uint64_t)0x0000000000000002)!=0);
+  shift=((x&(uint64_t)0x0000000000000002)!=0);
+  x>>=shift;
+  res+=shift;
+  
+  //printf("%d\n",(x&(uint64_t)0x0000000000000001)!=0);
+  shift=((x&(uint64_t)0x0000000000000001)!=0);
+  x>>=shift;
+  res+=shift;
+  
+  //printf("BITS NEEDED: %d\n",res);
+  return res;
+}
+
+static inline int bitsNeeded_I64(int64_t x){
+  uint64_t ux;
+  ux=abs_FastI64(x);
+  return bitsNeeded_UI64(ux);
+}
+
+//Implementations(They are inline, so they should be in this header file)
+
+static inline int myEndianType(){ //Should work for most cases. May not work at mixed endian systems.
+  uint64_t n=1;
+  if (*(unsigned char*)&n == 1){
+    //cout<<"Little-Endian"<<endl;
+    return 0;  //0 for little endian
+  }
+  else{
+    //cout<<"Big-Endian"<<endl;
+    return 1; //1 for big endian
+  }
+}
+
+static inline void flipBytes_UI64(uint64_t *dataPtr){
+  unsigned char*tempA;
+  char temp8b;
+  tempA=(unsigned char*)dataPtr;
+  temp8b=tempA[7];
+  tempA[7]=tempA[0];
+  tempA[0]=temp8b;
+  temp8b=tempA[6];
+  tempA[6]=tempA[1];
+  tempA[1]=temp8b;
+  temp8b=tempA[5];
+  tempA[5]=tempA[2];
+  tempA[2]=temp8b;
+  temp8b=tempA[4];
+  tempA[4]=tempA[3];
+  tempA[3]=temp8b;
+  return;
+}
+
+//WARNING: readBits works properly only on Little Endian machines! (For Big Endians, some modifications are needed)
+
+static inline uint64_t readBits_UI64(unsigned char* buffer,uint64_t *bitPosPtr,char numBits){ // numBits must be in range [0:56]
+    uint64_t mask = ((uint64_t)0x0000000000000001<<numBits)-1;
+    //cout<<"bitPos:"<<(*bitPosPtr)<<"\tbitPos>>3:"<<(*bitPosPtr>>3)<<endl;
+    uint64_t temp64b = *(uint64_t*)(buffer + ( *bitPosPtr >> 3)); 
+    //NOTE: bitPos>>3 is the same as bitPos/8
+    temp64b >>= (*bitPosPtr) & (uint64_t)0x0000000000000007;
+    
+    //cout<<endl;
+    //cout<<"bitpos>>3:"<<(bitPos>>3)<<" bitPos&0x7:"<<(bitPos & 0x00000007)<<" bitPos%8:"<<(bitPos%8)<<endl;
+    //cout<<"Read:"<<(temp64b & mask)<<" temp64b:"<<temp64b<<" Mask:"<<mask<<" numBits:"<<numBits<<endl;
+    
+    (*bitPosPtr) += numBits;
+    return (temp64b & mask);
+}
+
+static inline int64_t readBits_I64(unsigned char* buffer,uint64_t *bitPosPtr,char numBits){ // numBits must be in range [0:56]
+  int64_t val;
+  val=readBits_UI64(buffer,bitPosPtr,numBits);//Read value
+  int64_t shiftAmount=64-numBits;
+  val=(val<<shiftAmount)>>shiftAmount;//Sign correction
+  return val;
+}
+
+//WARNING: readBits_EndianSafe is not tested on Big-Endian machines
+static inline uint64_t readBits_EndianSafe(unsigned char* buffer,uint64_t *bitPosPtr,char numBits){ // numBits must be in range [0:56]
+    uint64_t mask = ((uint64_t)0x0000000000000001<<numBits)-1;
+    uint64_t temp64b = *(uint64_t*)(buffer + ((*bitPosPtr)>>3)); 
+    //NOTE: (*bitPosPtr)>>3 is the same as (*bitPosPtr)/8
+    if(myEndianType())
+      flipBytes_UI64(&temp64b);
+    temp64b >>= (*bitPosPtr) & (uint64_t)0x0000000000000007;
+    (*bitPosPtr) += numBits;
+    return temp64b & mask;
+}
+
+//WARNING: writeBits_Fast works properly only on Little Endian machines! (For Big Endians, some modifications are needed)
+//The buffer should be initialized as 0's for this to work!
+//Also, the range of data is not checked!(If data exceeds numBits, it may be cause problems)
+static inline void writeBits_Fast(unsigned char* buffer,uint64_t *bitPosPtr,char numBits,int64_t data){
+    //if(DEBUG){printf("writeBits_Fast: data:0x%lx %ld\n",data,data);} //DEBUG
+    //if(DEBUG){printf("writeBits_Fast: numBits:0x%lx %ld\n",numBits,numBits);} //DEBUG
+    uint64_t mask = ((uint64_t)0x0000000000000001<<numBits)-1;
+    //if(DEBUG){printf("writeBits_Fast: mask:0x%lx %ld\n",mask,mask);} //DEBUG
+    //if(DEBUG){printf("writeBits_Fast: data&mask:0x%lx %ld\n",((*(uint64_t*)&data)&mask),((*(uint64_t*)&data)&mask));} //DEBUG
+    
+    //if(DEBUG){printf("writeBits_Fast: buffer_O:0x%lx\n",*(uint64_t*)(buffer + ((*bitPosPtr)>>3)));} //DEBUG
+    *(uint64_t*)(buffer + ((*bitPosPtr)>>3)) |= ((*(uint64_t*)&data)&mask) << ((*bitPosPtr) & (uint64_t)0x0000000000000007);
+    //if(DEBUG){printf("writeBits_Fast: buffer_N:0x%lx\n",*(uint64_t*)(buffer + ((*bitPosPtr)>>3)));} //DEBUG
+
+    
+    (*bitPosPtr) += numBits;
+}
+
+//WARNING: writeBits_EndianSafe is not tested on Big-Endian machines
+static inline void writeBits_EndianSafe(unsigned char* buffer,uint64_t *bitPosPtr,char numBits,uint64_t data){
+    uint64_t mask = ((uint64_t)0x0000000000000001<<numBits)-1;
+    data=data&mask;
+    uint64_t temp64b_inBuffer=*(uint64_t*)(buffer + ((*bitPosPtr)>>3));
+    uint64_t temp64b_outBuffer=data << ((*bitPosPtr) & (uint64_t)0x0000000000000007);
+    if(myEndianType()){
+      flipBytes_UI64(&temp64b_inBuffer);
+    }
+    temp64b_outBuffer |= temp64b_inBuffer;
+    if(myEndianType()){
+      flipBytes_UI64(&temp64b_outBuffer);
+    }
+    *(uint64_t*)(buffer + ((*bitPosPtr)>>3))=temp64b_outBuffer;  // "|=" may also work
+    (*bitPosPtr) += numBits;
+}
+
+
+#endif
Index: thirdparty/SZ/sz/include/rw.h
===================================================================
--- thirdparty/SZ/sz/include/rw.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/rw.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,89 @@
+/**
+ *  @file io.h
+ *  @author Sheng Di
+ *  @date April, 2015
+ *  @brief Header file for the whole io interface.
+ *  (C) 2015 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _IO_H
+#define _IO_H
+
+#include <stdio.h>
+#include <stdint.h>
+
+#ifdef _WIN32
+#define PATH_SEPARATOR ';'
+#else
+#define PATH_SEPARATOR ':'
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int checkFileExistance(char* filePath);
+
+float** create2DArray_float(size_t m, size_t n);
+void free2DArray_float(float** data, size_t m);
+float*** create3DArray_float(size_t p, size_t m, size_t n);
+void free3DArray_float(float*** data, size_t p, size_t m);
+double** create2DArray_double(size_t m, size_t n);
+void free2DArray_double(double** data, size_t m);
+double*** create3DArray_double(size_t p, size_t m, size_t n);
+void free3DArray_double(double*** data, size_t p, size_t m);
+size_t checkFileSize(char *srcFilePath, int *status);
+
+unsigned char *readByteData(char *srcFilePath, size_t *byteLength, int *status);
+double *readDoubleData(char *srcFilePath, size_t *nbEle, int *status);
+int8_t *readInt8Data(char *srcFilePath, size_t *nbEle, int *status);
+int16_t *readInt16Data(char *srcFilePath, size_t *nbEle, int *status);
+uint16_t *readUInt16Data(char *srcFilePath, size_t *nbEle, int *status);
+int32_t *readInt32Data(char *srcFilePath, size_t *nbEle, int *status);
+uint32_t *readUInt32Data(char *srcFilePath, size_t *nbEle, int *status);
+int64_t *readInt64Data(char *srcFilePath, size_t *nbEle, int *status);
+uint64_t *readUInt64Data(char *srcFilePath, size_t *nbEle, int *status);
+float *readFloatData(char *srcFilePath, size_t *nbEle, int *status);
+unsigned short* readShortData(char *srcFilePath, size_t *dataLength, int *status);
+
+double *readDoubleData_systemEndian(char *srcFilePath, size_t *nbEle, int *status);
+int8_t *readInt8Data_systemEndian(char *srcFilePath, size_t *nbEle, int *status);
+int16_t *readInt16Data_systemEndian(char *srcFilePath, size_t *nbEle, int *status);
+uint16_t *readUInt16Data_systemEndian(char *srcFilePath, size_t *nbEle, int *status);
+int32_t *readInt32Data_systemEndian(char *srcFilePath, size_t *nbEle, int *status);
+uint32_t *readUInt32Data_systemEndian(char *srcFilePath, size_t *nbEle, int *status);
+int64_t *readInt64Data_systemEndian(char *srcFilePath, size_t *nbEle, int *status);
+uint64_t *readUInt64Data_systemEndian(char *srcFilePath, size_t *nbEle, int *status);
+float *readFloatData_systemEndian(char *srcFilePath, size_t *nbEle, int *status);
+
+void writeByteData(unsigned char *bytes, size_t byteLength, char *tgtFilePath, int *status);
+void writeDoubleData(double *data, size_t nbEle, char *tgtFilePath, int *status);
+void writeFloatData(float *data, size_t nbEle, char *tgtFilePath, int *status);
+void writeData(void *data, int dataType, size_t nbEle, char *tgtFilePath, int *status);
+void writeFloatData_inBytes(float *data, size_t nbEle, char* tgtFilePath, int *status);
+void writeDoubleData_inBytes(double *data, size_t nbEle, char* tgtFilePath, int *status);
+void writeShortData_inBytes(short *states, size_t stateLength, char *tgtFilePath, int *status);
+void writeUShortData_inBytes(unsigned short *states, size_t stateLength, char *tgtFilePath, int *status);
+void writeIntData_inBytes(int *states, size_t stateLength, char *tgtFilePath, int *status);
+void writeUIntData_inBytes(unsigned int *states, size_t stateLength, char *tgtFilePath, int *status);
+void writeLongData_inBytes(int64_t *states, size_t stateLength, char *tgtFilePath, int *status);
+void writeULongData_inBytes(uint64_t *states, size_t stateLength, char *tgtFilePath, int *status);
+
+void writeStrings(int nbStr, char *str[], char *tgtFilePath, int *status);
+
+//void convertToPFM_float(float *data, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, int endianType, char *tgtFilePath, int *status);
+
+void checkfilesizec_(char *srcFilePath, int *len, size_t *filesize);
+void readbytefile_(char *srcFilePath, int *len, unsigned char *bytes, size_t *byteLength);
+void readdoublefile_(char *srcFilePath, int *len, double *data, size_t *nbEle);
+void readfloatfile_(char *srcFilePath, int *len, float *data, size_t *nbEle);
+void writebytefile_(unsigned char *bytes, size_t *byteLength, char *tgtFilePath, int *len);
+void writedoublefile_(double *data, size_t *nbEle, char *tgtFilePath, int *len);
+void writefloatfile_(float *data, size_t *nbEle, char *tgtFilePath, int *len);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _IO_H  ----- */
Index: thirdparty/SZ/sz/include/sz.h
===================================================================
--- thirdparty/SZ/sz/include/sz.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/sz.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,379 @@
+/**
+ *  @file sz.h
+ *  @author Sheng Di
+ *  @date April, 2015
+ *  @brief Header file for the whole detector.
+ *  (C) 2015 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZ_H
+#define _SZ_H
+
+#include <stdio.h>
+#include <stdint.h>
+#include <sys/time.h>      /* For gettimeofday(), in microseconds */
+#include <time.h>          /* For time(), in seconds */
+#include "iniparser.h"
+#include "CompressElement.h"
+#include "DynamicByteArray.h"
+#include "DynamicIntArray.h"
+#include "VarSet.h"
+#include "Huffman.h"
+#include "TightDataPointStorageD.h"
+#include "TightDataPointStorageF.h"
+#include "TightDataPointStorageI.h"
+#include "conf.h"
+#include "dataCompression.h"
+#include "ByteToolkit.h"
+#include "TypeManager.h"
+#include "sz_int8.h"
+#include "sz_int16.h"
+#include "sz_int32.h"
+#include "sz_int64.h"
+#include "sz_uint8.h"
+#include "sz_uint16.h"
+#include "sz_uint32.h"
+#include "sz_uint64.h"
+#include "sz_float.h"
+#include "sz_double.h"
+#include "szd_int8.h"
+#include "szd_int16.h"
+#include "szd_int32.h"
+#include "szd_int64.h"
+#include "szd_uint8.h"
+#include "szd_uint16.h"
+#include "szd_uint32.h"
+#include "szd_uint64.h"
+#include "szd_float.h"
+#include "szd_double.h"
+#include "sz_float_pwr.h"
+#include "sz_double_pwr.h"
+#include "callZlib.h"
+#include "rw.h"
+#include "pastri.h"
+#include "sz_float_ts.h"
+#include "szd_float_ts.h"
+
+#ifdef _WIN32
+#define PATH_SEPARATOR ';'
+#else
+#define PATH_SEPARATOR ':'
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//typedef char int8_t;
+//typedef unsigned char uint8_t;
+//typedef short int16_t;
+//typedef unsigned short uint16_t;
+//typedef int int32_t;
+//typedef unsigned int uint32_t;
+//typedef long int64_t;
+//typedef unsigned long uint64_t;
+
+#define SZ_VERNUM 0x0140
+#define SZ_VER_MAJOR 1
+#define SZ_VER_MINOR 4
+#define SZ_VER_BUILD 13
+#define SZ_VER_REVISION 5
+
+#define PASTRI 103
+#define HZ 102
+#define SZ 101
+
+//prediction mode of temporal dimension based compression
+#define SZ_PREVIOUS_VALUE_ESTIMATE 0
+
+#define MIN_NUM_OF_ELEMENTS 20 //if the # elements <= 20, skip the compression
+
+#define ABS 0
+#define REL 1
+#define ABS_AND_REL 2
+#define ABS_OR_REL 3
+#define PSNR 4
+
+#define PW_REL 10
+#define ABS_AND_PW_REL 11
+#define ABS_OR_PW_REL 12
+#define REL_AND_PW_REL 13
+#define REL_OR_PW_REL 14
+
+#define SZ_FLOAT 0
+#define SZ_DOUBLE 1
+#define SZ_UINT8 2
+#define SZ_INT8 3
+#define SZ_UINT16 4
+#define SZ_INT16 5
+#define SZ_UINT32 6
+#define SZ_INT32 7
+#define SZ_UINT64 8
+#define SZ_INT64 9
+
+#define LITTLE_ENDIAN_DATA 0 //refers to the endian type of the data read from the disk
+#define BIG_ENDIAN_DATA 1 //big_endian (ppc, max, etc.) ; little_endian (x86, x64, etc.)
+
+#define LITTLE_ENDIAN_SYSTEM 0 //refers to the endian type of the system
+#define BIG_ENDIAN_SYSTEM 1
+
+#define DynArrayInitLen 1024
+
+#define MIN_ZLIB_DEC_ALLOMEM_BYTES 1000000
+
+//#define maxRangeRadius 32768
+//#define maxRangeRadius 1048576//131072
+
+#define SZ_BEST_SPEED 0
+#define SZ_BEST_COMPRESSION 1
+#define SZ_DEFAULT_COMPRESSION 2
+#define SZ_TEMPORAL_COMPRESSION 3
+
+#define SZ_PWR_MIN_TYPE 0
+#define SZ_PWR_AVG_TYPE 1
+#define SZ_PWR_MAX_TYPE 2
+
+//SUCCESS returning status
+#define SZ_SCES 0  //successful
+#define SZ_NSCS -1 //Not successful
+#define SZ_FERR -2 //Failed to open input file
+#define SZ_TERR -3 //wrong data type (should be only float or double)
+#define SZ_DERR -4 //dimension error
+#define SZ_MERR -5 //sz_mode error
+#define SZ_BERR -6 //bound-mode error (should be only ABS, REL, ABS_AND_REL, ABS_OR_REL, or PW_REL)
+
+#define SZ_MAINTAIN_VAR_DATA 0
+#define SZ_DESTROY_WHOLE_VARSET 1
+
+#define GROUP_COUNT 16 //2^{16}=65536
+	
+#define MetaDataByteLength 20	
+	
+#define numOfBufferedSteps 1 //the number of time steps in the buffer	
+	
+//Note: the following setting should be consistent with stateNum in Huffman.h
+//#define intvCapacity 65536
+//#define intvRadius 32768
+//#define intvCapacity 131072
+//#define intvRadius 65536
+
+#define SZ_COMPUTE_1D_NUMBER_OF_BLOCKS( COUNT, NUM_BLOCKS, BLOCK_SIZE ) \
+    if (COUNT <= BLOCK_SIZE){                  \
+        NUM_BLOCKS = 1;             \
+    }                                   \
+    else{                               \
+        NUM_BLOCKS = COUNT / BLOCK_SIZE;       \
+    }                                   \
+
+#define SZ_COMPUTE_2D_NUMBER_OF_BLOCKS( COUNT, NUM_BLOCKS, BLOCK_SIZE ) \
+    if (COUNT <= BLOCK_SIZE){                   \
+        NUM_BLOCKS = 1;             \
+    }                                   \
+    else{                               \
+        NUM_BLOCKS = COUNT / BLOCK_SIZE;        \
+    }                                   \
+
+#define SZ_COMPUTE_3D_NUMBER_OF_BLOCKS( COUNT, NUM_BLOCKS, BLOCK_SIZE ) \
+    if (COUNT <= BLOCK_SIZE){                   \
+        NUM_BLOCKS = 1;             \
+    }                                   \
+    else{                               \
+        NUM_BLOCKS = COUNT / BLOCK_SIZE;        \
+    }                                   \
+
+#define SZ_COMPUTE_BLOCKCOUNT( COUNT, NUM_BLOCKS, SPLIT_INDEX,       \
+                                       EARLY_BLOCK_COUNT, LATE_BLOCK_COUNT ) \
+    EARLY_BLOCK_COUNT = LATE_BLOCK_COUNT = COUNT / NUM_BLOCKS;               \
+    SPLIT_INDEX = COUNT % NUM_BLOCKS;                                        \
+    if (0 != SPLIT_INDEX) {                                                  \
+        EARLY_BLOCK_COUNT = EARLY_BLOCK_COUNT + 1;                           \
+    }                                                                        \
+
+//typedef unsigned long unsigned long;
+//typedef unsigned int uint;
+
+typedef union lint16
+{
+	unsigned short usvalue;
+	short svalue;
+	unsigned char byte[2];
+} lint16;
+
+typedef union lint32
+{
+	int ivalue;
+	unsigned int uivalue;
+	unsigned char byte[4];
+} lint32;
+
+typedef union lint64
+{
+	long lvalue;
+	unsigned long ulvalue;
+	unsigned char byte[8];
+} lint64;
+
+typedef union ldouble
+{
+    double value;
+    unsigned long lvalue;
+    unsigned char byte[8];
+} ldouble;
+
+typedef union lfloat
+{
+    float value;
+    unsigned int ivalue;
+    unsigned char byte[4];
+} lfloat;
+
+/* array meta data and compression parameters for SZ_Init_Params() */
+typedef struct sz_params
+{
+	int dataType;
+	unsigned int max_quant_intervals; //max number of quantization intervals for quantization
+	unsigned int quantization_intervals; 
+	unsigned int maxRangeRadius;
+	int sol_ID;// it's always SZ, unless the setting is PASTRI compression mode (./configure --enable-pastri)
+	int sampleDistance; //2 bytes
+	float predThreshold;  // 2 bytes
+	int szMode; //* 0 (best speed) or 1 (better compression with Gzip) or 3 temporal-dimension based compression
+	int gzipMode; //* four options: Z_NO_COMPRESSION, or Z_BEST_SPEED, Z_BEST_COMPRESSION, Z_DEFAULT_COMPRESSION
+	int  errorBoundMode; //4bits (0.5byte), //ABS, REL, ABS_AND_REL, or ABS_OR_REL, PSNR, or PW_REL, PSNR
+	double absErrBound; //absolute error bound
+	double relBoundRatio; //value range based relative error bound ratio
+	double psnr; //PSNR
+	double pw_relBoundRatio; //point-wise relative error bound
+	int segment_size; //only used for 2D/3D data compression with pw_relBoundRatio
+	int pwr_type; //only used for 2D/3D data compression with pw_relBoundRatio
+	
+	int snapshotCmprStep; //perform single-snapshot-based compression if time_step == snapshotCmprStep
+	int predictionMode;
+} sz_params;
+
+typedef struct sz_metadata
+{
+	int versionNumber[3]; //only used for checking the version by calling SZ_GetMetaData()
+	int isConstant; //only used for checking if the data are constant values by calling SZ_GetMetaData()
+	int isLossless; //only used for checking if the data compression was lossless, used only by calling SZ_GetMetaData()
+	int sizeType; //only used for checking whether the size type is "int" or "long" in the compression, used only by calling SZ_GetMetaData()
+	size_t dataSeriesLength; //# number of data points in the dataset
+	int defactoNBBins; //real number of quantization bins
+	struct sz_params* conf_params; //configuration parameters
+} sz_metadata;
+
+typedef struct sz_exedata
+{
+	char optQuantMode;	//opt Quantization (0: fixed ; 1: optimized)	
+	int intvCapacity; // the number of intervals for the linear-scaling quantization
+	int intvRadius;  // the number of intervals for the radius of the quantization range (intvRadius=intvCapacity/2)
+	int SZ_SIZE_TYPE; //the length (# bytes) of the size_t in the system at runtime //4 or 8: sizeof(size_t) 
+} sz_exedata;
+
+/*We use a linked list to maintain time-step meta info for time-step based compression*/
+typedef struct sz_tsc_metainfo
+{
+	int totalNumOfSteps;
+	int currentStep;
+	char metadata_filename[256];
+	FILE *metadata_file;
+} sz_tsc_metadata;
+
+extern int versionNumber[4];
+
+//-------------------key global variables--------------
+extern int dataEndianType; //*endian type of the data read from disk
+extern int sysEndianType; //*sysEndianType is actually set automatically.
+
+extern sz_params *confparams_cpr;
+extern sz_params *confparams_dec;
+extern sz_exedata *exe_params;
+//------------------------------------------------
+extern SZ_VarSet* sz_varset;
+extern sz_multisteps *multisteps; //compression based on multiple time steps (time-dimension based compression)
+extern sz_tsc_metadata *sz_tsc;
+
+//for pastri 
+#ifdef PASTRI
+extern pastri_params pastri_par; 
+#endif
+
+//sz.h
+HuffmanTree* SZ_Reset();
+
+int SZ_Init(const char *configFilePath);
+
+int SZ_Init_Params(sz_params *params);
+
+size_t computeDataLength(size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
+
+int computeDimension(size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
+
+int SZ_compress_args_float_subblock(unsigned char* compressedBytes, float *oriData,
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1,
+size_t s5, size_t s4, size_t s3, size_t s2, size_t s1,
+size_t e5, size_t e4, size_t e3, size_t e2, size_t e1,
+size_t *outSize, int errBoundMode, double absErr_Bound, double relBoundRatio);
+
+int SZ_compress_args_double_subblock(unsigned char* compressedBytes, double *oriData,
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1,
+size_t s5, size_t s4, size_t s3, size_t s2, size_t s1,
+size_t e5, size_t e4, size_t e3, size_t e2, size_t e1,
+size_t *outSize, int errBoundMode, double absErr_Bound, double relBoundRatio);
+
+unsigned char *SZ_compress(int dataType, void *data, size_t *outSize, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
+
+unsigned char* SZ_compress_args(int dataType, void *data, size_t *outSize, int errBoundMode, double absErrBound, 
+double relBoundRatio, double pwrBoundRatio, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
+
+int SZ_compress_args2(int dataType, void *data, unsigned char* compressed_bytes, size_t *outSize, 
+int errBoundMode, double absErrBound, double relBoundRatio, double pwrBoundRatio, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
+
+int SZ_compress_args3(int dataType, void *data, unsigned char* compressed_bytes, size_t *outSize, int errBoundMode, double absErrBound, double relBoundRatio, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1,
+size_t s5, size_t s4, size_t s3, size_t s2, size_t s1,
+size_t e5, size_t e4, size_t e3, size_t e2, size_t e1);
+
+unsigned char *SZ_compress_rev_args(int dataType, void *data, void *reservedValue, size_t *outSize, int errBoundMode, double absErrBound, double relBoundRatio, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
+
+int SZ_compress_rev_args2(int dataType, void *data, void *reservedValue, unsigned char* compressed_bytes, size_t *outSize, int errBoundMode, double absErrBound, double relBoundRatio, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
+unsigned char *SZ_compress_rev(int dataType, void *data, void *reservedValue, size_t *outSize, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
+
+void SZ_Create_ParamsExe(sz_params** conf_params, sz_exedata** exe_params);
+
+void *SZ_decompress(int dataType, unsigned char *bytes, size_t byteLength, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
+size_t SZ_decompress_args(int dataType, unsigned char *bytes, size_t byteLength, void* decompressed_array, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
+
+sz_metadata* SZ_getMetadata(unsigned char* bytes);
+void SZ_printMetadata(sz_metadata* metadata);
+
+
+void filloutDimArray(size_t* dim, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
+
+size_t compute_total_batch_size();
+
+int isZlibFormat(unsigned char magic1, unsigned char magic2);
+
+void SZ_registerVar(char* varName, int dataType, void* data, 
+			int errBoundMode, double absErrBound, double relBoundRatio, double pwRelBoundRatio, 
+			size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
+int SZ_deregisterVar(char* varName);
+int SZ_deregisterAllVars();
+
+int SZ_compress_ts(unsigned char** newByteData, size_t *outSize);
+void SZ_decompress_ts(unsigned char *bytes, size_t byteLength);
+
+void SZ_Finalize();
+
+void convertSZParamsToBytes(sz_params* params, unsigned char* result);
+sz_params* convertBytesToSZParams(unsigned char* bytes);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZ_H  ----- */
Index: thirdparty/SZ/sz/include/sz_double.h
===================================================================
--- thirdparty/SZ/sz/include/sz_double.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/sz_double.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,83 @@
+/**
+ *  @file sz_double.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the sz_double.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZ_Double_H
+#define _SZ_Double_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+unsigned char* SZ_skip_compress_double(double* data, size_t dataLength, size_t* outSize);
+
+void computeReqLength_double(double realPrecision, short radExpo, int* reqLength, double* medianValue);
+unsigned int optimize_intervals_double_1D(double *oriData, size_t dataLength, double realPrecision);
+unsigned int optimize_intervals_double_2D(double *oriData, size_t r1, size_t r2, double realPrecision);
+unsigned int optimize_intervals_double_3D(double *oriData, size_t r1, size_t r2, size_t r3, double realPrecision);
+unsigned int optimize_intervals_double_4D(double *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision);
+
+unsigned int optimize_intervals_double_3D_opt(double *oriData, size_t r1, size_t r2, size_t r3, double realPrecision);
+unsigned int optimize_intervals_double_2D_opt(double *oriData, size_t r1, size_t r2, double realPrecision);
+unsigned int optimize_intervals_double_1D_opt(double *oriData, size_t dataLength, double realPrecision);
+
+TightDataPointStorageD* SZ_compress_double_1D_MDQ(double *oriData, 
+size_t dataLength, double realPrecision, double valueRangeSize, double medianValue_d);
+void SZ_compress_args_double_StoreOriData(double* oriData, size_t dataLength, TightDataPointStorageD* tdps, unsigned char** newByteData, size_t *outSize);
+
+char SZ_compress_args_double_NoCkRngeNoGzip_1D(unsigned char** newByteData, double *oriData, size_t dataLength, double realPrecision, size_t *outSize, double valueRangeSize, double medianValue_d);
+
+TightDataPointStorageD* SZ_compress_double_2D_MDQ(double *oriData, size_t r1, size_t r2, double realPrecision, double valueRangeSize, double medianValue_d);
+char SZ_compress_args_double_NoCkRngeNoGzip_2D(unsigned char** newByteData, double *oriData, size_t r1, size_t r2, double realPrecision, size_t *outSize, double valueRangeSize, double medianValue_d);
+
+TightDataPointStorageD* SZ_compress_double_3D_MDQ(double *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, double valueRangeSize, double medianValue_d);
+char SZ_compress_args_double_NoCkRngeNoGzip_3D(unsigned char** newByteData, double *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t *outSize, double valueRangeSize, double medianValue_d);
+
+TightDataPointStorageD* SZ_compress_double_4D_MDQ(double *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, double valueRangeSize, double medianValue_d);
+char SZ_compress_args_double_NoCkRngeNoGzip_4D(unsigned char** newByteData, double *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, size_t *outSize, double valueRangeSize, double medianValue_d);
+
+void SZ_compress_args_double_withinRange(unsigned char** newByteData, double *oriData, size_t dataLength, size_t *outSize);
+
+int SZ_compress_args_double_wRngeNoGzip(unsigned char** newByteData, double *oriData, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, 
+int errBoundMode, double absErr_Bound, double relBoundRatio, double pwrErrRatio);
+
+int SZ_compress_args_double(unsigned char** newByteData, double *oriData, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, 
+int errBoundMode, double absErr_Bound, double relBoundRatio, double pwRelBoundRatio);
+
+void SZ_compress_args_double_NoCkRnge_1D_subblock(unsigned char* compressedBytes, double *oriData, double realPrecision, size_t *outSize, double valueRangeSize, double medianValue_d,
+size_t r1, size_t s1, size_t e1);
+void SZ_compress_args_double_NoCkRnge_2D_subblock(unsigned char* compressedBytes, double *oriData, double realPrecision, size_t *outSize, double valueRangeSize, double medianValue_d,
+size_t r2, size_t r1, size_t s2, size_t s1, size_t e2, size_t e1);
+void SZ_compress_args_double_NoCkRnge_3D_subblock(unsigned char* compressedBytes, double *oriData, double realPrecision, size_t *outSize, double valueRangeSize, double medianValue_d,
+size_t r3, size_t r2, size_t r1, size_t s3, size_t s2, size_t s1, size_t e3, size_t e2, size_t e1);
+void SZ_compress_args_double_NoCkRnge_4D_subblock(unsigned char* compressedBytes, double *oriData, double realPrecision, size_t *outSize, double valueRangeSize, double medianValue_d,
+size_t r4, size_t r3, size_t r2, size_t r1, size_t s4, size_t s3, size_t s2, size_t s1, size_t e4, size_t e3, size_t e2, size_t e1);
+
+unsigned int optimize_intervals_double_1D_subblock(double *oriData, double realPrecision, size_t r1, size_t s1, size_t e1);
+unsigned int optimize_intervals_double_2D_subblock(double *oriData, double realPrecision, size_t r1, size_t r2, size_t s1, size_t s2, size_t e1, size_t e2);
+unsigned int optimize_intervals_double_3D_subblock(double *oriData, double realPrecision, size_t r1, size_t r2, size_t r3, size_t s1, size_t s2, size_t s3, size_t e1, size_t e2, size_t e3);
+unsigned int optimize_intervals_double_4D_subblock(double *oriData, double realPrecision, size_t r1, size_t r2, size_t r3, size_t r4, size_t s1, size_t s2, size_t s3, size_t s4, size_t e1, size_t e2, size_t e3, size_t e4);
+
+TightDataPointStorageD* SZ_compress_double_1D_MDQ_subblock(double *oriData, double realPrecision, double valueRangeSize, double medianValue_d,
+size_t r1, size_t s1, size_t e1);
+TightDataPointStorageD* SZ_compress_double_2D_MDQ_subblock(double *oriData, double realPrecision, double valueRangeSize, double medianValue_d,
+size_t r1, size_t r2, size_t s1, size_t s2, size_t e1, size_t e2);
+TightDataPointStorageD* SZ_compress_double_3D_MDQ_subblock(double *oriData, double realPrecision, double valueRangeSize, double medianValue_d,
+size_t r1, size_t r2, size_t r3, size_t s1, size_t s2, size_t s3, size_t e1, size_t e2, size_t e3);
+TightDataPointStorageD* SZ_compress_double_4D_MDQ_subblock(double *oriData, double realPrecision, double valueRangeSize, double medianValue_d,
+size_t r1, size_t r2, size_t r3, size_t r4, size_t s1, size_t s2, size_t s3, size_t s4, size_t e1, size_t e2, size_t e3, size_t e4);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZ_Double_H  ----- */
+
Index: thirdparty/SZ/sz/include/sz_double_pwr.h
===================================================================
--- thirdparty/SZ/sz/include/sz_double_pwr.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/sz_double_pwr.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,45 @@
+/**
+ *  @file sz_double.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the sz_double.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZ_Double_PWR_H
+#define _SZ_Double_PWR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+void compute_segment_precisions_double_1D(double *oriData, size_t dataLength, double* pwrErrBound, unsigned char* pwrErrBoundBytes, double globalPrecision);
+unsigned int optimize_intervals_double_1D_pwr(double *oriData, size_t dataLength, double* pwrErrBound); 
+void compute_segment_precisions_double_2D(double *oriData, double* pwrErrBound, 
+size_t r1, size_t r2, size_t R2, size_t edgeSize, unsigned char* pwrErrBoundBytes, double Min, double Max, double globalPrecision);
+unsigned int optimize_intervals_double_2D_pwr(double *oriData, size_t r1, size_t r2, size_t R2, size_t edgeSize, double* pwrErrBound);
+void compute_segment_precisions_double_3D(double *oriData, double* pwrErrBound, 
+size_t r1, size_t r2, size_t r3, size_t R2, size_t R3, size_t edgeSize, unsigned char* pwrErrBoundBytes, double Min, double Max, double globalPrecision);
+unsigned int optimize_intervals_double_3D_pwr(double *oriData, size_t r1, size_t r2, size_t r3, size_t R2, size_t R3, size_t edgeSize, double* pwrErrBound);
+void SZ_compress_args_double_NoCkRngeNoGzip_1D_pwr(unsigned char** newByteData, double *oriData, double globalPrecision, size_t dataLength, size_t *outSize, double min, double max);
+void SZ_compress_args_double_NoCkRngeNoGzip_2D_pwr(unsigned char** newByteData, double *oriData, double globalPrecision, size_t r1, size_t r2,
+size_t *outSize, double min, double max);
+void SZ_compress_args_double_NoCkRngeNoGzip_3D_pwr(unsigned char** newByteData, double *oriData, double globalPrecision, 
+size_t r1, size_t r2, size_t r3, size_t *outSize, double min, double max);
+
+void createRangeGroups_double(double** posGroups, double** negGroups, int** posFlags, int** negFlags);
+void compressGroupIDArray_double(char* groupID, TightDataPointStorageD* tdps);
+TightDataPointStorageD* SZ_compress_double_1D_MDQ_pwrGroup(double* oriData, size_t dataLength, int errBoundMode, 
+double absErrBound, double relBoundRatio, double pwrErrRatio, double valueRangeSize, double medianValue_f);
+void SZ_compress_args_double_NoCkRngeNoGzip_1D_pwrgroup(unsigned char** newByteData, double *oriData,
+size_t dataLength, double absErrBound, double relBoundRatio, double pwrErrRatio, double valueRangeSize, double medianValue_f, size_t *outSize);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZ_Double_PWR_H  ----- */
+
Index: thirdparty/SZ/sz/include/sz_double_ts.h
===================================================================
--- thirdparty/SZ/sz/include/sz_double_ts.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/sz_double_ts.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,27 @@
+/**
+ *  @file sz_double_ts.h
+ *  @author Sheng Di
+ *  @date May, 2018
+ *  @brief Header file for the sz_double_ts.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+#include "TightDataPointStorageD.h"
+
+#ifndef _SZ_Double_TS_H
+#define _SZ_Double_TS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+unsigned int optimize_intervals_double_1D_ts(double *oriData, size_t dataLength, double* preData, double realPrecision);
+
+TightDataPointStorageD* SZ_compress_double_1D_MDQ_ts(double *oriData, size_t dataLength, sz_multisteps* multisteps,
+double realPrecision, double valueRangeSize, double medianValue_d);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZ_Double_TS_H  ----- */
+
Index: thirdparty/SZ/sz/include/sz_float.h
===================================================================
--- thirdparty/SZ/sz/include/sz_float.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/sz_float.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,136 @@
+/**
+ *  @file sz_float.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the sz_float.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+#include "DynamicFloatArray.h"
+
+#ifndef _SZ_Float_H
+#define _SZ_Float_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+unsigned char* SZ_skip_compress_float(float* data, size_t dataLength, size_t* outSize);
+
+void computeReqLength_float(double realPrecision, short radExpo, int* reqLength, float* medianValue);
+
+unsigned int optimize_intervals_float_1D(float *oriData, size_t dataLength, double realPrecision);
+unsigned int optimize_intervals_float_2D(float *oriData, size_t r1, size_t r2, double realPrecision);
+unsigned int optimize_intervals_float_3D(float *oriData, size_t r1, size_t r2, size_t r3, double realPrecision);
+unsigned int optimize_intervals_float_4D(float *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision);
+
+unsigned int optimize_intervals_and_compute_dense_position_float_1D(float *oriData, size_t dataLength, double realPrecision, float * dense_pos);
+unsigned int optimize_intervals_and_compute_dense_position_float_3D(float *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, float * dense_pos);
+unsigned int optimize_intervals_float_3D_with_freq_and_dense_pos(float *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, float * dense_pos, float * max_freq, float * mean_freq);
+unsigned int optimize_intervals_float_3D_opt(float *oriData, size_t r1, size_t r2, size_t r3, double realPrecision);
+unsigned int optimize_intervals_float_2D_opt(float *oriData, size_t r1, size_t r2, double realPrecision);
+unsigned int optimize_intervals_float_1D_opt(float *oriData, size_t dataLength, double realPrecision);
+
+
+TightDataPointStorageF* SZ_compress_float_1D_MDQ(float *oriData, 
+size_t dataLength, double realPrecision, float valueRangeSize, float medianValue_f);
+
+void SZ_compress_args_float_StoreOriData(float* oriData, size_t dataLength, TightDataPointStorageF* tdps, 
+unsigned char** newByteData, size_t *outSize);
+
+char SZ_compress_args_float_NoCkRngeNoGzip_1D(unsigned char** newByteData, float *oriData, 
+size_t dataLength, double realPrecision, size_t *outSize, float valueRangeSize, float medianValue_f);
+
+TightDataPointStorageF* SZ_compress_float_2D_MDQ(float *oriData, size_t r1, size_t r2, double realPrecision, float valueRangeSize, float medianValue_f);
+
+char SZ_compress_args_float_NoCkRngeNoGzip_2D(unsigned char** newByteData, float *oriData, size_t r1, size_t r2, double realPrecision, size_t *outSize, float valueRangeSize, float medianValue_f);
+
+TightDataPointStorageF* SZ_compress_float_3D_MDQ(float *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, float valueRangeSize, float medianValue_f);
+
+char SZ_compress_args_float_NoCkRngeNoGzip_3D(unsigned char** newByteData, float *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t *outSize, float valueRangeSize, float medianValue_f);
+
+size_t SZ_compress_float_1D_MDQ_RA_block(float * block_ori_data, float * mean, size_t dim_0, size_t block_dim_0, double realPrecision, int * type, float * unpredictable_data);
+size_t SZ_compress_float_2D_MDQ_RA_block(float * block_ori_data, float * mean, size_t dim_0, size_t dim_1, size_t block_dim_0, size_t block_dim_1, double realPrecision, float * P0, float * P1, int * type, float * unpredictable_data);
+
+size_t SZ_compress_float_1D_MDQ_RA_block_1D_pred(float * block_ori_data, float * mean, float dense_pos, size_t dim_0, size_t block_dim_0, double realPrecision, int * type, DynamicFloatArray * unpredictable_data);
+size_t SZ_compress_float_2D_MDQ_RA_block_2D_pred(float * block_ori_data, float * mean, float dense_pos, size_t dim_0, size_t dim_1, size_t block_dim_0, size_t block_dim_1, double realPrecision, float * P0, float * P1, int * type, float * unpredictable_data);
+size_t SZ_compress_float_3D_MDQ_RA_block(float * block_ori_data, float * mean, size_t dim_0, size_t dim_1, size_t dim_2, size_t block_dim_0, size_t block_dim_1, size_t block_dim_2, double realPrecision, float * P0, float * P1, int * type, float * unpredictable_data);
+size_t SZ_compress_float_3D_MDQ_RA_block_3D_pred(float * block_ori_data, float * mean, float dense_pos, size_t dim_0, size_t dim_1, size_t dim_2, size_t block_dim_0, size_t block_dim_1, size_t block_dim_2, double realPrecision, float * P0, float * P1, int * type, float * unpredictable_data);
+size_t SZ_compress_float_3D_MDQ_RA_block_adaptive(float * block_ori_data, float * mean, size_t dim_0, size_t dim_1, size_t dim_2, size_t block_dim_0, size_t block_dim_1, size_t block_dim_2, double realPrecision, float * P0, float * P1, int * type, float * unpredictable_data);
+//unsigned short SZ_compress_float_3D_MDQ_RA_block_1D_pred(float * block_ori_data, float * mean, float dense_pos, size_t dim_0, size_t dim_1, size_t dim_2, int block_dim_0, int block_dim_1, int block_dim_2, double realPrecision, int * type, float * unpredictable_data);
+size_t SZ_compress_float_3D_MDQ_RA_block_3D_pred_flush_after_compare(float * block_ori_data, float * mean, float dense_pos, size_t dim_0, size_t dim_1, size_t dim_2, size_t block_dim_0, size_t block_dim_1, size_t block_dim_2, double realPrecision, float * P0, float * P1, int * type, float * unpredictable_data);
+size_t SZ_compress_float_3D_MDQ_RA_block_2_layers(float * block_ori_data, float * mean, size_t dim_0, size_t dim_1, size_t dim_2, size_t block_dim_0, size_t block_dim_1, size_t block_dim_2, double realPrecision, float * P0, float * P1, float * P_, int * type, float * unpredictable_data);
+size_t SZ_compress_float_3D_MDQ_pred_by_regression(float * block_ori_data, size_t dim_0, size_t dim_1, size_t dim_2, size_t block_dim_0, size_t block_dim_1, size_t block_dim_2, double realPrecision, float * reg_params, int * type, float * unpredictable_data);
+void SZ_blocked_regression(float * block_ori_data, size_t dim_0, size_t dim_1, size_t dim_2, size_t block_dim_0, size_t block_dim_1, size_t block_dim_2, float *params);
+unsigned char * SZ_compress_float_3D_MDQ_RA_all_by_regression(float *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t * comp_size);
+float SZ_compress_float_3D_MDQ_RA_block_no_mean(float * block_ori_data, size_t dim_0, size_t dim_1, size_t dim_2, size_t block_dim_0, size_t block_dim_1, size_t block_dim_2, double realPrecision, float * P0, float * P1, int * type, unsigned short * unpred_count, float * unpredictable_data);
+float SZ_compress_float_3D_MDQ_pred_by_regression_with_err(float * block_ori_data, size_t dim_0, size_t dim_1, size_t dim_2, size_t block_dim_0, size_t block_dim_1, size_t block_dim_2, double realPrecision, float * reg_params, int * type, unsigned short * unpred_count, float * unpredictable_data);
+unsigned char * SZ_compress_float_3D_MDQ_RA_blocked_with_regression(float *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t * comp_size);
+void decompressDataSeries_float_3D_RA_blocked_with_regression(float** data, size_t r1, size_t r2, size_t r3, unsigned char* comp_data);
+
+unsigned char * SZ_compress_float_1D_MDQ_RA(float *oriData, size_t r1, double realPrecision, size_t * comp_size);
+unsigned char * SZ_compress_float_2D_MDQ_RA(float *oriData, size_t r1, size_t r2, double realPrecision, size_t * comp_size);
+unsigned char * SZ_compress_float_2D_MDQ_nonblocked(float *oriData, size_t r1, size_t r2, double realPrecision, size_t * comp_size);
+unsigned char * SZ_compress_float_3D_MDQ_RA(float *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t * comp_size);
+unsigned char * SZ_compress_float_3D_MDQ_nonblocked(float *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t * comp_size);
+unsigned char * SZ_compress_float_3D_MDQ_nonblocked_ori(float *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t * comp_size);
+unsigned char * SZ_compress_float_3D_MDQ_nonblocked_multi_means(float *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t * comp_size);
+unsigned char * SZ_compress_float_3D_MDQ_RA_multi_means(float *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t * comp_size);
+unsigned char * SZ_compress_float_3D_MDQ_nonblocked_adaptive(float *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t * comp_size);
+unsigned char * SZ_compress_float_3D_MDQ_nonblocked_with_blocked_regression(float *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t * comp_size);
+unsigned char * SZ_compress_float_2D_MDQ_nonblocked_with_blocked_regression(float *oriData, size_t r1, size_t r2, double realPrecision, size_t * comp_size);
+
+TightDataPointStorageF* SZ_compress_float_4D_MDQ(float *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, float valueRangeSize, float medianValue_f);
+
+char SZ_compress_args_float_NoCkRngeNoGzip_4D(unsigned char** newByteData, float *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, size_t *outSize, float valueRangeSize, float medianValue_f);
+
+void SZ_compress_args_float_withinRange(unsigned char** newByteData, float *oriData, size_t dataLength, size_t *outSize);
+
+int SZ_compress_args_float_wRngeNoGzip(unsigned char** newByteData, float *oriData, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, 
+int errBoundMode, double absErr_Bound, double relBoundRatio, double pwrErrRatio);
+
+int SZ_compress_args_float(unsigned char** newByteData, float *oriData, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, 
+int errBoundMode, double absErr_Bound, double relBoundRatio, double pwRelBoundRatio);
+
+int SZ_compress_args_float_subblock(unsigned char* compressedBytes, float *oriData,
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1,
+size_t s5, size_t s4, size_t s3, size_t s2, size_t s1,
+size_t e5, size_t e4, size_t e3, size_t e2, size_t e1,
+size_t *outSize, int errBoundMode, double absErr_Bound, double relBoundRatio);
+
+void SZ_compress_args_float_NoCkRnge_1D_subblock(unsigned char* compressedBytes, float *oriData, double realPrecision, size_t *outSize, float valueRangeSize, float medianValue_f,
+size_t r1, size_t s1, size_t e1); 
+
+void SZ_compress_args_float_NoCkRnge_2D_subblock(unsigned char* compressedBytes, float *oriData, double realPrecision, size_t *outSize, float valueRangeSize, float medianValue_f,
+size_t r2, size_t r1, size_t s2, size_t s1, size_t e2, size_t e1); 
+
+void SZ_compress_args_float_NoCkRnge_3D_subblock(unsigned char* compressedBytes, float *oriData, double realPrecision, size_t *outSize, float valueRangeSize, float medianValue_f,
+size_t r3, size_t r2, size_t r1, size_t s3, size_t s2, size_t s1, size_t e3, size_t e2, size_t e1); 
+
+void SZ_compress_args_float_NoCkRnge_4D_subblock(unsigned char* compressedBytes, float *oriData, double realPrecision, size_t *outSize, float valueRangeSize, float medianValue_f,
+size_t r4, size_t r3, size_t r2, size_t r1, size_t s4, size_t s3, size_t s2, size_t s1, size_t e4, size_t e3, size_t e2, size_t e1);
+
+unsigned int optimize_intervals_float_1D_subblock(float *oriData, double realPrecision, size_t r1, size_t s1, size_t e1); 
+unsigned int optimize_intervals_float_2D_subblock(float *oriData, double realPrecision, size_t r1, size_t r2, size_t s1, size_t s2, size_t e1, size_t e2); 
+unsigned int optimize_intervals_float_3D_subblock(float *oriData, double realPrecision, size_t r1, size_t r2, size_t r3, size_t s1, size_t s2, size_t s3, size_t e1, size_t e2, size_t e3); 
+unsigned int optimize_intervals_float_4D_subblock(float *oriData, double realPrecision, size_t r1, size_t r2, size_t r3, size_t r4, size_t s1, size_t s2, size_t s3, size_t s4, size_t e1, size_t e2, size_t e3, size_t e4);
+
+TightDataPointStorageF* SZ_compress_float_1D_MDQ_subblock(float *oriData, double realPrecision, float valueRangeSize, float medianValue_f,
+size_t r1, size_t s1, size_t e1); 
+
+TightDataPointStorageF* SZ_compress_float_2D_MDQ_subblock(float *oriData, double realPrecision, float valueRangeSize, float medianValue_f,
+size_t r1, size_t r2, size_t s1, size_t s2, size_t e1, size_t e2); 
+
+TightDataPointStorageF* SZ_compress_float_3D_MDQ_subblock(float *oriData, double realPrecision, float valueRangeSize, float medianValue_f,
+size_t r1, size_t r2, size_t r3, size_t s1, size_t s2, size_t s3, size_t e1, size_t e2, size_t e3); 
+
+TightDataPointStorageF* SZ_compress_float_4D_MDQ_subblock(float *oriData, double realPrecision, float valueRangeSize, float medianValue_f,
+size_t r1, size_t r2, size_t r3, size_t r4, size_t s1, size_t s2, size_t s3, size_t s4, size_t e1, size_t e2, size_t e3, size_t e4);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZ_Float_H  ----- */
+
Index: thirdparty/SZ/sz/include/sz_float_pwr.h
===================================================================
--- thirdparty/SZ/sz/include/sz_float_pwr.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/sz_float_pwr.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,52 @@
+/**
+ *  @file sz_float.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the sz_float.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZ_Float_PWR_H
+#define _SZ_Float_PWR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void compute_segment_precisions_float_1D(float *oriData, size_t dataLength, float* pwrErrBound, unsigned char* pwrErrBoundBytes, double globalPrecision);
+unsigned int optimize_intervals_float_1D_pwr(float *oriData, size_t dataLength, float* pwrErrBound);
+
+void compute_segment_precisions_float_2D(float *oriData, float* pwrErrBound, 
+size_t r1, size_t r2, size_t R2, size_t edgeSize, unsigned char* pwrErrBoundBytes, float Min, float Max, double globalPrecision);
+
+unsigned int optimize_intervals_float_2D_pwr(float *oriData, size_t r1, size_t r2, size_t R2, size_t edgeSize, float* pwrErrBound); 
+
+void compute_segment_precisions_float_3D(float *oriData, float* pwrErrBound, 
+size_t r1, size_t r2, size_t r3, size_t R2, size_t R3, size_t edgeSize, unsigned char* pwrErrBoundBytes, float Min, float Max, double globalPrecision);
+
+unsigned int optimize_intervals_float_3D_pwr(float *oriData, size_t r1, size_t r2, size_t r3, size_t R2, size_t R3, size_t edgeSize, float* pwrErrBound);
+
+void SZ_compress_args_float_NoCkRngeNoGzip_1D_pwr(unsigned char** newByteData, float *oriData, double globalPrecision, size_t dataLength, size_t *outSize, float min, float max);
+
+void SZ_compress_args_float_NoCkRngeNoGzip_2D_pwr(unsigned char** newByteData, float *oriData, double globalPrecision, size_t r1, size_t r2, 
+size_t *outSize, float min, float max);
+
+void SZ_compress_args_float_NoCkRngeNoGzip_3D_pwr(unsigned char** newByteData, float *oriData, double globalPrecision, size_t r1, size_t r2, 
+size_t r3, size_t *outSize, float min, float max);
+
+void createRangeGroups_float(float** posGroups, float** negGroups, int** posFlags, int** negFlags);
+void compressGroupIDArray_float(char* groupID, TightDataPointStorageF* tdps);
+int* generateGroupLowerBounds();
+TightDataPointStorageF* SZ_compress_float_1D_MDQ_pwrGroup(float* oriData, size_t dataLength, int errBoundMode, 
+double absErrBound, double relBoundRatio, double pwrErrRatio, float valueRangeSize, float medianValue_f);
+
+void SZ_compress_args_float_NoCkRngeNoGzip_1D_pwrgroup(unsigned char** newByteData, float *oriData,
+size_t dataLength, double absErrBound, double relBoundRatio, double pwrErrRatio, float valueRangeSize, float medianValue_f, size_t *outSize);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZ_Float_PWR_H  ----- */
+
Index: thirdparty/SZ/sz/include/sz_float_ts.h
===================================================================
--- thirdparty/SZ/sz/include/sz_float_ts.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/sz_float_ts.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,27 @@
+/**
+ *  @file sz_float_ts.h
+ *  @author Sheng Di
+ *  @date May, 2018
+ *  @brief Header file for the sz_float_ts.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+#include "TightDataPointStorageF.h"
+
+#ifndef _SZ_Float_TS_H
+#define _SZ_Float_TS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+unsigned int optimize_intervals_float_1D_ts(float *oriData, size_t dataLength, float* preData, double realPrecision);
+
+TightDataPointStorageF* SZ_compress_float_1D_MDQ_ts(float *oriData, size_t dataLength, sz_multisteps* multisteps,
+double realPrecision, float valueRangeSize, float medianValue_f);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZ_Float_TS_H  ----- */
+
Index: thirdparty/SZ/sz/include/sz_int16.h
===================================================================
--- thirdparty/SZ/sz/include/sz_int16.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/sz_int16.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,48 @@
+/**
+ *  @file sz_int16.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the sz_int16.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZ_Int16_H
+#define _SZ_Int16_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+unsigned int optimize_intervals_int16_1D(int16_t *oriData, size_t dataLength, double realPrecision);
+unsigned int optimize_intervals_int16_2D(int16_t *oriData, size_t r1, size_t r2, double realPrecision);
+unsigned int optimize_intervals_int16_3D(int16_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision);
+unsigned int optimize_intervals_int16_4D(int16_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision);
+TightDataPointStorageI* SZ_compress_int16_1D_MDQ(int16_t *oriData, size_t dataLength, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_int16_StoreOriData(int16_t* oriData, size_t dataLength, TightDataPointStorageI* tdps, unsigned char** newByteData, size_t *outSize);
+void SZ_compress_args_int16_NoCkRngeNoGzip_1D(unsigned char** newByteData, int16_t *oriData, 
+size_t dataLength, double realPrecision, size_t *outSize, int64_t valueRangeSize, int16_t minValue);
+TightDataPointStorageI* SZ_compress_int16_2D_MDQ(int16_t *oriData, size_t r1, size_t r2, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+TightDataPointStorageI* SZ_compress_int16_3D_MDQ(int16_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_int16_NoCkRngeNoGzip_3D(unsigned char** newByteData, int16_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t *outSize, int64_t valueRangeSize, int64_t minValue);
+TightDataPointStorageI* SZ_compress_int16_4D_MDQ(int16_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_int16_NoCkRngeNoGzip_4D(unsigned char** newByteData, int16_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, 
+size_t *outSize, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_int16_withinRange(unsigned char** newByteData, int16_t *oriData, size_t dataLength, size_t *outSize);
+
+int SZ_compress_args_int16_wRngeNoGzip(unsigned char** newByteData, int16_t *oriData, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, 
+int errBoundMode, double absErr_Bound, double relBoundRatio);
+
+int SZ_compress_args_int16(unsigned char** newByteData, int16_t *oriData, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, 
+int errBoundMode, double absErr_Bound, double relBoundRatio);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZ_Int16_H  ----- */
+
Index: thirdparty/SZ/sz/include/sz_int32.h
===================================================================
--- thirdparty/SZ/sz/include/sz_int32.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/sz_int32.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,48 @@
+/**
+ *  @file sz_int32.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the sz_int32.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZ_Int32_H
+#define _SZ_Int32_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+unsigned int optimize_intervals_int32_1D(int32_t *oriData, size_t dataLength, double realPrecision);
+unsigned int optimize_intervals_int32_2D(int32_t *oriData, size_t r1, size_t r2, double realPrecision);
+unsigned int optimize_intervals_int32_3D(int32_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision);
+unsigned int optimize_intervals_int32_4D(int32_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision);
+TightDataPointStorageI* SZ_compress_int32_1D_MDQ(int32_t *oriData, size_t dataLength, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_int32_StoreOriData(int32_t* oriData, size_t dataLength, TightDataPointStorageI* tdps, unsigned char** newByteData, size_t *outSize);
+void SZ_compress_args_int32_NoCkRngeNoGzip_1D(unsigned char** newByteData, int32_t *oriData, 
+size_t dataLength, double realPrecision, size_t *outSize, int64_t valueRangeSize, int32_t minValue);
+TightDataPointStorageI* SZ_compress_int32_2D_MDQ(int32_t *oriData, size_t r1, size_t r2, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+TightDataPointStorageI* SZ_compress_int32_3D_MDQ(int32_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_int32_NoCkRngeNoGzip_3D(unsigned char** newByteData, int32_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t *outSize, int64_t valueRangeSize, int64_t minValue);
+TightDataPointStorageI* SZ_compress_int32_4D_MDQ(int32_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_int32_NoCkRngeNoGzip_4D(unsigned char** newByteData, int32_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, 
+size_t *outSize, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_int32_withinRange(unsigned char** newByteData, int32_t *oriData, size_t dataLength, size_t *outSize);
+
+int SZ_compress_args_int32_wRngeNoGzip(unsigned char** newByteData, int32_t *oriData, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, 
+int errBoundMode, double absErr_Bound, double relBoundRatio);
+
+int SZ_compress_args_int32(unsigned char** newByteData, int32_t *oriData, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, 
+int errBoundMode, double absErr_Bound, double relBoundRatio);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZ_Int32_H  ----- */
+
Index: thirdparty/SZ/sz/include/sz_int64.h
===================================================================
--- thirdparty/SZ/sz/include/sz_int64.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/sz_int64.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,48 @@
+/**
+ *  @file sz_int64.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the sz_int64.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZ_Int64_H
+#define _SZ_Int64_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+unsigned int optimize_intervals_int64_1D(int64_t *oriData, size_t dataLength, double realPrecision);
+unsigned int optimize_intervals_int64_2D(int64_t *oriData, size_t r1, size_t r2, double realPrecision);
+unsigned int optimize_intervals_int64_3D(int64_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision);
+unsigned int optimize_intervals_int64_4D(int64_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision);
+TightDataPointStorageI* SZ_compress_int64_1D_MDQ(int64_t *oriData, size_t dataLength, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_int64_StoreOriData(int64_t* oriData, size_t dataLength, TightDataPointStorageI* tdps, unsigned char** newByteData, size_t *outSize);
+void SZ_compress_args_int64_NoCkRngeNoGzip_1D(unsigned char** newByteData, int64_t *oriData, 
+size_t dataLength, double realPrecision, size_t *outSize, int64_t valueRangeSize, int64_t minValue);
+TightDataPointStorageI* SZ_compress_int64_2D_MDQ(int64_t *oriData, size_t r1, size_t r2, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+TightDataPointStorageI* SZ_compress_int64_3D_MDQ(int64_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_int64_NoCkRngeNoGzip_3D(unsigned char** newByteData, int64_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t *outSize, int64_t valueRangeSize, int64_t minValue);
+TightDataPointStorageI* SZ_compress_int64_4D_MDQ(int64_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_int64_NoCkRngeNoGzip_4D(unsigned char** newByteData, int64_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, 
+size_t *outSize, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_int64_withinRange(unsigned char** newByteData, int64_t *oriData, size_t dataLength, size_t *outSize);
+
+int SZ_compress_args_int64_wRngeNoGzip(unsigned char** newByteData, int64_t *oriData, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, 
+int errBoundMode, double absErr_Bound, double relBoundRatio);
+
+int SZ_compress_args_int64(unsigned char** newByteData, int64_t *oriData, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, 
+int errBoundMode, double absErr_Bound, double relBoundRatio);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZ_Int64_H  ----- */
+
Index: thirdparty/SZ/sz/include/sz_int8.h
===================================================================
--- thirdparty/SZ/sz/include/sz_int8.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/sz_int8.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,48 @@
+/**
+ *  @file sz_int8.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the sz_int8.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZ_Int8_H
+#define _SZ_Int8_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+unsigned int optimize_intervals_int8_1D(int8_t *oriData, size_t dataLength, double realPrecision);
+unsigned int optimize_intervals_int8_2D(int8_t *oriData, size_t r1, size_t r2, double realPrecision);
+unsigned int optimize_intervals_int8_3D(int8_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision);
+unsigned int optimize_intervals_int8_4D(int8_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision);
+TightDataPointStorageI* SZ_compress_int8_1D_MDQ(int8_t *oriData, size_t dataLength, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_int8_StoreOriData(int8_t* oriData, size_t dataLength, TightDataPointStorageI* tdps, unsigned char** newByteData, size_t *outSize);
+void SZ_compress_args_int8_NoCkRngeNoGzip_1D(unsigned char** newByteData, int8_t *oriData, 
+size_t dataLength, double realPrecision, size_t *outSize, int64_t valueRangeSize, int8_t minValue);
+TightDataPointStorageI* SZ_compress_int8_2D_MDQ(int8_t *oriData, size_t r1, size_t r2, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+TightDataPointStorageI* SZ_compress_int8_3D_MDQ(int8_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_int8_NoCkRngeNoGzip_3D(unsigned char** newByteData, int8_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t *outSize, int64_t valueRangeSize, int64_t minValue);
+TightDataPointStorageI* SZ_compress_int8_4D_MDQ(int8_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_int8_NoCkRngeNoGzip_4D(unsigned char** newByteData, int8_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, 
+size_t *outSize, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_int8_withinRange(unsigned char** newByteData, int8_t *oriData, size_t dataLength, size_t *outSize);
+
+int SZ_compress_args_int8_wRngeNoGzip(unsigned char** newByteData, int8_t *oriData, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, 
+int errBoundMode, double absErr_Bound, double relBoundRatio);
+
+int SZ_compress_args_int8(unsigned char** newByteData, int8_t *oriData, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, 
+int errBoundMode, double absErr_Bound, double relBoundRatio);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZ_Int8_H  ----- */
+
Index: thirdparty/SZ/sz/include/sz_omp.h
===================================================================
--- thirdparty/SZ/sz/include/sz_omp.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/sz_omp.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,41 @@
+/**
+ *  @file sz_omp.h
+ *  @author Xin Liang
+ *  @date July, 2017
+ *  @brief Header file for the sz_omp.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "omp.h"
+#include "sz.h"
+
+#ifndef _SZ_OMP_H
+#define _SZ_OMP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+unsigned char * SZ_compress_float_1D_MDQ_openmp(float *oriData, size_t r1, double realPrecision, size_t * comp_size);
+
+unsigned char * SZ_compress_float_2D_MDQ_openmp(float *oriData, size_t r1, size_t r2, double realPrecision, size_t * comp_size);
+
+unsigned char * SZ_compress_float_3D_MDQ_openmp(float *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t * comp_size);
+
+void decompressDataSeries_float_1D_openmp(float** data, size_t r1, unsigned char* comp_data);
+
+void decompressDataSeries_float_3D_openmp(float** data, size_t r1, size_t r2, size_t r3, unsigned char* comp_data);
+
+void decompressDataSeries_float_2D_openmp(float** data, size_t r1, size_t r2, unsigned char* comp_data);
+
+//void Huffman_init_openmp(HuffmanTree* huffmanTree, int *s, size_t length, int thread_num);
+void Huffman_init_openmp(HuffmanTree* huffmanTree, int *s, size_t length, int thread_num, size_t * freq);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZ_OMP_H  ----- */
Index: thirdparty/SZ/sz/include/sz_uint16.h
===================================================================
--- thirdparty/SZ/sz/include/sz_uint16.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/sz_uint16.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,48 @@
+/**
+ *  @file sz_uint16.h
+ *  @author Sheng Di
+ *  @date Nov, 2017
+ *  @brief Header file for the sz_uint16.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZ_UInt16_H
+#define _SZ_UInt16_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+unsigned int optimize_intervals_uint16_1D(uint16_t *oriData, size_t dataLength, double realPrecision);
+unsigned int optimize_intervals_uint16_2D(uint16_t *oriData, size_t r1, size_t r2, double realPrecision);
+unsigned int optimize_intervals_uint16_3D(uint16_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision);
+unsigned int optimize_intervals_uint16_4D(uint16_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision);
+TightDataPointStorageI* SZ_compress_uint16_1D_MDQ(uint16_t *oriData, size_t dataLength, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_uint16_StoreOriData(uint16_t* oriData, size_t dataLength, TightDataPointStorageI* tdps, unsigned char** newByteData, size_t *outSize);
+void SZ_compress_args_uint16_NoCkRngeNoGzip_1D(unsigned char** newByteData, uint16_t *oriData, 
+size_t dataLength, double realPrecision, size_t *outSize, int64_t valueRangeSize, uint16_t minValue);
+TightDataPointStorageI* SZ_compress_uint16_2D_MDQ(uint16_t *oriData, size_t r1, size_t r2, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+TightDataPointStorageI* SZ_compress_uint16_3D_MDQ(uint16_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_uint16_NoCkRngeNoGzip_3D(unsigned char** newByteData, uint16_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t *outSize, int64_t valueRangeSize, int64_t minValue);
+TightDataPointStorageI* SZ_compress_uint16_4D_MDQ(uint16_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_uint16_NoCkRngeNoGzip_4D(unsigned char** newByteData, uint16_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, 
+size_t *outSize, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_uint16_withinRange(unsigned char** newByteData, uint16_t *oriData, size_t dataLength, size_t *outSize);
+
+int SZ_compress_args_uint16_wRngeNoGzip(unsigned char** newByteData, uint16_t *oriData, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, 
+int errBoundMode, double absErr_Bound, double relBoundRatio);
+
+int SZ_compress_args_uint16(unsigned char** newByteData, uint16_t *oriData, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, 
+int errBoundMode, double absErr_Bound, double relBoundRatio);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZ_UInt16_H  ----- */
+
Index: thirdparty/SZ/sz/include/sz_uint32.h
===================================================================
--- thirdparty/SZ/sz/include/sz_uint32.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/sz_uint32.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,48 @@
+/**
+ *  @file sz_uint32.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the sz_uint32.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZ_UInt32_H
+#define _SZ_UInt32_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+unsigned int optimize_intervals_uint32_1D(uint32_t *oriData, size_t dataLength, double realPrecision);
+unsigned int optimize_intervals_uint32_2D(uint32_t *oriData, size_t r1, size_t r2, double realPrecision);
+unsigned int optimize_intervals_uint32_3D(uint32_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision);
+unsigned int optimize_intervals_uint32_4D(uint32_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision);
+TightDataPointStorageI* SZ_compress_uint32_1D_MDQ(uint32_t *oriData, size_t dataLength, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_uint32_StoreOriData(uint32_t* oriData, size_t dataLength, TightDataPointStorageI* tdps, unsigned char** newByteData, size_t *outSize);
+void SZ_compress_args_uint32_NoCkRngeNoGzip_1D(unsigned char** newByteData, uint32_t *oriData, 
+size_t dataLength, double realPrecision, size_t *outSize, int64_t valueRangeSize, uint32_t minValue);
+TightDataPointStorageI* SZ_compress_uint32_2D_MDQ(uint32_t *oriData, size_t r1, size_t r2, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+TightDataPointStorageI* SZ_compress_uint32_3D_MDQ(uint32_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_uint32_NoCkRngeNoGzip_3D(unsigned char** newByteData, uint32_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t *outSize, int64_t valueRangeSize, int64_t minValue);
+TightDataPointStorageI* SZ_compress_uint32_4D_MDQ(uint32_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_uint32_NoCkRngeNoGzip_4D(unsigned char** newByteData, uint32_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, 
+size_t *outSize, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_uint32_withinRange(unsigned char** newByteData, uint32_t *oriData, size_t dataLength, size_t *outSize);
+
+int SZ_compress_args_uint32_wRngeNoGzip(unsigned char** newByteData, uint32_t *oriData, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, 
+int errBoundMode, double absErr_Bound, double relBoundRatio);
+
+int SZ_compress_args_uint32(unsigned char** newByteData, uint32_t *oriData, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, 
+int errBoundMode, double absErr_Bound, double relBoundRatio);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZ_UInt32_H  ----- */
+
Index: thirdparty/SZ/sz/include/sz_uint64.h
===================================================================
--- thirdparty/SZ/sz/include/sz_uint64.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/sz_uint64.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,48 @@
+/**
+ *  @file sz_uint64.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the sz_uint64.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZ_UInt64_H
+#define _SZ_UInt64_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+unsigned int optimize_intervals_uint64_1D(uint64_t *oriData, size_t dataLength, double realPrecision);
+unsigned int optimize_intervals_uint64_2D(uint64_t *oriData, size_t r1, size_t r2, double realPrecision);
+unsigned int optimize_intervals_uint64_3D(uint64_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision);
+unsigned int optimize_intervals_uint64_4D(uint64_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision);
+TightDataPointStorageI* SZ_compress_uint64_1D_MDQ(uint64_t *oriData, size_t dataLength, double realPrecision, uint64_t valueRangeSize, uint64_t minValue);
+void SZ_compress_args_uint64_StoreOriData(uint64_t* oriData, size_t dataLength, TightDataPointStorageI* tdps, unsigned char** newByteData, size_t *outSize);
+void SZ_compress_args_uint64_NoCkRngeNoGzip_1D(unsigned char** newByteData, uint64_t *oriData, 
+size_t dataLength, double realPrecision, size_t *outSize, uint64_t valueRangeSize, uint64_t minValue);
+TightDataPointStorageI* SZ_compress_uint64_2D_MDQ(uint64_t *oriData, size_t r1, size_t r2, double realPrecision, uint64_t valueRangeSize, uint64_t minValue);
+TightDataPointStorageI* SZ_compress_uint64_3D_MDQ(uint64_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, uint64_t valueRangeSize, uint64_t minValue);
+void SZ_compress_args_uint64_NoCkRngeNoGzip_3D(unsigned char** newByteData, uint64_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t *outSize, uint64_t valueRangeSize, uint64_t minValue);
+TightDataPointStorageI* SZ_compress_uint64_4D_MDQ(uint64_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, uint64_t valueRangeSize, uint64_t minValue);
+void SZ_compress_args_uint64_NoCkRngeNoGzip_4D(unsigned char** newByteData, uint64_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, 
+size_t *outSize, uint64_t valueRangeSize, uint64_t minValue);
+void SZ_compress_args_uint64_withinRange(unsigned char** newByteData, uint64_t *oriData, size_t dataLength, size_t *outSize);
+
+int SZ_compress_args_uint64_wRngeNoGzip(unsigned char** newByteData, uint64_t *oriData, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, 
+int errBoundMode, double absErr_Bound, double relBoundRatio);
+
+int SZ_compress_args_uint64(unsigned char** newByteData, uint64_t *oriData, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, 
+int errBoundMode, double absErr_Bound, double relBoundRatio);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZ_UInt64_H  ----- */
+
Index: thirdparty/SZ/sz/include/sz_uint8.h
===================================================================
--- thirdparty/SZ/sz/include/sz_uint8.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/sz_uint8.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,48 @@
+/**
+ *  @file sz_uint8.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the sz_uint8.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZ_UInt8_H
+#define _SZ_UInt8_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+unsigned int optimize_intervals_uint8_1D(uint8_t *oriData, size_t dataLength, double realPrecision);
+unsigned int optimize_intervals_uint8_2D(uint8_t *oriData, size_t r1, size_t r2, double realPrecision);
+unsigned int optimize_intervals_uint8_3D(uint8_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision);
+unsigned int optimize_intervals_uint8_4D(uint8_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision);
+TightDataPointStorageI* SZ_compress_uint8_1D_MDQ(uint8_t *oriData, size_t dataLength, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_uint8_StoreOriData(uint8_t* oriData, size_t dataLength, TightDataPointStorageI* tdps, unsigned char** newByteData, size_t *outSize);
+void SZ_compress_args_uint8_NoCkRngeNoGzip_1D(unsigned char** newByteData, uint8_t *oriData, 
+size_t dataLength, double realPrecision, size_t *outSize, int64_t valueRangeSize, uint8_t minValue);
+TightDataPointStorageI* SZ_compress_uint8_2D_MDQ(uint8_t *oriData, size_t r1, size_t r2, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+TightDataPointStorageI* SZ_compress_uint8_3D_MDQ(uint8_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_uint8_NoCkRngeNoGzip_3D(unsigned char** newByteData, uint8_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t *outSize, int64_t valueRangeSize, int64_t minValue);
+TightDataPointStorageI* SZ_compress_uint8_4D_MDQ(uint8_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_uint8_NoCkRngeNoGzip_4D(unsigned char** newByteData, uint8_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, 
+size_t *outSize, int64_t valueRangeSize, int64_t minValue);
+void SZ_compress_args_uint8_withinRange(unsigned char** newByteData, uint8_t *oriData, size_t dataLength, size_t *outSize);
+
+int SZ_compress_args_uint8_wRngeNoGzip(unsigned char** newByteData, uint8_t *oriData, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, 
+int errBoundMode, double absErr_Bound, double relBoundRatio);
+
+int SZ_compress_args_uint8(unsigned char** newByteData, uint8_t *oriData, 
+size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, 
+int errBoundMode, double absErr_Bound, double relBoundRatio);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZ_UInt8_H  ----- */
+
Index: thirdparty/SZ/sz/include/szd_double.h
===================================================================
--- thirdparty/SZ/sz/include/szd_double.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/szd_double.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,34 @@
+/**
+ *  @file szd_double.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the szd_double.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZD_Double_H
+#define _SZD_Double_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "TightDataPointStorageD.h"
+
+void decompressDataSeries_double_1D(double** data, size_t dataSeriesLength, TightDataPointStorageD* tdps);
+void decompressDataSeries_double_2D(double** data, size_t r1, size_t r2, TightDataPointStorageD* tdps);
+void decompressDataSeries_double_3D(double** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageD* tdps);
+void decompressDataSeries_double_4D(double** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageD* tdps);
+void getSnapshotData_double_1D(double** data, size_t dataSeriesLength, TightDataPointStorageD* tdps, int errBoundMode);
+void getSnapshotData_double_2D(double** data, size_t r1, size_t r2, TightDataPointStorageD* tdps, int errBoundMode);
+void getSnapshotData_double_3D(double** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageD* tdps, int errBoundMode);
+void getSnapshotData_double_4D(double** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageD* tdps, int errBoundMode);
+
+int SZ_decompress_args_double(double** newData, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, unsigned char* cmpBytes, size_t cmpSize);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZD_Double_H  ----- */
Index: thirdparty/SZ/sz/include/szd_double_pwr.h
===================================================================
--- thirdparty/SZ/sz/include/szd_double_pwr.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/szd_double_pwr.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,28 @@
+/**
+ *  @file szd_double_pwr.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the szd_double_pwr.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZD_Double_PWR_H
+#define _SZD_Double_PWR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void decompressDataSeries_double_1D_pwr(double** data, size_t dataSeriesLength, TightDataPointStorageD* tdps);
+double* extractRealPrecision_2D_double(size_t R1, size_t R2, int blockSize, TightDataPointStorageD* tdps);
+void decompressDataSeries_double_2D_pwr(double** data, size_t r1, size_t r2, TightDataPointStorageD* tdps);
+double* extractRealPrecision_3D_double(size_t R1, size_t R2, size_t R3, int blockSize, TightDataPointStorageD* tdps);
+void decompressDataSeries_double_3D_pwr(double** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageD* tdps);
+
+void decompressDataSeries_double_1D_pwrgroup(double** data, size_t dataSeriesLength, TightDataPointStorageD* tdps);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZD_Double_PWR_H  ----- */
Index: thirdparty/SZ/sz/include/szd_double_ts.h
===================================================================
--- thirdparty/SZ/sz/include/szd_double_ts.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/szd_double_ts.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,25 @@
+/**
+ *  @file szd_double_ts.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the szd_double_ts.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZD_Double_TS_H
+#define _SZD_Double_TS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "TightDataPointStorageD.h"
+
+void decompressDataSeries_double_1D_ts(double** data, size_t dataSeriesLength, sz_multisteps* multisteps, TightDataPointStorageD* tdps);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZD_Double_TS_H  ----- */
Index: thirdparty/SZ/sz/include/szd_float.h
===================================================================
--- thirdparty/SZ/sz/include/szd_float.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/szd_float.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,38 @@
+/**
+ *  @file szd_float.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the szd_float.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZD_Float_H
+#define _SZD_Float_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "TightDataPointStorageF.h"
+
+void decompressDataSeries_float_1D(float** data, size_t dataSeriesLength, TightDataPointStorageF* tdps);
+void decompressDataSeries_float_2D(float** data, size_t r1, size_t r2, TightDataPointStorageF* tdps);
+void decompressDataSeries_float_3D(float** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageF* tdps);
+void decompressDataSeries_float_4D(float** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageF* tdps);
+void getSnapshotData_float_1D(float** data, size_t dataSeriesLength, TightDataPointStorageF* tdps, int errBoundMode);
+void getSnapshotData_float_2D(float** data, size_t r1, size_t r2, TightDataPointStorageF* tdps, int errBoundMode);
+void getSnapshotData_float_3D(float** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageF* tdps, int errBoundMode);
+void getSnapshotData_float_4D(float** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageF* tdps, int errBoundMode);
+
+size_t decompressDataSeries_float_1D_RA_block(float * data, float mean, size_t dim_0, size_t block_dim_0, double realPrecision, int * type, float * unpredictable_data);
+size_t decompressDataSeries_float_2D_RA_block(float * data, float mean, size_t dim_0, size_t dim_1, size_t block_dim_0, size_t block_dim_1, double realPrecision, int * type, float * unpredictable_data);
+
+int SZ_decompress_args_float(float** newData, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, unsigned char* cmpBytes, size_t cmpSize);
+
+size_t decompressDataSeries_float_3D_RA_block(float * data, float mean, size_t dim_0, size_t dim_1, size_t dim_2, size_t block_dim_0, size_t block_dim_1, size_t block_dim_2, double realPrecision, int * type, float * unpredictable_data);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZD_Float_H  ----- */
Index: thirdparty/SZ/sz/include/szd_float_pwr.h
===================================================================
--- thirdparty/SZ/sz/include/szd_float_pwr.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/szd_float_pwr.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,31 @@
+/**
+ *  @file szd_float_pwr.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the szd_float_pwr.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZD_Float_PWR_H
+#define _SZD_Float_PWR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void decompressDataSeries_float_1D_pwr(float** data, size_t dataSeriesLength, TightDataPointStorageF* tdps);
+float* extractRealPrecision_2D_float(size_t R1, size_t R2, int blockSize, TightDataPointStorageF* tdps);
+void decompressDataSeries_float_2D_pwr(float** data, size_t r1, size_t r2, TightDataPointStorageF* tdps);
+float* extractRealPrecision_3D_float(size_t R1, size_t R2, size_t R3, int blockSize, TightDataPointStorageF* tdps);
+void decompressDataSeries_float_3D_pwr(float** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageF* tdps);
+
+char* decompressGroupIDArray(unsigned char* bytes, size_t dataLength);
+void decompressDataSeries_float_1D_pwrgroup(float** data, size_t dataSeriesLength, TightDataPointStorageF* tdps);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZD_Float_PWR_H  ----- */
+
Index: thirdparty/SZ/sz/include/szd_float_ts.h
===================================================================
--- thirdparty/SZ/sz/include/szd_float_ts.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/szd_float_ts.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,25 @@
+/**
+ *  @file szd_float_ts.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the szd_float_ts.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZD_Float_TS_H
+#define _SZD_Float_TS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "TightDataPointStorageF.h"
+
+void decompressDataSeries_float_1D_ts(float** data, size_t dataSeriesLength, sz_multisteps* multisteps, TightDataPointStorageF* tdps);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZD_Float_TS_H  ----- */
Index: thirdparty/SZ/sz/include/szd_int16.h
===================================================================
--- thirdparty/SZ/sz/include/szd_int16.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/szd_int16.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,38 @@
+/**
+ *  @file szd_int16.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the szd_int16.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZD_Int16_H
+#define _SZD_Int16_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "TightDataPointStorageI.h"
+
+#define SZ_INT16_MIN -32768
+#define SZ_INT16_MAX 32767
+
+void decompressDataSeries_int16_1D(int16_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps);
+void decompressDataSeries_int16_2D(int16_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps);
+void decompressDataSeries_int16_3D(int16_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps);
+void decompressDataSeries_int16_4D(int16_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps);
+
+void getSnapshotData_int16_1D(int16_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_int16_2D(int16_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_int16_3D(int16_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_int16_4D(int16_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps, int errBoundMode);
+
+int SZ_decompress_args_int16(int16_t** newData, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, unsigned char* cmpBytes, size_t cmpSize);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZD_Int16_H  ----- */
Index: thirdparty/SZ/sz/include/szd_int32.h
===================================================================
--- thirdparty/SZ/sz/include/szd_int32.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/szd_int32.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,38 @@
+/**
+ *  @file szd_int32.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the szd_int32.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZD_Int32_H
+#define _SZD_Int32_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "TightDataPointStorageI.h"
+
+#define SZ_INT32_MIN -2147483648
+#define SZ_INT32_MAX 2147483647
+
+void decompressDataSeries_int32_1D(int32_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps);
+void decompressDataSeries_int32_2D(int32_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps);
+void decompressDataSeries_int32_3D(int32_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps);
+void decompressDataSeries_int32_4D(int32_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps);
+
+void getSnapshotData_int32_1D(int32_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_int32_2D(int32_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_int32_3D(int32_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_int32_4D(int32_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps, int errBoundMode);
+
+int SZ_decompress_args_int32(int32_t** newData, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, unsigned char* cmpBytes, size_t cmpSize);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZD_Int32_H  ----- */
Index: thirdparty/SZ/sz/include/szd_int64.h
===================================================================
--- thirdparty/SZ/sz/include/szd_int64.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/szd_int64.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,35 @@
+/**
+ *  @file szd_int64.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the szd_int64.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZD_Int64_H
+#define _SZD_Int64_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "TightDataPointStorageI.h"
+
+void decompressDataSeries_int64_1D(int64_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps);
+void decompressDataSeries_int64_2D(int64_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps);
+void decompressDataSeries_int64_3D(int64_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps);
+void decompressDataSeries_int64_4D(int64_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps);
+
+void getSnapshotData_int64_1D(int64_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_int64_2D(int64_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_int64_3D(int64_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_int64_4D(int64_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps, int errBoundMode);
+
+int SZ_decompress_args_int64(int64_t** newData, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, unsigned char* cmpBytes, size_t cmpSize);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZD_Int64_H  ----- */
Index: thirdparty/SZ/sz/include/szd_int8.h
===================================================================
--- thirdparty/SZ/sz/include/szd_int8.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/szd_int8.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,38 @@
+/**
+ *  @file szd_int8.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the szd_int8.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZD_Int8_H
+#define _SZD_Int8_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "TightDataPointStorageI.h"
+
+#define SZ_INT8_MIN -128
+#define SZ_INT8_MAX 127
+
+void decompressDataSeries_int8_1D(int8_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps);
+void decompressDataSeries_int8_2D(int8_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps);
+void decompressDataSeries_int8_3D(int8_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps);
+void decompressDataSeries_int8_4D(int8_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps);
+
+void getSnapshotData_int8_1D(int8_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_int8_2D(int8_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_int8_3D(int8_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_int8_4D(int8_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps, int errBoundMode);
+
+int SZ_decompress_args_int8(int8_t** newData, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, unsigned char* cmpBytes, size_t cmpSize);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZD_Int8_H  ----- */
Index: thirdparty/SZ/sz/include/szd_uint16.h
===================================================================
--- thirdparty/SZ/sz/include/szd_uint16.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/szd_uint16.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,38 @@
+/**
+ *  @file szd_uint16.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the szd_uint16.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZD_UInt16_H
+#define _SZD_UInt16_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "TightDataPointStorageI.h"
+
+#define SZ_UINT16_MIN 0
+#define SZ_UINT16_MAX 65535
+
+void decompressDataSeries_uint16_1D(uint16_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps);
+void decompressDataSeries_uint16_2D(uint16_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps);
+void decompressDataSeries_uint16_3D(uint16_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps);
+void decompressDataSeries_uint16_4D(uint16_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps);
+
+void getSnapshotData_uint16_1D(uint16_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_uint16_2D(uint16_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_uint16_3D(uint16_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_uint16_4D(uint16_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps, int errBoundMode);
+
+int SZ_decompress_args_uint16(uint16_t** newData, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, unsigned char* cmpBytes, size_t cmpSize);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZD_Int16_H  ----- */
Index: thirdparty/SZ/sz/include/szd_uint32.h
===================================================================
--- thirdparty/SZ/sz/include/szd_uint32.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/szd_uint32.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,38 @@
+/**
+ *  @file szd_uint32.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the szd_uint32.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZD_UInt32_H
+#define _SZD_UInt32_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "TightDataPointStorageI.h"
+
+#define SZ_UINT32_MIN 0
+#define SZ_UINT32_MAX 4294967295
+
+void decompressDataSeries_uint32_1D(uint32_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps);
+void decompressDataSeries_uint32_2D(uint32_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps);
+void decompressDataSeries_uint32_3D(uint32_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps);
+void decompressDataSeries_uint32_4D(uint32_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps);
+
+void getSnapshotData_uint32_1D(uint32_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_uint32_2D(uint32_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_uint32_3D(uint32_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_uint32_4D(uint32_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps, int errBoundMode);
+
+int SZ_decompress_args_uint32(uint32_t** newData, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, unsigned char* cmpBytes, size_t cmpSize);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZD_UInt32_H  ----- */
Index: thirdparty/SZ/sz/include/szd_uint64.h
===================================================================
--- thirdparty/SZ/sz/include/szd_uint64.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/szd_uint64.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,35 @@
+/**
+ *  @file szd_uint64.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the szd_uint64.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZD_UInt64_H
+#define _SZD_UInt64_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "TightDataPointStorageI.h"
+
+void decompressDataSeries_uint64_1D(uint64_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps);
+void decompressDataSeries_uint64_2D(uint64_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps);
+void decompressDataSeries_uint64_3D(uint64_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps);
+void decompressDataSeries_uint64_4D(uint64_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps);
+
+void getSnapshotData_uint64_1D(uint64_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_uint64_2D(uint64_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_uint64_3D(uint64_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_uint64_4D(uint64_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps, int errBoundMode);
+
+int SZ_decompress_args_uint64(uint64_t** newData, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, unsigned char* cmpBytes, size_t cmpSize);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZD_UInt64_H  ----- */
Index: thirdparty/SZ/sz/include/szd_uint8.h
===================================================================
--- thirdparty/SZ/sz/include/szd_uint8.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/szd_uint8.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,38 @@
+/**
+ *  @file szd_uint8.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the szd_uint8.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZD_UInt8_H
+#define _SZD_UInt8_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "TightDataPointStorageI.h"
+
+#define SZ_UINT8_MIN 0
+#define SZ_UINT8_MAX 255
+
+void decompressDataSeries_uint8_1D(uint8_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps);
+void decompressDataSeries_uint8_2D(uint8_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps);
+void decompressDataSeries_uint8_3D(uint8_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps);
+void decompressDataSeries_uint8_4D(uint8_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps);
+
+void getSnapshotData_uint8_1D(uint8_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_uint8_2D(uint8_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_uint8_3D(uint8_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps, int errBoundMode);
+void getSnapshotData_uint8_4D(uint8_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps, int errBoundMode);
+
+int SZ_decompress_args_uint8(uint8_t** newData, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, unsigned char* cmpBytes, size_t cmpSize);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZD_UInt8_H  ----- */
Index: thirdparty/SZ/sz/include/szf.h
===================================================================
--- thirdparty/SZ/sz/include/szf.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/szf.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
@@ -0,0 +1,102 @@
+/**
+ *  @file szf.h
+ *  @author Sheng Di
+ *  @date July, 2017
+ *  @brief Header file for the szf.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _SZF_H
+#define _SZF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+//szf.c
+void sz_init_c_(char *configFile,int *len,int *ierr);
+void sz_finalize_c_();
+void SZ_writeData_inBinary_d1_Float_(float* data, char *fileName, int *len);
+void sz_compress_d1_float_(float* data, unsigned char *bytes, size_t *outSize, size_t *r1);
+void sz_compress_d1_float_rev_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1);
+void sz_compress_d2_float_(float* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2);
+void sz_compress_d2_float_rev_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2);
+void sz_compress_d3_float_(float* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3);
+void sz_compress_d3_float_rev_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3);
+void sz_compress_d4_float_(float* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
+void sz_compress_d4_float_rev_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
+void sz_compress_d5_float_(float* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
+void sz_compress_d5_float_rev_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
+
+void sz_compress_d1_double_(double* data, unsigned char *bytes, size_t *outSize, size_t *r1);
+void sz_compress_d1_double_rev_(double* data, double *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1);
+void sz_compress_d2_double_(double* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2);
+void sz_compress_d2_double_rev_(double* data, double *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2);
+void sz_compress_d3_double_(double* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3);
+void sz_compress_d3_double_rev_(double* data, double *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3);
+void sz_compress_d4_double_(double* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
+void sz_compress_d4_double_rev_(double* data, double *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
+void sz_compress_d5_double_(double* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
+void sz_compress_d5_double_rev_(double* data, double *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
+
+void sz_compress_d1_float_args_(float* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1);
+void sz_compress_d2_float_args_(float* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2);
+void sz_compress_d3_float_args_(float* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3);
+void sz_compress_d4_float_args_(float* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
+void sz_compress_d5_float_args_(float* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
+void sz_compress_d1_double_args_(double* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1);
+void sz_compress_d2_double_args_(double* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2);
+void sz_compress_d3_double_args_(double* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3);
+void sz_compress_d4_double_args_(double* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
+void sz_compress_d5_double_args_(double* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
+
+void sz_compress_d1_float_rev_args_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1);
+void sz_compress_d2_float_rev_args_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2);
+void sz_compress_d3_float_rev_args_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3);
+void sz_compress_d4_float_rev_args_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
+void sz_compress_d5_float_rev_args_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
+void sz_compress_d1_double_rev_args_(double* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1);
+void sz_compress_d2_double_rev_args_(double* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2);
+void sz_compress_d3_double_rev_args_(double* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3);
+void sz_compress_d4_double_rev_args_(double* data, double *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
+void sz_compress_d5_double_rev_args_(double* data, double *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
+
+void sz_decompress_d1_float_(unsigned char *bytes, size_t *byteLength, float *data, size_t *r1);
+void sz_decompress_d2_float_(unsigned char *bytes, size_t *byteLength, float *data, size_t *r1, size_t *r2);
+void sz_decompress_d3_float_(unsigned char *bytes, size_t *byteLength, float *data, size_t *r1, size_t *r2, size_t *r3);
+void sz_decompress_d4_float_(unsigned char *bytes, size_t *byteLength, float *data, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
+void sz_decompress_d5_float_(unsigned char *bytes, size_t *byteLength, float *data, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
+void sz_decompress_d1_double_(unsigned char *bytes, size_t *byteLength, double *data, size_t *r1);
+void sz_decompress_d2_double_(unsigned char *bytes, size_t *byteLength, double *data, size_t *r1, size_t *r2);
+void sz_decompress_d3_double_(unsigned char *bytes, size_t *byteLength, double *data, size_t *r1, size_t *r2, size_t *r3);
+void sz_decompress_d4_double_(unsigned char *bytes, size_t *byteLength, double *data, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
+void sz_decompress_d5_double_(unsigned char *bytes, size_t *byteLength, double *data, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
+
+void sz_batchaddVar_d1_float_(char* varName, int *len, float* data, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1);
+void sz_batchaddvar_d2_float_(char* varName, int *len, float* data, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2);
+void sz_batchaddvar_d3_float_(char* varName, int *len, float* data, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3);
+void sz_batchaddvar_d4_float_(char* varName, int *len, float* data, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
+void sz_batchaddvar_d5_float_(char* varName, int *len, float* data, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
+void sz_batchaddvar_d1_double_(char* varName, int *len, double* data, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1);
+void sz_batchaddvar_d2_double_(char* varName, int *len, double* data, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2);
+void sz_batchaddvar_d3_double_(char* varName, int *len, double* data, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3);
+void sz_batchaddvar_d4_double_(char* varName, int *len, double* data, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
+void sz_batchaddvar_d5_double_(char* varName, int *len, double* data, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
+void sz_batchdelvar_c_(char* varName, int *len, int *errState);
+void sz_batch_compress_c_(unsigned char* bytes, size_t *outSize);
+void sz_batch_decompress_c_(unsigned char* bytes, size_t *byteLength, int *ierr);
+void sz_getvardim_c_(char* varName, int *len, int *dim, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
+void compute_total_batch_size_c_(size_t *totalSize);
+void sz_getvardata_float_(char* varName, int *len, float* data);
+void sz_getvardata_double_(char* varName, int *len, double* data);
+void sz_freevarset_c_(int *mode);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _SZF_H  ----- */
+
