23 namespace seqan3::detail
44 template <std::ranges::input_range score_matrix_t, std::ranges::input_range trace_matrix_t>
46 requires (std::ranges::input_range<std::ranges::range_reference_t<score_matrix_t>> &&
47 std::ranges::input_range<std::ranges::range_reference_t<trace_matrix_t>>)
49 class combined_score_and_trace_matrix
59 score_matrix_t score_matrix{};
61 trace_matrix_t trace_matrix{};
67 combined_score_and_trace_matrix() =
default;
68 combined_score_and_trace_matrix(combined_score_and_trace_matrix
const &) =
default;
69 combined_score_and_trace_matrix(combined_score_and_trace_matrix &&) =
default;
70 combined_score_and_trace_matrix & operator=(combined_score_and_trace_matrix
const &) =
default;
71 combined_score_and_trace_matrix & operator=(combined_score_and_trace_matrix &&) =
default;
72 ~combined_score_and_trace_matrix() =
default;
96 template <std::
integral column_index_t, std::
integral row_index_t>
97 void resize(column_index_type<column_index_t>
const column_count,
98 row_index_type<row_index_t>
const row_count,
99 score_type
const initial_score = score_type{})
101 score_matrix_t tmp_score_matrix{};
102 tmp_score_matrix.resize(column_count, row_count, initial_score);
104 trace_matrix_t tmp_trace_matrix{};
105 tmp_trace_matrix.resize(column_count, row_count);
107 score_matrix =
std::move(tmp_score_matrix);
108 trace_matrix =
std::move(tmp_trace_matrix);
117 return iterator{score_matrix.begin(), trace_matrix.begin()};
121 iterator
begin()
const =
delete;
126 return sentinel{score_matrix.end()};
130 sentinel
end()
const =
delete;
141 auto trace_path(matrix_coordinate
const & from_coordinate)
const
143 return trace_matrix.trace_path(from_coordinate);
158 template <std::ranges::input_range score_matrix_t, std::ranges::input_range trace_matrix_t>
160 requires (std::ranges::input_range<std::ranges::range_reference_t<score_matrix_t>> &&
161 std::ranges::input_range<std::ranges::range_reference_t<trace_matrix_t>>)
163 class combined_score_and_trace_matrix<score_matrix_t, trace_matrix_t>::iterator
167 using score_matrix_reference_type = std::ranges::range_reference_t<score_matrix_t>;
169 using trace_matrix_reference_type = std::ranges::range_reference_t<trace_matrix_t>;
171 static_assert(std::ranges::viewable_range<score_matrix_reference_type>);
172 static_assert(std::ranges::viewable_range<trace_matrix_reference_type>);
175 using combined_column_type = decltype(
views::zip(std::declval<score_matrix_reference_type>(),
176 std::declval<trace_matrix_reference_type>()));
178 using score_matrix_iter_type = std::ranges::iterator_t<score_matrix_t>;
180 using trace_matrix_iter_type = std::ranges::iterator_t<trace_matrix_t>;
183 template <std::ranges::input_range other_score_matrix_t, std::ranges::input_range other_trace_matrix_t>
185 requires (std::ranges::input_range<std::ranges::range_reference_t<other_score_matrix_t>> &&
186 std::ranges::input_range<std::ranges::range_reference_t<other_trace_matrix_t>>)
188 friend class combined_score_and_trace_matrix;
191 static constexpr auto transform_to_combined_matrix_cell =
std::views::
transform([] (auto && tpl)
194 using fwd_tuple_t = decltype(tpl);
195 return affine_cell_proxy<std::remove_cvref_t<fwd_tuple_t>>{std::forward<fwd_tuple_t>(tpl)};
199 score_matrix_iter_type score_matrix_it;
201 trace_matrix_iter_type trace_matrix_it;
208 using value_type = decltype(std::declval<combined_column_type>() | transform_to_combined_matrix_cell);
210 using reference = value_type;
212 using pointer = void;
222 iterator() =
default;
223 iterator(iterator
const &) =
default;
224 iterator(iterator &&) =
default;
225 iterator & operator=(iterator
const &) =
default;
226 iterator & operator=(iterator &&) =
default;
227 ~iterator() =
default;
234 explicit iterator(score_matrix_iter_type score_matrix_it,
235 trace_matrix_iter_type trace_matrix_it) noexcept :
236 score_matrix_it{
std::move(score_matrix_it)},
237 trace_matrix_it{
std::move(trace_matrix_it)}
245 reference operator*()
const
247 return views::zip(*score_matrix_it, *trace_matrix_it) | transform_to_combined_matrix_cell;
255 iterator & operator++()
277 template <std::ranges::input_range score_matrix_t, std::ranges::input_range trace_matrix_t>
279 requires (std::ranges::input_range<std::ranges::range_reference_t<score_matrix_t>> &&
280 std::ranges::input_range<std::ranges::range_reference_t<trace_matrix_t>>)
282 class combined_score_and_trace_matrix<score_matrix_t, trace_matrix_t>::sentinel
286 using score_matrix_sentinel_type = std::ranges::sentinel_t<score_matrix_t>;
289 score_matrix_sentinel_type score_matrix_sentinel{};
295 sentinel() =
default;
296 sentinel(sentinel
const &) =
default;
297 sentinel(sentinel &&) =
default;
298 sentinel & operator=(sentinel
const &) =
default;
299 sentinel & operator=(sentinel &&) =
default;
300 ~sentinel() =
default;
306 explicit sentinel(score_matrix_sentinel_type score_matrix_sentinel) noexcept :
307 score_matrix_sentinel{
std::move(score_matrix_sentinel)}
315 friend bool operator==(iterator
const & lhs, sentinel
const & rhs) noexcept
317 return rhs.equal(lhs);
321 friend bool operator==(sentinel
const & lhs, iterator
const & rhs) noexcept
327 friend bool operator!=(iterator
const & lhs, sentinel
const & rhs) noexcept
329 return !(lhs == rhs);
333 friend bool operator!=(sentinel
const & lhs, iterator
const & rhs) noexcept
335 return !(lhs == rhs);
349 constexpr
bool equal(iterator
const & iter)
const noexcept
351 return iter.score_matrix_it == score_matrix_sentinel;
Provides seqan3::detail::affine_cell_proxy.
Provides various transformation traits used by the range module.
Provides concepts for core language types and relations that don't have concepts in C++20 (yet).
decltype(detail::transform< trait_t >(list_t{})) transform
Apply a transformation trait to every type in the list and return a seqan3::type_list of the results.
Definition: traits.hpp:471
std::remove_cv_t< std::remove_reference_t< t > > remove_cvref_t
Return the input type with const, volatile and references removed (type trait).
Definition: basic.hpp:45
constexpr auto zip
A zip view.
Definition: zip.hpp:29
auto const move
A view that turns lvalue-references into rvalue-references.
Definition: move.hpp:74
Provides seqan3::detail::matrix_index, seqan3::detail::matrix_coordinate and associated strong types.
SeqAn specific customisations in the standard namespace.
Adaptations of concepts from the Ranges TS.
Provides seqan3::views::zip.