SourceXtractorPlusPlus
0.10
Please provide a description of the project.
|
Class responsible for managing the parameters the least square engine minimizes. More...
#include <EngineParameterManager.h>
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 {} |
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 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.
|
virtualdefault |
Destructor.
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().
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.
DoubleIter | A forward output iterator to double |
output_iter | An iterator pointing to the first element where the parameter engine values will be outputed |
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.
parameter | The 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(), and main().
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.
DoubleIter | A forward input iterator to double |
new_values_iter |
Referenced by ModelFitting::GSLEngine::solveProblem(), and ModelFitting::LevmarEngine::solveProblem().
|
private |
Definition at line 140 of file EngineParameterManager.h.
Referenced by convertCovarianceMatrixToWorldSpace(), numberOfParameters(), and registerParameter().