Esempio n. 1
0
bool BWSearch1CPU(uint8_t *W, vector *C, vector *C1, comp_matrix *O, comp_matrix *Oi, result *res, results_list *r_list) {

	int16_t start, end, half, n;;
	SA_TYPE _k, _l;

	_k = res->k;
	_l = res->l;

	start = res->start;
	end   = res->end;

	n = end - start + 1;
	half = n / 2;

	result r;

	init_result(&r, 0);
	bound_result(&r, half, end);
	change_result(&r, _k, _l, end);

	BWExactSearchBackward(W, C, C1, O, &r);

	if (r.k <= r.l) {
		r.start = start;
		r.pos = half-1;
		BWSimpleSearch1Backward(W, C, C1, O, &r, r_list);

		if (r.k <= r.l) add_result(&r, r_list); //Match
	}

	half--;

	init_result(&r, 1);
	bound_result(&r, start, half);
	change_result(&r, _k, _l, start);

	BWExactSearchForward(W, C, C1, Oi, &r);
	if (r.k <= r.l) {
		r.pos = half+1;
		r.end = end;
		BWSimpleSearch1Forward(W, C, C1, Oi, &r, r_list);
	}

	return false;

}
Esempio n. 2
0
void BWSearch1CPU(char *W, vector *C, vector *C1, comp_matrix *O, comp_matrix *Oi, result *res, results_list *r_list) {

  unsigned int half, n;
  int start, end;
  unsigned int _k, _l;

  _k = res->k;
  _l = res->l;

  start = res->start;
  end   = res->end;

  n = end - start + 1;
  half = n / 2;

  result r;

  init_result(&r, 0);
  bound_result(&r, half, end);
  change_result(&r, _k, _l, end);

  BWExactSearchBackward(W, C, C1, O, &r);

  if (r.k <= r.l) {
    r.start = start;
    r.pos = half-1;
    BWSimpleSearch1Backward(W, C, C1, O, &r, r_list);

    if (r.k <= r.l) add_result(&r, r_list); //Match
  }

  half--;

  init_result(&r, 1);
  bound_result(&r, start, half);
  change_result(&r, _k, _l, start);

  BWExactSearchForward(W, C, C1, Oi, &r);
  if (r.k <= r.l) {
    r.pos = half+1;
    r.end = end;
    BWSimpleSearch1Forward(W, C, C1, Oi, &r, r_list);
  }

}