13 #include "msdevstudio/MSconfig.h"
22 #ifdef ITERATOR_MEMBER_DEFECT
29 using namespace hippodraw;
31 LinearSumFunction::LinearSumFunction ( )
67 for (
unsigned int i = 0;
i < f_size;
i++ ) {
68 string suffix (
"-" );
72 unsigned int n_size = names.size ();
73 for (
unsigned int j = 0; j < n_size; j++ ) {
74 string name = names [j];
89 const vector<double> & vals = (*it)->getParameters ();
90 p->
m_parms.insert ( p->
m_parms.end (), vals.begin(), vals.end () );
95 const vector < int > &
104 const vector < int > & flags = (*it)->getFixedFlags ();
106 flags.begin(), flags.end() );
111 vector< double >::const_iterator
115 FunctionList_t::iterator fit =
m_functions.begin();
118 it = (*fit)->setParameters ( it );
129 for (
unsigned int i = 0;
i < numf;
i++ ) {
131 if ( index < size ) {
155 for (
unsigned int i = 0;
i < numf;
i++ ) {
157 number +=
function ->
size ();
180 if ( (*it) == function ){
195 sum += (*it)->operator () ( x );
virtual void addToComposite(FunctionBase *)
Adds the function to the linear sum of functions.
const std::vector< std::string > & parmNames() const
Returns a reference to a vector of parameter names.
virtual void initialize()
Initializes the function and parameter names.
std::vector< int > m_fixed_flags
The flags to indicated which parameters are to be held fixed during minimization of this objective fu...
virtual std::vector< double >::const_iterator setParameters(std::vector< double >::const_iterator it)
Sets the parameter values to the value pointed to by the iterator.
virtual double derivByParm(int i, double x) const
Returns the function's derivative at the coordinate value x with respect to the i-th parameter...
LinearSumFunction()
The default constructor.
virtual bool isComposite() const
Returns true.
virtual FunctionBase * clone() const
Creates a new function object by copying an existing one.
virtual const std::vector< double > & getParameters() const
Returns the values of the parameters as a vector.
virtual double operator()(double x) const
The function call operator.
The namespace for conversion to string.
std::vector< double > m_parms
The parameter values.
FunctionList_t m_functions
A function that can be used with a fitter.
virtual FunctionBase * clone() const
Creates a new function object by copying an existing one.
string convert(int i)
Converts an integer to a string.
virtual int count()
Returns the number of functions that are a part of this composite.
A function that can be added to a DataRep and used in a fitter.
hippodraw::LinearSumFunction class interface
An abstract base class to help FunctionBase objects perform some operations.
std::string m_name
The name of the function.
virtual const std::vector< int > & getFixedFlags() const
Returns the flags indicating which parameters should remain fixed during any minimization process...
virtual void removeFromComposite(FunctionBase *)
Removes the function from the linear sum of functions.
std::vector< std::string > m_parm_names
The names of the function parameters.
virtual void initialParameters(const FunctionHelper *helper)
Sets the FunctionHelper so that the function can calculate a reasonable set of initial parameter valu...
virtual int size() const
Returns the number of parameters.
list< QAction * >::iterator it
const std::string & name() const
Returns the name of the function.