Go to the documentation of this file.00001
00002
00003
00004 #ifndef clusterF01_hh
00005 #define clusterF01_hh
00006
00007 #include "toolbox/scannerConnectors.hh"
00008 #include "toolbox/hashMap.hh"
00009 #include "cluster/expansion.hh"
00010 #include "cluster/f.hh"
00011
00012 namespace cluster {
00013
00014
00015
00021 template<class NodeX, class NodeY>
00022 class F01 : public ClstF<NodeX, NodeY> {
00023 public:
00025 typedef typename ClstF<NodeX, NodeY>::TraitsX TraitsX;
00026 typedef typename ClstF<NodeX, NodeY>::TraitsY TraitsY;
00027 typedef typename ClstF<NodeX, NodeY>::FX FX;
00028 typedef typename ClstF<NodeX, NodeY>::FY FY;
00029 typedef typename ClstF<NodeX, NodeY>::NfldNodes NfldNodes;
00030 typedef typename ClstF<NodeX, NodeY>::NfldScan NfldScan;
00031 private:
00034 class Ffld {
00036 Ffld* lnk_;
00038 uint sigma_, tau_;
00040 FColExp* val_;
00041
00042 public:
00043 inline Ffld(uint blksz, const ExpansionF<FX>& exp, uint sigma,
00044 uint tau, Ffld* lnk)
00045 : lnk_(lnk), sigma_(sigma), tau_(tau) {
00046 val_ = exp.getCol(blksz);
00047 }
00048 inline ~Ffld() {delete val_;}
00049
00050 inline Ffld* link() const {return lnk_;}
00051 inline uint sigma() const {return sigma_;}
00052 inline uint tau() const {return tau_;}
00053 inline FColExp* val() const {return val_;}
00054 };
00055
00057 const Tree<NodeX>& treeX_;
00058 const Tree<NodeY>& treeY_;
00059
00061 const ExpansionF<FX>& exp_;
00062
00064 uint m_;
00066 concepts::Real eta_;
00068 uint minsz_;
00070 Ffld* ffld_;
00072 uint nffld_;
00074 concepts::Joiner<NfldNodes, 1>* nfld_;
00076 uint nnfld_;
00077
00079 void constructor_(const NodeX* clstX, const NodeY* clstY);
00081 void constructorSym_(const NodeX* clstX, const NodeY* clstY);
00085 template<class Trts, class Nd>
00086 uint info_(uint idx, const Nd* clst,
00087 __gnu_cxx::hash_map<uint, uint>& nlf) const;
00088
00089 protected:
00091 std::ostream& info(std::ostream& os) const;
00092
00093 public:
00103 F01(const Tree<NodeX>& treeX, const Tree<NodeY>& treeY,
00104 const ExpansionF<FX>& exp, concepts::Real eta, uint minsz);
00113 F01(const Tree<NodeX>& tree, const ExpansionF<FX>& exp,
00114 concepts::Real eta, uint minsz);
00115
00116 ~F01();
00117
00119 void operator()(const ClstY<NodeY>& vecY, ClstX<NodeX>& vecX) const;
00121 inline NfldScan* scan() const {
00122 return new concepts::ListScan<NfldNodes>(*nfld_);
00123 }
00125 inline float memory() const;
00131 std::ostream& info(std::ostream& os, uint idxX, uint idxY) const;
00132 };
00133
00134 template<class NodeX, class NodeY>
00135 inline float F01<NodeX,NodeY>::memory() const {
00136 return sizeof(F01<NodeX,NodeY>)
00137 + (float)nffld_ *
00138 (sizeof(typename F01<NodeX,NodeY>::Ffld)
00139 + (ffld_ ? ffld_->val()->memory(exp_.blksz(m_)) : 0))
00140 + (float)nnfld_ * sizeof(concepts::Joiner<NfldNodes, 1>);
00141 }
00142
00143 }
00144
00145 #endif // clusterF01_hh