ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/seqalign/GXAlign.h
(Generate patch)
# Line 196 | Line 196
196       }
197   };
198  
199 < #define ERROR_FRACTION 6  // 1/this : the higher it is, the smaller the diagonal band
199 > #define ERROR_FRACTION 5  // 1/this : the higher it is, the smaller the diagonal band
200  
201   struct GXAlnMem { //GreedyAlignMem
202    int** flast_d; //flast_d[][]
203    int* max_row_free;
204    int* uplow_free;
205    GXMemPool* space;
206 <  int max_d;
206 >  int MAX_D;
207    GXAlnMem(int max_len, int reward, int penalty, int Xdrop) {
208      flast_d=NULL;
209      max_row_free=NULL;
210 <    max_d=0;
210 >    MAX_D=0;
211      uplow_free=NULL;
212      space=NULL;
213 <    max_d = (int)(max_len / ERROR_FRACTION + 1);
213 >    MAX_D = (int)(max_len / ERROR_FRACTION + 1);
214 >    //MAX_D = 4;
215      int d_diff = (Xdrop+reward/2)/(penalty+reward) + 1;
216 <    GCALLOC(flast_d, (max_d+2)* sizeof(int*));
216 >    GCALLOC(flast_d, (MAX_D+2)* sizeof(int*));
217      if (flast_d == NULL) {
218         GError("Error: cannot allocate GXAlnMem structure!\n");
219         }
220 <    flast_d[0] = (int*)malloc((max_d + max_d + 6) * sizeof(int) * 2);
220 >    flast_d[0] = (int*)malloc(((MAX_D<<1) + 6) * sizeof(int) * 2);
221      //allocates two int rows - flast_d[1] too
222      if (flast_d[0] == NULL) {
223          GError("Error: failed to allocate flast_d[0] in GXAlnMem!\n");
224          }
225 <    flast_d[1] = flast_d[0] + max_d + max_d + 6; //int array for next row
225 >    flast_d[1] = flast_d[0] + (MAX_D<<1) + 6; //int array for next row
226      uplow_free = NULL;
227 <    max_row_free = (int*) malloc(sizeof(int) * (max_d + 1 + d_diff));
227 >    max_row_free = (int*) malloc(sizeof(int) * (MAX_D + 1 + d_diff));
228      space = new GXMemPool();
229      }
230    ~GXAlnMem() {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines