13 #include "msdevstudio/MSconfig.h" 30 m_needs_derivs ( false )
67 string what (
"StatedFCN: The function `" );
68 what +=
function -> name ();
69 what +=
"' can not provide partial\n";
70 what +=
"derivatives needed by this fitter.";
71 throw std::runtime_error ( what );
77 const vector < string > &
84 const vector < double > &
105 unsigned int size = parms.size ();
106 for (
unsigned int i = 0; i <
size; i++ ) {
107 if ( flags[ i ] == 0 ) {
108 free_parms.push_back ( parms[ i ] );
117 unsigned int number = 0;
120 unsigned int size = flags.size ();
121 for (
unsigned int i = 0; i <
size; i++ ) {
123 if ( flags[i] == 0 ) number++;
129 const vector < int > &
152 unsigned int size = parms.size ();
155 for (
unsigned int i = 0; i <
size; i++ ) {
156 if ( flags [i] == 0 ) {
157 parms[i] = free_parms[j];
172 unsigned int size = parms.size();
174 for (
unsigned int i = 0; i <
size; i++ ) {
176 if ( flags [i] == 0 ) {
177 double value =
m_function -> derivByParm ( i, x );
178 derives.push_back ( value );
205 (
function -> hasDerivatives () ==
false ) ) {
hippodraw::FunctionBase class interface
bool m_needs_derivs
Needs derivatives flag.
virtual void copyFrom(const StatedFCN *other)
Makes a copy of the relevant attributes from other object.
StatedFCN()
The default constructor.
bool hasFunction() const
Returns true if model function has been set, otherwise returns false.
virtual double operator()(const std::vector< double > &parms) const
Sets the model function parameters to parms and returns the objective value.
virtual double objectiveValue() const =0
Returns the value of the objective function.
virtual void setFreeParameters(const std::vector< double > &parms)
Sets the free parameters from the vector parms.
unsigned int getNumberFreeParms() const
Returns the number of free parameters.
A derived class for FCNBase class.
intp size(numeric::array arr)
const std::vector< int > & getFixedFlags() const
Returns a vector of flags for parameters which are held fixed by the function.
const std::vector< double > & getParameters() const
Returns the current state of the model function's parameters.
hippodraw::StatedFCN class interface
void setNeedsDerivatives(bool yes)
Sets the needs derivatives flag.
void fillFreeParameters(std::vector< double > &free_parms) const
Fills the vector with the values of the free parameters.
bool isCompatible(const FunctionBase *) const
Returns true if function is compatible this objective function.
A function that can be added to a DataRep and used in a fitter.
FunctionBase * m_function
The flags to indicated which parameters are to be held fixed during minimization of this objective fu...
void setParameters(const std::vector< double > &parms)
Sets the values of the model function's parameters.
virtual void setFixedFlags(const std::vector< int > &flags)
Returns the vector of which of the model function's parameters are considered fixed and not to be cha...
const std::vector< std::string > & getParmNames() const
Returns the names of the model function's parameters.
void setFunction(FunctionBase *function)
Sets the model function.
void fillFreeDerivatives(std::vector< double > &, double x)
Clears and fills the vector with the derivatives of the function a coordinate value x...