Ignore:
Timestamp:
09/28/18 16:32:55 (6 years ago)
Author:
Hal Finkel <hfinkel@…>
Branches:
master, pympi
Children:
e6aa0eb
Parents:
abca157
git-author:
Hal Finkel <hfinkel@…> (09/28/18 16:32:55)
git-committer:
Hal Finkel <hfinkel@…> (09/28/18 16:32:55)
Message:

importing new SZ files

Location:
thirdparty/SZ/sz/include
Files:
1 added
16 edited

Legend:

Unmodified
Added
Removed
  • thirdparty/SZ/sz/include/TightDataPointStorageD.h

    r2c47b73 r9ee2ce3  
    2323        char reqLength;  
    2424        char radExpo; //used to compute reqLength based on segmented precisions in "pw_rel_compression" 
     25 
     26        double minLogValue; 
    2527 
    2628        int stateNum; 
     
    5355        unsigned char* pwrErrBoundBytes; 
    5456        int pwrErrBoundBytes_size; 
     57                 
     58        unsigned char* raBytes; 
     59        size_t raBytes_size; 
     60         
    5561} TightDataPointStorageD; 
    5662 
  • thirdparty/SZ/sz/include/TightDataPointStorageF.h

    r2c47b73 r9ee2ce3  
    3535        size_t rtypeArray_size; 
    3636         
     37        float minLogValue; 
     38 
    3739        unsigned char* typeArray; //its size is dataSeriesLength/4 (or xxx/4+1)  
    3840        size_t typeArray_size; 
     
    5557        unsigned char* pwrErrBoundBytes; 
    5658        int pwrErrBoundBytes_size; 
     59         
     60        unsigned char* raBytes; 
     61        size_t raBytes_size; 
    5762         
    5863} TightDataPointStorageF; 
  • thirdparty/SZ/sz/include/TypeManager.h

    r2c47b73 r9ee2ce3  
    2020//TypeManager.c 
    2121size_t convertIntArray2ByteArray_fast_1b(unsigned char* intArray, size_t intArrayLength, unsigned char **result); 
     22size_t convertIntArray2ByteArray_fast_1b_to_result(unsigned char* intArray, size_t intArrayLength, unsigned char *result); 
    2223void convertByteArray2IntArray_fast_1b(size_t intArrayLength, unsigned char* byteArray, size_t byteArrayLength, unsigned char **intArray); 
    2324size_t convertIntArray2ByteArray_fast_2b(unsigned char* timeStepType, size_t timeStepTypeLength, unsigned char **result); 
     25size_t convertIntArray2ByteArray_fast_2b_inplace(unsigned char* timeStepType, size_t timeStepTypeLength, unsigned char *result); 
    2426void convertByteArray2IntArray_fast_2b(size_t stepLength, unsigned char* byteArray, size_t byteArrayLength, unsigned char **intArray); 
    2527size_t convertIntArray2ByteArray_fast_3b(unsigned char* timeStepType, size_t timeStepTypeLength, unsigned char **result); 
  • thirdparty/SZ/sz/include/callZlib.h

    r2c47b73 r9ee2ce3  
    1919 
    2020#include <stdio.h> 
     21 
     22int isZlibFormat(unsigned char magic1, unsigned char magic2); 
    2123 
    2224//callZlib.c 
  • thirdparty/SZ/sz/include/dataCompression.h

    r2c47b73 r9ee2ce3  
    7878int initRandomAccessBytes(unsigned char* raBytes); 
    7979 
     80int generateLossyCoefficients_float(float* oriData, double precision, size_t nbEle, int* reqBytesLength, int* resiBitsLength, float* medianValue, float* decData); 
     81int compressExactDataArray_float(float* oriData, double precision, size_t nbEle, unsigned char** leadArray, unsigned char** midArray, unsigned char** resiArray,  
     82int reqLength, int reqBytesLength, int resiBitsLength, float medianValue); 
     83 
     84void decompressExactDataArray_float(unsigned char* leadNum, unsigned char* exactMidBytes, unsigned char* residualMidBits, size_t nbEle, int reqLength, float medianValue, float** decData); 
     85 
     86int generateLossyCoefficients_double(double* oriData, double precision, size_t nbEle, int* reqBytesLength, int* resiBitsLength, double* medianValue, double* decData); 
     87int compressExactDataArray_double(double* oriData, double precision, size_t nbEle, unsigned char** leadArray, unsigned char** midArray, unsigned char** resiArray,  
     88int reqLength, int reqBytesLength, int resiBitsLength, double medianValue); 
     89 
     90void decompressExactDataArray_double(unsigned char* leadNum, unsigned char* exactMidBytes, unsigned char* residualMidBits, size_t nbEle, int reqLength, double medianValue, double** decData); 
     91 
    8092#ifdef __cplusplus 
    8193} 
  • thirdparty/SZ/sz/include/pastriD.h

    r2c47b73 r9ee2ce3  
    1111  half.d=0.5; 
    1212   
    13   //printf("pastri_double_quantize:\nx=%lf  x=0x%lx\n",x,(*((uint64_t *)(&x)))); 
    14   //printf("sign(x):0x%lx\n", x); 
    15   //printf("0.5:0x%lx\n", (*((uint64_t *)(&half)))); 
     13//  //printf("pastri_double_quantize:\nx=%lf  x=0x%lx\n",x,(*((uint64_t *)(&x)))); 
     14//  //printf("sign(x):0x%lx\n", x); 
     15//  //printf("0.5:0x%lx\n", (*((uint64_t *)(&half)))); 
    1616  half.ui64 |= (u1.ui64 & (uint64_t)0x8000000000000000); 
    17   //printf("sign(x)*0.5:0x%lx\n", (*((uint64_t *)(&half)))); 
     17//  //printf("sign(x)*0.5:0x%lx\n", (*((uint64_t *)(&half)))); 
    1818  return (int64_t)(x + half.d); 
    1919} 
     
    2727  int i,sb; 
    2828  for(i=0;i<p->bSize;i++){ 
    29     //printf("data[%d] = %.16lf\n",i,data[i]);//DEBUG 
     29//    //printf("data[%d] = %.16lf\n",i,data[i]);//DEBUG 
    3030    if(abs_FastD(data[i])>p->usedEb){ 
    3131      bp->nonZeros++; 
    32       //if(DEBUG)printf("data[%d]:%.6e\n",i,data[i]); //DEBUG 
     32      ////if(DEBUG)printf("data[%d]:%.6e\n",i,data[i]); //DEBUG 
    3333    } 
    3434    if(abs_FastD(data[i])>absExt){ 
     
    4343  bp->binSize=2*p->usedEb; 
    4444   
    45   //if(DEBUG){printf("Extremum  : data[%d] = %.6e\n",extIdx,patternExt);} //DEBUG 
    46   //if(DEBUG){printf("patternIdx: %d\n",patternIdx);} //DEBUG 
    47    
    48   //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 
     45  ////if(DEBUG){printf("Extremum  : data[%d] = %.6e\n",extIdx,patternExt);} //DEBUG 
     46  ////if(DEBUG){printf("patternIdx: %d\n",patternIdx);} //DEBUG 
     47   
     48  ////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 
    4949   
    5050  //int64_t *patternQ=(int64_t*)(outBuf+15);  //Possible Improvement! 
     
    5353  for(i=0;i<p->sbSize;i++){ 
    5454    patternQ[i]=pastri_double_quantize(data[patternIdx+i],bp->binSize); 
    55     if(D_W){printf("patternQ[%d]=%ld\n",i,patternQ[i]);} 
     55    //if(D_W){printf("patternQ[%d]=%ld\n",i,patternQ[i]);} 
    5656  } 
    5757   
     
    5959  bp->scaleBits=bp->patternBits; 
    6060  bp->scalesBinSize=1/(double)(((uint64_t)1<<(bp->scaleBits-1))-1); 
    61   //if(DEBUG){printf("(patternExt/binSize)+1: %.6e\n",(patternExt/binSize)+1);} //DEBUG 
    62   //if(DEBUG){printf("scaleBits=patternBits: %d\n",scaleBits);} //DEBUG 
    63   if(D_W){printf("scalesBinSize: %.6e\n",bp->scalesBinSize);} //DEBUG 
     61  ////if(DEBUG){printf("(patternExt/binSize)+1: %.6e\n",(patternExt/binSize)+1);} //DEBUG 
     62  ////if(DEBUG){printf("scaleBits=patternBits: %d\n",scaleBits);} //DEBUG 
     63  //if(D_W){printf("scalesBinSize: %.6e\n",bp->scalesBinSize);} //DEBUG 
    6464   
    6565  //Calculate Scales. 
     
    6868  //int64_t *scalesQ=(int64_t*)(outBuf+15+p->sbSize*8);  //Possible Improvement! 
    6969  int patternExtZero=(patternExt==0); 
    70   //if(DEBUG){printf("patternExtZero: %d\n",patternExtZero);} //DEBUG 
     70  ////if(DEBUG){printf("patternExtZero: %d\n",patternExtZero);} //DEBUG 
    7171  for(sb=0;sb<p->sbNum;sb++){ 
    7272    //scales[sb]=data[sb*p->sbSize+localExtIdx]/patternExt; 
     
    7474    //assert(scales[sb]<=1); 
    7575    scalesQ[sb]=pastri_double_quantize((patternExtZero ? 0 : data[sb*p->sbSize+localExtIdx]/patternExt),bp->scalesBinSize); 
    76     if(D_W){printf("scalesQ[%d]=%ld\n",sb,scalesQ[sb]);} 
     76    //if(D_W){printf("scalesQ[%d]=%ld\n",sb,scalesQ[sb]);} 
    7777  } 
    78   //if(DEBUG){for(i=0;i<p->sbSize;i++){printf("scalesQ[%d]=%ld \n",i,scalesQ[i]);}} //DEBUG 
     78  ////if(DEBUG){for(i=0;i<p->sbSize;i++){printf("scalesQ[%d]=%ld \n",i,scalesQ[i]);}} //DEBUG 
    7979 
    8080  //int64_t *ECQ=(int64_t*)(outBuf+p->bSize*8); //ECQ is written into outBuf, just be careful when handling it. 
     
    9393      if(absECQ > bp->ECQExt) 
    9494        bp->ECQExt=absECQ; 
    95       //if(DEBUG){printf("EC[%d]: %.6e Quantized:%ld \n",_1DIdx,(scalesQ[sb]*patternQ[i]*scalesBinSize*binSize-data[_1DIdx]),ECQ[_1DIdx]);} //DEBUG 
     95      ////if(DEBUG){printf("EC[%d]: %.6e Quantized:%ld \n",_1DIdx,(scalesQ[sb]*patternQ[i]*scalesBinSize*binSize-data[_1DIdx]),ECQ[_1DIdx]);} //DEBUG 
    9696      switch (ECQ[_1DIdx]){ 
    9797        case 0: 
     
    118118      double decompressed=scalesQ[sb]*patternQ[i]*scalesBinSize*binSize-ECQ[_1DIdx]*binSize; 
    119119      if(abs_FastD(decompressed-data[_1DIdx])>(p->usedEb)){ 
    120         printf("p->usedEb=%.6e\n",p->usedEb); 
    121         printf("data[%d]=%.6e decompressed[%d]=%.6e diff=%.6e\n",_1DIdx,data[_1DIdx],_1DIdx,decompressed,abs_FastD(data[_1DIdx]-decompressed)); 
     120        //printf("p->usedEb=%.6e\n",p->usedEb); 
     121        //printf("data[%d]=%.6e decompressed[%d]=%.6e diff=%.6e\n",_1DIdx,data[_1DIdx],_1DIdx,decompressed,abs_FastD(data[_1DIdx]-decompressed)); 
    122122        assert(0); 
    123123      } 
     
    175175  //*(uint16_t*)(&outBuf[7])=p->idxOffset[3]; 
    176176     
    177   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 
    178   if(D_W){printf("numOutliers:%d\n",bp->numOutliers);} //DEBUG 
     177  //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 
     178  //if(D_W){printf("numOutliers:%d\n",bp->numOutliers);} //DEBUG 
    179179   
    180180  //**************************************************************************************** 
     
    184184    //Uncompressed, Sparse bits. Just like the original GAMESS data. Includes: mode, indexOffsets, nonZeros, indexes, data 
    185185    *numOutBytes=UCSparseBytes; 
    186     if(D_G){printf("UCSparse\n");} //DEBUG 
    187     if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 
     186    //if(D_G){printf("UCSparse\n");} //DEBUG 
     187    //if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 
    188188    outBuf[0]=0; //mode 
    189189     
     
    217217          } 
    218218     
    219     if(D_G)printf("UCSparseBytes:%d \n",UCSparseBytes); //DEBUG 
     219    //if(D_G)printf("UCSparseBytes:%d \n",UCSparseBytes); //DEBUG 
    220220     
    221221  //**************************************************************************************** 
     
    225225    //Uncompressed, NonSparse bits. Includes: mode, indexOffsets, data 
    226226    *numOutBytes=UCNonSparseBytes; 
    227     if(D_G){printf("UCNonSparse\n");} //DEBUG 
    228     if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 
     227    //if(D_G){printf("UCNonSparse\n");} //DEBUG 
     228    //if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 
    229229    outBuf[0]=1; //mode 
    230230     
     
    232232    memcpy(&outBuf[1], data, p->bSize*p->dataSize); 
    233233     
    234     if(D_G)printf("UCNonSparseBytes:%d \n",UCNonSparseBytes); //DEBUG 
     234    //if(D_G)printf("UCNonSparseBytes:%d \n",UCNonSparseBytes); //DEBUG 
    235235    /* 
    236236    for(i=0;i<UCNonSparseBytes-17;i++){ 
    237       printf("%d ",inBuf[p->bSize*8+i]); 
    238     } 
    239     printf("\n"); 
     237      //printf("%d ",inBuf[p->bSize*8+i]); 
     238    } 
     239    //printf("\n"); 
    240240    for(i=0;i<UCNonSparseBytes-17;i++){ 
    241       printf("%d ",outBuf[17+i]); 
    242     } 
    243     printf("\n"); 
     241      //printf("%d ",outBuf[17+i]); 
     242    } 
     243    //printf("\n"); 
    244244    */ 
    245245  //**************************************************************************************** 
     
    249249    //Includes: mode, indexOffsets, compressedBytes, patternBits, ECQBits,numOutliers,P, S, {Indexes(Sparse), ECQ} 
    250250    *numOutBytes=CSparseBytes; 
    251     if(D_G){printf("CSparse\n");} //DEBUG 
    252     if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 
    253     //if(DEBUG){printf("patternBits:%d _1DIdxBits:%d\n",patternBits,_1DIdxBits);} //DEBUG 
     251    //if(D_G){printf("CSparse\n");} //DEBUG 
     252    //if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 
     253    ////if(DEBUG){printf("patternBits:%d _1DIdxBits:%d\n",patternBits,_1DIdxBits);} //DEBUG 
    254254    outBuf[0]=2; //mode 
    255255     
     
    270270    bitPos=9*8;  
    271271     
    272     //if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG 
     272    ////if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG 
    273273 
    274274    for(i=0;i<p->sbSize;i++){ 
    275275      writeBits_Fast(outBuf,&bitPos,bp->patternBits,patternQ[i]);//Pattern point 
    276276    } 
    277     //if(DEBUG){printf("bitPos_P:%ld\n",bitPos);} //DEBUG 
     277    ////if(DEBUG){printf("bitPos_P:%ld\n",bitPos);} //DEBUG 
    278278    for(i=0;i<p->sbNum;i++){ 
    279279      writeBits_Fast(outBuf,&bitPos,bp->scaleBits,scalesQ[i]);//Scale 
    280280    } 
    281     //if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG 
    282     //if(DEBUG)printf("ECQBits:%d\n",ECQBits); 
     281    ////if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG 
     282    ////if(DEBUG)printf("ECQBits:%d\n",ECQBits); 
    283283    switch(bp->ECQBits){ 
    284284      case 2: 
     
    288288              break; 
    289289            case 1: 
    290               //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x0\n",i,ECQ[i]); //DEBUG 
     290              ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x0\n",i,ECQ[i]); //DEBUG 
    291291              writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i); 
    292292              //writeBits_Fast(outBuf,&bitPos,2,0x10); 
     
    296296              break; 
    297297            case -1: 
    298               //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1\n",i,ECQ[i]); //DEBUG 
     298              ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1\n",i,ECQ[i]); //DEBUG 
    299299              writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i); 
    300300              //writeBits_Fast(outBuf,&bitPos,2,0x11); 
     
    315315            break; 
    316316          case 1: 
    317             //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x00\n",i,ECQ[i]); //DEBUG 
     317            ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x00\n",i,ECQ[i]); //DEBUG 
    318318            writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i); 
    319319            //writeBits_Fast(outBuf,&bitPos,3,0);//0x000 
     
    323323            break; 
    324324          case -1: 
    325             //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x01\n",i,ECQ[i]); //DEBUG 
     325            ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x01\n",i,ECQ[i]); //DEBUG 
    326326            writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i); 
    327327            //writeBits_Fast(outBuf,&bitPos,3,1);//0x001 
     
    331331            break; 
    332332          default: 
    333             //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1 0x%lx\n",i,ECQ[i],ECQ[i]); //DEBUG 
     333            ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1 0x%lx\n",i,ECQ[i],ECQ[i]); //DEBUG 
    334334            writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i); 
    335335            //writeBits_Fast(outBuf,&bitPos,2+ECQBits,((uint64_t)0x11<<ECQBits)|ECQ[i]); 
     
    344344    } 
    345345     
    346     //if(DEBUG){printf("bitPos_E:%ld\n",bitPos);} //DEBUG 
    347     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 
     346    ////if(DEBUG){printf("bitPos_E:%ld\n",bitPos);} //DEBUG 
     347    //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 
    348348           
    349349 
     
    352352    *(uint32_t*)(&outBuf[1])=bytePos; 
    353353     
    354     if(D_G)printf("bitPos:%ld CSparseBits:%d bytePos:%d CSparseBytes:%d\n",bitPos,CSparseBits,bytePos,CSparseBytes); //DEBUG 
     354    //if(D_G)printf("bitPos:%ld CSparseBits:%d bytePos:%d CSparseBytes:%d\n",bitPos,CSparseBits,bytePos,CSparseBytes); //DEBUG 
    355355    if(D_G){assert(bitPos==CSparseBits);} 
    356356     
     
    360360    //Includes: mode, indexOffsets, compressedBytes, patternBits, ECQBits,P, S, {ECQ} 
    361361    *numOutBytes=CNonSparseBytes; 
    362     if(D_G){printf("CNonSparse\n");} //DEBUG 
    363     if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 
    364     //if(DEBUG){printf("patternBits:%d _1DIdxBits:%d\n",patternBits,_1DIdxBits);} //DEBUG 
     362    //if(D_G){printf("CNonSparse\n");} //DEBUG 
     363    //if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 
     364    ////if(DEBUG){printf("patternBits:%d _1DIdxBits:%d\n",patternBits,_1DIdxBits);} //DEBUG 
    365365    outBuf[0]=3; //mode 
    366366     
     
    375375    bitPos=7*8; //Currently, we are at the end of 7th byte. 
    376376     
    377     //if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG 
     377    ////if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG 
    378378 
    379379    for(i=0;i<p->sbSize;i++){ 
    380380      writeBits_Fast(outBuf,&bitPos,bp->patternBits,patternQ[i]);//Pattern point 
    381381    } 
    382     //if(DEBUG){printf("bitPos_P:%ld\n",bitPos);} //DEBUG 
     382    ////if(DEBUG){printf("bitPos_P:%ld\n",bitPos);} //DEBUG 
    383383    for(i=0;i<p->sbNum;i++){ 
    384384      writeBits_Fast(outBuf,&bitPos,bp->scaleBits,scalesQ[i]);//Scale 
    385385    } 
    386     //if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG 
    387     //if(DEBUG)printf("ECQBits:%d\n",ECQBits); 
     386    ////if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG 
     387    ////if(DEBUG)printf("ECQBits:%d\n",ECQBits); 
    388388    switch(bp->ECQBits){ 
    389389      case 2: 
     
    391391          switch(ECQ[i]){ 
    392392            case 0: 
    393               //if(DEBUG)printf("Index:%d ECQ:%d Written:0x1\n",i,ECQ[i]); //DEBUG 
     393              ////if(DEBUG)printf("Index:%d ECQ:%d Written:0x1\n",i,ECQ[i]); //DEBUG 
    394394              writeBits_Fast(outBuf,&bitPos,1,1);//0x1 
    395395              break; 
    396396            case 1: 
    397               //if(DEBUG)printf("Index:%d ECQ:%d Written:0x00\n",i,ECQ[i]); //DEBUG 
     397              ////if(DEBUG)printf("Index:%d ECQ:%d Written:0x00\n",i,ECQ[i]); //DEBUG 
    398398              //writeBits_Fast(outBuf,&bitPos,2,0);//0x00 
    399399              writeBits_Fast(outBuf,&bitPos,1,0); 
     
    401401              break; 
    402402            case -1: 
    403               //if(DEBUG)printf("Index:%d ECQ:%d Written:0x01\n",i,ECQ[i]); //DEBUG 
     403              ////if(DEBUG)printf("Index:%d ECQ:%d Written:0x01\n",i,ECQ[i]); //DEBUG 
    404404              //writeBits_Fast(outBuf,&bitPos,2,2); //0x01 
    405405              writeBits_Fast(outBuf,&bitPos,1,0); 
     
    413413        break; 
    414414      default: //ECQBits>2 
    415         //if(DEBUG) printf("AMG_W1:bitPos:%ld\n",bitPos); //DEBUG 
     415        ////if(DEBUG) printf("AMG_W1:bitPos:%ld\n",bitPos); //DEBUG 
    416416        for(i=0;i<p->bSize;i++){ 
    417           //if(DEBUG){printf("AMG_W3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 
    418           //if(DEBUG) printf("AMG_W2:bitPos:%ld\n",bitPos); //DEBUG 
    419           //if(DEBUG) printf("ECQ[%d]:%ld\n",i,ECQ[i]); //DEBUG 
     417          ////if(DEBUG){printf("AMG_W3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 
     418          ////if(DEBUG) printf("AMG_W2:bitPos:%ld\n",bitPos); //DEBUG 
     419          ////if(DEBUG) printf("ECQ[%d]:%ld\n",i,ECQ[i]); //DEBUG 
    420420          switch(ECQ[i]){ 
    421421            case 0: 
    422               //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1\n",i,ECQ[i]); //DEBUG 
    423               //if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 
     422              ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1\n",i,ECQ[i]); //DEBUG 
     423              ////if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 
    424424              //temp1=bitPos; 
    425425              writeBits_Fast(outBuf,&bitPos,1,1);  //0x1 
    426426              //wVal=1; writeBits_Fast(outBuf,&bitPos,1,wVal); //0x1 
    427               //if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 
     427              ////if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 
    428428              break; 
    429429            case 1: 
    430               //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x000\n",i,ECQ[i]); //DEBUG 
    431               //if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 
     430              ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x000\n",i,ECQ[i]); //DEBUG 
     431              ////if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 
    432432              //temp1=bitPos; 
    433433              //writeBits_Fast(outBuf,&bitPos,3,0); //0x000 
     
    436436              writeBits_Fast(outBuf,&bitPos,1,0); 
    437437              //wVal=0; writeBits_Fast(outBuf,&bitPos,3,wVal); //0x000 
    438               //if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 
     438              ////if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 
    439439              break; 
    440440            case -1: 
    441               //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x001\n",i,ECQ[i]); //DEBUG 
    442               //if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 
     441              ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x001\n",i,ECQ[i]); //DEBUG 
     442              ////if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 
    443443              //temp1=bitPos; 
    444444              //writeBits_Fast(outBuf,&bitPos,3,8); //0x001 
     
    447447              writeBits_Fast(outBuf,&bitPos,1,1);  
    448448              //wVal=8; writeBits_Fast(outBuf,&bitPos,3,wVal); //0x001 
    449               //if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 
     449              ////if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 
    450450              break; 
    451451            default: 
    452               //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x01 0x%lx\n",i,ECQ[i]); //DEBUG 
    453               //if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 
     452              ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x01 0x%lx\n",i,ECQ[i]); //DEBUG 
     453              ////if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 
    454454              //temp1=bitPos; 
    455455              //writeBits_Fast(outBuf,&bitPos,2,2); //0x01 
     
    458458              //wVal=2; writeBits_Fast(outBuf,&bitPos,2,wVal); //0x01 
    459459              writeBits_Fast(outBuf,&bitPos,bp->ECQBits,ECQ[i]); 
    460               //if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 
     460              ////if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 
    461461              break; 
    462462          } 
     
    465465    } 
    466466     
    467     //if(DEBUG){printf("bitPos_E:%ld\n",bitPos);} //DEBUG 
    468     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 
     467    ////if(DEBUG){printf("bitPos_E:%ld\n",bitPos);} //DEBUG 
     468    //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 
    469469     
    470470           
     
    474474    *(uint32_t*)(&outBuf[1])=bytePos; 
    475475     
    476     if(D_G)printf("bitPos:%ld CNonSparseBits:%d bytePos:%d CNonSparseBytes:%d\n",bitPos,CNonSparseBits,bytePos,CNonSparseBytes); //DEBUG 
     476    //if(D_G)printf("bitPos:%ld CNonSparseBits:%d bytePos:%d CNonSparseBytes:%d\n",bitPos,CNonSparseBits,bytePos,CNonSparseBytes); //DEBUG 
    477477    if(D_G){assert(bitPos==CNonSparseBits);} 
    478478     
    479479  } 
    480   //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 
     480  ////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 
    481481   
    482482} 
     
    484484  pastri_blockParams bp; 
    485485 
    486   if(D_G2){printf("Parameters: dataSize:%d\n",p->dataSize);}  //DEBUG 
    487   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 
    488   if(D_G2){printf("Parameters: idxRanges:%d %d %d %d\n",p->idxRange[0],p->idxRange[1],p->idxRange[2],p->idxRange[3]);} //DEBUG 
    489   if(D_G2){printf("Parameters: sbSize:%d sbNum:%d bSize:%d\n",p->sbSize,p->sbNum,p->bSize); }//DEBUG 
     486  //if(D_G2){printf("Parameters: dataSize:%d\n",p->dataSize);}  //DEBUG 
     487  //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 
     488  //if(D_G2){printf("Parameters: idxRanges:%d %d %d %d\n",p->idxRange[0],p->idxRange[1],p->idxRange[2],p->idxRange[3]);} //DEBUG 
     489  //if(D_G2){printf("Parameters: sbSize:%d sbNum:%d bSize:%d\n",p->sbSize,p->sbNum,p->bSize); }//DEBUG 
    490490   
    491491  int64_t patternQ[MAX_PS_SIZE]; 
     
    567567    //R:UCSparse 
    568568    case 0: 
    569       if(D_G){printf("\nDC:UCSparse\n");} //DEBUG 
     569      //if(D_G){printf("\nDC:UCSparse\n");} //DEBUG 
    570570      //bp->nonZeros=*(uint16_t*)(&inBuf[9]); 
    571571      //bytePos=11; 
     
    592592        bytePos+=8;  
    593593      } 
    594       if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 
     594      //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 
    595595      break; 
    596596    //R:UCNonSparse 
    597597    case 1: 
    598       if(D_G){printf("\nDC:UCNonSparse\n");} //DEBUG 
     598      //if(D_G){printf("\nDC:UCNonSparse\n");} //DEBUG 
    599599      //memcpy(&outBuf[p->bSize*8], &inBuf[9], p->bSize*8); 
    600600      memcpy(data, &inBuf[1], p->bSize*8); 
    601601      bytePos=p->bSize*8; 
    602       if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 
     602      //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 
    603603      break; 
    604604    //R:CSparse 
    605605    case 2: 
    606       if(D_G){printf("\nDC:CSparse\n");} //DEBUG 
     606      //if(D_G){printf("\nDC:CSparse\n");} //DEBUG 
    607607      //for(j=0;j<p->bSize;j++){ 
    608608      //  data[j]=0; 
     
    615615      bp->ECQBits=inBuf[6]; 
    616616       
    617       if(D_R){printf("bp->patternBits:%d bp->ECQBits:%d bp->_1DIdxBits:%d\n",bp->patternBits,bp->ECQBits,bp->_1DIdxBits);} //DEBUG 
     617      //if(D_R){printf("bp->patternBits:%d bp->ECQBits:%d bp->_1DIdxBits:%d\n",bp->patternBits,bp->ECQBits,bp->_1DIdxBits);} //DEBUG 
    618618       
    619619      //bp->numOutliers=*(uint16_t*)(&inBuf[15]); 
     
    621621      bp->numOutliers=*(uint16_t*)(&inBuf[7]); 
    622622      bitPos=9*8; 
    623       if(D_R){printf("bp->numOutliers:%d\n",bp->numOutliers);} //DEBUG 
     623      //if(D_R){printf("bp->numOutliers:%d\n",bp->numOutliers);} //DEBUG 
    624624 
    625625      bp->scalesBinSize=1/(double)(((uint64_t)1<<(bp->patternBits-1))-1); 
     
    627627      bp->binSize=p->usedEb*2; 
    628628       
    629       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 
     629      //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 
    630630 
    631631      for(j=0;j<p->sbSize;j++){ 
    632632        patternQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Pattern point 
    633         if(D_R){printf("R:patternQ[%d]=%ld\n",j,patternQ[j]);} 
     633        //if(D_R){printf("R:patternQ[%d]=%ld\n",j,patternQ[j]);} 
    634634      } 
    635635      for(j=0;j<p->sbNum;j++){ 
    636636        scalesQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Scale 
    637         if(D_R){printf("R:scalesQ[%d]=%ld\n",j,scalesQ[j]);} 
     637        //if(D_R){printf("R:scalesQ[%d]=%ld\n",j,scalesQ[j]);} 
    638638      } 
    639639       
     
    649649        case 2: 
    650650          for(j=0;j<bp->numOutliers;j++){ 
    651             //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG 
    652             //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG 
     651            ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG 
     652            ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG 
    653653             
    654654            _1DIdx=readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits); 
    655655            ECQTemp=readBits_I64(inBuf,&bitPos,1); 
    656656            ECQTemp= ((ECQTemp<<63)>>63)|(uint64_t)0x1; 
    657             //if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp); 
     657            ////if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp); 
    658658            //continue; 
    659659            //sb=_1DIdx/p->sbSize;  
     
    663663            ECQ[_1DIdx]=ECQTemp; 
    664664             
    665             //if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG 
     665            ////if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG 
    666666          } 
    667667          break; 
    668668        default: //bp->ECQBits>2 
    669           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 
     669          //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 
    670670     
    671671          for(j=0;j<bp->numOutliers;j++){ 
     
    674674            //localIdx=_1DIdx%p->sbSize; 
    675675            temp=readBits_UI64(inBuf,&bitPos,1); 
    676             //if(DEBUG){printf("temp:%ld\n",temp);} //DEBUG 
     676            ////if(DEBUG){printf("temp:%ld\n",temp);} //DEBUG 
    677677            switch(temp){ 
    678678              case 0:  //+-1 
    679679                ECQTemp=readBits_I64(inBuf,&bitPos,1); 
    680680                ECQTemp= ((ECQTemp<<63)>>63)|(uint64_t)0x1; 
    681                 //if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 
    682                 //if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp); 
     681                ////if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 
     682                ////if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp); 
    683683                break; 
    684684              case 1: //Others 
    685685                ECQTemp=readBits_I64(inBuf,&bitPos,bp->ECQBits); 
    686                 //if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 
    687                 //if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp); 
     686                ////if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 
     687                ////if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp); 
    688688                break; 
    689689              //default: 
    690               //  printf("ERROR: Bad 2-bit value: 0x%lx",temp); 
     690              ////  printf("ERROR: Bad 2-bit value: 0x%lx",temp); 
    691691              // assert(0); //AMG 
    692692              //  break; 
     
    696696            ECQ[_1DIdx]=ECQTemp; 
    697697             
    698             //if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG 
     698            ////if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG 
    699699          } 
    700700          break; 
     
    705705       
    706706      bytePos=(bitPos+7)/8; 
    707       if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 
     707      //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 
    708708       
    709709      //STEP 2: PREDICT DATA(Includes INVERSE QUANTIZATION) 
     
    713713    //R:CNonSparse 
    714714    case 3: 
    715       if(D_G){printf("\nDC:CNonSparse\n");} //DEBUG 
     715      //if(D_G){printf("\nDC:CNonSparse\n");} //DEBUG 
    716716       
    717717      //for(j=0;j<p->bSize;j++){ 
     
    725725      bp->ECQBits=inBuf[6]; 
    726726       
    727       if(D_R){printf("bp->patternBits:%d bp->ECQBits:%d bp->_1DIdxBits:%d\n",bp->patternBits,bp->ECQBits,bp->_1DIdxBits);} //DEBUG 
     727      //if(D_R){printf("bp->patternBits:%d bp->ECQBits:%d bp->_1DIdxBits:%d\n",bp->patternBits,bp->ECQBits,bp->_1DIdxBits);} //DEBUG 
    728728       
    729729      //bitPos=15*8; 
     
    733733      bp->binSize=p->usedEb*2; 
    734734       
    735       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 
     735      //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 
    736736 
    737737      for(j=0;j<p->sbSize;j++){ 
    738738        patternQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Pattern point 
    739         if(D_R){printf("R:patternQ[%d]=%ld\n",j,patternQ[j]);} 
     739        //if(D_R){printf("R:patternQ[%d]=%ld\n",j,patternQ[j]);} 
    740740      } 
    741741      for(j=0;j<p->sbNum;j++){ 
    742742        scalesQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Scale 
    743         if(D_R){printf("R:scalesQ[%d]=%ld\n",j,scalesQ[j]);} 
     743        //if(D_R){printf("R:scalesQ[%d]=%ld\n",j,scalesQ[j]);} 
    744744      } 
    745745      /* //Splitting 
    746746      for(j=0;j<p->bSize;j++){ 
    747747        data[j]=scalesQ[j/p->sbSize]*patternQ[j%p->sbSize]*bp->scalesBinSize*bp->binSize; 
    748         //if(DEBUG){printf("DC:PS[%d]=%.6e\n",j,data[j]);} 
     748        ////if(DEBUG){printf("DC:PS[%d]=%.6e\n",j,data[j]);} 
    749749      } 
    750750      */ 
     
    752752        case 2: 
    753753          for(j=0;j<p->bSize;j++){ 
    754             //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG 
    755             //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG 
     754            ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG 
     755            ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG 
    756756            //_1DIdx=readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits); 
    757757            temp=readBits_UI64(inBuf,&bitPos,1); 
     
    769769            } 
    770770             
    771             //if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 
     771            ////if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 
    772772            //continue; 
    773773            //sb=_1DIdx/p->sbSize;  
     
    777777            ECQ[j]=ECQTemp; 
    778778             
    779             //if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG 
     779            ////if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG 
    780780          } 
    781781          break; 
    782782        default: //bp->ECQBits>2 
    783           //if(DEBUG)printf("AMG_R1:bitPos: %ld\n",bitPos); 
     783          ////if(DEBUG)printf("AMG_R1:bitPos: %ld\n",bitPos); 
    784784           
    785785          for(j=0;j<p->bSize;j++){ 
    786             //if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 
    787             //if(DEBUG)printf("AMG_R2:bitPos: %ld\n",bitPos); 
    788  
    789             //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG 
    790             //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG 
     786            ////if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 
     787            ////if(DEBUG)printf("AMG_R2:bitPos: %ld\n",bitPos); 
     788 
     789            ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG 
     790            ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG 
    791791            //_1DIdx=readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits); 
    792792            temp=readBits_UI64(inBuf,&bitPos,1); 
    793             //if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 
     793            ////if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 
    794794            switch(temp){ 
    795795              case 0: 
    796                 //if(DEBUG)printf("Read:0"); 
     796                ////if(DEBUG)printf("Read:0"); 
    797797                temp2=readBits_UI64(inBuf,&bitPos,1); 
    798798                switch(temp2){ 
    799799                  case 0: 
    800                     //if(DEBUG)printf("0"); 
     800                    ////if(DEBUG)printf("0"); 
    801801                    ECQTemp=readBits_I64(inBuf,&bitPos,1); 
    802                     //if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 
    803                     //if(DEBUG)printf("R:ECQTemp:%ld\n",ECQTemp); 
     802                    ////if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 
     803                    ////if(DEBUG)printf("R:ECQTemp:%ld\n",ECQTemp); 
    804804                    ECQTemp= ((ECQTemp<<63)>>63)|(uint64_t)0x1; 
    805                     //if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp); 
     805                    ////if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp); 
    806806                    break; 
    807807                  case 1: 
    808                     //if(DEBUG)printf("1\n"); 
     808                    ////if(DEBUG)printf("1\n"); 
    809809                    ECQTemp=readBits_I64(inBuf,&bitPos,bp->ECQBits); 
    810                     //if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 
    811                     //if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp); 
     810                    ////if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 
     811                    ////if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp); 
    812812                    break; 
    813813                  default: 
     
    817817                break; 
    818818              case 1: 
    819                 //if(DEBUG)printf("Read:1\n"); 
     819                ////if(DEBUG)printf("Read:1\n"); 
    820820                ECQTemp=0; 
    821                 //if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp); 
     821                ////if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp); 
    822822                break; 
    823823              default: 
     
    826826            } 
    827827             
    828             //if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 
     828            ////if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 
    829829            //continue; 
    830830            //sb=_1DIdx/p->sbSize;  
     
    834834            ECQ[j]=ECQTemp; 
    835835             
    836             //if(DEBUG){printf("DC:data[%d]:%.6e\n",j,data[j]);} //DEBUG 
     836            ////if(DEBUG){printf("DC:data[%d]:%.6e\n",j,data[j]);} //DEBUG 
    837837          } 
    838838          break; 
     
    842842      //scalesQ=(int64_t*)(inBuf+15+p->sbSize*8); 
    843843      bytePos=(bitPos+7)/8; 
    844       if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 
     844      //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 
    845845       
    846846      //STEP 2: PREDICT DATA(Includes INVERSE QUANTIZATION) 
     
    880880  for(i=0;i<p->bSize;i++){ 
    881881    if(idx0[i]!=idx0_dc[i]){ 
    882       printf("idx0[%d]=%d  !=  %d=idx0_dc[%d]",i,idx0[i],idx0_dc[i],i); 
     882      //printf("idx0[%d]=%d  !=  %d=idx0_dc[%d]",i,idx0[i],idx0_dc[i],i); 
    883883      assert(0); 
    884884    } 
    885885    if(idx1[i]!=idx1_dc[i]){ 
    886       printf("idx1[%d]=%d  !=  %d=idx1_dc[%d]",i,idx1[i],idx1_dc[i],i); 
     886      //printf("idx1[%d]=%d  !=  %d=idx1_dc[%d]",i,idx1[i],idx1_dc[i],i); 
    887887      assert(0); 
    888888    } 
    889889    if(idx2[i]!=idx2_dc[i]){ 
    890       printf("idx2[%d]=%d  !=  %d=idx2_dc[%d]",i,idx2[i],idx2_dc[i],i); 
     890      //printf("idx2[%d]=%d  !=  %d=idx2_dc[%d]",i,idx2[i],idx2_dc[i],i); 
    891891      assert(0); 
    892892    } 
    893893    if(idx3[i]!=idx3_dc[i]){ 
    894       printf("idx3[%d]=%d  !=  %d=idx3_dc[%d]",i,idx3[i],idx3_dc[i],i); 
     894      //printf("idx3[%d]=%d  !=  %d=idx3_dc[%d]",i,idx3[i],idx3_dc[i],i); 
    895895      assert(0); 
    896896    } 
     
    901901  for(i=0;i<p->bSize;i++){ 
    902902    if(abs_FastD(data[i]-data_dc[i])>p->usedEb){ 
    903       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); 
     903      //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); 
    904904      assert(0); 
    905905    } 
  • thirdparty/SZ/sz/include/pastriF.h

    r2c47b73 r9ee2ce3  
    1111  half.d=0.5; 
    1212   
    13   //printf("pastri_float_quantize:\nx=%lf  x=0x%lx\n",x,(*((uint64_t *)(&x)))); 
    14   //printf("sign(x):0x%lx\n", x); 
    15   //printf("0.5:0x%lx\n", (*((uint64_t *)(&half)))); 
     13  ////printf("pastri_float_quantize:\nx=%lf  x=0x%lx\n",x,(*((uint64_t *)(&x)))); 
     14  ////printf("sign(x):0x%lx\n", x); 
     15  ////printf("0.5:0x%lx\n", (*((uint64_t *)(&half)))); 
    1616  half.ui64 |= (u1.ui64 & (uint64_t)0x8000000000000000); 
    17   //printf("sign(x)*0.5:0x%lx\n", (*((uint64_t *)(&half)))); 
     17  ////printf("sign(x)*0.5:0x%lx\n", (*((uint64_t *)(&half)))); 
    1818  return (int64_t)(x + half.d); 
    1919} 
     
    2727  int i,sb; 
    2828  for(i=0;i<p->bSize;i++){ 
    29     //printf("data[%d] = %.16lf\n",i,data[i]);//DEBUG 
     29    ////printf("data[%d] = %.16lf\n",i,data[i]);//DEBUG 
    3030    if(abs_FastD(data[i])>p->usedEb){ 
    3131      bp->nonZeros++; 
    32       //if(DEBUG)printf("data[%d]:%.6e\n",i,data[i]); //DEBUG 
     32      ////if(DEBUG)printf("data[%d]:%.6e\n",i,data[i]); //DEBUG 
    3333    } 
    3434    if(abs_FastD(data[i])>absExt){ 
     
    4343  bp->binSize=2*p->usedEb; 
    4444   
    45   //if(DEBUG){printf("Extremum  : data[%d] = %.6e\n",extIdx,patternExt);} //DEBUG 
    46   //if(DEBUG){printf("patternIdx: %d\n",patternIdx);} //DEBUG 
    47    
    48   //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 
     45  ////if(DEBUG){printf("Extremum  : data[%d] = %.6e\n",extIdx,patternExt);} //DEBUG 
     46  ////if(DEBUG){printf("patternIdx: %d\n",patternIdx);} //DEBUG 
     47   
     48  ////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 
    4949   
    5050  //int64_t *patternQ=(int64_t*)(outBuf+15);  //Possible Improvement! 
     
    5353  for(i=0;i<p->sbSize;i++){ 
    5454    patternQ[i]=pastri_float_quantize(data[patternIdx+i],bp->binSize); 
    55     if(D_W){printf("patternQ[%d]=%ld\n",i,patternQ[i]);} 
     55    //if(D_W){printf("patternQ[%d]=%ld\n",i,patternQ[i]);} 
    5656  } 
    5757   
     
    5959  bp->scaleBits=bp->patternBits; 
    6060  bp->scalesBinSize=1/(float)(((uint64_t)1<<(bp->scaleBits-1))-1); 
    61   //if(DEBUG){printf("(patternExt/binSize)+1: %.6e\n",(patternExt/binSize)+1);} //DEBUG 
    62   //if(DEBUG){printf("scaleBits=patternBits: %d\n",scaleBits);} //DEBUG 
    63   if(D_W){printf("scalesBinSize: %.6e\n",bp->scalesBinSize);} //DEBUG 
     61  ////if(DEBUG){printf("(patternExt/binSize)+1: %.6e\n",(patternExt/binSize)+1);} //DEBUG 
     62  ////if(DEBUG){printf("scaleBits=patternBits: %d\n",scaleBits);} //DEBUG 
     63  //if(D_W){printf("scalesBinSize: %.6e\n",bp->scalesBinSize);} //DEBUG 
    6464   
    6565  //Calculate Scales. 
     
    6868  //int64_t *scalesQ=(int64_t*)(outBuf+15+p->sbSize*8);  //Possible Improvement! 
    6969  int patternExtZero=(patternExt==0); 
    70   //if(DEBUG){printf("patternExtZero: %d\n",patternExtZero);} //DEBUG 
     70  ////if(DEBUG){printf("patternExtZero: %d\n",patternExtZero);} //DEBUG 
    7171  for(sb=0;sb<p->sbNum;sb++){ 
    7272    //scales[sb]=data[sb*p->sbSize+localExtIdx]/patternExt; 
     
    7474    //assert(scales[sb]<=1); 
    7575    scalesQ[sb]=pastri_float_quantize((patternExtZero ? 0 : data[sb*p->sbSize+localExtIdx]/patternExt),bp->scalesBinSize); 
    76     if(D_W){printf("scalesQ[%d]=%ld\n",sb,scalesQ[sb]);} 
     76    //if(D_W){printf("scalesQ[%d]=%ld\n",sb,scalesQ[sb]);} 
    7777  } 
    78   //if(DEBUG){for(i=0;i<p->sbSize;i++){printf("scalesQ[%d]=%ld \n",i,scalesQ[i]);}} //DEBUG 
     78  ////if(DEBUG){for(i=0;i<p->sbSize;i++){printf("scalesQ[%d]=%ld \n",i,scalesQ[i]);}} //DEBUG 
    7979 
    8080  //int64_t *ECQ=(int64_t*)(outBuf+p->bSize*8); //ECQ is written into outBuf, just be careful when handling it. 
     
    9393      if(absECQ > bp->ECQExt) 
    9494        bp->ECQExt=absECQ; 
    95       //if(DEBUG){printf("EC[%d]: %.6e Quantized:%ld \n",_1DIdx,(scalesQ[sb]*patternQ[i]*scalesBinSize*binSize-data[_1DIdx]),ECQ[_1DIdx]);} //DEBUG 
     95      ////if(DEBUG){printf("EC[%d]: %.6e Quantized:%ld \n",_1DIdx,(scalesQ[sb]*patternQ[i]*scalesBinSize*binSize-data[_1DIdx]),ECQ[_1DIdx]);} //DEBUG 
    9696      switch (ECQ[_1DIdx]){ 
    9797        case 0: 
     
    118118      float decompressed=scalesQ[sb]*patternQ[i]*scalesBinSize*binSize-ECQ[_1DIdx]*binSize; 
    119119      if(abs_FastD(decompressed-data[_1DIdx])>(p->usedEb)){ 
    120         printf("p->usedEb=%.6e\n",p->usedEb); 
    121         printf("data[%d]=%.6e decompressed[%d]=%.6e diff=%.6e\n",_1DIdx,data[_1DIdx],_1DIdx,decompressed,abs_FastD(data[_1DIdx]-decompressed)); 
     120        //printf("p->usedEb=%.6e\n",p->usedEb); 
     121        //printf("data[%d]=%.6e decompressed[%d]=%.6e diff=%.6e\n",_1DIdx,data[_1DIdx],_1DIdx,decompressed,abs_FastD(data[_1DIdx]-decompressed)); 
    122122        assert(0); 
    123123      } 
     
    175175  //*(uint16_t*)(&outBuf[7])=p->idxOffset[3]; 
    176176     
    177   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 
    178   if(D_W){printf("numOutliers:%d\n",bp->numOutliers);} //DEBUG 
     177  //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 
     178  //if(D_W){printf("numOutliers:%d\n",bp->numOutliers);} //DEBUG 
    179179   
    180180  //**************************************************************************************** 
     
    184184    //Uncompressed, Sparse bits. Just like the original GAMESS data. Includes: mode, indexOffsets, nonZeros, indexes, data 
    185185    *numOutBytes=UCSparseBytes; 
    186     if(D_G){printf("UCSparse\n");} //DEBUG 
    187     if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 
     186    //if(D_G){printf("UCSparse\n");} //DEBUG 
     187    //if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 
    188188    outBuf[0]=0; //mode 
    189189     
     
    217217          } 
    218218     
    219     if(D_G)printf("UCSparseBytes:%d \n",UCSparseBytes); //DEBUG 
     219    //if(D_G)printf("UCSparseBytes:%d \n",UCSparseBytes); //DEBUG 
    220220     
    221221  //**************************************************************************************** 
     
    225225    //Uncompressed, NonSparse bits. Includes: mode, indexOffsets, data 
    226226    *numOutBytes=UCNonSparseBytes; 
    227     if(D_G){printf("UCNonSparse\n");} //DEBUG 
    228     if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 
     227    //if(D_G){printf("UCNonSparse\n");} //DEBUG 
     228    //if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 
    229229    outBuf[0]=1; //mode 
    230230     
     
    232232    memcpy(&outBuf[1], data, p->bSize*p->dataSize); 
    233233     
    234     if(D_G)printf("UCNonSparseBytes:%d \n",UCNonSparseBytes); //DEBUG 
     234    //if(D_G)printf("UCNonSparseBytes:%d \n",UCNonSparseBytes); //DEBUG 
    235235    /* 
    236236    for(i=0;i<UCNonSparseBytes-17;i++){ 
    237       printf("%d ",inBuf[p->bSize*8+i]); 
    238     } 
    239     printf("\n"); 
     237      //printf("%d ",inBuf[p->bSize*8+i]); 
     238    } 
     239    //printf("\n"); 
    240240    for(i=0;i<UCNonSparseBytes-17;i++){ 
    241       printf("%d ",outBuf[17+i]); 
    242     } 
    243     printf("\n"); 
     241      //printf("%d ",outBuf[17+i]); 
     242    } 
     243    //printf("\n"); 
    244244    */ 
    245245  //**************************************************************************************** 
     
    249249    //Includes: mode, indexOffsets, compressedBytes, patternBits, ECQBits,numOutliers,P, S, {Indexes(Sparse), ECQ} 
    250250    *numOutBytes=CSparseBytes; 
    251     if(D_G){printf("CSparse\n");} //DEBUG 
    252     if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 
    253     //if(DEBUG){printf("patternBits:%d _1DIdxBits:%d\n",patternBits,_1DIdxBits);} //DEBUG 
     251    //if(D_G){printf("CSparse\n");} //DEBUG 
     252    //if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 
     253    ////if(DEBUG){printf("patternBits:%d _1DIdxBits:%d\n",patternBits,_1DIdxBits);} //DEBUG 
    254254    outBuf[0]=2; //mode 
    255255     
     
    270270    bitPos=9*8;  
    271271     
    272     //if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG 
     272    ////if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG 
    273273 
    274274    for(i=0;i<p->sbSize;i++){ 
    275275      writeBits_Fast(outBuf,&bitPos,bp->patternBits,patternQ[i]);//Pattern point 
    276276    } 
    277     //if(DEBUG){printf("bitPos_P:%ld\n",bitPos);} //DEBUG 
     277    ////if(DEBUG){printf("bitPos_P:%ld\n",bitPos);} //DEBUG 
    278278    for(i=0;i<p->sbNum;i++){ 
    279279      writeBits_Fast(outBuf,&bitPos,bp->scaleBits,scalesQ[i]);//Scale 
    280280    } 
    281     //if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG 
    282     //if(DEBUG)printf("ECQBits:%d\n",ECQBits); 
     281    ////if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG 
     282    ////if(DEBUG)printf("ECQBits:%d\n",ECQBits); 
    283283    switch(bp->ECQBits){ 
    284284      case 2: 
     
    288288              break; 
    289289            case 1: 
    290               //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x0\n",i,ECQ[i]); //DEBUG 
     290              ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x0\n",i,ECQ[i]); //DEBUG 
    291291              writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i); 
    292292              //writeBits_Fast(outBuf,&bitPos,2,0x10); 
     
    296296              break; 
    297297            case -1: 
    298               //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1\n",i,ECQ[i]); //DEBUG 
     298              ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1\n",i,ECQ[i]); //DEBUG 
    299299              writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i); 
    300300              //writeBits_Fast(outBuf,&bitPos,2,0x11); 
     
    315315            break; 
    316316          case 1: 
    317             //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x00\n",i,ECQ[i]); //DEBUG 
     317            ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x00\n",i,ECQ[i]); //DEBUG 
    318318            writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i); 
    319319            //writeBits_Fast(outBuf,&bitPos,3,0);//0x000 
     
    323323            break; 
    324324          case -1: 
    325             //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x01\n",i,ECQ[i]); //DEBUG 
     325            ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x01\n",i,ECQ[i]); //DEBUG 
    326326            writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i); 
    327327            //writeBits_Fast(outBuf,&bitPos,3,1);//0x001 
     
    331331            break; 
    332332          default: 
    333             //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1 0x%lx\n",i,ECQ[i],ECQ[i]); //DEBUG 
     333            ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1 0x%lx\n",i,ECQ[i],ECQ[i]); //DEBUG 
    334334            writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i); 
    335335            //writeBits_Fast(outBuf,&bitPos,2+ECQBits,((uint64_t)0x11<<ECQBits)|ECQ[i]); 
     
    344344    } 
    345345     
    346     //if(DEBUG){printf("bitPos_E:%ld\n",bitPos);} //DEBUG 
    347     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 
     346    ////if(DEBUG){printf("bitPos_E:%ld\n",bitPos);} //DEBUG 
     347    //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 
    348348           
    349349 
     
    352352    *(uint32_t*)(&outBuf[1])=bytePos; 
    353353     
    354     if(D_G)printf("bitPos:%ld CSparseBits:%d bytePos:%d CSparseBytes:%d\n",bitPos,CSparseBits,bytePos,CSparseBytes); //DEBUG 
     354    //if(D_G)printf("bitPos:%ld CSparseBits:%d bytePos:%d CSparseBytes:%d\n",bitPos,CSparseBits,bytePos,CSparseBytes); //DEBUG 
    355355    if(D_G){assert(bitPos==CSparseBits);} 
    356356     
     
    360360    //Includes: mode, indexOffsets, compressedBytes, patternBits, ECQBits,P, S, {ECQ} 
    361361    *numOutBytes=CNonSparseBytes; 
    362     if(D_G){printf("CNonSparse\n");} //DEBUG 
    363     if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 
    364     //if(DEBUG){printf("patternBits:%d _1DIdxBits:%d\n",patternBits,_1DIdxBits);} //DEBUG 
     362    //if(D_G){printf("CNonSparse\n");} //DEBUG 
     363    //if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 
     364    ////if(DEBUG){printf("patternBits:%d _1DIdxBits:%d\n",patternBits,_1DIdxBits);} //DEBUG 
    365365    outBuf[0]=3; //mode 
    366366     
     
    375375    bitPos=7*8; //Currently, we are at the end of 7th byte. 
    376376     
    377     //if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG 
     377    ////if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG 
    378378 
    379379    for(i=0;i<p->sbSize;i++){ 
    380380      writeBits_Fast(outBuf,&bitPos,bp->patternBits,patternQ[i]);//Pattern point 
    381381    } 
    382     //if(DEBUG){printf("bitPos_P:%ld\n",bitPos);} //DEBUG 
     382    ////if(DEBUG){printf("bitPos_P:%ld\n",bitPos);} //DEBUG 
    383383    for(i=0;i<p->sbNum;i++){ 
    384384      writeBits_Fast(outBuf,&bitPos,bp->scaleBits,scalesQ[i]);//Scale 
    385385    } 
    386     //if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG 
    387     //if(DEBUG)printf("ECQBits:%d\n",ECQBits); 
     386    ////if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG 
     387    ////if(DEBUG)printf("ECQBits:%d\n",ECQBits); 
    388388    switch(bp->ECQBits){ 
    389389      case 2: 
     
    391391          switch(ECQ[i]){ 
    392392            case 0: 
    393               //if(DEBUG)printf("Index:%d ECQ:%d Written:0x1\n",i,ECQ[i]); //DEBUG 
     393              ////if(DEBUG)printf("Index:%d ECQ:%d Written:0x1\n",i,ECQ[i]); //DEBUG 
    394394              writeBits_Fast(outBuf,&bitPos,1,1);//0x1 
    395395              break; 
    396396            case 1: 
    397               //if(DEBUG)printf("Index:%d ECQ:%d Written:0x00\n",i,ECQ[i]); //DEBUG 
     397              ////if(DEBUG)printf("Index:%d ECQ:%d Written:0x00\n",i,ECQ[i]); //DEBUG 
    398398              //writeBits_Fast(outBuf,&bitPos,2,0);//0x00 
    399399              writeBits_Fast(outBuf,&bitPos,1,0); 
     
    401401              break; 
    402402            case -1: 
    403               //if(DEBUG)printf("Index:%d ECQ:%d Written:0x01\n",i,ECQ[i]); //DEBUG 
     403              ////if(DEBUG)printf("Index:%d ECQ:%d Written:0x01\n",i,ECQ[i]); //DEBUG 
    404404              //writeBits_Fast(outBuf,&bitPos,2,2); //0x01 
    405405              writeBits_Fast(outBuf,&bitPos,1,0); 
     
    413413        break; 
    414414      default: //ECQBits>2 
    415         //if(DEBUG) printf("AMG_W1:bitPos:%ld\n",bitPos); //DEBUG 
     415        ////if(DEBUG) printf("AMG_W1:bitPos:%ld\n",bitPos); //DEBUG 
    416416        for(i=0;i<p->bSize;i++){ 
    417           //if(DEBUG){printf("AMG_W3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 
    418           //if(DEBUG) printf("AMG_W2:bitPos:%ld\n",bitPos); //DEBUG 
    419           //if(DEBUG) printf("ECQ[%d]:%ld\n",i,ECQ[i]); //DEBUG 
     417          ////if(DEBUG){printf("AMG_W3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 
     418          ////if(DEBUG) printf("AMG_W2:bitPos:%ld\n",bitPos); //DEBUG 
     419          ////if(DEBUG) printf("ECQ[%d]:%ld\n",i,ECQ[i]); //DEBUG 
    420420          switch(ECQ[i]){ 
    421421            case 0: 
    422               //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1\n",i,ECQ[i]); //DEBUG 
    423               //if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 
     422              ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1\n",i,ECQ[i]); //DEBUG 
     423              ////if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 
    424424              //temp1=bitPos; 
    425425              writeBits_Fast(outBuf,&bitPos,1,1);  //0x1 
    426426              //wVal=1; writeBits_Fast(outBuf,&bitPos,1,wVal); //0x1 
    427               //if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 
     427              ////if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 
    428428              break; 
    429429            case 1: 
    430               //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x000\n",i,ECQ[i]); //DEBUG 
    431               //if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 
     430              ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x000\n",i,ECQ[i]); //DEBUG 
     431              ////if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 
    432432              //temp1=bitPos; 
    433433              //writeBits_Fast(outBuf,&bitPos,3,0); //0x000 
     
    436436              writeBits_Fast(outBuf,&bitPos,1,0); 
    437437              //wVal=0; writeBits_Fast(outBuf,&bitPos,3,wVal); //0x000 
    438               //if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 
     438              ////if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 
    439439              break; 
    440440            case -1: 
    441               //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x001\n",i,ECQ[i]); //DEBUG 
    442               //if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 
     441              ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x001\n",i,ECQ[i]); //DEBUG 
     442              ////if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 
    443443              //temp1=bitPos; 
    444444              //writeBits_Fast(outBuf,&bitPos,3,8); //0x001 
     
    447447              writeBits_Fast(outBuf,&bitPos,1,1);  
    448448              //wVal=8; writeBits_Fast(outBuf,&bitPos,3,wVal); //0x001 
    449               //if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 
     449              ////if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 
    450450              break; 
    451451            default: 
    452               //if(DEBUG)printf("Index:%d ECQ:%ld Written:0x01 0x%lx\n",i,ECQ[i]); //DEBUG 
    453               //if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 
     452              ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x01 0x%lx\n",i,ECQ[i]); //DEBUG 
     453              ////if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 
    454454              //temp1=bitPos; 
    455455              //writeBits_Fast(outBuf,&bitPos,2,2); //0x01 
     
    458458              //wVal=2; writeBits_Fast(outBuf,&bitPos,2,wVal); //0x01 
    459459              writeBits_Fast(outBuf,&bitPos,bp->ECQBits,ECQ[i]); 
    460               //if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 
     460              ////if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 
    461461              break; 
    462462          } 
     
    465465    } 
    466466     
    467     //if(DEBUG){printf("bitPos_E:%ld\n",bitPos);} //DEBUG 
    468     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 
     467    ////if(DEBUG){printf("bitPos_E:%ld\n",bitPos);} //DEBUG 
     468    //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 
    469469     
    470470           
     
    474474    *(uint32_t*)(&outBuf[1])=bytePos; 
    475475     
    476     if(D_G)printf("bitPos:%ld CNonSparseBits:%d bytePos:%d CNonSparseBytes:%d\n",bitPos,CNonSparseBits,bytePos,CNonSparseBytes); //DEBUG 
     476    //if(D_G)printf("bitPos:%ld CNonSparseBits:%d bytePos:%d CNonSparseBytes:%d\n",bitPos,CNonSparseBits,bytePos,CNonSparseBytes); //DEBUG 
    477477    if(D_G){assert(bitPos==CNonSparseBits);} 
    478478     
    479479  } 
    480   //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 
     480  ////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 
    481481   
    482482} 
     
    484484  pastri_blockParams bp; 
    485485 
    486   if(D_G2){printf("Parameters: dataSize:%d\n",p->dataSize);}  //DEBUG 
    487   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 
    488   if(D_G2){printf("Parameters: idxRanges:%d %d %d %d\n",p->idxRange[0],p->idxRange[1],p->idxRange[2],p->idxRange[3]);} //DEBUG 
    489   if(D_G2){printf("Parameters: sbSize:%d sbNum:%d bSize:%d\n",p->sbSize,p->sbNum,p->bSize); }//DEBUG 
     486  //if(D_G2){printf("Parameters: dataSize:%d\n",p->dataSize);}  //DEBUG 
     487  //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 
     488  //if(D_G2){printf("Parameters: idxRanges:%d %d %d %d\n",p->idxRange[0],p->idxRange[1],p->idxRange[2],p->idxRange[3]);} //DEBUG 
     489  //if(D_G2){printf("Parameters: sbSize:%d sbNum:%d bSize:%d\n",p->sbSize,p->sbNum,p->bSize); }//DEBUG 
    490490   
    491491  int64_t patternQ[MAX_PS_SIZE]; 
     
    567567    //R:UCSparse 
    568568    case 0: 
    569       if(D_G){printf("\nDC:UCSparse\n");} //DEBUG 
     569      //if(D_G){printf("\nDC:UCSparse\n");} //DEBUG 
    570570      //bp->nonZeros=*(uint16_t*)(&inBuf[9]); 
    571571      //bytePos=11; 
     
    592592        bytePos+=8;  
    593593      } 
    594       if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 
     594      //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 
    595595      break; 
    596596    //R:UCNonSparse 
    597597    case 1: 
    598       if(D_G){printf("\nDC:UCNonSparse\n");} //DEBUG 
     598      //if(D_G){printf("\nDC:UCNonSparse\n");} //DEBUG 
    599599      //memcpy(&outBuf[p->bSize*8], &inBuf[9], p->bSize*8); 
    600600      memcpy(data, &inBuf[1], p->bSize*8); 
    601601      bytePos=p->bSize*8; 
    602       if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 
     602      //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 
    603603      break; 
    604604    //R:CSparse 
    605605    case 2: 
    606       if(D_G){printf("\nDC:CSparse\n");} //DEBUG 
     606      //if(D_G){printf("\nDC:CSparse\n");} //DEBUG 
    607607      //for(j=0;j<p->bSize;j++){ 
    608608      //  data[j]=0; 
     
    615615      bp->ECQBits=inBuf[6]; 
    616616       
    617       if(D_R){printf("bp->patternBits:%d bp->ECQBits:%d bp->_1DIdxBits:%d\n",bp->patternBits,bp->ECQBits,bp->_1DIdxBits);} //DEBUG 
     617      //if(D_R){printf("bp->patternBits:%d bp->ECQBits:%d bp->_1DIdxBits:%d\n",bp->patternBits,bp->ECQBits,bp->_1DIdxBits);} //DEBUG 
    618618       
    619619      //bp->numOutliers=*(uint16_t*)(&inBuf[15]); 
     
    621621      bp->numOutliers=*(uint16_t*)(&inBuf[7]); 
    622622      bitPos=9*8; 
    623       if(D_R){printf("bp->numOutliers:%d\n",bp->numOutliers);} //DEBUG 
     623      //if(D_R){printf("bp->numOutliers:%d\n",bp->numOutliers);} //DEBUG 
    624624 
    625625      bp->scalesBinSize=1/(float)(((uint64_t)1<<(bp->patternBits-1))-1); 
     
    627627      bp->binSize=p->usedEb*2; 
    628628       
    629       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 
     629      //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 
    630630 
    631631      for(j=0;j<p->sbSize;j++){ 
    632632        patternQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Pattern point 
    633         if(D_R){printf("R:patternQ[%d]=%ld\n",j,patternQ[j]);} 
     633        //if(D_R){printf("R:patternQ[%d]=%ld\n",j,patternQ[j]);} 
    634634      } 
    635635      for(j=0;j<p->sbNum;j++){ 
    636636        scalesQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Scale 
    637         if(D_R){printf("R:scalesQ[%d]=%ld\n",j,scalesQ[j]);} 
     637        //if(D_R){printf("R:scalesQ[%d]=%ld\n",j,scalesQ[j]);} 
    638638      } 
    639639       
     
    649649        case 2: 
    650650          for(j=0;j<bp->numOutliers;j++){ 
    651             //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG 
    652             //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG 
     651            ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG 
     652            ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG 
    653653             
    654654            _1DIdx=readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits); 
    655655            ECQTemp=readBits_I64(inBuf,&bitPos,1); 
    656656            ECQTemp= ((ECQTemp<<63)>>63)|(uint64_t)0x1; 
    657             //if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp); 
     657            ////if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp); 
    658658            //continue; 
    659659            //sb=_1DIdx/p->sbSize;  
     
    663663            ECQ[_1DIdx]=ECQTemp; 
    664664             
    665             //if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG 
     665            ////if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG 
    666666          } 
    667667          break; 
    668668        default: //bp->ECQBits>2 
    669           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 
     669          //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 
    670670     
    671671          for(j=0;j<bp->numOutliers;j++){ 
     
    674674            //localIdx=_1DIdx%p->sbSize; 
    675675            temp=readBits_UI64(inBuf,&bitPos,1); 
    676             //if(DEBUG){printf("temp:%ld\n",temp);} //DEBUG 
     676            ////if(DEBUG){printf("temp:%ld\n",temp);} //DEBUG 
    677677            switch(temp){ 
    678678              case 0:  //+-1 
    679679                ECQTemp=readBits_I64(inBuf,&bitPos,1); 
    680680                ECQTemp= ((ECQTemp<<63)>>63)|(uint64_t)0x1; 
    681                 //if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 
    682                 //if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp); 
     681                ////if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 
     682                ////if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp); 
    683683                break; 
    684684              case 1: //Others 
    685685                ECQTemp=readBits_I64(inBuf,&bitPos,bp->ECQBits); 
    686                 //if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 
    687                 //if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp); 
     686                ////if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 
     687                ////if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp); 
    688688                break; 
    689689              //default: 
    690               //  printf("ERROR: Bad 2-bit value: 0x%lx",temp); 
     690              ////  printf("ERROR: Bad 2-bit value: 0x%lx",temp); 
    691691              // assert(0); //AMG 
    692692              //  break; 
     
    696696            ECQ[_1DIdx]=ECQTemp; 
    697697             
    698             //if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG 
     698            ////if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG 
    699699          } 
    700700          break; 
     
    705705       
    706706      bytePos=(bitPos+7)/8; 
    707       if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 
     707      //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 
    708708       
    709709      //STEP 2: PREDICT DATA(Includes INVERSE QUANTIZATION) 
     
    713713    //R:CNonSparse 
    714714    case 3: 
    715       if(D_G){printf("\nDC:CNonSparse\n");} //DEBUG 
     715      //if(D_G){printf("\nDC:CNonSparse\n");} //DEBUG 
    716716       
    717717      //for(j=0;j<p->bSize;j++){ 
     
    725725      bp->ECQBits=inBuf[6]; 
    726726       
    727       if(D_R){printf("bp->patternBits:%d bp->ECQBits:%d bp->_1DIdxBits:%d\n",bp->patternBits,bp->ECQBits,bp->_1DIdxBits);} //DEBUG 
     727      //if(D_R){printf("bp->patternBits:%d bp->ECQBits:%d bp->_1DIdxBits:%d\n",bp->patternBits,bp->ECQBits,bp->_1DIdxBits);} //DEBUG 
    728728       
    729729      //bitPos=15*8; 
     
    733733      bp->binSize=p->usedEb*2; 
    734734       
    735       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 
     735      //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 
    736736 
    737737      for(j=0;j<p->sbSize;j++){ 
    738738        patternQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Pattern point 
    739         if(D_R){printf("R:patternQ[%d]=%ld\n",j,patternQ[j]);} 
     739        //if(D_R){printf("R:patternQ[%d]=%ld\n",j,patternQ[j]);} 
    740740      } 
    741741      for(j=0;j<p->sbNum;j++){ 
    742742        scalesQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Scale 
    743         if(D_R){printf("R:scalesQ[%d]=%ld\n",j,scalesQ[j]);} 
     743        //if(D_R){printf("R:scalesQ[%d]=%ld\n",j,scalesQ[j]);} 
    744744      } 
    745745      /* //Splitting 
    746746      for(j=0;j<p->bSize;j++){ 
    747747        data[j]=scalesQ[j/p->sbSize]*patternQ[j%p->sbSize]*bp->scalesBinSize*bp->binSize; 
    748         //if(DEBUG){printf("DC:PS[%d]=%.6e\n",j,data[j]);} 
     748        ////if(DEBUG){printf("DC:PS[%d]=%.6e\n",j,data[j]);} 
    749749      } 
    750750      */ 
     
    752752        case 2: 
    753753          for(j=0;j<p->bSize;j++){ 
    754             //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG 
    755             //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG 
     754            ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG 
     755            ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG 
    756756            //_1DIdx=readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits); 
    757757            temp=readBits_UI64(inBuf,&bitPos,1); 
     
    769769            } 
    770770             
    771             //if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 
     771            ////if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 
    772772            //continue; 
    773773            //sb=_1DIdx/p->sbSize;  
     
    777777            ECQ[j]=ECQTemp; 
    778778             
    779             //if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG 
     779            ////if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG 
    780780          } 
    781781          break; 
    782782        default: //bp->ECQBits>2 
    783           //if(DEBUG)printf("AMG_R1:bitPos: %ld\n",bitPos); 
     783          ////if(DEBUG)printf("AMG_R1:bitPos: %ld\n",bitPos); 
    784784           
    785785          for(j=0;j<p->bSize;j++){ 
    786             //if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 
    787             //if(DEBUG)printf("AMG_R2:bitPos: %ld\n",bitPos); 
    788  
    789             //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG 
    790             //if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG 
     786            ////if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 
     787            ////if(DEBUG)printf("AMG_R2:bitPos: %ld\n",bitPos); 
     788 
     789            ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG 
     790            ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG 
    791791            //_1DIdx=readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits); 
    792792            temp=readBits_UI64(inBuf,&bitPos,1); 
    793             //if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 
     793            ////if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 
    794794            switch(temp){ 
    795795              case 0: 
    796                 //if(DEBUG)printf("Read:0"); 
     796                ////if(DEBUG)printf("Read:0"); 
    797797                temp2=readBits_UI64(inBuf,&bitPos,1); 
    798798                switch(temp2){ 
    799799                  case 0: 
    800                     //if(DEBUG)printf("0"); 
     800                    ////if(DEBUG)printf("0"); 
    801801                    ECQTemp=readBits_I64(inBuf,&bitPos,1); 
    802                     //if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 
    803                     //if(DEBUG)printf("R:ECQTemp:%ld\n",ECQTemp); 
     802                    ////if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 
     803                    ////if(DEBUG)printf("R:ECQTemp:%ld\n",ECQTemp); 
    804804                    ECQTemp= ((ECQTemp<<63)>>63)|(uint64_t)0x1; 
    805                     //if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp); 
     805                    ////if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp); 
    806806                    break; 
    807807                  case 1: 
    808                     //if(DEBUG)printf("1\n"); 
     808                    ////if(DEBUG)printf("1\n"); 
    809809                    ECQTemp=readBits_I64(inBuf,&bitPos,bp->ECQBits); 
    810                     //if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 
    811                     //if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp); 
     810                    ////if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 
     811                    ////if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp); 
    812812                    break; 
    813813                  default: 
     
    817817                break; 
    818818              case 1: 
    819                 //if(DEBUG)printf("Read:1\n"); 
     819                ////if(DEBUG)printf("Read:1\n"); 
    820820                ECQTemp=0; 
    821                 //if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp); 
     821                ////if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp); 
    822822                break; 
    823823              default: 
     
    826826            } 
    827827             
    828             //if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 
     828            ////if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 
    829829            //continue; 
    830830            //sb=_1DIdx/p->sbSize;  
     
    834834            ECQ[j]=ECQTemp; 
    835835             
    836             //if(DEBUG){printf("DC:data[%d]:%.6e\n",j,data[j]);} //DEBUG 
     836            ////if(DEBUG){printf("DC:data[%d]:%.6e\n",j,data[j]);} //DEBUG 
    837837          } 
    838838          break; 
     
    842842      //scalesQ=(int64_t*)(inBuf+15+p->sbSize*8); 
    843843      bytePos=(bitPos+7)/8; 
    844       if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 
     844      //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 
    845845       
    846846      //STEP 2: PREDICT DATA(Includes INVERSE QUANTIZATION) 
     
    880880  for(i=0;i<p->bSize;i++){ 
    881881    if(idx0[i]!=idx0_dc[i]){ 
    882       printf("idx0[%d]=%d  !=  %d=idx0_dc[%d]",i,idx0[i],idx0_dc[i],i); 
     882      //printf("idx0[%d]=%d  !=  %d=idx0_dc[%d]",i,idx0[i],idx0_dc[i],i); 
    883883      assert(0); 
    884884    } 
    885885    if(idx1[i]!=idx1_dc[i]){ 
    886       printf("idx1[%d]=%d  !=  %d=idx1_dc[%d]",i,idx1[i],idx1_dc[i],i); 
     886      //printf("idx1[%d]=%d  !=  %d=idx1_dc[%d]",i,idx1[i],idx1_dc[i],i); 
    887887      assert(0); 
    888888    } 
    889889    if(idx2[i]!=idx2_dc[i]){ 
    890       printf("idx2[%d]=%d  !=  %d=idx2_dc[%d]",i,idx2[i],idx2_dc[i],i); 
     890      //printf("idx2[%d]=%d  !=  %d=idx2_dc[%d]",i,idx2[i],idx2_dc[i],i); 
    891891      assert(0); 
    892892    } 
    893893    if(idx3[i]!=idx3_dc[i]){ 
    894       printf("idx3[%d]=%d  !=  %d=idx3_dc[%d]",i,idx3[i],idx3_dc[i],i); 
     894      //printf("idx3[%d]=%d  !=  %d=idx3_dc[%d]",i,idx3[i],idx3_dc[i],i); 
    895895      assert(0); 
    896896    } 
     
    901901  for(i=0;i<p->bSize;i++){ 
    902902    if(abs_FastD(data[i]-data_dc[i])>p->usedEb){ 
    903       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); 
     903      //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); 
    904904      assert(0); 
    905905    } 
  • thirdparty/SZ/sz/include/sz.h

    r2c47b73 r9ee2ce3  
    5555#include "sz_float_ts.h" 
    5656#include "szd_float_ts.h" 
     57#include "utility.h" 
    5758 
    5859#ifdef _WIN32 
     
    7576//typedef unsigned long uint64_t; 
    7677 
    77 #define SZ_VERNUM 0x0140 
    78 #define SZ_VER_MAJOR 1 
    79 #define SZ_VER_MINOR 4 
    80 #define SZ_VER_BUILD 13 
    81 #define SZ_VER_REVISION 5 
     78#define SZ_VERNUM 0x0200 
     79#define SZ_VER_MAJOR 2 
     80#define SZ_VER_MINOR 0 
     81#define SZ_VER_BUILD 2 
     82#define SZ_VER_REVISION 0 
    8283 
    8384#define PASTRI 103 
     
    131132#define SZ_TEMPORAL_COMPRESSION 3 
    132133 
     134#define SZ_NO_REGRESSION 0 
     135#define SZ_WITH_LINEAR_REGRESSION 1 
     136 
    133137#define SZ_PWR_MIN_TYPE 0 
    134138#define SZ_PWR_AVG_TYPE 1 
     
    152156         
    153157#define numOfBufferedSteps 1 //the number of time steps in the buffer    
     158 
     159 
     160#define GZIP_COMPRESSOR 0 //i.e., ZLIB_COMPRSSOR 
     161#define ZSTD_COMPRESSOR 1 
    154162         
    155163//Note: the following setting should be consistent with stateNum in Huffman.h 
     
    237245        unsigned int maxRangeRadius; 
    238246        int sol_ID;// it's always SZ, unless the setting is PASTRI compression mode (./configure --enable-pastri) 
     247        int losslessCompressor; 
    239248        int sampleDistance; //2 bytes 
    240249        float predThreshold;  // 2 bytes 
     
    279288        char metadata_filename[256]; 
    280289        FILE *metadata_file; 
     290        unsigned char* bit_array; //sihuan added 
     291        size_t intersect_size; //sihuan added 
     292        int64_t* hist_index; //sihuan added: prestep index  
     293 
    281294} sz_tsc_metadata; 
    282295 
     
    290303extern sz_params *confparams_dec; 
    291304extern sz_exedata *exe_params; 
     305extern int sz_with_regression; 
     306 
    292307//------------------------------------------------ 
    293308extern SZ_VarSet* sz_varset; 
     
    357372size_t compute_total_batch_size(); 
    358373 
    359 int isZlibFormat(unsigned char magic1, unsigned char magic2); 
    360  
    361374void SZ_registerVar(char* varName, int dataType, void* data,  
    362375                        int errBoundMode, double absErrBound, double relBoundRatio, double pwRelBoundRatio,  
  • thirdparty/SZ/sz/include/sz_double.h

    r2c47b73 r9ee2ce3  
    7676size_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); 
    7777 
     78unsigned 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); 
     79unsigned 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); 
     80unsigned char * SZ_compress_double_2D_MDQ_nonblocked_with_blocked_regression(double *oriData, size_t r1, size_t r2, double realPrecision, size_t * comp_size); 
     81unsigned 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); 
     82 
     83 
    7884#ifdef __cplusplus 
    7985} 
  • thirdparty/SZ/sz/include/sz_double_pwr.h

    r2c47b73 r9ee2ce3  
    3838size_t dataLength, double absErrBound, double relBoundRatio, double pwrErrRatio, double valueRangeSize, double medianValue_f, size_t *outSize); 
    3939 
     40void 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); 
     41void 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); 
     42void 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); 
     43 
    4044#ifdef __cplusplus 
    4145} 
  • thirdparty/SZ/sz/include/sz_float.h

    r2c47b73 r9ee2ce3  
    129129size_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); 
    130130 
     131 
     132unsigned 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); 
     133unsigned 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); 
     134 
     135unsigned char * SZ_compress_float_2D_MDQ_nonblocked_with_blocked_regression(float *oriData, size_t r1, size_t r2, double realPrecision, size_t * comp_size); 
     136unsigned 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); 
     137unsigned 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); 
     138 
    131139#ifdef __cplusplus 
    132140} 
  • thirdparty/SZ/sz/include/sz_float_pwr.h

    r2c47b73 r9ee2ce3  
    4545size_t dataLength, double absErrBound, double relBoundRatio, double pwrErrRatio, float valueRangeSize, float medianValue_f, size_t *outSize); 
    4646 
     47void 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); 
     48void 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); 
     49void 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); 
     50 
    4751#ifdef __cplusplus 
    4852} 
  • thirdparty/SZ/sz/include/szd_double.h

    r2c47b73 r9ee2ce3  
    2525void getSnapshotData_double_3D(double** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageD* tdps, int errBoundMode); 
    2626void getSnapshotData_double_4D(double** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageD* tdps, int errBoundMode); 
     27void decompressDataSeries_double_2D_nonblocked_with_blocked_regression(double** data, size_t r1, size_t r2, unsigned char* comp_data); 
     28void decompressDataSeries_double_3D_nonblocked_with_blocked_regression(double** data, size_t r1, size_t r2, size_t r3, unsigned char* comp_data); 
    2729 
    2830int 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); 
  • thirdparty/SZ/sz/include/szd_double_pwr.h

    r2c47b73 r9ee2ce3  
    2222 
    2323void decompressDataSeries_double_1D_pwrgroup(double** data, size_t dataSeriesLength, TightDataPointStorageD* tdps); 
     24void decompressDataSeries_double_1D_pwr_pre_log(double** data, size_t dataSeriesLength, TightDataPointStorageD* tdps); 
     25void decompressDataSeries_double_2D_pwr_pre_log(double** data, size_t r1, size_t r2, TightDataPointStorageD* tdps); 
     26void decompressDataSeries_double_3D_pwr_pre_log(double** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageD* tdps); 
     27 
    2428#ifdef __cplusplus 
    2529} 
  • thirdparty/SZ/sz/include/szd_float.h

    r2c47b73 r9ee2ce3  
    3232 
    3333size_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); 
     34 
     35void decompressDataSeries_float_2D_nonblocked_with_blocked_regression(float** data, size_t r1, size_t r2, unsigned char* comp_data); 
     36void decompressDataSeries_float_3D_nonblocked_with_blocked_regression(float** data, size_t r1, size_t r2, size_t r3, unsigned char* comp_data); 
     37void decompressDataSeries_float_3D_random_access_with_blocked_regression(float** data, size_t r1, size_t r2, size_t r3, unsigned char* comp_data); 
     38 
    3439#ifdef __cplusplus 
    3540} 
  • thirdparty/SZ/sz/include/szd_float_pwr.h

    r2c47b73 r9ee2ce3  
    2323char* decompressGroupIDArray(unsigned char* bytes, size_t dataLength); 
    2424void decompressDataSeries_float_1D_pwrgroup(float** data, size_t dataSeriesLength, TightDataPointStorageF* tdps); 
     25void decompressDataSeries_float_1D_pwr_pre_log(float** data, size_t dataSeriesLength, TightDataPointStorageF* tdps); 
     26void decompressDataSeries_float_2D_pwr_pre_log(float** data, size_t r1, size_t r2, TightDataPointStorageF* tdps); 
     27void decompressDataSeries_float_3D_pwr_pre_log(float** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageF* tdps); 
    2528 
    2629#ifdef __cplusplus 
Note: See TracChangeset for help on using the changeset viewer.