bpp-phyl3  3.0.0
BipartitionTools.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_PHYL_TREE_BIPARTITIONTOOLS_H
6 #define BPP_PHYL_TREE_BIPARTITIONTOOLS_H
7 
8 
9 #include "BipartitionList.h"
10 
11 // From bpp-seq:
13 
14 namespace bpp
15 {
27 {
28 public:
35  static int LWORD;
36 
37 public:
39  virtual ~BipartitionTools() {}
40 
41 public:
47  static void bit1(int* list, int num);
48 
54  static void bit0(int* list, int num);
55 
68  static void bitAnd(int* listet, int* list1, int* list2, size_t len);
69 
82  static void bitOr(int* listou, int* list1, int* list2, size_t len);
83 
95  static void bitNot(int* listnon, int* list, size_t len);
96 
100  static bool testBit(int* list, int num);
101 
108  static std::unique_ptr<BipartitionList> mergeBipartitionLists(const std::vector<std::unique_ptr<BipartitionList>>& vecBipartL, bool checkElements = true);
109 
113  static std::unique_ptr<BipartitionList> buildBipartitionPair(const BipartitionList& bipartL1, size_t i1, const BipartitionList& bipartL2, size_t i2, bool checkElements = true);
114 
118  static bool areIdentical(const BipartitionList& bipart1, size_t i1, const BipartitionList& bipart2, size_t i2, bool checkElements = true);
119 
123  static bool areCompatible(const BipartitionList& bipart1, size_t i1, const BipartitionList& bipart2, size_t i2, bool checkElements = true);
124 
132  static std::unique_ptr<VectorSiteContainer> MRPEncode(
133  const std::vector<std::unique_ptr<BipartitionList>>& vecBipartL);
134 
142  static std::unique_ptr<VectorSiteContainer> MRPEncodeMultilabel(
143  const std::vector<std::unique_ptr<BipartitionList>>& vecBipartL);
144 };
145 } // end of namespace bpp.
146 #endif // BPP_PHYL_TREE_BIPARTITIONTOOLS_H
This class deals with the bipartitions defined by trees.
This class provides tools related to the BipartitionList class.
static int LWORD
Unit length (in bits) of arrays of bits. Must be a multiple of CHAR_BIT*sizeof(int)....
static bool areCompatible(const BipartitionList &bipart1, size_t i1, const BipartitionList &bipart2, size_t i2, bool checkElements=true)
Tells whether two bipartitions from distinct lists are compatible.
static bool testBit(int *list, int num)
Tells whether bit number num in bit array list is one.
static std::unique_ptr< VectorSiteContainer > MRPEncodeMultilabel(const std::vector< std::unique_ptr< BipartitionList >> &vecBipartL)
Create a sequence data set corresponding to the Matrix Representation of the input BipartitionList ob...
static void bitAnd(int *listet, int *list1, int *list2, size_t len)
bit-wise logical AND between two arrays of bits
static void bit1(int *list, int num)
Sets bit number num of bit array list to one.
static void bitOr(int *listou, int *list1, int *list2, size_t len)
bit-wise logical OR between two arrays of bits
static std::unique_ptr< BipartitionList > buildBipartitionPair(const BipartitionList &bipartL1, size_t i1, const BipartitionList &bipartL2, size_t i2, bool checkElements=true)
Construct a BipartitionList containing two bipartitions taken from distinct input lists.
static std::unique_ptr< VectorSiteContainer > MRPEncode(const std::vector< std::unique_ptr< BipartitionList >> &vecBipartL)
Create a sequence data set corresponding to the Matrix Representation of the input BipartitionList ob...
static std::unique_ptr< BipartitionList > mergeBipartitionLists(const std::vector< std::unique_ptr< BipartitionList >> &vecBipartL, bool checkElements=true)
Makes one BipartitionList out of several.
static void bitNot(int *listnon, int *list, size_t len)
bit-wise logical NOT
static void bit0(int *list, int num)
Sets bit number num of bit array plist to zero.
static bool areIdentical(const BipartitionList &bipart1, size_t i1, const BipartitionList &bipart2, size_t i2, bool checkElements=true)
Tells whether two bipartitions from distinct lists are identical.
Defines the basic types of data flow nodes.