Commit 5a23f9d6 authored by Mathieu Giraud's avatar Mathieu Giraud

core/dynprog.{h,cpp}: 'onlyBottomTriangle', limits the DP matrix computation to its bottom half

parent 57be3d55
......@@ -223,7 +223,7 @@ inline void try_operation(operation &best, int type, int i, int j, int score)
int DynProg::compute()
int DynProg::compute(bool onlyBottomTriangle, int onlyBottomTriangleShift)
best_score = MINUS_INF ;
best_i = 0 ;
......@@ -236,6 +236,19 @@ int DynProg::compute()
best.score = MINUS_INF ;
// If onlyBottomTriangle, stops when we are not in the bottom triangle
if (onlyBottomTriangle && ((n-j) >= (m-i) + onlyBottomTriangleShift))
best.type = 'k';
B[i][j] = best;
if (cost.affine_gap)
Bins[i][j] = best;
Bdel[i][j] = best;
continue ;
// The edit operations, with their backtracking information and their score
// Match, mismatch
......@@ -124,7 +124,21 @@ class DynProg
DynProg(const string &x, const string &y, DynProgMode mode, const Cost &c, const bool reverse_x=false, const bool reverse_y=false);
void init();
int compute();
* Launch the DP matrix computation
* @param onlyBottomTriangle: limits the DP matrix computation to its bottom 'half'
* (the reference point being the 'last' point (m,n))
* (if the matrix is not square, this 'half' will be larger or smaller than 50%)
* @param onlyBottomTriangleShift: shifts the border between the top 'half' and the bottom 'half' of the DP matrix
* (when this value is positive, slighty more than 'half' of the matrix will be computed)
int compute(bool onlyBottomTriangle = false, int onlyBottomTriangleShift = 0);
void backtrack();
void SemiGlobal_hits_threshold(vector<int> &hits, int threshold, int shift_pos, int verbose);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment