43 template <simd_concept simd_score_t, semialphabet alphabet_t,
typename alignment_t,
typename scoring_scheme_t>
45 requires scoring_scheme<scoring_scheme_t, alphabet_t> &&
49 class simd_matrix_scoring_scheme
55 constexpr simd_matrix_scoring_scheme() =
default;
56 constexpr simd_matrix_scoring_scheme(simd_matrix_scoring_scheme
const &) =
default;
57 constexpr simd_matrix_scoring_scheme(simd_matrix_scoring_scheme &&) =
default;
58 constexpr simd_matrix_scoring_scheme & operator=(simd_matrix_scoring_scheme
const &) =
default;
59 constexpr simd_matrix_scoring_scheme & operator=(simd_matrix_scoring_scheme &&) =
default;
60 ~simd_matrix_scoring_scheme() =
default;
63 constexpr
explicit simd_matrix_scoring_scheme(scoring_scheme_t
const & scoring_scheme)
65 initialise_from_scalar_scoring_scheme(scoring_scheme);
69 constexpr simd_matrix_scoring_scheme & operator=(scoring_scheme_t
const & scoring_scheme)
71 initialise_from_scalar_scoring_scheme(scoring_scheme);
96 constexpr simd_score_t score(simd_score_t
const & lhs, simd_score_t
const & rhs)
const noexcept
98 simd_score_t result{};
100 for (
size_t i = 0; i < simd_traits<simd_score_t>::length; ++i)
102 if (is_padded(lhs[i]) || is_padded(rhs[i]))
111 result[i] = internal_scoring_scheme.score(
assign_rank_to(lhs[i], alphabet_t{}),
121 constexpr
typename scoring_scheme_t::score_type padding_match_score() noexcept
128 scoring_scheme_t internal_scoring_scheme;
133 constexpr
void initialise_from_scalar_scoring_scheme(scoring_scheme_t
const & scoring_scheme)
135 using score_t = decltype(std::declval<scoring_scheme_t const &>().score(alphabet_t{}, alphabet_t{}));
136 using simd_scalar_t =
typename simd_traits<simd_score_t>::scalar_type;
139 if constexpr (
sizeof(simd_scalar_t) <
sizeof(score_t))
141 if (min_or_max_exceeded<score_t, simd_scalar_t>(scoring_scheme))
143 "for the selected scalar type of the simd type."};
146 internal_scoring_scheme = scoring_scheme;
156 template <
typename score_t,
typename simd_scalar_t>
157 constexpr
bool min_or_max_exceeded(scoring_scheme_t
const & scoring_scheme)
162 for (uint8_t i = 0; i < alphabet_size<alphabet_t>; ++i)
164 for (uint8_t j = 0; j < alphabet_size<alphabet_t>; ++j)
166 score_t tmp_score = scoring_scheme.score(
assign_rank_to(i, alphabet_t{}),
169 if (tmp_score > max_val || tmp_score < min_val)
184 constexpr
bool is_padded(
typename simd_traits<simd_score_t>::scalar_type
const & value)
const 188 return static_cast<unsigned_scalar_t
>(value) >= alphabet_size<alphabet_t>;
Provides seqan3::simd::simd_concept.
constexpr auto assign_rank_to
Assign a rank to an alphabet object.
Definition: concept.hpp:238
Provides global alignment configurations.
Provides algorithms to modify seqan3::simd::simd_type.
Adaptions of concepts from the Cereal library.
Provides seqan3::scoring_scheme.
Definition: aligned_sequence_concept.hpp:36
Core alphabet concept and free function/type trait wrappers.
The concept std::same_as<T, U> is satisfied if and only if T and U denote the same type...