SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
seqan3::detail::view_to_simd< urng_t, simd_t >::iterator_type Class Reference

Iterator that transposes the underlying range of ranges and transforms that to SIMD types. More...

#include <seqan3/utility/simd/views/to_simd.hpp>

Public Types

Associated types
using reference = std::span< std::ranges::range_value_t< chunk_type > >
 The reference type.
 
using value_type = reference
 The value type.
 
using pointer = void
 The pointer type.
 
using difference_type = ptrdiff_t
 The difference type.
 
using iterator_category = std::input_iterator_tag
 The iterator category.
 
using iterator_concept = iterator_category
 

Public Member Functions

Constructors, destructor and assignment
constexpr iterator_type ()=default
 Defaulted.
 
constexpr iterator_type (iterator_type const &)=default
 Defaulted.
 
constexpr iterator_type (iterator_type &&)=default
 Defaulted.
 
constexpr iterator_typeoperator= (iterator_type const &)=default
 Defaulted.
 
constexpr iterator_typeoperator= (iterator_type &&)=default
 Defaulted.
 
 ~iterator_type ()=default
 Defaulted.
 
constexpr iterator_type (view_to_simd &this_view)
 Construction from the associated range.
 
Element access
constexpr reference operator* () const noexcept
 Returns a reference to the current chunk of simd vectors.
 
Arithmetic operators
constexpr iterator_typeoperator++ ()
 Advances the iterator to the next chunk.
 
constexpr value_type operator++ (int)
 Advances the iterator to the next chunk and returns the previous pointed-to value.
 

Private Member Functions

constexpr bool all_iterators_reached_sentinel () const noexcept
 Checks if all sequence iterators reached the end.
 
constexpr simd_t convert_single_column () noexcept
 Convert a single column into a simd vector.
 
constexpr void split_into_sub_matrices (std::array< max_simd_type, simd_traits< max_simd_type >::length > matrix) const
 Unpacks the matrix of simd types and caches the respective chunk entries.
 
constexpr void underflow ()
 Fetches the next available chunk(s).
 
constexpr void underflow ()
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
auto unpack (max_simd_type const &row) const
 Unpacks one row of the transposed byte matrix using simd instructions.
 
template<typename array_t >
constexpr void update_final_chunk_position (array_t const &iterators_before_update) noexcept
 Updates the end of the final chunk and sets the index of the final chunk.
 

Private Attributes

bool at_end {true}
 Flag indicating that iterator is at end.
 
std::array< std::ranges::iterator_t< inner_range_type >, chunk_sizecached_iter {}
 Array containing the cached sequence iterators over the inner ranges.
 
std::array< std::ranges::sentinel_t< inner_range_type >, chunk_sizecached_sentinel {}
 Array containing the cached sequence sentinels over the inner ranges.
 
uint8_t current_chunk_pos {0}
 The current chunk position.
 
bool final_chunk {true}
 Flag indicating that final chunk was reached.
 
uint8_t final_chunk_pos {total_chunks - 1}
 The final chunk position.
 
uint8_t final_chunk_size {chunk_size}
 The size of the final chunk.
 
view_to_simdthis_view {nullptr}
 Pointer to the associated range.
 

Comparison operators

constexpr bool operator== (std::default_sentinel_t const &) const noexcept
 Returns true if iterator reached the end, otherwise false.
 
constexpr bool operator!= (std::default_sentinel_t const &) const noexcept
 Returns true if iterator did not reach the end yet, otherwise false.
 
constexpr bool operator== (std::default_sentinel_t const &, iterator_type const &rhs) noexcept
 Returns true if iterator reached the end, otherwise false.
 
constexpr bool operator!= (std::default_sentinel_t const &, iterator_type const &rhs) noexcept
 Returns true if iterator did not reach the end yet, otherwise false.
 

Detailed Description

template<std::ranges::view urng_t, simd::simd_concept simd_t>
class seqan3::detail::view_to_simd< urng_t, simd_t >::iterator_type

Iterator that transposes the underlying range of ranges and transforms that to SIMD types.

This iterator models std::input_iterator. When dereferencing it returns a span over a range with value type simd_t.

Member Typedef Documentation

◆ iterator_concept

template<std::ranges::view urng_t, simd::simd_concept simd_t>
using seqan3::detail::view_to_simd< urng_t, simd_t >::iterator_type::iterator_concept = iterator_category

The iterator concept.

Constructor & Destructor Documentation

◆ iterator_type()

template<std::ranges::view urng_t, simd::simd_concept simd_t>
constexpr seqan3::detail::view_to_simd< urng_t, simd_t >::iterator_type::iterator_type ( view_to_simd this_view)
inlineconstexpr

Construction from the associated range.

Parameters
this_viewA reference to the associated view.

Initialises the iterators and sentinels of the underlying sequences to be transformed and calls underflow to fetch the first chunk.

Member Function Documentation

◆ all_iterators_reached_sentinel()

template<std::ranges::view urng_t, simd::simd_concept simd_t>
constexpr bool seqan3::detail::view_to_simd< urng_t, simd_t >::iterator_type::all_iterators_reached_sentinel ( ) const
inlineconstexprprivatenoexcept

Checks if all sequence iterators reached the end.

Returns
true if all iterators reached the end, otherwise false.

◆ convert_single_column()

template<std::ranges::view urng_t, simd::simd_concept simd_t>
constexpr simd_t seqan3::detail::view_to_simd< urng_t, simd_t >::iterator_type::convert_single_column ( )
inlineconstexprprivatenoexcept

Convert a single column into a simd vector.

Template Parameters
indicesA non-type template parameter pack over the sequence indices.
Returns
A simd vector filled with the symbols of the sequences at the current position.

Converts a single column over the sequences into a simd type. If the end of one sequence was already reached it will return the padding value instead.

◆ split_into_sub_matrices()

template<std::ranges::view urng_t, simd::simd_concept simd_t>
constexpr void seqan3::detail::view_to_simd< urng_t, simd_t >::iterator_type::split_into_sub_matrices ( std::array< max_simd_type, simd_traits< max_simd_type >::length >  matrix) const
inlineconstexprprivate

Unpacks the matrix of simd types and caches the respective chunk entries.

Parameters
matrixThe transposed byte matrix from the efficient load procedure.

In the efficient load procedure a quadratic byte matrix is first filled and then transposed using efficient simd instructions. Depending on the target simd vector type this byte matrix must be unpacked and the corresponding simd vectors must be assigned to their respective position within the cached chunk array.

◆ unpack()

template<std::ranges::view urng_t, simd::simd_concept simd_t>
auto seqan3::detail::view_to_simd< urng_t, simd_t >::iterator_type::unpack ( max_simd_type const &  row) const
inlineprivate

Unpacks one row of the transposed byte matrix using simd instructions.

Parameters
[in]rowThe current matrix row to unpack.
Returns
The unpacked simd vectors depending on the target vector length.

If the target vector length is the same as the max vector length nothing will be unpacked and the function is a noop. In the other cases the corresponding parts of the source vector are extracted and upcasted to the target simd type.

◆ update_final_chunk_position()

template<std::ranges::view urng_t, simd::simd_concept simd_t>
template<typename array_t >
constexpr void seqan3::detail::view_to_simd< urng_t, simd_t >::iterator_type::update_final_chunk_position ( array_t const &  iterators_before_update)
inlineconstexprprivatenoexcept

Updates the end of the final chunk and sets the index of the final chunk.

Template Parameters
array_tThe array type containing the iterators over sequences.
Parameters
[in]iterators_before_updateThe array containing the iterators before the load operations.

Sets the index of the final chunk (final_chunk_pos) and updates the end position of the final chunk such that the view ends at the last character of the longest sequences contained in the set of sequences to be transformed.

Friends And Related Symbol Documentation

◆ operator!=

template<std::ranges::view urng_t, simd::simd_concept simd_t>
constexpr bool operator!= ( std::default_sentinel_t const &  ,
iterator_type const &  rhs 
)
friend

Returns true if iterator did not reach the end yet, otherwise false.

◆ operator==

template<std::ranges::view urng_t, simd::simd_concept simd_t>
constexpr bool operator== ( std::default_sentinel_t const &  ,
iterator_type const &  rhs 
)
friend

Returns true if iterator reached the end, otherwise false.


The documentation for this class was generated from the following file:
Hide me