00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef KL_H
00016 #define KL_H
00017
00018 #include <limits>
00019
00020 #include "kl_fwd.h"
00021
00022 #include "blocks_fwd.h"
00023
00024 #include "bitset.h"
00025 #include "klsupport.h"
00026 #include "polynomials.h"
00027 #include "wgraph.h"
00028
00029 namespace atlas {
00030
00031
00032
00033 namespace kl {
00034
00035
00036
00037
00038 const KLPol Zero;
00039
00040
00041 const KLPol One(0);
00042
00043 const KLCoeff UndefKLCoeff = std::numeric_limits<KLCoeff>::max();
00044 const KLCoeff UndefMuCoeff = std::numeric_limits<MuCoeff>::max();
00045
00046 typedef std::vector<KLPol> KLStore;
00047
00048 typedef KLStore::const_reference KLPolRef;
00049
00050 typedef std::vector<KLIndex> KLRow;
00051
00052
00053
00054 }
00055
00056
00057
00058 namespace kl {
00059
00060 void wGraph(wgraph::WGraph&, const KLContext&);
00061
00062 }
00063
00064
00065
00066
00067
00068
00069 namespace kl {
00070
00071 using blocks::BlockElt;
00072
00073
00074
00075
00076
00077 class KLContext {
00078
00079 protected:
00080
00081
00082
00083
00084 enum State { KLFilled, NumStates };
00085
00086
00087
00088
00089
00090 bitset::BitSet<NumStates> d_state;
00091
00092
00093
00094
00095 klsupport::KLSupport* d_support;
00096
00097
00098
00099
00100
00101 std::vector<klsupport::PrimitiveRow> d_prim;
00102
00103
00104
00105
00106
00107 std::vector<KLRow> d_kl;
00108
00109
00110
00111
00112 std::vector<MuRow> d_mu;
00113
00114
00115
00116
00117 KLStore d_store;
00118
00119
00120
00121 KLIndex d_zero;
00122
00123
00124
00125 KLIndex d_one;
00126
00127 public:
00128
00129
00130 KLContext(klsupport::KLSupport&);
00131
00132
00133 ~KLContext() {}
00134
00135
00136 KLContext(const KLContext&);
00137
00138 KLContext& operator= (const KLContext&);
00139
00140 void swap(KLContext&);
00141
00142
00143 const blocks::Block& block() const {
00144 return d_support->block();
00145 }
00146
00147
00148 void makeExtremalRow(klsupport::PrimitiveRow& e, BlockElt y) const;
00149
00150 void makePrimitiveRow(klsupport::PrimitiveRow& e, BlockElt y) const;
00151
00152
00153
00154
00155
00156 const klsupport::PrimitiveRow& primitiveRow(BlockElt y) const {
00157 return d_prim[y];
00158 }
00159
00160 const bitset::RankFlags& descentSet(BlockElt y) const {
00161 return d_support->descentSet(y);
00162 }
00163
00164 bool isZero(const KLIndex p) const {
00165 return p == d_zero;
00166 }
00167
00168
00169
00170
00171 KLPolRef klPol(BlockElt x, BlockElt y) const;
00172
00173
00174
00175
00176
00177 const KLRow& klRow(BlockElt y) const {
00178 return d_kl[y];
00179 }
00180
00181
00182
00183
00184 size_t length(BlockElt y) const {
00185 return d_support->length(y);
00186 }
00187
00188
00189
00190
00191 size_t lengthLess(size_t l) const {
00192 return d_support->lengthLess(l);
00193 }
00194 MuCoeff mu(BlockElt x, BlockElt y) const;
00195
00196
00197
00198
00199
00200 const MuRow& muRow(BlockElt y) const {
00201 return d_mu[y];
00202 }
00203
00204
00205
00206
00207 const KLStore& polStore() const {
00208 return d_store;
00209 }
00210
00211
00212
00213
00214 const size_t rank() const {
00215 return d_support->rank();
00216 }
00217
00218
00219
00220
00221 const size_t size() const {
00222 return d_kl.size();
00223 }
00224
00225
00226 bitmap::BitMap primMap (BlockElt y) const;
00227
00228
00229
00230
00231 void fill();
00232
00233 blocks::Block& block() {
00234 return d_support->block();
00235 }
00236
00237
00238
00239 };
00240
00241 }
00242
00243 }
00244
00245 #endif