Skip to content

Commit

Permalink
fix MIN_M 2 for lbndm and sbndm2
Browse files Browse the repository at this point in the history
  • Loading branch information
rurban committed Nov 26, 2024
1 parent ad70807 commit ee4f22c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions source/algocfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,13 @@ const struct algocfg ALGOCFGS[] = {
[_SBNDM] = {_SBNDM, GOOD, ASAN, VFY_PASS, 0, 0, 0, 0, 0, 0},
[_TNDM] = {_TNDM, GOOD, ASAN, VFY_PASS, 0, 0, 0, 0, 0, 0},
[_TNDMa] = {_TNDMa, GOOD, ASAN, VFY_PASS, 0, 0, 0, 0, 0, 0},
[_LBNDM] = {_LBNDM, GOOD, ASAN, VFY_PASS, 0, 0, 0, 0, 0, 0},
[_LBNDM] = {_LBNDM, GOOD, ASAN, VFY_PASS, 2, 0, 0, 0, 0, 0},
[_SVM0] = {_SVM0, GOOD, ASAN, VFY_PASS, 0, 0, 0, 0, 0, 0},
[_SVM1] = {_SVM1, GOOD, ASAN, VFY_PASS, 0, 0, 0, 0, 0, 0},
[_SVM2] = {_SVM2, GOOD, ASAN, VFY_PASS, 0, 0, 0, 0, 0, 0},
[_SVM3] = {_SVM3, GOOD, ASAN, VFY_PASS, 0, 0, 0, 0, 0, 0},
[_SVM4] = {_SVM4, GOOD, ASAN, VFY_PASS, 0, 0, 0, 0, 0, 0},
[_SBNDM2] = {_SBNDM2, GOOD, ASAN, VFY_PASS, 0, 0, 0, 0, 0, 0},
[_SBNDM2] = {_SBNDM2, GOOD, ASAN, VFY_PASS, 2, 0, 0, 0, 0, 0},
[_SBNDM_BMH] = {_SBNDM_BMH, GOOD, ASAN, VFY_PASS, 2, 0, 0, 0, 0, 0},
[_BMH_SBNDM] = {_BMH_SBNDM, FAIL, ASAN, VFY_PASS, 0, 0, 0, 0, 0, 0},
[_FNDM] = {_FNDM, GOOD, ASAN, VFY_PASS, 0, 0, 0, 0, 0, 0},
Expand Down
4 changes: 2 additions & 2 deletions source/algorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,15 +360,15 @@ const struct algo ALGOS[] = {
[_SBNDM] = {_SBNDM, OK, "sbndm", "Simplified BNDM", 0, 0},
[_TNDM] = {_TNDM, OK, "tndm", "Two-Way Nondeterministic DAWG Matching", 0, 0},
[_TNDMa] = {_TNDMa, OK, "tndma", "Two-Way Nondeterministic DAWG Matching (version 2)", 0, 0},
[_LBNDM] = {_LBNDM, OK, "lbndm", "long patterns bndm", 0, 0},
[_LBNDM] = {_LBNDM, OK, "lbndm", "long patterns bndm", 2, 0},
// hg BNDM with q-grams
// bg BNDM with q-grams, and parallel search
[_SVM0] = {_SVM0, OK, "svm0", "shift vector matching (version 0)", 0, 0},
[_SVM1] = {_SVM1, OK, "svm1", "shift vector matching (version 1)", 0, 0},
[_SVM2] = {_SVM2, OK, "svm2", "shift vector matching (version 2)", 0, 0},
[_SVM3] = {_SVM3, OK, "svm3", "shift vector matching (version 3)", 0, 0},
[_SVM4] = {_SVM4, OK, "svm4", "shift vector matching (version 4)", 0, 0},
[_SBNDM2] = {_SBNDM2, OK, "sbndm2", "simplified bndm with loop-unrolling", 0, 0},
[_SBNDM2] = {_SBNDM2, OK, "sbndm2", "simplified bndm with loop-unrolling", 2, 0},
[_SBNDM_BMH] = {_SBNDM_BMH, OK, "sbndm-bmh", "sbndm with horspool shift", 2, 0},
[_BMH_SBNDM] = {_BMH_SBNDM, FAIL, "bmh-sbndm", "Horspool with SBNDM test", 0, 0},
[_FNDM] = {_FNDM, OK, "fndm", "forward nondeterministic dawg matching", 0, 0},
Expand Down
6 changes: 5 additions & 1 deletion source/algos/lbndm.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@
* Proceedings of the 10th International Symposium on String Processing and
* Information Retrieval SPIRE'03, Lecture Notes in Computer Science, vol.2857,
* pp.80--94, Springer-Verlag, Berlin, Manaus, Brazil, (2003).
*
* Constraints: requires m>=2
*/

#define MIN_M 2
#include "include/define.h"
#include "include/main.h"
#include "include/search_small.h"

int verify(unsigned char *y, int left, unsigned char *x, int m, int k,
int pos) {
Expand All @@ -52,7 +56,7 @@ int search(unsigned char *x, int m, unsigned char *y, int n) {
int i, j, l;
int m1, m2, rmd;
if (m < 2)
return -1;
return search_small(x, m, y, n);

BEGIN_PREPROCESSING
/* Preprocessing */
Expand Down
6 changes: 5 additions & 1 deletion source/algos/sbndm2.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,22 @@
* in J. Holub and B. Durian. Talk: Fast variants of bit parallel approach to
* suffix automata. The Second Haifa Annual International Stringology Research
* Workshop of the Israeli Science Foundation, (2005).
*
* Constraints: requires m>=2
*/

#define MIN_M 2
#include "include/define.h"
#include "include/main.h"
#include "include/search_small.h"

int search_large(unsigned char *x, int m, unsigned char *y, int n);

int search(unsigned char *x, int m, unsigned char *y, int n) {
unsigned int B[SIGMA], D;
int i, j, pos, mMinus1, m2, count, shift;
if (m < 2)
return -1;
return search_small(x, m, y, n);
if (m > 32)
return search_large(x, m, y, n);

Expand Down

0 comments on commit ee4f22c

Please sign in to comment.