14#include "MEAL/OneParameter.h"
20 template<
typename Parent>
27 Phase (
double _scale = 1.0) : parameter (this)
28 { parameter.set_name (
"phase"); scale = _scale; }
38 {
return "Phase<" + std::string(Parent::Name) +
">"; }
42 typedef typename Parent::Result Return;
45 void calculate (Return& result, std::vector<Return>* gradient);
54template<
typename Parent>
57 double phase = this->get_param(0);
59 double cos_phase =
cos(scale * phase);
60 double sin_phase =
sin(scale * phase);
63 std::cerr <<
get_name () <<
"::calculate scale=" << scale
64 <<
" phase=" << phase*180/M_PI <<
" deg"
65 <<
" cos=" << cos_phase <<
" sin=" << sin_phase << std::endl;
67 result = std::complex<double>(cos_phase, sin_phase);
71 (*grad)[0] = scale * std::complex<double>(-sin_phase, cos_phase);
74 std::cerr <<
"MEAL::Phase<Parent>::calculate gradient" << std::endl
75 <<
" " << (*grad)[0] << std::endl;
static bool verbose
Verbosity flag.
Definition Function.h:54
Abstract base class implements parameter storage and access.
Definition OneParameter.h:21
void calculate(Return &result, std::vector< Return > *gradient)
Calculate the result and its gradient.
Definition Phase.h:55
Phase(double _scale=1.0)
Default constructor.
Definition Phase.h:27
std::string get_name() const
Return the name of the class.
Definition Phase.h:37
Namespace in which all modeling and calibration related code is declared.
Definition ExampleComplex2.h:16
const ScalarMath sin(const ScalarMath &x)
Return a ScalarMath instance representing sin(x)
Definition ScalarMath.C:160
const ScalarMath cos(const ScalarMath &x)
Return a ScalarMath instance representing cos(x)
Definition ScalarMath.C:168