SeqAn3 3.4.0-rc.3
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
matrix_concept.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
12#include <concepts>
13#include <cstddef>
14#include <limits>
15
17
18namespace seqan3::detail
19{
20
23template <typename score_type>
24constexpr score_type matrix_inf = std::numeric_limits<score_type>::max();
25
32template <typename matrix_t>
33concept matrix = requires (std::remove_cvref_t<matrix_t> m) {
34 typename std::remove_cvref_t<matrix_t>::value_type;
35
36 typename std::remove_cvref_t<matrix_t>::reference;
37
38 typename std::remove_cvref_t<matrix_t>::size_type;
39
41
43
45};
47
48// Workaround for https://github.com/doxygen/doxygen/issues/9379
49#if SEQAN3_DOXYGEN_ONLY(1) 0
50template <typename matrix_t>
51class matrix
52{};
53#endif
54
81
93template <matrix matrix1_t, matrix matrix2_t>
95inline bool operator==(matrix1_t const & lhs, matrix2_t const & rhs) noexcept
96{
97 if (lhs.rows() != rhs.rows())
98 return false;
99
100 if (lhs.cols() != rhs.cols())
101 return false;
102
103 for (size_t row = 0u; row < lhs.rows(); ++row)
104 for (size_t col = 0u; col < lhs.cols(); ++col)
105 if (matrix_coordinate co{row_index_type{row}, column_index_type{col}}; lhs.at(co) != rhs.at(co))
106 return false;
107
108 return true;
109}
110
117template <matrix matrix1_t, matrix matrix2_t>
119inline bool operator!=(matrix1_t const & lhs, matrix2_t const & rhs) noexcept
120{
121 return !(lhs == rhs);
122}
124
125} // namespace seqan3::detail
Provides seqan3::detail::matrix_index, seqan3::detail::matrix_coordinate and associated strong types.
T max(T... args)
T operator!=(T... args)
T tuple_size_v
Hide me