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
17template<typename T>
18struct EstimateTraits< std::complex<T> >
19{
20 typedef std::complex< Estimate<T> > type;
21};
22
23template<typename T>
24void 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
35namespace 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
Pure virtual base class of all complex-valued functions.
Definition Complex.h:39
static const char * Name
The name of the class.
Definition Complex.h:42
virtual Complex * clone() const
Clone method.
Definition Complex.C:13
Evaluable()
Definition Evaluable.h:48
Namespace in which all modeling and calibration related code is declared.
Definition ExampleComplex2.h:16
STL namespace.
Works for most scalar types.
Definition Evaluable.h:22

Generated using doxygen 1.14.0