File indexing completed on 2025-04-19 09:10:03
0001 #ifndef DIRE__Tools__Weight_H
0002 #define DIRE__Tools__Weight_H
0003
0004 namespace DIRE {
0005
0006 struct Weight {
0007 public:
0008
0009 double m_f, m_g, m_h;
0010
0011 inline Weight(const double &f,
0012 const double &g,const double &h):
0013 m_f(f), m_g(g), m_h(h) {}
0014
0015 inline double MC() const { return m_f/m_g; }
0016 inline double Accept() const { return m_g/m_h; }
0017 inline double Reject() const
0018 { return m_g/m_h*(m_h-m_f)/(m_g-m_f); }
0019
0020 };
0021
0022 inline std::ostream &operator<<(std::ostream &s,const Weight &w)
0023 { return s<<"W(f="<<w.m_f<<",g="<<w.m_g<<",h="<<w.m_h<<")"; }
0024
0025 }
0026
0027 #endif