45 template <
typename hit_type>
61 const uint32 diag = range.y - range.x;
84 const uint32 diag = range.z - range.y;
87 return make_uint2( rounded_diag, range.x );
93 template <
typename qgram_index_type,
typename index_iterator,
typename coord_type>
96 template <
typename qgram_index_type,
typename index_iterator>
104 const qgram_index_type _qgram_index,
107 const uint2* _ranges,
108 const index_iterator _index) :
109 qgram_index ( _qgram_index ),
110 n_queries ( _n_queries ),
123 n_queries ) - slots );
126 const uint32 text_pos = index[ slot ];
129 const uint2 range = ranges[ slot ];
130 const uint64 base_slot = slot ? slots[ slot-1 ] : 0u;
131 const uint32 local_index = output_index - base_slot;
133 const uint32 qgram_pos = qgram_index.locate( range.x + local_index );
136 return make_uint2( qgram_pos, text_pos );
146 template <
typename qgram_index_type,
typename index_iterator>
154 const qgram_index_type _qgram_index,
157 const uint2* _ranges,
158 const index_iterator _index) :
159 qgram_index ( _qgram_index ),
160 n_queries ( _n_queries ),
173 n_queries ) - slots );
176 const uint32 text_pos = index[ slot ];
179 const uint2 range = ranges[ slot ];
180 const uint32 base_slot = slot ? slots[ slot-1 ] : 0u;
181 const uint32 local_index = output_index - base_slot;
183 const uint2 qgram_pos = qgram_index.locate( range.x + local_index );
186 return make_uint4( qgram_pos.x, qgram_pos.y, text_pos, 0u );
205 template <
typename qgram_index_type,
typename query_iterator,
typename index_iterator>
207 const qgram_index_type& qgram_index,
209 const query_iterator queries,
210 const index_iterator indices)
212 typedef typename qgram_index_type::coord_type
coord_type;
215 m_n_queries = n_queries;
221 m_ranges.resize( n_queries );
222 m_slots.resize( n_queries );
238 m_n_occurrences = m_slots[ n_queries-1 ];
239 return m_n_occurrences;
244 template <
typename qgram_index_type,
typename query_iterator,
typename index_iterator>
245 template <
typename hits_iterator>
251 typedef typename qgram_index_type::coord_type
coord_type;
255 thrust::make_counting_iterator<uint64>(0u) + begin,
256 thrust::make_counting_iterator<uint64>(0u) + end,
275 template <
typename qgram_index_type,
typename query_iterator,
typename index_iterator>
276 template <
typename hits_iterator,
typename output_iterator>
279 const hits_iterator hits,
280 output_iterator diags,
304 template <
typename qgram_index_type,
typename query_iterator,
typename index_iterator>
305 template <
typename hits_iterator,
typename output_iterator,
typename count_iterator>
309 const hits_iterator hits,
310 output_iterator merged_hits,
311 count_iterator merged_counts)
313 m_diags.resize( n_hits );
316 diagonals( n_hits, hits, m_diags.begin(), interval );
324 raw_diags + n_hits );
329 m_diags.begin() + n_hits,
330 thrust::make_constant_iterator<uint32>(1u),
332 merged_counts ).first - merged_hits );
344 template <
typename qgram_index_type,
typename query_iterator,
typename index_iterator>
346 const qgram_index_type& qgram_index,
348 const query_iterator queries,
349 const index_iterator indices)
351 typedef typename qgram_index_type::coord_type
coord_type;
354 m_n_queries = n_queries;
360 if (m_ranges.size() < n_queries)
363 m_ranges.resize( n_queries );
365 if (m_slots.size() < n_queries)
368 m_slots.resize( n_queries );
383 thrust::plus<uint64>(),
387 m_n_occurrences = m_slots[ n_queries-1 ];
388 return m_n_occurrences;
393 template <
typename qgram_index_type,
typename query_iterator,
typename index_iterator>
394 template <
typename hits_iterator>
400 typedef typename qgram_index_type::coord_type
coord_type;
404 thrust::make_counting_iterator<uint64>(0u) + begin,
405 thrust::make_counting_iterator<uint64>(0u) + end,
424 template <
typename qgram_index_type,
typename query_iterator,
typename index_iterator>
425 template <
typename hits_iterator,
typename output_iterator>
428 const hits_iterator hits,
429 output_iterator diags,
453 template <
typename qgram_index_type,
typename query_iterator,
typename index_iterator>
454 template <
typename hits_iterator,
typename output_iterator,
typename count_iterator>
458 const hits_iterator hits,
459 output_iterator merged_hits,
460 count_iterator merged_counts)
463 const uint32 buffer_size = align<32>( n_hits );
464 m_diags.resize( buffer_size * 2u );
467 diagonals( n_hits, hits, m_diags.begin(), interval );
475 sort_buffers.
keys[0] = raw_diags;
476 sort_buffers.
keys[1] = raw_diags + buffer_size;
479 sort_enactor.
sort( n_hits, sort_buffers );
484 m_diags.begin() + sort_buffers.
selector * buffer_size,