Skip to content

Commit

Permalink
Cosmetic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Felipe A. Louza committed Apr 3, 2017
1 parent 0f996f0 commit 8885f62
Show file tree
Hide file tree
Showing 11 changed files with 676 additions and 2,049 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ An ANSI C Compiler (e.g. GNU GCC)

## API

**gsacak.h**
**gsacak.h** (the same for gsais.h)

```c
/** @brief Computes the suffix array SA (LCP, DA) of T^cat in s[0..n-1]
Expand Down Expand Up @@ -66,8 +66,8 @@ int gsacak_int(uint_t *s, uint_t *SA, int_t *LCP, int_t *DA, uint_t n, uint_t k)
**Compilation:**

```sh
gcc -c sacak-lcp.c experiments/external/malloc_count.c
gcc test.c -o test sacak-lcp.o malloc_count.o -ldl
gcc -c gsacak.c experiments/external/malloc_count/malloc_count.c
gcc test.c -o test gsacak.o malloc_count.o -ldl
```

**Run a test:**
Expand All @@ -80,7 +80,7 @@ gcc test.c -o test sacak-lcp.o malloc_count.o -ldl

```c
sizeof(int_t) = 4 bytes
sum = 18
N = 18
Text = banana$anaba$anan$#
i SA DA LCP BWT suffixes
0 18 3 0 $ #
Expand Down Expand Up @@ -136,7 +136,7 @@ Please, if you use this tool in an academic setting cite the following paper:

\[1\] Louza, F. A., Gog, S., Telles, G. P., Induced Suffix Sorting for String Collections. In Proc. DCC, pp. 43-58, 2016, [IEEE](http://ieeexplore.ieee.org/document/7786148/).

\[2\] Louza, F. A., Gog, S., and Telles, G. P., Inducing enhanced suffix arrays for string collections. Theor. Comput. Sci., pages 134.
\[2\] Louza, F. A., Gog, S., Telles, G. P., Inducing enhanced suffix arrays for string collections. Theor. Comput. Sci., (to appear), pages 1-34.

\[3\] Nong G., Zhang S., Chan W. H., Two efficient algorithms for linear time suffix array construction, IEEE Trans. Comput., vol. 60, no. 10, pp. 1471–1484, 2011

Expand Down
2 changes: 1 addition & 1 deletion experiments/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ LIBOBJ = \
lib/lcp_array.o\
lib/document_array.o\
external/malloc_count/malloc_count.o\
src/gsais.o\
../gsais.o\
../gsacak.o


Expand Down
22 changes: 19 additions & 3 deletions experiments/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ make

--

**Settings:**
**Settings**

**SA:**

MODE parameter specifies which algorithm is called by main.c:

Expand All @@ -32,7 +34,7 @@ SAIS\* and SACA-K\* are versions that receive an integer alphabet as input.

--

**LCP-array:**
**SA and LCP:**

MODE parameter:

Expand All @@ -51,7 +53,7 @@ make run MODE=6 LCP_COMPUTE=1

--

**Document-array:**
**SA and DA:**

MODE parameter:

Expand Down Expand Up @@ -80,6 +82,20 @@ SDV=1 uses a sparse bitvector.

--

**SA, LCP and DA:**

MODE parameter:

* 11: gSAIS+LCP+DA
* 12: gSACA-K+LCP+DA

```sh
make run MODE=11
make run MODE=12
```

--

**Validate:**

One can check if the output produced is correct:
Expand Down
34 changes: 22 additions & 12 deletions experiments/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "lib/lcp_array.h"
#include "lib/document_array.h"
#include "external/malloc_count/malloc_count.h"
#include "src/gsais.h"
#include "../gsais.h"
#include "../gsacak.h"

#ifndef DEBUG
Expand Down Expand Up @@ -51,9 +51,9 @@ clock_t c_start=0, c_total=0;
sscanf(argv[7], "%u", &VALIDATE);
sscanf(argv[8], "%u", &OUTPUT);

if(MODE==7 || MODE==8 || MODE==11) LCP_COMPUTE=1;
if(MODE==9 || MODE==10 || MODE==11) DA_COMPUTE=1;
if(MODE>11) return 1;
if(MODE==7 || MODE==8 || MODE==11 || MODE==12) LCP_COMPUTE=1;
if(MODE==9 || MODE==10 || MODE==11 || MODE==12) DA_COMPUTE=1;
if(MODE>12) return 1;

file_chdir(c_dir);

Expand Down Expand Up @@ -124,7 +124,8 @@ clock_t c_start=0, c_total=0;

switch(MODE){
case 1: printf("## SAIS (int) ##\n");
depth = SAIS((int_t*)str_int, SA, n, 256+k, sizeof(int_t), 0);
//depth = SAIS((int_t*)str_int, SA, n, 256+k, sizeof(int_t), 0);
depth = sais_int((int_t*)str_int, (uint_t*)SA, n, 256+k);
break;

case 2: printf("## SACA_K (int) ##\n");
Expand All @@ -133,7 +134,8 @@ clock_t c_start=0, c_total=0;
break;

case 3: printf("## SAIS (char) ##\n");
depth = SAIS((int_t*)str, SA, n, 256, sizeof(char), 0);
//depth = SAIS((int_t*)str, SA, n, 256, sizeof(char), 0);
depth = sais(str, (uint_t*)SA, n);
break;

case 4: printf("## SACA_K (char) ##\n");
Expand All @@ -142,7 +144,8 @@ clock_t c_start=0, c_total=0;
break;

case 5: printf("## gSAIS ##\n");
depth = gSAIS((unsigned char*)str, SA, n, 256, sizeof(char), 0, 1);//separator=1
//depth = gSAIS((unsigned char*)str, SA, n, 256, sizeof(char), 0, 1);//separator=1
depth = gsais((unsigned char*)str, (uint_t*)SA, NULL, NULL, n);
break;

case 6: printf("## gSACA_K ##\n");
Expand All @@ -151,7 +154,8 @@ clock_t c_start=0, c_total=0;
break;

case 7: printf("## gSAIS+LCP ##\n");
depth = gSAIS_LCP((unsigned char*)str, SA, LCP, n, 256, sizeof(char), 0, 1);//separator=1
//depth = gSAIS_LCP((unsigned char*)str, SA, LCP, n, 256, sizeof(char), 0, 1);//separator=1
depth = gsais((unsigned char*)str, (uint_t*)SA, LCP, NULL, n);
break;

case 8: printf("## gSACA_K+LCP ##\n");
Expand All @@ -160,14 +164,20 @@ clock_t c_start=0, c_total=0;
break;

case 9: printf("## gSAIS+DA ##\n");
depth = gSAIS_DA((unsigned char*)str, SA, DA, n, 256, sizeof(char), 0, 1);//separator=1
//depth = gSAIS_DA((unsigned char*)str, SA, DA, n, 256, sizeof(char), 0, 1);//separator=1
depth = gsais((unsigned char*)str, (uint_t*)SA, NULL, DA, n);
break;

case 10: printf("## gSACA_K+DA ##\n");
//depth = gSACA_K_DA((unsigned char*)str, (uint_t*)SA, DA, n, 256, sizeof(char), 0, 1);//separator=1
depth = gsacak((unsigned char*)str, (uint_t*)SA, NULL, DA, n);
break;
case 11: printf("## gSACA_K+LCP+DA ##\n");

case 11: printf("## gSAIS+LCP+DA ##\n");
depth = gsais((unsigned char*)str, (uint_t*)SA, LCP, DA, n);
break;

case 12: printf("## gSACA_K+LCP+DA ##\n");
depth = gsacak((unsigned char*)str, (uint_t*)SA, LCP, DA, n);
break;

Expand All @@ -177,7 +187,7 @@ clock_t c_start=0, c_total=0;
fprintf(stderr,"%.6lf\n", time_stop(t_start, c_start));

//LCP array
if(LCP_COMPUTE && (MODE!=7 && MODE!=8 && MODE!=11)){
if(LCP_COMPUTE && (MODE!=7 && MODE!=8 && MODE!=11 && MODE!=12)){
time_start(&t_start, &c_start);
if(MODE==1 || MODE==2)
lcp_PHI_int((int_t*)str_int, SA, LCP, n, sizeof(int_t));
Expand All @@ -188,7 +198,7 @@ clock_t c_start=0, c_total=0;
}

//Document array
if(DA_COMPUTE && (MODE!=9 && MODE!=10 && MODE!=11)){
if(DA_COMPUTE && (MODE!=9 && MODE!=10 && MODE!=11 && MODE!=12)){
time_start(&t_start, &c_start);
if(MODE==1 || MODE==2)
document_array_LF_int((int_t*)str_int, SA, DA, n, 256+k, sizeof(int_t), 1, k);
Expand Down
Loading

0 comments on commit 8885f62

Please sign in to comment.