SeqAn3
3.4.0
The Modern C++ library for sequence analysis.
Toggle main menu visibility
Loading...
Searching...
No Matches
matrix_concept.hpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
2
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
3
// SPDX-License-Identifier: BSD-3-Clause
4
9
10
#pragma once
11
12
#include <concepts>
13
#include <
cstddef
>
14
#include <
limits
>
15
16
#include <
seqan3/alignment/matrix/detail/matrix_coordinate.hpp
>
17
18
namespace
seqan3::detail
19
{
20
23
template
<
typename
score_type>
24
constexpr
score_type matrix_inf =
std::numeric_limits<score_type>::max
();
25
32
template
<
typename
matrix_t>
33
concept
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
40
{ m.cols() } -> std::same_as<typename std::remove_cvref_t<matrix_t>::size_type>;
41
42
{ m.rows() } -> std::same_as<typename std::remove_cvref_t<matrix_t>::size_type>;
43
44
{ m.at(matrix_coordinate{}) } -> std::same_as<typename std::remove_cvref_t<matrix_t>::reference>;
45
};
47
48
// Workaround for https://github.com/doxygen/doxygen/issues/9379
49
#if SEQAN3_DOXYGEN_ONLY(1) 0
50
template
<
typename
matrix_t>
51
class
matrix
52
{};
53
#endif
54
60
79
81
86
93
template
<matrix matrix1_t, matrix matrix2_t>
94
requires
std::equality_comparable_with<typename matrix1_t::reference, typename matrix2_t::reference>
95
inline
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
117
template
<matrix matrix1_t, matrix matrix2_t>
118
requires
std::equality_comparable_with<typename matrix1_t::reference, typename matrix2_t::reference>
119
inline
bool
operator!=(matrix1_t
const
& lhs, matrix2_t
const
& rhs)
noexcept
120
{
121
return
!(lhs == rhs);
122
}
124
125
}
// namespace seqan3::detail
cstddef
limits
matrix_coordinate.hpp
Provides seqan3::detail::matrix_index, seqan3::detail::matrix_coordinate and associated strong types.
std::numeric_limits::max
T max(T... args)
Hide me
Version:
seqan3
alignment
matrix
detail
matrix_concept.hpp
Generated on
for SeqAn3 by
1.17.0