SourceXtractorPlusPlus  0.13
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
ModelFitting::EngineParameterManager Class Reference

Class responsible for managing the parameters the least square engine minimizes. More...

#include <EngineParameterManager.h>

Collaboration diagram for ModelFitting::EngineParameterManager:
[legend]

Public Member Functions

virtual ~EngineParameterManager ()
 Destructor. More...
 
void registerParameter (std::shared_ptr< EngineParameter > parameter)
 Registers an EngineParameter to the EngineParameterManager. More...
 
std::size_t numberOfParameters ()
 Returns the number of parameters managed by the manager. More...
 
template<typename DoubleIter >
void getEngineValues (DoubleIter output_iter) const
 Returns the engine values of the managed parameters. More...
 
template<typename DoubleIter >
void updateEngineValues (DoubleIter new_values_iter)
 Updates the managed parameters with the given engine values. More...
 
std::vector< double > convertCovarianceMatrixToWorldSpace (std::vector< double > covariance_matrix) const
 

Private Attributes

std::vector< std::shared_ptr
< EngineParameter > > 
m_parameters {}
 

Detailed Description

Class responsible for managing the parameters the least square engine minimizes.

The typical usage of this manager is to create an instance with the default constructor, register the parameters to be minimized by using the registerParameter() function, and pass the manager to the LeastSquareEngine. For example:

// The parameters which will be optimized
EngineParameter param1 = ...;
EngineParameter param2 = ...;
EngineParameter param3 = ...;
// Create the manager and register the parameters
EngineParameterManager manager {};
manager.registerParameter(param1);
manager.registerParameter(param2);
manager.registerParameter(param3);
// Pass the parameter to an engine for solving a problem
engine.solveProblem(manager, residual_estimator);

The purpose of the rest of the methods of this class is to be used by the minimization engine and can be safely ignored by the normal user.

Definition at line 61 of file EngineParameterManager.h.

Constructor & Destructor Documentation

ModelFitting::EngineParameterManager::~EngineParameterManager ( )
virtualdefault

Destructor.

Member Function Documentation

std::vector< double > ModelFitting::EngineParameterManager::convertCovarianceMatrixToWorldSpace ( std::vector< double >  covariance_matrix) const

Definition at line 37 of file EngineParameterManager.cpp.

References std::vector< T >::begin(), m_parameters, std::vector< T >::push_back(), std::vector< T >::reserve(), and std::vector< T >::size().

Referenced by ModelFitting::GSLEngine::solveProblem(), and ModelFitting::LevmarEngine::solveProblem().

Here is the call graph for this function:

template<typename DoubleIter >
void ModelFitting::EngineParameterManager::getEngineValues ( DoubleIter  output_iter) const

Returns the engine values of the managed parameters.

The engine values are returned via the passed iterator. The order of the values is the same with the order the parameters were registered to the manager (by calls to the registerParameter() method).

It is the responsibility of the caller to make sure that the structure where the iterator points has enough elements to accommodate the results. Failure of this precondition can lead to undefined behavior.

Template Parameters
DoubleIterA forward output iterator to double
Parameters
output_iterAn iterator pointing to the first element where the parameter engine values will be outputed

Definition at line 26 of file EngineParameterManager.icpp.

References m_parameters.

Referenced by ModelFitting::GSLEngine::solveProblem(), and ModelFitting::LevmarEngine::solveProblem().

std::size_t ModelFitting::EngineParameterManager::numberOfParameters ( )

Returns the number of parameters managed by the manager.

Definition at line 33 of file EngineParameterManager.cpp.

References m_parameters.

Referenced by ModelFitting::GSLEngine::solveProblem(), and ModelFitting::LevmarEngine::solveProblem().

void ModelFitting::EngineParameterManager::registerParameter ( std::shared_ptr< EngineParameter parameter)

Registers an EngineParameter to the EngineParameterManager.

Registered parameters are the ones which will be optimized by the minimization engine, while solving the least square problem. The manager will update their values during the minimization, as requested by the engine.

Each parameter to be optimized by the minimization engine should be registered by a call to this method a single time, before passing the manager to the engine.

Note that the EngineParameterManager relies on the fact that the passed reference lifetime is longer than the one of the manager, in other words, that the reference will be valid for the full time of the minimization solving. Failure to meet this requirement leads to undefined behavior.

Parameters
parameterThe EngineParameter to register to the manager

Definition at line 29 of file EngineParameterManager.cpp.

References m_parameters, and std::move().

Referenced by SourceXtractor::FlexibleModelFittingFreeParameter::create().

Here is the call graph for this function:

template<typename DoubleIter >
void ModelFitting::EngineParameterManager::updateEngineValues ( DoubleIter  new_values_iter)

Updates the managed parameters with the given engine values.

The engine values of the parameters are retrieved using the passed iterator. The order of the values is assumed to be the same as the order the parameters were registered to the manager.

It is the responsibility of the caller to make sure that the structure where the iterator points contains at least as many elements as the number of the managed parameters. Failure of this precondition can lead to undefined behavior.

Template Parameters
DoubleIterA forward input iterator to double
Parameters
new_values_iter

Definition at line 33 of file EngineParameterManager.icpp.

References m_parameters.

Referenced by ModelFitting::GSLEngine::solveProblem(), and ModelFitting::LevmarEngine::solveProblem().

Member Data Documentation

std::vector<std::shared_ptr<EngineParameter> > ModelFitting::EngineParameterManager::m_parameters {}
private

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