Steps.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2007 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/More/MEAL/MEAL/Steps.h
10 
11 #ifndef __Steps_H
12 #define __Steps_H
13 
14 #include "MEAL/Univariate.h"
15 #include "MEAL/Scalar.h"
16 #include "MEAL/Parameters.h"
17 
18 namespace MEAL {
19 
21 
25  class Steps : public Univariate<Scalar> {
26 
27  public:
28 
30  Steps ();
31 
33  Steps (const Steps&);
34 
36  Steps& operator = (const Steps&);
37 
39  Steps* clone () const;
40 
42  void set_param_name_prefix (const std::string&);
43 
45  void add_step (double x);
46 
48  void set_step (unsigned istep, double x);
49 
51  void remove_step (unsigned istep);
52 
54  double get_step (unsigned istep) const;
55 
57  unsigned get_nstep () const;
58 
60  void set_abscissa (double value);
61 
63  unsigned get_step () const;
64 
65  // ///////////////////////////////////////////////////////////////////
66  //
67  // Function implementation
68  //
69  // ///////////////////////////////////////////////////////////////////
70 
72  std::string get_name () const;
73 
74  protected:
75 
77  void calculate (double& x, std::vector<double>* grad=0);
78 
79  private:
80 
82  Parameters parameters;
83 
85  std::vector<double> step;
86 
88  int current_step;
89 
91  std::string param_name_prefix;
92 
93  };
94 
95 }
96 
97 #endif
Abstract base class implements parameter storage and access.
Definition: Parameters.h:28
unsigned get_step() const
Get the current step index.
Definition: Steps.C:149
A function with an arbitrary number of steps.
Definition: Steps.h:30
Steps * clone() const
Clone operator.
Definition: Steps.C:38
void set_step(unsigned istep, double x)
Set the abscissa of the specified step.
Definition: Steps.C:101
void set_param_name_prefix(const std::string &)
Set the prefix of each parameter name.
Definition: Steps.C:50
void add_step(double x)
Add a step at the given point on the abscissa.
Definition: Steps.C:58
Namespace in which all modeling and calibration related code is declared.
Definition: ExampleComplex2.h:16
Steps & operator=(const Steps &)
Assignment operator.
Definition: Steps.C:27
std::string get_name() const
Return the name of the class.
Definition: Steps.C:44
virtual void set_abscissa(double value)
Set the abscissa value.
Definition: Univariate.h:50
unsigned get_nstep() const
Get the number of steps.
Definition: Steps.C:116
void calculate(double &x, std::vector< double > *grad=0)
Return the value (and gradient, if requested) of the function.
Definition: Steps.C:158
void set_abscissa(double value)
Set the abscissa value.
Definition: Steps.C:122
virtual void copy(const Function *model)
Does the work for operator =.
Definition: Function.C:58
void remove_step(unsigned istep)
Remove a step.
Definition: Steps.C:93
Steps()
Default constructor.
Definition: Steps.C:13

Generated using doxygen 1.8.17