flavour
calcuex Class Reference

class to do the calculus of a constraint based on a GiNaC symbolic expression More...

#include <model.h>

Inheritance diagram for calcuex:
Collaboration diagram for calcuex:

Public Member Functions

 calcuex (observable *ob, const ex &e0)
 
 ~calcuex ()
 
double operator() (const parameters &p) const
 
double error (const parameters &p) const
 

Public Attributes

shared_ptr< observableo
 
ex e
 

Detailed Description

class to do the calculus of a constraint based on a GiNaC symbolic expression

Definition at line 282 of file model.h.

Constructor & Destructor Documentation

calcuex::calcuex ( observable ob,
const ex &  e0 
)
inline

Definition at line 284 of file model.h.

284 : calcu(), o(ob), e(e0){}
Base class to do the calculus of a constraint to the model.
Definition: model.h:237
shared_ptr< observable > o
Definition: model.h:339
ex e
Definition: model.h:340
calcuex::~calcuex ( )
inline

Definition at line 285 of file model.h.

285 {}

Member Function Documentation

double calcuex::error ( const parameters p) const
inline

Definition at line 310 of file model.h.

References parameters::p.

310  {
311  double ret=1000;
312  int pass=1;
313  try{
314  cout<<e<<endl;
315  cout<<e.subs(p.p)<<endl;
316 
317  ret=ex_to<numeric>(e.subs(p.p,subs_options::no_pattern).evalf()).to_double();
318  }
319  catch(GiNaC::pole_error er){
320  pass=0;
321  cout<<"Pole error"<<endl;
322  }
323  catch(exception er){
324  pass=0;
325 
326  cout<<er.what()<<endl;
327  cout<<e.subs(p.p,subs_options::no_pattern).evalf()<<endl;
328  }
329  catch(...){
330  cout<<"Other exception"<<endl;
331  exit(1);
332  }
333  if(pass) ret=o->error(ret);
334  else ret=1000;
335 
336  return ret;
337  }
lst p
Definition: model.h:231
shared_ptr< observable > o
Definition: model.h:339
ex e
Definition: model.h:340
double calcuex::operator() ( const parameters p) const
inlinevirtual
Parameters
hipothesisthe theoretical hypothesis
Returns
the logarithm of the probability of measuring what was measured, assuming that the hypothesis is true

Implements calcu.

Definition at line 287 of file model.h.

References parameters::p.

287  {
288  double ret=1000;
289  int pass=1;
290  try{
291  ret=ex_to<numeric>(e.subs(p.p,subs_options::no_pattern).evalf()).to_double();
292  }
293  catch(GiNaC::pole_error e){
294  pass=0;
295  cout<<"Pole error"<<endl;
296  }
297  catch(exception e){
298  cout<<e.what()<<endl;
299  }
300  catch(...){
301  cout<<"Other exception"<<endl;
302  exit(1);
303  }
304  if(pass) ret=o->loglikelihood(ret);
305  else ret=1000;
306 
307  return ret;
308  }
lst p
Definition: model.h:231
shared_ptr< observable > o
Definition: model.h:339
ex e
Definition: model.h:340

Member Data Documentation

ex calcuex::e

Definition at line 340 of file model.h.

shared_ptr<observable> calcuex::o

Definition at line 339 of file model.h.


The documentation for this class was generated from the following file: