21namespace seqan3::detail
46template <
typename trace_t,
bool coordinate_only = false>
47class alignment_trace_matrix_full :
48 protected alignment_trace_matrix_base<trace_t>,
49 public alignment_matrix_column_major_range_base<alignment_trace_matrix_full<trace_t, coordinate_only>>
52 static_assert(std::same_as<trace_t, trace_directions> || simd_concept<trace_t>,
53 "Value type must either be a trace_directions object or a simd vector.");
56 using matrix_base_t = alignment_trace_matrix_base<trace_t>;
59 alignment_matrix_column_major_range_base<alignment_trace_matrix_full<trace_t, coordinate_only>>;
65 using typename matrix_base_t::coordinate_type;
66 using typename matrix_base_t::element_type;
67 using typename range_base_t::alignment_column_type;
69 using column_data_view_type =
71 decltype(std::views::iota(coordinate_type{}, coordinate_type{})),
74 std::views::iota(coordinate_type{}, coordinate_type{})))>;
82 alignment_trace_matrix_proxy<coordinate_type,
85 using reference = value_type;
87 using iterator =
typename range_base_t::iterator;
89 using sentinel =
typename range_base_t::sentinel;
90 using typename matrix_base_t::size_type;
96 constexpr alignment_trace_matrix_full() =
default;
97 constexpr alignment_trace_matrix_full(alignment_trace_matrix_full
const &) =
default;
98 constexpr alignment_trace_matrix_full(alignment_trace_matrix_full &&) =
default;
99 constexpr alignment_trace_matrix_full & operator=(alignment_trace_matrix_full
const &) =
default;
100 constexpr alignment_trace_matrix_full & operator=(alignment_trace_matrix_full &&) =
default;
101 ~alignment_trace_matrix_full() =
default;
116 template <std::ranges::forward_range first_sequence_t, std::ranges::forward_range second_sequence_t>
117 constexpr alignment_trace_matrix_full(first_sequence_t && first,
118 second_sequence_t && second,
119 [[maybe_unused]] trace_t
const initial_value = trace_t{})
121 matrix_base_t::num_cols =
static_cast<size_type
>(std::ranges::distance(first) + 1);
122 matrix_base_t::num_rows =
static_cast<size_type
>(std::ranges::distance(second) + 1);
124 if constexpr (!coordinate_only)
127 matrix_base_t::data =
typename matrix_base_t::pool_type{number_rows{matrix_base_t::num_rows},
128 number_cols{matrix_base_t::num_cols}};
129 matrix_base_t::cache_left.resize(matrix_base_t::num_rows, initial_value);
140 auto trace_path(matrix_coordinate
const & trace_begin)
142 static_assert(!coordinate_only,
"Requested trace but storing the trace was disabled!");
144 using matrix_iter_t = std::ranges::iterator_t<typename matrix_base_t::pool_type>;
145 using trace_iterator_t = trace_iterator<matrix_iter_t>;
146 using path_t = std::ranges::subrange<trace_iterator_t, std::default_sentinel_t>;
148 if (trace_begin.row >= matrix_base_t::num_rows || trace_begin.col >= matrix_base_t::num_cols)
149 throw std::invalid_argument{
"The given coordinate exceeds the matrix in vertical or horizontal direction."};
151 return path_t{trace_iterator_t{matrix_base_t::data.begin() + matrix_offset{trace_begin}},
152 std::default_sentinel};
157 constexpr alignment_column_type initialise_column(size_type
const column_index)
noexcept
159 coordinate_type row_begin{column_index_type{column_index}, row_index_type{0u}};
160 coordinate_type row_end{column_index_type{column_index}, row_index_type{matrix_base_t::num_rows}};
161 if constexpr (coordinate_only)
163 return alignment_column_type{
165 column_data_view_type{std::views::iota(std::move(row_begin), std::move(row_end))}};
169 matrix_coordinate current_position{row_index_type{0u}, column_index_type{column_index}};
173 std::views::iota(std::move(row_begin), std::move(row_end)));
174 return alignment_column_type{*
this, column_data_view_type{col}};
179 template <std::random_access_iterator iter_t>
180 constexpr value_type make_proxy(iter_t host_iter)
noexcept
182 if constexpr (coordinate_only)
184 return {*host_iter, std::ignore, std::ignore, std::ignore, std::ignore};
189 std::get<2>(*host_iter),
190 std::get<0>(*host_iter),
191 std::get<1>(*host_iter),
192 std::get<1>(*host_iter),
193 matrix_base_t::cache_up,
Provides seqan3::detail::alignment_matrix_column_major_range_base.
Provides seqan3::detail::alignment_trace_matrix_base.
Provides seqan3::detail::alignment_trace_matrix_proxy.
seqan::stl::views::zip zip
A view adaptor that takes several views and returns tuple-like values from every i-th element of each...
Definition zip.hpp:24
Provides seqan3::detail::trace_iterator.
Provides seqan3::views::zip.