Unfit  3.1.1
Data fitting and optimization software
Public Member Functions | List of all members
Unfit::TestLevenbergMarquardt Class Reference
Inheritance diagram for Unfit::TestLevenbergMarquardt:
Unfit::LevenbergMarquardt Unfit::GenericOptimizer

Public Member Functions

void AccessFindJacobian (GenericCostFunction &cost_function, const std::vector< double > &residuals, const std::vector< double > &variables, bool one_sided_difference=true)
 
void AccessBroydenUpdate (const std::vector< double > &residuals_new, const std::vector< double > &residuals, const std::vector< double > &hlm, Matrix &jacobianT)
 
Matrix AccessJacobian ()
 
std::vector< double > AccessGetSolution ()
 
void SetDimensions (std::size_t dimensions)
 
std::size_t GetDimensions () const
 
void SetObservationSize (std::size_t obs_size)
 
std::size_t GetObservationSize () const
 
- Public Member Functions inherited from Unfit::LevenbergMarquardt
 LevenbergMarquardt ()
 
virtual ~LevenbergMarquardt ()
 
int FindMin (GenericCostFunction &cost_function, std::vector< double > &coordinates) override
 Implements the Levenberd-Marquardt optimization method. More...
 
void Reset () override
 
- Public Member Functions inherited from Unfit::GenericOptimizer
 GenericOptimizer ()
 
virtual ~GenericOptimizer ()
 
void ResetGenericOptimizer ()
 
virtual double GetCost (std::size_t index=0) const noexcept
 
virtual bool GetIsPopulationBased () const noexcept
 
virtual std::size_t GetNumberOfIterations () const noexcept
 
virtual std::size_t GetNumberOfFunctionEvaluations () const noexcept
 
virtual std::vector< std::vector< double > > GetPopulation () const
 
virtual std::vector< double > GetSolution (std::size_t index=0) const
 
virtual void SetPopulation (const std::vector< std::vector< double >> &population)
 

Additional Inherited Members

- Public Attributes inherited from Unfit::GenericOptimizer
Unfit::Bounds bounds
 
Unfit::Options options
 
- Protected Member Functions inherited from Unfit::GenericOptimizer
virtual bool CalculateCost (GenericCostFunction &CostFunction, std::vector< double > &x)
 
void GeneratePopulation (GenericCostFunction &CostFunction, std::size_t dimensions)
 
void GenerateRandomEngines ()
 
virtual bool IsConverged (const std::vector< double > &best_member, std::size_t truncated_index=0) const
 Checks to see if the population has converged. More...
 
virtual void PrintInitialOutput (double best_cost) const
 
virtual void PrintIterationOutput (double best_cost) const
 
virtual void PrintFinalOutput () const
 
virtual void SortPopulation () noexcept
 
- Protected Attributes inherited from Unfit::GenericOptimizer
std::vector< std::vector< double > > population_
 
std::vector< std::mt19937 > random_engines_
 
std::atomic< std::size_t > function_evaluations_
 
std::atomic< std::size_t > iterations_
 
bool is_population_based_
 

Detailed Description

This class is designed solely to provide the functionality to access the private methods and member variables of the LevenbergMarquardt class.

Member Function Documentation

◆ AccessBroydenUpdate()

void Unfit::TestLevenbergMarquardt::AccessBroydenUpdate ( const std::vector< double > &  residuals_new,
const std::vector< double > &  residuals,
const std::vector< double > &  hlm,
Matrix jacobianT 
)
inline

A function to access the private method (BroydenUpdate) in the LevenbergMarquardt class.

Parameters
residuals_newresidual vector from the candidate solution
residualsresidual vector from the current solution
hlmvector containing the step between the current and new solutions
jacobianTtranspose of the Jacobian matrix

◆ AccessFindJacobian()

void Unfit::TestLevenbergMarquardt::AccessFindJacobian ( GenericCostFunction cost_function,
const std::vector< double > &  residuals,
const std::vector< double > &  variables,
bool  one_sided_difference = true 
)
inline

A function to access the private method (FindJacobian) in the LevenbergMarquardt class.

Parameters
cost_functionsample functions to be tested
residualsa vector of residuals at the current guess. Only used for one-sided differencing; can be empty for two-sided differencing.
variablesvector of the coefficients of the function
one_sided_differenceselect between one sided (forward) and two sided finite different approximations for the Jacobian calculation

◆ AccessGetSolution()

std::vector<double> Unfit::TestLevenbergMarquardt::AccessGetSolution ( )
inline

A function to access the private method (GetSolution) in the LevenbergMarquardt class.

Returns
An empty vector, as the solution is not stored internally

◆ AccessJacobian()

Matrix Unfit::TestLevenbergMarquardt::AccessJacobian ( )
inline

A function to access the private member variable (jacobian_) in the LevenbergMarquardt class.

Returns
The jacobian matrix (transposed)

◆ GetDimensions()

std::size_t Unfit::TestLevenbergMarquardt::GetDimensions ( ) const
inline

A function to get the private member variable (dimensions_) in the LevenbergMarquardt class. This is the number of variables to be fitted.

Returns
the number of variables in the problem

◆ GetObservationSize()

std::size_t Unfit::TestLevenbergMarquardt::GetObservationSize ( ) const
inline

A function to get the private member variable (observation_size_) in the LevenbergMarquardt class. This is the number of data points in the fit.

Returns
the number of data points to be fitted

◆ SetDimensions()

void Unfit::TestLevenbergMarquardt::SetDimensions ( std::size_t  dimensions)
inline

A function to set the private member variable (dimensions_) in the LevenbergMarquardt class. This is the number of variables to be fitted.

Parameters
dimensionsthe number of variables in the problem

◆ SetObservationSize()

void Unfit::TestLevenbergMarquardt::SetObservationSize ( std::size_t  obs_size)
inline

A function to set the private member variable (observation_size_) in the LevenbergMarquardt class. This is the number of data points in the fit.

Parameters
obs_sizethe number of data points to be fitted

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