11 #ifndef __MEAL_Phase_H
12 #define __MEAL_Phase_H
14 #include "MEAL/OneParameter.h"
20 template< typename Parent>
21 class Phase : public 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);
54 template< 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;
Abstract base class implements parameter storage and access. Definition: OneParameter.h:26
void set_name(const std::string &_name) Set the name of the parameter. Definition: OneParameter.h:54
const ScalarMath sin(const ScalarMath &x) Return a ScalarMath instance representing sin(x) Definition: ScalarMath.C:160
void calculate(Return &result, std::vector< Return > *gradient) Calculate the result and its gradient. Definition: Phase.h:55
Namespace in which all modeling and calibration related code is declared. Definition: ExampleComplex2.h:16
static bool verbose Verbosity flag. Definition: Function.h:54
const ScalarMath cos(const ScalarMath &x) Return a ScalarMath instance representing cos(x) Definition: ScalarMath.C:168
Phase(double _scale=1.0) Default constructor. Definition: Phase.h:37
std::string get_name() const Return the name of the class. Definition: Phase.h:47
Generated using doxygen 1.8.17
|