Go to the documentation of this file.00001
00002
00003
00004 #ifndef clusterF04_hh
00005 #define clusterF04_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
00020 template<class NodeX, class NodeY>
00021 class F04 : public ClstF<NodeX, NodeY> {
00022 public:
00024 typedef typename ClstF<NodeX, NodeY>::TraitsX TraitsX;
00025 typedef typename ClstF<NodeX, NodeY>::TraitsY TraitsY;
00026 typedef typename ClstF<NodeX, NodeY>::FX FX;
00027 typedef typename ClstF<NodeX, NodeY>::FY FY;
00028 typedef typename ClstF<NodeX, NodeY>::NfldNodes NfldNodes;
00029 typedef typename ClstF<NodeX, NodeY>::NfldScan NfldScan;
00030 private:
00033 class Ffld {
00035 Ffld* lnk_;
00037 const NodeX* clstX_;
00038 const NodeY* clstY_;
00040 uint m_;
00042 FColExp* val_;
00043
00044 public:
00045 inline Ffld(const NodeX* clstX, const NodeY* clstY,
00046 Ffld* lnk = 0)
00047 : lnk_(lnk), clstX_(clstX), clstY_(clstY), m_(0), val_(0) {}
00048 inline ~Ffld() {delete val_;}
00049
00050 inline Ffld* link() const {return lnk_;}
00051 inline uint sigma() const {return TraitsX::index(clstX_);}
00052 inline uint tau() const {return TraitsY::index(clstY_);}
00053 inline concepts::Real3d z() const {
00054 return TraitsY::center(clstY_) - TraitsX::center(clstX_);
00055 }
00056 inline uint m(uint m) {if (m) m_ = m; return m_;}
00057 inline uint m() const {return m_;}
00058 inline FColExp* val(uint blksz, const ExpansionF<FX>& exp) {
00059 if (blksz) {delete val_; val_ = exp.getCol(blksz);} return val_;
00060 }
00061 inline FColExp* val() const {return val_;}
00062 inline concepts::Real intensity(concepts::Real s) const {
00063 concepts::Real I = TraitsX::nleaf(clstX_);
00064 if (I < TraitsY::nleaf(clstY_)) I = TraitsY::nleaf(clstY_);
00065
00066
00067 return I * pow(z().l2(), -s);
00068 }
00069 };
00070
00072 const Tree<NodeX>& treeX_;
00073 const Tree<NodeY>& treeY_;
00074
00076 const ExpansionF<FX>& exp_;
00077
00079 uint m_;
00080 concepts::Real eta_;
00081 concepts::Real s_;
00083 uint minsz_;
00084
00086 Ffld* ffld_;
00088 uint nffld_;
00089 uint nffldval_;
00091 concepts::Joiner<NfldNodes, 1>* nfld_;
00093 uint nnfld_;
00094
00096 void constructor_(const NodeX* clstX, const NodeY* clstY,
00097 concepts::Real* Imax);
00098 template<class Trts, class Nd>
00099 uint info_(uint idx, const Nd* clst,
00100 __gnu_cxx::hash_map<uint, uint>& nlf) const;
00101
00102 protected:
00103 std::ostream& info(std::ostream& os) const;
00104
00105 public:
00106 F04(const Tree<NodeX>& treeX, const Tree<NodeY>& treeY,
00107 const ExpansionF<FX>& exp, concepts::Real eta,
00108 concepts::Real s, uint minsz);
00109 ~F04();
00110
00112 void operator()(const ClstY<NodeY>& vecY, ClstX<NodeX>& vecX) const;
00113
00114 inline NfldScan* scan() const {
00115 return new concepts::ListScan<NfldNodes>(*nfld_);
00116 }
00118 inline float memory() const;
00119 std::ostream& info(std::ostream& os, uint idxX, uint idxY) const;
00120 };
00121
00122 template<class NodeX, class NodeY>
00123 inline float F04<NodeX, NodeY>::memory() const {
00124 return sizeof(F04<NodeX, NodeY>)
00125 + (float)nffld_ * sizeof(typename F04<NodeX, NodeY>::Ffld)
00126 + (float)nnfld_ * sizeof(concepts::Joiner<NfldNodes, 1>)
00127 + nffldval_ *
00128 (ffld_->val() ? ffld_->val()->memory(1)
00129 : ffld_->val(1, exp_)->memory(1));
00130 }
00131
00132 }
00133
00134 #endif // clusterF04_hh