A toolkit for working with phylogenetic data.
v0.24.0
utils/math/bitvector/operators.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_UTILS_MATH_BITVECTOR_OPERATORS_H_
2 #define GENESIS_UTILS_MATH_BITVECTOR_OPERATORS_H_
3 
4 /*
5  Genesis - A toolkit for working with phylogenetic data.
6  Copyright (C) 2014-2020 Lucas Czech and HITS gGmbH
7 
8  This program is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program. If not, see <http://www.gnu.org/licenses/>.
20 
21  Contact:
22  Lucas Czech <lucas.czech@h-its.org>
23  Exelixis Lab, Heidelberg Institute for Theoretical Studies
24  Schloss-Wolfsbrunnenweg 35, D-69118 Heidelberg, Germany
25 */
26 
35 
36 #include <iosfwd>
37 
38 namespace genesis {
39 namespace utils {
40 
41 // =================================================================================================
42 // Bitvector Operators
43 // =================================================================================================
44 
52 Bitvector bitwise_and (Bitvector const& lhs, Bitvector const& rhs);
53 
61 Bitvector bitwise_or (Bitvector const& lhs, Bitvector const& rhs);
62 
70 Bitvector bitwise_xor (Bitvector const& lhs, Bitvector const& rhs);
71 
72 Bitvector set_minus (Bitvector const& lhs, Bitvector const& rhs);
73 Bitvector symmetric_difference (Bitvector const& lhs, Bitvector const& rhs);
74 
78 bool is_strict_subset( Bitvector const& sub, Bitvector const& super );
79 
83 bool is_strict_superset( Bitvector const& super, Bitvector const& sub );
84 
88 bool is_subset( Bitvector const& sub, Bitvector const& super );
89 
93 bool is_superset( Bitvector const& super, Bitvector const& sub );
94 
98 std::ostream& operator << ( std::ostream& out, Bitvector const& bv );
99 
104 std::istream& operator >> ( std::istream& in, Bitvector& bv );
105 
106 } // namespace utils
107 } // namespace genesis
108 
109 #endif // include guard
bool is_superset(Bitvector const &super, Bitvector const &sub)
Superset or equal.
std::istream & operator>>(std::istream &in, Bitvector &bv)
Extraction operator that inputs a Bitvector from a string of &#39;0&#39;s and &#39;1&#39;s, and stops at the first ch...
bool is_strict_subset(Bitvector const &sub, Bitvector const &super)
Strict subset.
Bitvector symmetric_difference(Bitvector const &lhs, Bitvector const &rhs)
Container namespace for all symbols of genesis in order to keep them separate when used as a library...
std::ostream & operator<<(std::ostream &os, const Matrix< signed char > &matrix)
Template specialization for signed char, in order to print nicely.
bool is_subset(Bitvector const &sub, Bitvector const &super)
Subset or equal.
Bitvector bitwise_or(Bitvector const &lhs, Bitvector const &rhs)
Take the bitwise or of two Bitvectors of potentially different size.
Bitvector bitwise_xor(Bitvector const &lhs, Bitvector const &rhs)
Take the bitwise xor of two Bitvectors of potentially different size.
Bitvector bitwise_and(Bitvector const &lhs, Bitvector const &rhs)
Take the bitwise and of two Bitvectors of potentially different size.
bool is_strict_superset(Bitvector const &super, Bitvector const &sub)
Strict superset.
Bitvector set_minus(Bitvector const &lhs, Bitvector const &rhs)