bpp-phyl  2.2.0
BipartitionTools.h
Go to the documentation of this file.
1 //
2 // File: BipartitionTools.h
3 // Created by: Nicolas Galtier & Julien Dutheil
4 // Created on: Tue Apr 13 15:09 2007
5 //
6 
7 /*
8  Copyright or © or Copr. Bio++ Development Team, (November 16, 2004)
9 
10  This software is a computer program whose purpose is to provide classes
11  for phylogenetic data analysis.
12 
13  This software is governed by the CeCILL license under French law and
14  abiding by the rules of distribution of free software. You can use,
15  modify and/ or redistribute the software under the terms of the CeCILL
16  license as circulated by CEA, CNRS and INRIA at the following URL
17  "http://www.cecill.info".
18 
19  As a counterpart to the access to the source code and rights to copy,
20  modify and redistribute granted by the license, users are provided only
21  with a limited warranty and the software's author, the holder of the
22  economic rights, and the successive licensors have only limited
23  liability.
24 
25  In this respect, the user's attention is drawn to the risks associated
26  with loading, using, modifying and/or developing or reproducing the
27  software by the user in light of its specific status of free software,
28  that may mean that it is complicated to manipulate, and that also
29  therefore means that it is reserved for developers and experienced
30  professionals having in-depth computer knowledge. Users are therefore
31  encouraged to load and test the software's suitability as regards their
32  requirements in conditions enabling the security of their systems and/or
33  data to be ensured and, more generally, to use and operate it in the
34  same conditions as regards security.
35 
36  The fact that you are presently reading this means that you have had
37  knowledge of the CeCILL license and that you accept its terms.
38  */
39 
40 #ifndef _BIPARTITIONTOOLS_H_
41 #define _BIPARTITIONTOOLS_H_
42 
43 #include "BipartitionList.h"
44 
45 // From bpp-seq:
46 #include <Bpp/Seq/Container/VectorSiteContainer.h>
47 
48 namespace bpp
49 {
61 {
62 public:
69  static int LWORD;
70 
71 public:
73  virtual ~BipartitionTools() {}
74 
75 public:
81  static void bit1(int* list, int num);
82 
88  static void bit0(int* list, int num);
89 
102  static void bitAnd(int* listet, int* list1, int* list2, size_t len);
103 
116  static void bitOr(int* listou, int* list1, int* list2, size_t len);
117 
129  static void bitNot(int* listnon, int* list, size_t len);
130 
134  static bool testBit(int* list, int num);
135 
142  static BipartitionList* mergeBipartitionLists(const std::vector<BipartitionList*>& vecBipartL, bool checkElements = true) throw (Exception);
143 
147  static BipartitionList* buildBipartitionPair(const BipartitionList& bipartL1, size_t i1, const BipartitionList& bipartL2, size_t i2, bool checkElements = true) throw (Exception);
148 
152  static bool areIdentical(const BipartitionList& bipart1, size_t i1, const BipartitionList& bipart2, size_t i2, bool checkElements = true);
153 
157  static bool areCompatible(const BipartitionList& bipart1, size_t i1, const BipartitionList& bipart2, size_t i2, bool checkElements = true);
158 
166  static VectorSiteContainer* MRPEncode(const std::vector<BipartitionList*>& vecBipartL) throw (Exception);
167 
175  static VectorSiteContainer* MRPEncodeMultilabel( const std::vector<BipartitionList*>& vecBipartL) throw (Exception);
176 
177 };
178 } // end of namespace bpp.
179 
180 #endif // _BIPARTITIONTOOLS_H_
181 
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.
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 void bitAnd(int *listet, int *list1, int *list2, size_t len)
bit-wise logical AND between two arrays of bits
static void bit0(int *list, int num)
Sets bit number num of bit array plist to zero.
static void bit1(int *list, int num)
Sets bit number num of bit array list to one.
STL namespace.
static BipartitionList * mergeBipartitionLists(const std::vector< BipartitionList *> &vecBipartL, bool checkElements=true)
Makes one BipartitionList out of several.
static int LWORD
Unit length (in bits) of arrays of bits. Must be a multiple of CHAR_BIT*sizeof(int). Default value is 64.
This class provides tools related to the BipartitionList class.
static void bitNot(int *listnon, int *list, size_t len)
bit-wise logical NOT
static bool testBit(int *list, int num)
Tells whether bit number num in bit array list is one.
static VectorSiteContainer * MRPEncode(const std::vector< BipartitionList *> &vecBipartL)
Create a sequence data set corresponding to the Matrix Representation of the input BipartitionList ob...
This class deals with the bipartitions defined by trees.
static VectorSiteContainer * MRPEncodeMultilabel(const std::vector< BipartitionList *> &vecBipartL)
Create a sequence data set corresponding to the Matrix Representation of the input BipartitionList ob...
static 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 void bitOr(int *listou, int *list1, int *list2, size_t len)
bit-wise logical OR between two arrays of bits