Unfit  3.1.1
Data fitting and optimization software
Public Member Functions | Private Attributes | List of all members
Unfit::Examples::Modroslam Class Reference

Implements a Modified Rosenbrock function. More...

#include <Modroslam.hpp>

Inheritance diagram for Unfit::Examples::Modroslam:
Unfit::GenericCostFunction

Public Member Functions

 Modroslam (unsigned n)
 
std::vector< double > operator() (const std::vector< double > &param)
 
- Public Member Functions inherited from Unfit::GenericCostFunction
virtual ~GenericCostFunction ()
 

Private Attributes

const unsigned n_
 

Detailed Description

Implements a Modified Rosenbrock function.

Here the goal is to find a parameter set that minimises the Modified Rosenbrock function. This function is defined as:

residuals[i] = 10.0*(B - A*A); residuals[i+1] = 1.0 - A; residuals[i+2] = 100.0;

The goal is to find the values of A & B that give a minimum cost. In terms of the model, A = param[0] and B = param[1].

Constructor & Destructor Documentation

◆ Modroslam()

Unfit::Examples::Modroslam::Modroslam ( unsigned  n)
inline

Create the cost function. Here the number of observations must be passed in.

Intended use : Modroslam cost_func(n);

Parameters
nThe number of observations (must be divisible by 3. If it is not, the code will truncate back to the nearest multiple of 3).

Member Function Documentation

◆ operator()()

std::vector<double> Unfit::Examples::Modroslam::operator() ( const std::vector< double > &  param)
inlinevirtual

Calculate the residuals for the Modified Rosenbrock function.

Intended use : residuals = cost_func(param)

Parameters
paramA vector containing the current estimates of the parameters
Returns
A vector containing the residuals

Implements Unfit::GenericCostFunction.

Member Data Documentation

◆ n_

const unsigned Unfit::Examples::Modroslam::n_
private

A variable to store number of observations (should be a multiple of 3)


The documentation for this class was generated from the following file: