bbq Implementation Documentation
Main Page | Namespace List | Class List | File List | Namespace Members | Class Members | File Members

weighted_bitsets.h

Go to the documentation of this file.
00001 #ifndef WEIGHTED_BITSETS_H
00002 #define WEIGHTED_BITSETS_H
00003 
00004 #include <iostream>
00005 
00006 namespace bbq {
00007 
00008 
00013 class weighted_variable_bitset 
00014 {
00015 public:
00016 
00017         unsigned int* bits;
00018         float* weights;
00019         
00022         static int k;
00023 
00026         static int k_;
00027 
00030         static bool weighted;
00031         
00033         weighted_variable_bitset(const weighted_variable_bitset&);
00034 
00036         weighted_variable_bitset& operator=(const weighted_variable_bitset& vb);
00037         
00039         weighted_variable_bitset();
00040 
00042         ~weighted_variable_bitset();
00043         
00045         bool subseteq(const weighted_variable_bitset& b) const;
00046 
00047         // this version of subseteq checks only up to the J-th bit whether
00048         // *this is a subset of the set passed as an argument.
00049         // This gives a slight speedup for large values of k.
00050         bool subseteq(const weighted_variable_bitset&, const unsigned int& J) const;
00051         
00053         int cardinality();
00054 
00057         float weight();
00058 
00059         friend std::ostream& operator<<(std::ostream& o,const weighted_variable_bitset&);
00060         
00063         void intersect(const weighted_variable_bitset& b);
00064 
00066         void set(const int& j, const float& w);
00067 
00069         void reset(const int& j, const float& w);
00070 
00072         void decrease(const int& j, const float& w);
00073 
00075         void remove(const int& j, const float& w);
00076 
00079         bool contains(const int&);
00080 
00088         bool operator<(const weighted_variable_bitset&) const;
00089 
00097         bool operator==(const weighted_variable_bitset&) const; 
00098         
00099 };
00100 
00101 
00102 } // end namespace bbq
00103 
00104 
00105 #endif
00106 
bbq Implementation Documentation
Axel Mosig, Bioinformatics, University of Leipzig