Index: thirdparty/SZ/sz/include/TightDataPointStorageD.h
===================================================================
--- thirdparty/SZ/sz/include/TightDataPointStorageD.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/TightDataPointStorageD.h	(revision 9ee2ce3c0d78f4ec0c8dee6bba00cac6e8b2f339)
@@ -23,4 +23,6 @@
 	char reqLength;	
 	char radExpo; //used to compute reqLength based on segmented precisions in "pw_rel_compression"
+
+	double minLogValue;
 
 	int stateNum;
@@ -53,4 +55,8 @@
 	unsigned char* pwrErrBoundBytes;
 	int pwrErrBoundBytes_size;
+		
+	unsigned char* raBytes;
+	size_t raBytes_size;
+	
 } TightDataPointStorageD;
 
Index: thirdparty/SZ/sz/include/TightDataPointStorageF.h
===================================================================
--- thirdparty/SZ/sz/include/TightDataPointStorageF.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/TightDataPointStorageF.h	(revision 9ee2ce3c0d78f4ec0c8dee6bba00cac6e8b2f339)
@@ -35,4 +35,6 @@
 	size_t rtypeArray_size;
 	
+	float minLogValue;
+
 	unsigned char* typeArray; //its size is dataSeriesLength/4 (or xxx/4+1) 
 	size_t typeArray_size;
@@ -55,4 +57,7 @@
 	unsigned char* pwrErrBoundBytes;
 	int pwrErrBoundBytes_size;
+	
+	unsigned char* raBytes;
+	size_t raBytes_size;
 	
 } TightDataPointStorageF;
Index: thirdparty/SZ/sz/include/TypeManager.h
===================================================================
--- thirdparty/SZ/sz/include/TypeManager.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/TypeManager.h	(revision 9ee2ce3c0d78f4ec0c8dee6bba00cac6e8b2f339)
@@ -20,6 +20,8 @@
 //TypeManager.c
 size_t convertIntArray2ByteArray_fast_1b(unsigned char* intArray, size_t intArrayLength, unsigned char **result);
+size_t convertIntArray2ByteArray_fast_1b_to_result(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);
+size_t convertIntArray2ByteArray_fast_2b_inplace(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);
Index: thirdparty/SZ/sz/include/callZlib.h
===================================================================
--- thirdparty/SZ/sz/include/callZlib.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/callZlib.h	(revision 9ee2ce3c0d78f4ec0c8dee6bba00cac6e8b2f339)
@@ -19,4 +19,6 @@
 
 #include <stdio.h>
+
+int isZlibFormat(unsigned char magic1, unsigned char magic2);
 
 //callZlib.c
Index: thirdparty/SZ/sz/include/dataCompression.h
===================================================================
--- thirdparty/SZ/sz/include/dataCompression.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/dataCompression.h	(revision 9ee2ce3c0d78f4ec0c8dee6bba00cac6e8b2f339)
@@ -78,4 +78,16 @@
 int initRandomAccessBytes(unsigned char* raBytes);
 
+int generateLossyCoefficients_float(float* oriData, double precision, size_t nbEle, int* reqBytesLength, int* resiBitsLength, float* medianValue, float* decData);
+int compressExactDataArray_float(float* oriData, double precision, size_t nbEle, unsigned char** leadArray, unsigned char** midArray, unsigned char** resiArray, 
+int reqLength, int reqBytesLength, int resiBitsLength, float medianValue);
+
+void decompressExactDataArray_float(unsigned char* leadNum, unsigned char* exactMidBytes, unsigned char* residualMidBits, size_t nbEle, int reqLength, float medianValue, float** decData);
+
+int generateLossyCoefficients_double(double* oriData, double precision, size_t nbEle, int* reqBytesLength, int* resiBitsLength, double* medianValue, double* decData);
+int compressExactDataArray_double(double* oriData, double precision, size_t nbEle, unsigned char** leadArray, unsigned char** midArray, unsigned char** resiArray, 
+int reqLength, int reqBytesLength, int resiBitsLength, double medianValue);
+
+void decompressExactDataArray_double(unsigned char* leadNum, unsigned char* exactMidBytes, unsigned char* residualMidBits, size_t nbEle, int reqLength, double medianValue, double** decData);
+
 #ifdef __cplusplus
 }
Index: thirdparty/SZ/sz/include/pastriD.h
===================================================================
--- thirdparty/SZ/sz/include/pastriD.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/pastriD.h	(revision 9ee2ce3c0d78f4ec0c8dee6bba00cac6e8b2f339)
@@ -11,9 +11,9 @@
   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))));
+//  //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))));
+//  //printf("sign(x)*0.5:0x%lx\n", (*((uint64_t *)(&half))));
   return (int64_t)(x + half.d);
 }
@@ -27,8 +27,8 @@
   int i,sb;
   for(i=0;i<p->bSize;i++){
-    //printf("data[%d] = %.16lf\n",i,data[i]);//DEBUG
+//    //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(DEBUG)printf("data[%d]:%.6e\n",i,data[i]); //DEBUG
     }
     if(abs_FastD(data[i])>absExt){
@@ -43,8 +43,8 @@
   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
+  ////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!
@@ -53,5 +53,5 @@
   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]);}
+    //if(D_W){printf("patternQ[%d]=%ld\n",i,patternQ[i]);}
   }
   
@@ -59,7 +59,7 @@
   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
+  ////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.
@@ -68,5 +68,5 @@
   //int64_t *scalesQ=(int64_t*)(outBuf+15+p->sbSize*8);  //Possible Improvement!
   int patternExtZero=(patternExt==0);
-  //if(DEBUG){printf("patternExtZero: %d\n",patternExtZero);} //DEBUG
+  ////if(DEBUG){printf("patternExtZero: %d\n",patternExtZero);} //DEBUG
   for(sb=0;sb<p->sbNum;sb++){
     //scales[sb]=data[sb*p->sbSize+localExtIdx]/patternExt;
@@ -74,7 +74,7 @@
     //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(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
+  ////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.
@@ -93,5 +93,5 @@
       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
+      ////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:
@@ -118,6 +118,6 @@
       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));
+        //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);
       }
@@ -175,6 +175,6 @@
   //*(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(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
   
   //****************************************************************************************
@@ -184,6 +184,6 @@
     //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
+    //if(D_G){printf("UCSparse\n");} //DEBUG
+    //if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG
     outBuf[0]=0; //mode
     
@@ -217,5 +217,5 @@
           }
     
-    if(D_G)printf("UCSparseBytes:%d \n",UCSparseBytes); //DEBUG
+    //if(D_G)printf("UCSparseBytes:%d \n",UCSparseBytes); //DEBUG
     
   //****************************************************************************************
@@ -225,6 +225,6 @@
     //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
+    //if(D_G){printf("UCNonSparse\n");} //DEBUG
+    //if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG
     outBuf[0]=1; //mode
     
@@ -232,14 +232,14 @@
     memcpy(&outBuf[1], data, p->bSize*p->dataSize);
     
-    if(D_G)printf("UCNonSparseBytes:%d \n",UCNonSparseBytes); //DEBUG
+    //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");
+      //printf("%d ",inBuf[p->bSize*8+i]);
+    }
+    //printf("\n");
     for(i=0;i<UCNonSparseBytes-17;i++){
-      printf("%d ",outBuf[17+i]);
-    }
-    printf("\n");
+      //printf("%d ",outBuf[17+i]);
+    }
+    //printf("\n");
     */
   //****************************************************************************************
@@ -249,7 +249,7 @@
     //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
+    //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
     
@@ -270,15 +270,15 @@
     bitPos=9*8; 
     
-    //if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG
+    ////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
+    ////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);
+    ////if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG
+    ////if(DEBUG)printf("ECQBits:%d\n",ECQBits);
     switch(bp->ECQBits){
       case 2:
@@ -288,5 +288,5 @@
               break;
             case 1:
-              //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x0\n",i,ECQ[i]); //DEBUG
+              ////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);
@@ -296,5 +296,5 @@
               break;
             case -1:
-              //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1\n",i,ECQ[i]); //DEBUG
+              ////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);
@@ -315,5 +315,5 @@
             break;
           case 1:
-            //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x00\n",i,ECQ[i]); //DEBUG
+            ////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
@@ -323,5 +323,5 @@
             break;
           case -1:
-            //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x01\n",i,ECQ[i]); //DEBUG
+            ////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
@@ -331,5 +331,5 @@
             break;
           default:
-            //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1 0x%lx\n",i,ECQ[i],ECQ[i]); //DEBUG
+            ////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]);
@@ -344,6 +344,6 @@
     }
     
-    //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
+    ////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
           
 
@@ -352,5 +352,5 @@
     *(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)printf("bitPos:%ld CSparseBits:%d bytePos:%d CSparseBytes:%d\n",bitPos,CSparseBits,bytePos,CSparseBytes); //DEBUG
     if(D_G){assert(bitPos==CSparseBits);}
     
@@ -360,7 +360,7 @@
     //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
+    //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
     
@@ -375,15 +375,15 @@
     bitPos=7*8; //Currently, we are at the end of 7th byte.
     
-    //if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG
+    ////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
+    ////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);
+    ////if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG
+    ////if(DEBUG)printf("ECQBits:%d\n",ECQBits);
     switch(bp->ECQBits){
       case 2:
@@ -391,9 +391,9 @@
           switch(ECQ[i]){
             case 0:
-              //if(DEBUG)printf("Index:%d ECQ:%d Written:0x1\n",i,ECQ[i]); //DEBUG
+              ////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
+              ////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);
@@ -401,5 +401,5 @@
               break;
             case -1:
-              //if(DEBUG)printf("Index:%d ECQ:%d Written:0x01\n",i,ECQ[i]); //DEBUG
+              ////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);
@@ -413,21 +413,21 @@
         break;
       default: //ECQBits>2
-        //if(DEBUG) printf("AMG_W1:bitPos:%ld\n",bitPos); //DEBUG
+        ////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
+          ////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
+              ////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
+              ////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
+              ////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
@@ -436,9 +436,9 @@
               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
+              ////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
+              ////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
@@ -447,9 +447,9 @@
               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
+              ////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
+              ////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
@@ -458,5 +458,5 @@
               //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
+              ////if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG
               break;
           }
@@ -465,6 +465,6 @@
     }
     
-    //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
+    ////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
     
           
@@ -474,9 +474,9 @@
     *(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)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
+  ////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
   
 }
@@ -484,8 +484,8 @@
   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
+  //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];
@@ -567,5 +567,5 @@
     //R:UCSparse
     case 0:
-      if(D_G){printf("\nDC:UCSparse\n");} //DEBUG
+      //if(D_G){printf("\nDC:UCSparse\n");} //DEBUG
       //bp->nonZeros=*(uint16_t*)(&inBuf[9]);
       //bytePos=11;
@@ -592,17 +592,17 @@
         bytePos+=8; 
       }
-      if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG
+      //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG
       break;
     //R:UCNonSparse
     case 1:
-      if(D_G){printf("\nDC:UCNonSparse\n");} //DEBUG
+      //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
+      //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG
       break;
     //R:CSparse
     case 2:
-      if(D_G){printf("\nDC:CSparse\n");} //DEBUG
+      //if(D_G){printf("\nDC:CSparse\n");} //DEBUG
       //for(j=0;j<p->bSize;j++){
       //  data[j]=0;
@@ -615,5 +615,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
+      //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]);
@@ -621,5 +621,5 @@
       bp->numOutliers=*(uint16_t*)(&inBuf[7]);
       bitPos=9*8;
-      if(D_R){printf("bp->numOutliers:%d\n",bp->numOutliers);} //DEBUG
+      //if(D_R){printf("bp->numOutliers:%d\n",bp->numOutliers);} //DEBUG
 
       bp->scalesBinSize=1/(double)(((uint64_t)1<<(bp->patternBits-1))-1);
@@ -627,13 +627,13 @@
       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
+      //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]);}
+        //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]);}
+        //if(D_R){printf("R:scalesQ[%d]=%ld\n",j,scalesQ[j]);}
       }
       
@@ -649,11 +649,11 @@
         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
+            ////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);
+            ////if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp);
             //continue;
             //sb=_1DIdx/p->sbSize; 
@@ -663,9 +663,9 @@
             ECQ[_1DIdx]=ECQTemp;
             
-            //if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG
+            ////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
+          //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++){
@@ -674,19 +674,19 @@
             //localIdx=_1DIdx%p->sbSize;
             temp=readBits_UI64(inBuf,&bitPos,1);
-            //if(DEBUG){printf("temp:%ld\n",temp);} //DEBUG
+            ////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);
+                ////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);
+                ////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);
+              ////  printf("ERROR: Bad 2-bit value: 0x%lx",temp);
               // assert(0); //AMG
               //  break;
@@ -696,5 +696,5 @@
             ECQ[_1DIdx]=ECQTemp;
             
-            //if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG
+            ////if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG
           }
           break;
@@ -705,5 +705,5 @@
       
       bytePos=(bitPos+7)/8;
-      if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG
+      //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG
       
       //STEP 2: PREDICT DATA(Includes INVERSE QUANTIZATION)
@@ -713,5 +713,5 @@
     //R:CNonSparse
     case 3:
-      if(D_G){printf("\nDC:CNonSparse\n");} //DEBUG
+      //if(D_G){printf("\nDC:CNonSparse\n");} //DEBUG
       
       //for(j=0;j<p->bSize;j++){
@@ -725,5 +725,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
+      //if(D_R){printf("bp->patternBits:%d bp->ECQBits:%d bp->_1DIdxBits:%d\n",bp->patternBits,bp->ECQBits,bp->_1DIdxBits);} //DEBUG
       
       //bitPos=15*8;
@@ -733,18 +733,18 @@
       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
+      //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]);}
+        //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]);}
+        //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]);}
+        ////if(DEBUG){printf("DC:PS[%d]=%.6e\n",j,data[j]);}
       }
       */
@@ -752,6 +752,6 @@
         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
+            ////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);
@@ -769,5 +769,5 @@
             }
             
-            //if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG
+            ////if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG
             //continue;
             //sb=_1DIdx/p->sbSize; 
@@ -777,37 +777,37 @@
             ECQ[j]=ECQTemp;
             
-            //if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG
+            ////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);
+          ////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
+            ////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
+            ////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");
+                ////if(DEBUG)printf("Read:0");
                 temp2=readBits_UI64(inBuf,&bitPos,1);
                 switch(temp2){
                   case 0:
-                    //if(DEBUG)printf("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);
+                    ////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);
+                    ////if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp);
                     break;
                   case 1:
-                    //if(DEBUG)printf("1\n");
+                    ////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);
+                    ////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:
@@ -817,7 +817,7 @@
                 break;
               case 1:
-                //if(DEBUG)printf("Read:1\n");
+                ////if(DEBUG)printf("Read:1\n");
                 ECQTemp=0;
-                //if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp);
+                ////if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp);
                 break;
               default:
@@ -826,5 +826,5 @@
             }
             
-            //if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG
+            ////if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG
             //continue;
             //sb=_1DIdx/p->sbSize; 
@@ -834,5 +834,5 @@
             ECQ[j]=ECQTemp;
             
-            //if(DEBUG){printf("DC:data[%d]:%.6e\n",j,data[j]);} //DEBUG
+            ////if(DEBUG){printf("DC:data[%d]:%.6e\n",j,data[j]);} //DEBUG
           }
           break;
@@ -842,5 +842,5 @@
       //scalesQ=(int64_t*)(inBuf+15+p->sbSize*8);
       bytePos=(bitPos+7)/8;
-      if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG
+      //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG
       
       //STEP 2: PREDICT DATA(Includes INVERSE QUANTIZATION)
@@ -880,17 +880,17 @@
   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);
+      //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);
+      //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);
+      //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);
+      //printf("idx3[%d]=%d  !=  %d=idx3_dc[%d]",i,idx3[i],idx3_dc[i],i);
       assert(0);
     }
@@ -901,5 +901,5 @@
   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);
+      //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);
     }
Index: thirdparty/SZ/sz/include/pastriF.h
===================================================================
--- thirdparty/SZ/sz/include/pastriF.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/pastriF.h	(revision 9ee2ce3c0d78f4ec0c8dee6bba00cac6e8b2f339)
@@ -11,9 +11,9 @@
   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))));
+  ////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))));
+  ////printf("sign(x)*0.5:0x%lx\n", (*((uint64_t *)(&half))));
   return (int64_t)(x + half.d);
 }
@@ -27,8 +27,8 @@
   int i,sb;
   for(i=0;i<p->bSize;i++){
-    //printf("data[%d] = %.16lf\n",i,data[i]);//DEBUG
+    ////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(DEBUG)printf("data[%d]:%.6e\n",i,data[i]); //DEBUG
     }
     if(abs_FastD(data[i])>absExt){
@@ -43,8 +43,8 @@
   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
+  ////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!
@@ -53,5 +53,5 @@
   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]);}
+    //if(D_W){printf("patternQ[%d]=%ld\n",i,patternQ[i]);}
   }
   
@@ -59,7 +59,7 @@
   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
+  ////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.
@@ -68,5 +68,5 @@
   //int64_t *scalesQ=(int64_t*)(outBuf+15+p->sbSize*8);  //Possible Improvement!
   int patternExtZero=(patternExt==0);
-  //if(DEBUG){printf("patternExtZero: %d\n",patternExtZero);} //DEBUG
+  ////if(DEBUG){printf("patternExtZero: %d\n",patternExtZero);} //DEBUG
   for(sb=0;sb<p->sbNum;sb++){
     //scales[sb]=data[sb*p->sbSize+localExtIdx]/patternExt;
@@ -74,7 +74,7 @@
     //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(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
+  ////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.
@@ -93,5 +93,5 @@
       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
+      ////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:
@@ -118,6 +118,6 @@
       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));
+        //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);
       }
@@ -175,6 +175,6 @@
   //*(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(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
   
   //****************************************************************************************
@@ -184,6 +184,6 @@
     //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
+    //if(D_G){printf("UCSparse\n");} //DEBUG
+    //if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG
     outBuf[0]=0; //mode
     
@@ -217,5 +217,5 @@
           }
     
-    if(D_G)printf("UCSparseBytes:%d \n",UCSparseBytes); //DEBUG
+    //if(D_G)printf("UCSparseBytes:%d \n",UCSparseBytes); //DEBUG
     
   //****************************************************************************************
@@ -225,6 +225,6 @@
     //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
+    //if(D_G){printf("UCNonSparse\n");} //DEBUG
+    //if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG
     outBuf[0]=1; //mode
     
@@ -232,14 +232,14 @@
     memcpy(&outBuf[1], data, p->bSize*p->dataSize);
     
-    if(D_G)printf("UCNonSparseBytes:%d \n",UCNonSparseBytes); //DEBUG
+    //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");
+      //printf("%d ",inBuf[p->bSize*8+i]);
+    }
+    //printf("\n");
     for(i=0;i<UCNonSparseBytes-17;i++){
-      printf("%d ",outBuf[17+i]);
-    }
-    printf("\n");
+      //printf("%d ",outBuf[17+i]);
+    }
+    //printf("\n");
     */
   //****************************************************************************************
@@ -249,7 +249,7 @@
     //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
+    //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
     
@@ -270,15 +270,15 @@
     bitPos=9*8; 
     
-    //if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG
+    ////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
+    ////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);
+    ////if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG
+    ////if(DEBUG)printf("ECQBits:%d\n",ECQBits);
     switch(bp->ECQBits){
       case 2:
@@ -288,5 +288,5 @@
               break;
             case 1:
-              //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x0\n",i,ECQ[i]); //DEBUG
+              ////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);
@@ -296,5 +296,5 @@
               break;
             case -1:
-              //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1\n",i,ECQ[i]); //DEBUG
+              ////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);
@@ -315,5 +315,5 @@
             break;
           case 1:
-            //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x00\n",i,ECQ[i]); //DEBUG
+            ////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
@@ -323,5 +323,5 @@
             break;
           case -1:
-            //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x01\n",i,ECQ[i]); //DEBUG
+            ////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
@@ -331,5 +331,5 @@
             break;
           default:
-            //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1 0x%lx\n",i,ECQ[i],ECQ[i]); //DEBUG
+            ////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]);
@@ -344,6 +344,6 @@
     }
     
-    //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
+    ////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
           
 
@@ -352,5 +352,5 @@
     *(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)printf("bitPos:%ld CSparseBits:%d bytePos:%d CSparseBytes:%d\n",bitPos,CSparseBits,bytePos,CSparseBytes); //DEBUG
     if(D_G){assert(bitPos==CSparseBits);}
     
@@ -360,7 +360,7 @@
     //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
+    //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
     
@@ -375,15 +375,15 @@
     bitPos=7*8; //Currently, we are at the end of 7th byte.
     
-    //if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG
+    ////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
+    ////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);
+    ////if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG
+    ////if(DEBUG)printf("ECQBits:%d\n",ECQBits);
     switch(bp->ECQBits){
       case 2:
@@ -391,9 +391,9 @@
           switch(ECQ[i]){
             case 0:
-              //if(DEBUG)printf("Index:%d ECQ:%d Written:0x1\n",i,ECQ[i]); //DEBUG
+              ////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
+              ////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);
@@ -401,5 +401,5 @@
               break;
             case -1:
-              //if(DEBUG)printf("Index:%d ECQ:%d Written:0x01\n",i,ECQ[i]); //DEBUG
+              ////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);
@@ -413,21 +413,21 @@
         break;
       default: //ECQBits>2
-        //if(DEBUG) printf("AMG_W1:bitPos:%ld\n",bitPos); //DEBUG
+        ////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
+          ////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
+              ////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
+              ////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
+              ////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
@@ -436,9 +436,9 @@
               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
+              ////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
+              ////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
@@ -447,9 +447,9 @@
               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
+              ////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
+              ////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
@@ -458,5 +458,5 @@
               //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
+              ////if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG
               break;
           }
@@ -465,6 +465,6 @@
     }
     
-    //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
+    ////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
     
           
@@ -474,9 +474,9 @@
     *(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)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
+  ////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
   
 }
@@ -484,8 +484,8 @@
   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
+  //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];
@@ -567,5 +567,5 @@
     //R:UCSparse
     case 0:
-      if(D_G){printf("\nDC:UCSparse\n");} //DEBUG
+      //if(D_G){printf("\nDC:UCSparse\n");} //DEBUG
       //bp->nonZeros=*(uint16_t*)(&inBuf[9]);
       //bytePos=11;
@@ -592,17 +592,17 @@
         bytePos+=8; 
       }
-      if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG
+      //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG
       break;
     //R:UCNonSparse
     case 1:
-      if(D_G){printf("\nDC:UCNonSparse\n");} //DEBUG
+      //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
+      //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG
       break;
     //R:CSparse
     case 2:
-      if(D_G){printf("\nDC:CSparse\n");} //DEBUG
+      //if(D_G){printf("\nDC:CSparse\n");} //DEBUG
       //for(j=0;j<p->bSize;j++){
       //  data[j]=0;
@@ -615,5 +615,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
+      //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]);
@@ -621,5 +621,5 @@
       bp->numOutliers=*(uint16_t*)(&inBuf[7]);
       bitPos=9*8;
-      if(D_R){printf("bp->numOutliers:%d\n",bp->numOutliers);} //DEBUG
+      //if(D_R){printf("bp->numOutliers:%d\n",bp->numOutliers);} //DEBUG
 
       bp->scalesBinSize=1/(float)(((uint64_t)1<<(bp->patternBits-1))-1);
@@ -627,13 +627,13 @@
       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
+      //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]);}
+        //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]);}
+        //if(D_R){printf("R:scalesQ[%d]=%ld\n",j,scalesQ[j]);}
       }
       
@@ -649,11 +649,11 @@
         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
+            ////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);
+            ////if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp);
             //continue;
             //sb=_1DIdx/p->sbSize; 
@@ -663,9 +663,9 @@
             ECQ[_1DIdx]=ECQTemp;
             
-            //if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG
+            ////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
+          //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++){
@@ -674,19 +674,19 @@
             //localIdx=_1DIdx%p->sbSize;
             temp=readBits_UI64(inBuf,&bitPos,1);
-            //if(DEBUG){printf("temp:%ld\n",temp);} //DEBUG
+            ////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);
+                ////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);
+                ////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);
+              ////  printf("ERROR: Bad 2-bit value: 0x%lx",temp);
               // assert(0); //AMG
               //  break;
@@ -696,5 +696,5 @@
             ECQ[_1DIdx]=ECQTemp;
             
-            //if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG
+            ////if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG
           }
           break;
@@ -705,5 +705,5 @@
       
       bytePos=(bitPos+7)/8;
-      if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG
+      //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG
       
       //STEP 2: PREDICT DATA(Includes INVERSE QUANTIZATION)
@@ -713,5 +713,5 @@
     //R:CNonSparse
     case 3:
-      if(D_G){printf("\nDC:CNonSparse\n");} //DEBUG
+      //if(D_G){printf("\nDC:CNonSparse\n");} //DEBUG
       
       //for(j=0;j<p->bSize;j++){
@@ -725,5 +725,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
+      //if(D_R){printf("bp->patternBits:%d bp->ECQBits:%d bp->_1DIdxBits:%d\n",bp->patternBits,bp->ECQBits,bp->_1DIdxBits);} //DEBUG
       
       //bitPos=15*8;
@@ -733,18 +733,18 @@
       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
+      //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]);}
+        //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]);}
+        //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]);}
+        ////if(DEBUG){printf("DC:PS[%d]=%.6e\n",j,data[j]);}
       }
       */
@@ -752,6 +752,6 @@
         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
+            ////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);
@@ -769,5 +769,5 @@
             }
             
-            //if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG
+            ////if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG
             //continue;
             //sb=_1DIdx/p->sbSize; 
@@ -777,37 +777,37 @@
             ECQ[j]=ECQTemp;
             
-            //if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG
+            ////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);
+          ////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
+            ////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
+            ////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");
+                ////if(DEBUG)printf("Read:0");
                 temp2=readBits_UI64(inBuf,&bitPos,1);
                 switch(temp2){
                   case 0:
-                    //if(DEBUG)printf("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);
+                    ////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);
+                    ////if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp);
                     break;
                   case 1:
-                    //if(DEBUG)printf("1\n");
+                    ////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);
+                    ////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:
@@ -817,7 +817,7 @@
                 break;
               case 1:
-                //if(DEBUG)printf("Read:1\n");
+                ////if(DEBUG)printf("Read:1\n");
                 ECQTemp=0;
-                //if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp);
+                ////if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp);
                 break;
               default:
@@ -826,5 +826,5 @@
             }
             
-            //if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG
+            ////if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG
             //continue;
             //sb=_1DIdx/p->sbSize; 
@@ -834,5 +834,5 @@
             ECQ[j]=ECQTemp;
             
-            //if(DEBUG){printf("DC:data[%d]:%.6e\n",j,data[j]);} //DEBUG
+            ////if(DEBUG){printf("DC:data[%d]:%.6e\n",j,data[j]);} //DEBUG
           }
           break;
@@ -842,5 +842,5 @@
       //scalesQ=(int64_t*)(inBuf+15+p->sbSize*8);
       bytePos=(bitPos+7)/8;
-      if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG
+      //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG
       
       //STEP 2: PREDICT DATA(Includes INVERSE QUANTIZATION)
@@ -880,17 +880,17 @@
   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);
+      //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);
+      //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);
+      //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);
+      //printf("idx3[%d]=%d  !=  %d=idx3_dc[%d]",i,idx3[i],idx3_dc[i],i);
       assert(0);
     }
@@ -901,5 +901,5 @@
   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);
+      //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);
     }
Index: thirdparty/SZ/sz/include/sz.h
===================================================================
--- thirdparty/SZ/sz/include/sz.h	(revision 2c47b734c78138a26f64051bee9d14ecd93594b3)
+++ thirdparty/SZ/sz/include/sz.h	(revision 9ee2ce3c0d78f4ec0c8dee6bba00cac6e8b2f339)
@@ -55,4 +55,5 @@
 #include "sz_float_ts.h"
 #include "szd_float_ts.h"
+#include "utility.h"
 
 #ifdef _WIN32
@@ -75,9 +76,9 @@
 //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 SZ_VERNUM 0x0200
+#define SZ_VER_MAJOR 2
+#define SZ_VER_MINOR 0
+#define SZ_VER_BUILD 2
+#define SZ_VER_REVISION 0
 
 #define PASTRI 103
@@ -131,4 +132,7 @@
 #define SZ_TEMPORAL_COMPRESSION 3
 
+#define SZ_NO_REGRESSION 0
+#define SZ_WITH_LINEAR_REGRESSION 1
+
 #define SZ_PWR_MIN_TYPE 0
 #define SZ_PWR_AVG_TYPE 1
@@ -152,4 +156,8 @@
 	
 #define numOfBufferedSteps 1 //the number of time steps in the buffer	
+
+
+#define GZIP_COMPRESSOR 0 //i.e., ZLIB_COMPRSSOR
+#define ZSTD_COMPRESSOR 1
 	
 //Note: the following setting should be consistent with stateNum in Huffman.h
@@ -237,4 +245,5 @@
 	unsigned int maxRangeRadius;
 	int sol_ID;// it's always SZ, unless the setting is PASTRI compression mode (./configure --enable-pastri)
+	int losslessCompressor;
 	int sampleDistance; //2 bytes
 	float predThreshold;  // 2 bytes
@@ -279,4 +288,8 @@
 	char metadata_filename[256];
 	FILE *metadata_file;
+	unsigned char* bit_array; //sihuan added
+	size_t intersect_size; //sihuan added
+	int64_t* hist_index; //sihuan added: prestep index 
+
 } sz_tsc_metadata;
 
@@ -290,4 +303,6 @@
 extern sz_params *confparams_dec;
 extern sz_exedata *exe_params;
+extern int sz_with_regression;
+
 //------------------------------------------------
 extern SZ_VarSet* sz_varset;
@@ -357,6 +372,4 @@
 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, 
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 9ee2ce3c0d78f4ec0c8dee6bba00cac6e8b2f339)
@@ -76,4 +76,10 @@
 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);
 
+unsigned int optimize_intervals_double_2D_with_freq_and_dense_pos(double *oriData, size_t r1, size_t r2, double realPrecision, double * dense_pos, double * max_freq, double * mean_freq);
+unsigned int optimize_intervals_double_3D_with_freq_and_dense_pos(double *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, double * dense_pos, double * max_freq, double * mean_freq);
+unsigned char * SZ_compress_double_2D_MDQ_nonblocked_with_blocked_regression(double *oriData, size_t r1, size_t r2, double realPrecision, size_t * comp_size);
+unsigned char * SZ_compress_double_3D_MDQ_nonblocked_with_blocked_regression(double *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t * comp_size);
+
+
 #ifdef __cplusplus
 }
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 9ee2ce3c0d78f4ec0c8dee6bba00cac6e8b2f339)
@@ -38,4 +38,8 @@
 size_t dataLength, double absErrBound, double relBoundRatio, double pwrErrRatio, double valueRangeSize, double medianValue_f, size_t *outSize);
 
+void SZ_compress_args_double_NoCkRngeNoGzip_1D_pwr_pre_log(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_pre_log(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_pre_log(unsigned char** newByteData, double *oriData, double globalPrecision, size_t r1, size_t r2, size_t r3, size_t *outSize, double min, double max);
+
 #ifdef __cplusplus
 }
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 9ee2ce3c0d78f4ec0c8dee6bba00cac6e8b2f339)
@@ -129,4 +129,12 @@
 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);
 
+
+unsigned int optimize_intervals_float_2D_with_freq_and_dense_pos(float *oriData, size_t r1, size_t r2, double realPrecision, float * dense_pos, float * max_freq, float * mean_freq);
+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 char * SZ_compress_float_2D_MDQ_nonblocked_with_blocked_regression(float *oriData, size_t r1, size_t r2, 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_3D_MDQ_random_access_with_blocked_regression(float *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t * comp_size);
+
 #ifdef __cplusplus
 }
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 9ee2ce3c0d78f4ec0c8dee6bba00cac6e8b2f339)
@@ -45,4 +45,8 @@
 size_t dataLength, double absErrBound, double relBoundRatio, double pwrErrRatio, float valueRangeSize, float medianValue_f, size_t *outSize);
 
+void SZ_compress_args_float_NoCkRngeNoGzip_1D_pwr_pre_log(unsigned char** newByteData, float *oriData, double pwrErrRatio, size_t dataLength, size_t *outSize, float min, float max);
+void SZ_compress_args_float_NoCkRngeNoGzip_2D_pwr_pre_log(unsigned char** newByteData, float *oriData, double pwrErrRatio, size_t r1, size_t r2, size_t *outSize, float min, float max);
+void SZ_compress_args_float_NoCkRngeNoGzip_3D_pwr_pre_log(unsigned char** newByteData, float *oriData, double pwrErrRatio, size_t r1, size_t r2, size_t r3, size_t *outSize, float min, float max);
+
 #ifdef __cplusplus
 }
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 9ee2ce3c0d78f4ec0c8dee6bba00cac6e8b2f339)
@@ -25,4 +25,6 @@
 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);
+void decompressDataSeries_double_2D_nonblocked_with_blocked_regression(double** data, size_t r1, size_t r2, unsigned char* comp_data);
+void decompressDataSeries_double_3D_nonblocked_with_blocked_regression(double** data, size_t r1, size_t r2, size_t r3, unsigned char* comp_data);
 
 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);
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 9ee2ce3c0d78f4ec0c8dee6bba00cac6e8b2f339)
@@ -22,4 +22,8 @@
 
 void decompressDataSeries_double_1D_pwrgroup(double** data, size_t dataSeriesLength, TightDataPointStorageD* tdps);
+void decompressDataSeries_double_1D_pwr_pre_log(double** data, size_t dataSeriesLength, TightDataPointStorageD* tdps);
+void decompressDataSeries_double_2D_pwr_pre_log(double** data, size_t r1, size_t r2, TightDataPointStorageD* tdps);
+void decompressDataSeries_double_3D_pwr_pre_log(double** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageD* tdps);
+
 #ifdef __cplusplus
 }
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 9ee2ce3c0d78f4ec0c8dee6bba00cac6e8b2f339)
@@ -32,4 +32,9 @@
 
 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);
+
+void decompressDataSeries_float_2D_nonblocked_with_blocked_regression(float** data, size_t r1, size_t r2, unsigned char* comp_data);
+void decompressDataSeries_float_3D_nonblocked_with_blocked_regression(float** data, size_t r1, size_t r2, size_t r3, unsigned char* comp_data);
+void decompressDataSeries_float_3D_random_access_with_blocked_regression(float** data, size_t r1, size_t r2, size_t r3, unsigned char* comp_data);
+
 #ifdef __cplusplus
 }
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 9ee2ce3c0d78f4ec0c8dee6bba00cac6e8b2f339)
@@ -23,4 +23,7 @@
 char* decompressGroupIDArray(unsigned char* bytes, size_t dataLength);
 void decompressDataSeries_float_1D_pwrgroup(float** data, size_t dataSeriesLength, TightDataPointStorageF* tdps);
+void decompressDataSeries_float_1D_pwr_pre_log(float** data, size_t dataSeriesLength, TightDataPointStorageF* tdps);
+void decompressDataSeries_float_2D_pwr_pre_log(float** data, size_t r1, size_t r2, TightDataPointStorageF* tdps);
+void decompressDataSeries_float_3D_pwr_pre_log(float** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageF* tdps);
 
 #ifdef __cplusplus
Index: thirdparty/SZ/sz/include/utility.h
===================================================================
--- thirdparty/SZ/sz/include/utility.h	(revision 9ee2ce3c0d78f4ec0c8dee6bba00cac6e8b2f339)
+++ thirdparty/SZ/sz/include/utility.h	(revision 9ee2ce3c0d78f4ec0c8dee6bba00cac6e8b2f339)
@@ -0,0 +1,43 @@
+/**
+ *  @file utility.h
+ *  @author Sheng Di, Sihuan Li
+ *  @date July, 2018
+ *  @brief Header file for the utility.c.
+ *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _UTILITY_H
+#define _UTILITY_H
+
+#include "sz.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//sihuan added: use a assistant struct to do sorting and swap that are easy to implement: should
+//consider optimizing the performance later.
+typedef struct sort_ast_particle{
+	int64_t id;
+	float var[6];
+} sort_ast_particle;
+
+int compare_struct(const void* obj1, const void* obj2);//sihuan added: the compare function in the qsort parameter for 2 structures
+void reorder_vars(SZ_VarSet* vset);//sihuan added: reorder the variables increasingly by their index
+size_t intersectAndsort(int64_t* preIndex, size_t preLen, SZ_VarSet* curVar, size_t dataLen, unsigned char* bitarray);
+//sihuan added: find intersection and keep new var sorted by id
+void write_reordered_tofile(SZ_VarSet* curVar, size_t dataLen);
+//sihuan added: write the reordered input to files for further decompression validation
+float calculate_delta_t(size_t size);//sihuan added
+
+int is_lossless_compressed_data(unsigned char* compressedBytes, size_t cmpSize);
+unsigned long sz_lossless_compress(int losslessCompressor, int level, unsigned char* data, unsigned long dataLength, unsigned char** compressBytes);
+unsigned long sz_lossless_decompress(int losslessCompressor, unsigned char* compressBytes, unsigned long cmpSize, unsigned char** oriData, unsigned long targetOriSize);
+unsigned long sz_lossless_decompress65536bytes(int losslessCompressor, unsigned char* compressBytes, unsigned long cmpSize, unsigned char** oriData);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ----- #ifndef _UTILITY_H  ----- */
