From 4a50eab1571b36d91d75499bfe0429871822e65a Mon Sep 17 00:00:00 2001 From: rrahn Date: Wed, 4 Sep 2019 00:09:49 +0200 Subject: [PATCH] [FEATURE] Adds alignment cache. --- .../detail/alignment_algorithm_cache.hpp | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 include/seqan3/alignment/pairwise/detail/alignment_algorithm_cache.hpp diff --git a/include/seqan3/alignment/pairwise/detail/alignment_algorithm_cache.hpp b/include/seqan3/alignment/pairwise/detail/alignment_algorithm_cache.hpp new file mode 100644 index 00000000000..3bdd51bc1f0 --- /dev/null +++ b/include/seqan3/alignment/pairwise/detail/alignment_algorithm_cache.hpp @@ -0,0 +1,52 @@ +// ----------------------------------------------------------------------------------------------------- +// Copyright (c) 2006-2019, Knut Reinert & Freie Universität Berlin +// Copyright (c) 2016-2019, Knut Reinert & MPI für molekulare Genetik +// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License +// shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md +// ----------------------------------------------------------------------------------------------------- + +/*!\file + * \brief Provides seqan3::detail::alignment_algorithm_cache. + * \author Rene Rahn + */ + +#pragma once + +#include +#include + +namespace seqan3::detail +{ +/*!\brief Local cache for the standard alignment algorithm. + * \tparam score_type The type of the score. + * \ingroup pairwise_alignment + * + * \details + * + * This cache is used internally for the standard alignment algorithm and caches the gap extension and gap open scores + * as well as the current alignment optimum. + * The alignment optimum stores the current score and the corresponding matrix coordinate in + * the underlying two-dimensional matrix. + */ +template +struct alignment_algorithm_cache +{ + //!\brief The cached gap open score. + score_type gap_open_score{}; + //!\brief The cached gap extension score. + score_type gap_extension_score{}; + //!\brief The current alignment optimum. + alignment_optimum optimum{std::numeric_limits::lowest(), + alignment_coordinate{column_index_type{0u}, row_index_type{0u}}}; +}; + +/*!\name Type deduction guides + * \relates seqan3::detail::alignment_algorithm_cache + * \{ + */ + +//!\brief Deduces the template parameter for the score type from construction with gap open and gap extension scores. +template +alignment_algorithm_cache(score_type, score_type) -> alignment_algorithm_cache; +//!\} +} // namespace seqan3::detail