22namespace seqan3::detail
38template <
typename score_t>
39class alignment_score_matrix_one_column_banded :
40 protected alignment_score_matrix_one_column_base<score_t>,
41 public alignment_matrix_column_major_range_base<alignment_score_matrix_one_column_banded<score_t>>
45 using matrix_base_t = alignment_score_matrix_one_column_base<score_t>;
47 using range_base_t = alignment_matrix_column_major_range_base<alignment_score_matrix_one_column_banded<score_t>>;
53 using typename matrix_base_t::element_type;
54 using typename range_base_t::alignment_column_type;
59 using matrix_base_t::num_cols;
60 using matrix_base_t::num_rows;
66 using value_type = alignment_score_matrix_proxy<score_t>;
68 using reference = value_type;
70 using iterator =
typename range_base_t::iterator;
72 using sentinel =
typename range_base_t::sentinel;
73 using typename matrix_base_t::size_type;
74 using typename matrix_base_t::underlying_type;
81 constexpr alignment_score_matrix_one_column_banded() =
default;
83 constexpr alignment_score_matrix_one_column_banded(alignment_score_matrix_one_column_banded
const &) =
default;
85 constexpr alignment_score_matrix_one_column_banded(alignment_score_matrix_one_column_banded &&) =
default;
87 constexpr alignment_score_matrix_one_column_banded &
88 operator=(alignment_score_matrix_one_column_banded
const &) =
default;
90 constexpr alignment_score_matrix_one_column_banded &
91 operator=(alignment_score_matrix_one_column_banded &&) =
default;
93 ~alignment_score_matrix_one_column_banded() =
default;
109 template <std::ranges::forward_range first_sequence_t, std::ranges::forward_range second_sequence_t>
110 constexpr alignment_score_matrix_one_column_banded(first_sequence_t && first,
111 second_sequence_t && second,
112 align_cfg::band_fixed_size
const & band,
113 score_t
const initial_value = score_t{})
115 matrix_base_t::num_cols =
static_cast<size_type
>(std::ranges::distance(first) + 1);
116 matrix_base_t::num_rows =
static_cast<size_type
>(std::ranges::distance(second) + 1);
118 band_col_index = std::min<int32_t>(std::max<int32_t>(band.upper_diagonal, 0), matrix_base_t::num_cols - 1);
120 std::min<int32_t>(std::abs(std::min<int32_t>(band.lower_diagonal, 0)), matrix_base_t::num_rows - 1);
122 band_size = band_col_index + band_row_index + 1;
124 matrix_base_t::pool.resize(band_size + 1, element_type{initial_value, initial_value});
129 int32_t band_col_index{};
131 int32_t band_row_index{};
137 constexpr alignment_column_type initialise_column(size_type
const column_index)
noexcept
139 int32_t slice_begin = std::max<int32_t>(0, band_col_index - column_index);
140 int32_t row_end_index = column_index - band_col_index + band_size;
141 int32_t slice_end = band_size - std::max<int32_t>(row_end_index - matrix_base_t::num_rows, 0);
143 assert(row_end_index >= 0);
144 assert(slice_begin >= 0);
145 assert(slice_end > 0);
146 assert(slice_begin < slice_end);
148 return alignment_column_type{*
this,
149 column_data_view_type{
std::addressof(matrix_base_t::pool[slice_begin]),
154 template <std::random_access_iterator iter_t>
155 constexpr value_type make_proxy(iter_t host_iter)
noexcept
157 return {std::get<0>(*host_iter),
158 std::get<0>(matrix_base_t::cache),
159 std::get<1>(*(host_iter + 1)),
160 std::get<1>(*(host_iter)),
161 std::get<1>(matrix_base_t::cache)};
165 template <std::random_access_iterator iter_t>
166 constexpr void on_column_iterator_creation(iter_t host_iter)
noexcept
169 std::get<0>(matrix_base_t::cache) = std::get<0>(*host_iter);
173 template <std::random_access_iterator iter_t>
174 constexpr void before_column_iterator_increment(iter_t SEQAN3_DOXYGEN_ONLY(host_iter))
noexcept
180 template <std::random_access_iterator iter_t>
181 constexpr void after_column_iterator_increment(iter_t host_iter)
noexcept
184 std::get<0>(matrix_base_t::cache) = std::get<0>(*host_iter);
Provides seqan3::detail::align_config_band.
Provides seqan3::detail::alignment_matrix_column_major_range_base.
Provides seqan3::detail::alignment_score_matrix_one_column_base.
Provides seqan3::detail::alignment_score_matrix_proxy.