Complex.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2009 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/More/MEAL/MEAL/Complex.h
10 
11 #ifndef __MEAL_Complex_H
12 #define __MEAL_Complex_H
13 
14 #include "MEAL/Evaluable.h"
15 #include <complex>
16 
17 template<typename T>
18 struct EstimateTraits< std::complex<T> >
19 {
20  typedef std::complex< Estimate<T> > type;
21 };
22 
23 template<typename T>
24 void add_variance (std::complex< Estimate<T> >& result,
25  double var, const std::complex<T>& grad)
26 {
27  double re = grad.real();
28  double im = grad.imag();
29 
30  std::complex< Estimate<double> > add ( Estimate<double>(0.0,re*re*var),
31  Estimate<double>(0.0,im*im*var) );
32  result += add;
33 }
34 
35 namespace MEAL
36 {
38  class Complex : public Evaluable< std::complex<double> >
39  {
40  public:
42  static const char* Name;
43 
45  virtual Complex* clone () const;
46  };
47 }
48 
49 #endif
Template base class of functions with an evaluate method.
Definition: Evaluable.h:35
Namespace in which all modeling and calibration related code is declared.
Definition: ExampleComplex2.h:16
Pure virtual base class of all complex-valued functions.
Definition: Complex.h:38
static const char * Name
The name of the class.
Definition: Complex.h:42
virtual Complex * clone() const
Clone method.
Definition: Complex.C:13
Works for most scalar types.
Definition: Evaluable.h:20

Generated using doxygen 1.8.17