Index: thirdparty/SZ/sz/src/TightDataPointStorageD.c
===================================================================
--- thirdparty/SZ/sz/src/TightDataPointStorageD.c	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/src/TightDataPointStorageD.c	(revision 9ee2ce3c0d78f4ec0c8dee6bba00cac6e8b2f339)
@@ -47,4 +47,8 @@
 	(*this)->pwrErrBoundBytes = NULL;
 	(*this)->pwrErrBoundBytes_size = 0;
+	
+	(*this)->raBytes = NULL;
+	(*this)->raBytes_size = 0;
+
 }
 
@@ -84,8 +88,11 @@
 	int mode = confparams_dec->szMode;
 	int predictionMode = confparams_dec->predictionMode;
+	int losslessCompressor = confparams_dec->losslessCompressor;
 	if(confparams_dec!=NULL)
 		free(confparams_dec);
 	confparams_dec = params;
 	confparams_dec->szMode = mode;
+	confparams_dec->losslessCompressor = losslessCompressor;
+	
 	if(mode==SZ_TEMPORAL_COMPRESSION)
 	{
@@ -94,4 +101,6 @@
 	}
 	index += MetaDataByteLength;
+
+	int isRandomAccess = (sameRByte >> 7) & 0x01;
 
 	unsigned char dsLengthBytes[8];
@@ -122,4 +131,11 @@
 		(*this)->allSameData = 0;
 		
+	if(isRandomAccess == 1)
+	{
+		(*this)->raBytes_size = flatBytesLength - 3 - 1 - MetaDataByteLength - exe_params->SZ_SIZE_TYPE;
+		(*this)->raBytes = &(flatBytes[index]);
+		return errorBoundMode;
+	}					
+		
 	int rtype_ = sameRByte & 0x08; //1000		
 
@@ -205,4 +221,8 @@
 		(*this)->leadNumArray_size = (logicLeadNumBitsNum >> 3) + 1;
 	}
+	
+	int minLogValueSize = 0;
+	if(errorBoundMode>=PW_REL)
+		minLogValueSize = 8;
 
 	if ((*this)->rtypeArray != NULL) 
@@ -210,5 +230,5 @@
 		(*this)->residualMidBits_size = flatBytesLength - 3 - 1 - MetaDataByteLength - exe_params->SZ_SIZE_TYPE - 4 - radExpoL - segmentL - pwrErrBoundBytesL - 4 - 8 - 1 - 8 
 				- exe_params->SZ_SIZE_TYPE - exe_params->SZ_SIZE_TYPE - exe_params->SZ_SIZE_TYPE - exe_params->SZ_SIZE_TYPE - 8 - (*this)->rtypeArray_size 
-				- (*this)->typeArray_size - (*this)->leadNumArray_size
+				- minLogValueSize - (*this)->typeArray_size - (*this)->leadNumArray_size
 				- (*this)->exactMidBytes_size - pwrErrBoundBytes_size;
 		for (i = 0; i < (*this)->rtypeArray_size; i++)
@@ -218,7 +238,12 @@
 	{
 		(*this)->residualMidBits_size = flatBytesLength - 3 - 1 - MetaDataByteLength - exe_params->SZ_SIZE_TYPE - 4 - radExpoL - segmentL - pwrErrBoundBytesL - 4 - 8 - 1 - 8
-				- exe_params->SZ_SIZE_TYPE - exe_params->SZ_SIZE_TYPE - exe_params->SZ_SIZE_TYPE - (*this)->typeArray_size
+				- exe_params->SZ_SIZE_TYPE - exe_params->SZ_SIZE_TYPE - exe_params->SZ_SIZE_TYPE - minLogValueSize - (*this)->typeArray_size
 				- (*this)->leadNumArray_size - (*this)->exactMidBytes_size - pwrErrBoundBytes_size;
 	}	
+
+	if(errorBoundMode >= PW_REL){
+		(*this)->minLogValue = bytesToDouble(&flatBytes[index]);
+		index+=8;
+	}
 
 	(*this)->typeArray = &flatBytes[index];
@@ -423,4 +448,11 @@
 		bytes[k++] = exactMidBytesLength[i];
 
+	if(confparams_cpr->errorBoundMode>=PW_REL)
+	{
+		doubleToBytes(exactMidBytesLength, tdps->minLogValue);
+		for(i = 0;i < 8; i++)
+			bytes[k++] = exactMidBytesLength[i];
+	}
+
 	memcpy(&(bytes[k]), tdps->typeArray, tdps->typeArray_size);
 	k += tdps->typeArray_size;
@@ -522,4 +554,12 @@
 	memcpy(&(bytes[k]), tdps->rtypeArray, tdps->rtypeArray_size);
 	k += tdps->rtypeArray_size;		
+	
+	if(confparams_cpr->errorBoundMode>=PW_REL)
+	{
+		doubleToBytes(exactMidBytesLength, tdps->minLogValue);
+		for(i = 0;i < 8; i++)
+			bytes[k++] = exactMidBytesLength[i];
+	}
+	
 	memcpy(&(bytes[k]), tdps->typeArray, tdps->typeArray_size);
 	k += tdps->typeArray_size;
@@ -584,4 +624,6 @@
 		size_t residualMidBitsLength = tdps->residualMidBits == NULL ? 0 : tdps->residualMidBits_size;
 		size_t segmentL = 0, radExpoL = 0, pwrBoundArrayL = 0;
+
+		int minLogValueSize = 0;
 		if(confparams_cpr->errorBoundMode>=PW_REL)
 		{			
@@ -589,8 +631,10 @@
 			radExpoL = 1;
 			pwrBoundArrayL = 4;
+			minLogValueSize = 8;
 		}
 
 		size_t totalByteLength = 3 + 1 + MetaDataByteLength + exe_params->SZ_SIZE_TYPE + 4 + radExpoL + segmentL + pwrBoundArrayL + 4 + 8 + 1 + 8 
 				+ exe_params->SZ_SIZE_TYPE + exe_params->SZ_SIZE_TYPE + exe_params->SZ_SIZE_TYPE 
+				+ minLogValueSize /*max absolute log value*/
 				+ tdps->typeArray_size + tdps->leadNumArray_size
 				+ tdps->exactMidBytes_size + residualMidBitsLength + tdps->pwrErrBoundBytes_size;
@@ -606,4 +650,5 @@
 		size_t residualMidBitsLength = tdps->residualMidBits == NULL ? 0 : tdps->residualMidBits_size;
 		size_t segmentL = 0, radExpoL = 0, pwrBoundArrayL = 0;
+		int minLogValueSize = 0;
 		if(confparams_cpr->errorBoundMode>=PW_REL)
 		{
@@ -611,9 +656,10 @@
 			radExpoL = 1;
 			pwrBoundArrayL = 4;
+			minLogValueSize = 8;
 		}
 
 		size_t totalByteLength = 3 + 1 + MetaDataByteLength + exe_params->SZ_SIZE_TYPE + 4 + radExpoL + segmentL + pwrBoundArrayL + 4 + 8 + 1 + 8 
 				+ exe_params->SZ_SIZE_TYPE + exe_params->SZ_SIZE_TYPE + exe_params->SZ_SIZE_TYPE + exe_params->SZ_SIZE_TYPE + 8 + tdps->rtypeArray_size
-				+ tdps->typeArray_size + tdps->leadNumArray_size 
+				+ minLogValueSize + tdps->typeArray_size + tdps->leadNumArray_size 
 				+ tdps->exactMidBytes_size + residualMidBitsLength + tdps->pwrErrBoundBytes_size;
 
