Loading...
Searching...
No Matches
alignment_optimum.hpp
Go to the documentation of this file.
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: BSD-3-Clause
#pragma once
#include <concepts>
#include <type_traits>
#include <seqan3/alignment/matrix/detail/matrix_coordinate.hpp>
#include <seqan3/core/detail/template_inspection.hpp>
#include <seqan3/utility/concept.hpp>
#include <seqan3/utility/simd/algorithm.hpp>
#include <seqan3/utility/simd/concept.hpp>
#include <seqan3/utility/simd/simd_traits.hpp>
namespace seqan3::detail
{
template <typename score_t>
struct alignment_optimum
#if SEQAN3_DOXYGEN_ONLY(1) 0
{
using index_t = IMPLEMENTATION_DEFINED;
index_t column_index{};
index_t row_index{};
score_t score = IMPLEMENTATION_DEFINED;
template <typename column_index_t, typename row_index_t>
void update_if_new_optimal_score(score_t const & compare_score,
column_index_type<column_index_t> column_index,
row_index_type<row_index_t> row_index) noexcept;
}
#endif //SEQAN3_DOXYGEN_ONLY(1): This code block is only dis
;
template <arithmetic score_t>
struct alignment_optimum<score_t>
{
size_t column_index{};
size_t row_index{};
score_t score{std::numeric_limits<score_t>::lowest()};
template <std::integral column_index_t, std::integral row_index_t>
constexpr void update_if_new_optimal_score(score_t const & compare_score,
column_index_type<column_index_t> column_index,
row_index_type<row_index_t> row_index) noexcept
{
score = (compare_score > score)
? (this->column_index = column_index.get(), this->row_index = row_index.get(), compare_score)
: score;
}
};
template <simd_concept score_t>
struct alignment_optimum<score_t>
{
using scalar_t = typename simd_traits<score_t>::scalar_type;
score_t column_index{};
score_t row_index{};
score_t score{simd::fill<score_t>(std::numeric_limits<scalar_t>::lowest())};
template <std::integral column_index_t, std::integral row_index_t>
constexpr void update_if_new_optimal_score(score_t const & compare_score,
column_index_type<column_index_t> column_index,
row_index_type<row_index_t> row_index) noexcept
{
auto mask = compare_score > score;
score = mask ? compare_score : score;
this->column_index = mask ? simd::fill<score_t>(column_index.get()) : this->column_index;
this->row_index = mask ? simd::fill<score_t>(row_index.get()) : this->row_index;
}
};
alignment_optimum() -> alignment_optimum<int32_t>;
template <typename column_index_t, typename row_index_t, typename score_t>
alignment_optimum(column_index_t, row_index_t, score_t) -> alignment_optimum<score_t>;
} // namespace seqan3::detail
std::numeric_limits::lowest
T lowest(T... args)
matrix_coordinate.hpp
Provides seqan3::detail::matrix_index, seqan3::detail::matrix_coordinate and associated strong types.
template_inspection.hpp
Provides type traits for working with templates.
type_traits
concept.hpp
Provides concepts that do not have equivalents in C++20.
Hide me