00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef KLSUPPORT_H
00015 #define KLSUPPORT_H
00016
00017 #include "klsupport_fwd.h"
00018
00019 #include "bitmap.h"
00020 #include "bitset.h"
00021 #include "blocks.h"
00022 #include "descents.h"
00023
00024 namespace atlas {
00025
00026
00027
00028
00029
00030 namespace klsupport {
00031
00032 using blocks::BlockElt;
00033
00034 class KLSupport {
00035
00036 private:
00037
00038 enum State { DownsetsFilled, LengthLessFilled, Filled, NumStates};
00039
00040 bitset::BitSet<NumStates> d_state;
00041
00042 blocks::Block* d_block;
00043 size_t d_rank;
00044 BlockElt d_size;
00045
00046 std::vector<bitset::RankFlags> d_descent;
00047 std::vector<bitset::RankFlags> d_goodAscent;
00048 std::vector<bitmap::BitMap> d_downset;
00049 std::vector<bitmap::BitMap> d_primset;
00050 std::vector<BlockElt> d_lengthLess;
00051
00052 public:
00053
00054
00055 KLSupport():d_block(0) {}
00056
00057 KLSupport(blocks::Block&);
00058
00059 ~KLSupport() {}
00060
00061
00062 void swap(KLSupport&);
00063
00064
00065
00066 const blocks::Block& block() const {
00067 return *d_block;
00068 }
00069
00070 BlockElt cross(size_t s, BlockElt z) const {
00071 return d_block->cross(s,z);
00072 }
00073
00074 blocks::BlockEltPair cayley(size_t s, BlockElt z) const {
00075 return d_block->cayley(s,z);
00076 }
00077
00078 const bitset::RankFlags& descentSet(BlockElt z) const {
00079 return d_descent[z];
00080 }
00081
00082
00083
00084
00085 descents::DescentStatus::Value descentValue(size_t s, BlockElt z) const {
00086 return d_block->descentValue(s,z);
00087 }
00088
00089 void extremalize(bitmap::BitMap&, const bitset::RankFlags&) const;
00090
00091 const bitset::RankFlags& goodAscentSet(BlockElt z) const {
00092 return d_goodAscent[z];
00093 }
00094
00095 size_t length(BlockElt z) const {
00096 return d_block->length(z);
00097 }
00098
00099
00100
00101
00102 BlockElt lengthLess(size_t l) const {
00103 return d_lengthLess[l];
00104 }
00105
00106 void primitivize(bitmap::BitMap&, const bitset::RankFlags&) const;
00107
00108 BlockElt primitivize(BlockElt x, const bitset::RankFlags& A) const;
00109
00110 size_t rank() const {
00111 return d_rank;
00112 }
00113
00114 size_t size() const {
00115 return d_size;
00116 }
00117
00118
00119 void fill();
00120
00121 void fillDownsets();
00122
00123 blocks::Block& block() {
00124 return *d_block;
00125 }
00126
00127 };
00128
00129 }
00130
00131 }
00132
00133 #endif