Lines Matching full:sa

38 sort_typeBstar(const sauchar_t *T, saidx_t *SA,  in sort_typeBstar()  argument
59 type B* suffixes into the array SA. */ in sort_typeBstar()
66 SA[--m] = i; in sort_typeBstar()
94 PAb = SA + n - m; ISAb = SA + m; in sort_typeBstar()
97 SA[--BUCKET_BSTAR(c0, c1)] = i; in sort_typeBstar()
100 SA[--BUCKET_BSTAR(c0, c1)] = m - 1; in sort_typeBstar()
105 buf = SA + m, bufsize = (n - (2 * m)) / tmp; in sort_typeBstar()
128 sssort(T, PAb, SA + k, SA + l, in sort_typeBstar()
129 curbuf, bufsize, 2, n, *(SA + k) == (m - 1)); in sort_typeBstar()
133 buf = SA + m, bufsize = n - (2 * m); in sort_typeBstar()
138 sssort(T, PAb, SA + i, SA + j, in sort_typeBstar()
139 buf, bufsize, 2, n, *(SA + i) == (m - 1)); in sort_typeBstar()
147 if(0 <= SA[i]) { in sort_typeBstar()
149 do { ISAb[SA[i]] = i; } while((0 <= --i) && (0 <= SA[i])); in sort_typeBstar()
150 SA[i + 1] = i - j; in sort_typeBstar()
154 do { ISAb[SA[i] = ~SA[i]] = j; } while(SA[--i] < 0); in sort_typeBstar()
155 ISAb[SA[i]] = j; in sort_typeBstar()
159 trsort(ISAb, SA, m, 1); in sort_typeBstar()
167 SA[ISAb[--j]] = ((t == 0) || (1 < (t - i))) ? t : ~t; in sort_typeBstar()
182 --i, --k) { SA[i] = SA[k]; } in sort_typeBstar()
195 construct_SA(const sauchar_t *T, saidx_t *SA, in construct_SA() argument
207 for(i = SA + BUCKET_BSTAR(c1, c1 + 1), in construct_SA()
208 j = SA + BUCKET_A(c1 + 1) - 1, k = NULL, c2 = -1; in construct_SA()
219 if(0 <= c2) { BUCKET_B(c2, c1) = k - SA; } in construct_SA()
220 k = SA + BUCKET_B(c2 = c0, c1); in construct_SA()
234 k = SA + BUCKET_A(c2 = T[n - 1]); in construct_SA()
237 for(i = SA, j = SA + n; i < j; ++i) { in construct_SA()
243 BUCKET_A(c2) = k - SA; in construct_SA()
244 k = SA + BUCKET_A(c2 = c0); in construct_SA()
259 construct_BWT(const sauchar_t *T, saidx_t *SA, in construct_BWT() argument
271 for(i = SA + BUCKET_BSTAR(c1, c1 + 1), in construct_BWT()
272 j = SA + BUCKET_A(c1 + 1) - 1, k = NULL, c2 = -1; in construct_BWT()
283 if(0 <= c2) { BUCKET_B(c2, c1) = k - SA; } in construct_BWT()
284 k = SA + BUCKET_B(c2 = c0, c1); in construct_BWT()
301 k = SA + BUCKET_A(c2 = T[n - 1]); in construct_BWT()
304 for(i = SA, j = SA + n, orig = SA; i < j; ++i) { in construct_BWT()
311 BUCKET_A(c2) = k - SA; in construct_BWT()
312 k = SA + BUCKET_A(c2 = c0); in construct_BWT()
323 return orig - SA; in construct_BWT()
332 divsufsort(const sauchar_t *T, saidx_t *SA, saidx_t n) { in divsufsort() argument
338 if((T == NULL) || (SA == NULL) || (n < 0)) { return -1; } in divsufsort()
340 else if(n == 1) { SA[0] = 0; return 0; } in divsufsort()
341 else if(n == 2) { m = (T[0] < T[1]); SA[m ^ 1] = 0, SA[m] = 1; return 0; } in divsufsort()
348 m = sort_typeBstar(T, SA, bucket_A, bucket_B, n); in divsufsort()
349 construct_SA(T, SA, bucket_A, bucket_B, n, m); in divsufsort()