33 #include <thrust/host_vector.h>
34 #include <thrust/device_vector.h>
35 #include <thrust/iterator/constant_iterator.h>
36 #include <thrust/iterator/counting_iterator.h>
51 static const uint32 dc[9] = { 1, 2, 3, 6, 15, 17, 35, 43, 60 };
62 static const uint32 dc[16] = { 0, 1, 2, 5, 10, 15, 26, 37, 48, 59, 70, 76, 82, 88, 89, 90 };
73 static const uint32 dc[22] = { 0, 1, 2, 3, 7, 14, 21, 28, 43, 58, 73, 88, 103, 118, 133, 141, 149, 157, 165, 166, 167, 168 };
84 static const uint32 dc[28] = { 0, 1, 2, 3, 4, 9, 18, 27, 36, 45, 64, 83, 102, 121, 140, 159, 178, 197, 216, 226, 236, 246, 256, 266, 267, 268, 269, 270 };
95 static const uint32 dc[40] = { 0, 1, 2, 3, 4, 5, 6, 13, 26, 39, 52, 65, 78, 91, 118, 145, 172, 199, 226, 253, 280, 307, 334, 361, 388, 415, 442, 456, 470, 484, 498, 512, 526, 540, 541, 542, 543, 544, 545, 546 };
106 static const uint32 dc[58] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 19, 38, 57, 76, 95, 114, 133, 152, 171, 190, 229, 268, 307, 346, 385, 424, 463, 502, 541, 580, 619, 658, 697, 736, 775, 814, 853, 892, 931, 951, 971, 991, 1011, 1031, 1051, 1071, 1091, 1111, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140 };
122 uint8* _bitmask = NULL,
172 thrust::device_vector<uint32>
d_dc;
173 thrust::device_vector<uint32>
d_lut;
174 thrust::device_vector<uint32>
d_pos;
246 template <u
int32 SYMBOL_SIZE,
typename string_type>
258 const string_type _string,
272 #if defined(DCS_CHECKS)
274 const bool r = less( suffix_idx1, suffix_idx2 );
277 const uint32 WORD_BITS = 32u;
278 const uint32 DOLLAR_BITS = 4u;
279 const uint32 SYMBOLS_PER_WORD = symbols_per_word<SYMBOL_SIZE,WORD_BITS,DOLLAR_BITS>();
283 const uint32 q_words = (Q + SYMBOLS_PER_WORD-1) / SYMBOLS_PER_WORD;
287 suffix_len2 ) + SYMBOLS_PER_WORD-1 ) / SYMBOLS_PER_WORD,
291 for (
uint32 w = 0; w < n_words; ++w)
295 const uint32 w1 = word_functor( suffix_idx1 );
296 const uint32 w2 = word_functor( suffix_idx2 );
297 if (w1 < w2)
return true;
298 if (w1 > w2)
return false;
302 if (suffix_len1 < Q ||
305 #if defined(DCS_CHECKS)
306 const bool r2 = suffix_len1 < suffix_len2;
308 printf(
"short suffixes %u, %u\n", suffix_len1, suffix_len2 );
311 return suffix_len1 < suffix_len2;
316 const uint32 i_mod_Q = suffix_idx1 & (Q-1);
317 const uint32 j_mod_Q = suffix_idx2 & (Q-1);
331 #if defined(DCS_CHECKS)
332 const bool r2 = rank_i < rank_j;
335 printf(
"(%u,%u) : %u != %u, l[%u], pos[%u,%u], rank[%u,%u]\n",
347 return rank_i < rank_j;