A toolkit for working with phylogenetic data.
v0.19.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-2018 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 
45 Bitvector operator & (Bitvector const& lhs, Bitvector const& rhs);
46 Bitvector operator | (Bitvector const& lhs, Bitvector const& rhs);
47 Bitvector operator ^ (Bitvector const& lhs, Bitvector const& rhs);
48 
56 Bitvector bitwise_and (Bitvector const& lhs, Bitvector const& rhs);
57 
65 Bitvector bitwise_or (Bitvector const& lhs, Bitvector const& rhs);
66 
74 Bitvector bitwise_xor (Bitvector const& lhs, Bitvector const& rhs);
75 
76 Bitvector set_minus (Bitvector const& lhs, Bitvector const& rhs);
77 Bitvector symmetric_difference (Bitvector const& lhs, Bitvector const& rhs);
78 
82 bool is_strict_subset( Bitvector const& sub, Bitvector const& super );
83 
87 bool is_strict_superset( Bitvector const& super, Bitvector const& sub );
88 
92 bool is_subset( Bitvector const& sub, Bitvector const& super );
93 
97 bool is_superset( Bitvector const& super, Bitvector const& sub );
98 
102 std::ostream& operator << ( std::ostream& out, Bitvector const& bv );
103 
108 std::istream& operator >> ( std::istream& in, Bitvector& bv );
109 
110 } // namespace utils
111 } // namespace genesis
112 
113 #endif // include guard
Bitvector bitwise_or(Bitvector const &lhs, Bitvector const &rhs)
Take the bitwise or of two Bitvectors of potentially different size.
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 '0's and '1's, and stops at the first ch...
bool is_strict_superset(Bitvector const &super, Bitvector const &sub)
Strict superset.
bool operator&(SkipWhitespace lhs, SkipWhitespace rhs)
And-operator to check whether a SkipWhitespace is set.
Definition: scanner.hpp:95
Bitvector operator|(Bitvector const &lhs, Bitvector const &rhs)
Bitvector symmetric_difference(Bitvector const &lhs, Bitvector const &rhs)
Bitvector operator^(Bitvector const &lhs, Bitvector const &rhs)
Bitvector bitwise_and(Bitvector const &lhs, Bitvector const &rhs)
Take the bitwise and of two Bitvectors of potentially different size.
std::ostream & operator<<(std::ostream &os, const Matrix< T > &matrix)
Print the elements of a Matrix to a stream, using operator << for each element.
bool is_strict_subset(Bitvector const &sub, Bitvector const &super)
Strict subset.
bool is_subset(Bitvector const &sub, Bitvector const &super)
Subset or equal.
Bitvector set_minus(Bitvector const &lhs, Bitvector const &rhs)
Bitvector bitwise_xor(Bitvector const &lhs, Bitvector const &rhs)
Take the bitwise xor of two Bitvectors of potentially different size.