SourceXtractorPlusPlus
0.12
Please provide a description of the project.
|
Provides to the LeastSquareEngine the residual values. More...
#include <ResidualEstimator.h>
Public Member Functions | |
virtual | ~ResidualEstimator () |
Destructor. More... | |
void | registerBlockProvider (std::unique_ptr< ResidualBlockProvider > provider) |
Registers a ResidualBlockProvider to the ResidualEstimator. More... | |
std::size_t | numberOfResiduals () const |
template<typename DoubleIter > | |
void | populateResiduals (DoubleIter output_iter) const |
void | populateResiduals (double *output_iter) const |
void | populateResiduals (std::vector< double >::iterator output_iter) const |
Private Attributes | |
std::size_t | m_residual_no {0} |
std::vector< std::unique_ptr < ResidualBlockProvider > > | m_block_provider_list {} |
Provides to the LeastSquareEngine the residual values.
This class does not compute the residuals itself. It operates as a collection of objects implementing the ResidualBlockProvider interface, each one of which is responsible for a block of residuals.
The proper way of using this class is to create an instance, register ResidualBlockProvider instances by using the registerBlockProvider() method and pass it to a LeastSquareEngine for solving the minimization problem. The rest of the methods are dedicated for usage from inside the minimization engine, so they can be safely be ignored.
Definition at line 50 of file ResidualEstimator.h.
|
virtualdefault |
Destructor.
std::size_t ModelFitting::ResidualEstimator::numberOfResiduals | ( | ) | const |
Returns the total number of residuals. It is equal with the sum of the sizes of all the registered block providers.
Definition at line 34 of file ResidualEstimator.cpp.
References m_residual_no.
Referenced by ModelFitting::GSLEngine::solveProblem(), and ModelFitting::LevmarEngine::solveProblem().
void ModelFitting::ResidualEstimator::populateResiduals | ( | DoubleIter | output_iter | ) | const |
Populates the elements where the given iterator points to with the current residual values. Note that the method makes the assumption that the iterator points to a structure which sufficient number of elements to fit the residuals. Failure of this precondition can lead to undefined behavior.
Definition at line 26 of file ResidualEstimator.icpp.
References std::vector< T >::begin(), std::copy(), std::vector< T >::data(), std::vector< T >::end(), m_block_provider_list, and m_residual_no.
Referenced by ModelFitting::GSLEngine::solveProblem(), and ModelFitting::LevmarEngine::solveProblem().
void ModelFitting::ResidualEstimator::populateResiduals | ( | double * | output_iter | ) | const |
Specialization of the populateResiduals() method for double*, which avoids alocating intermediate memory for the residuals.
Definition at line 38 of file ResidualEstimator.cpp.
References m_block_provider_list.
void ModelFitting::ResidualEstimator::populateResiduals | ( | std::vector< double >::iterator | output_iter | ) | const |
Specialization of the populateResiduals() method for vector of doubles, which avoids alocating intermediate memory for the residuals.
Definition at line 45 of file ResidualEstimator.cpp.
References m_block_provider_list.
void ModelFitting::ResidualEstimator::registerBlockProvider | ( | std::unique_ptr< ResidualBlockProvider > | provider | ) |
Registers a ResidualBlockProvider to the ResidualEstimator.
Definition at line 29 of file ResidualEstimator.cpp.
References m_block_provider_list, m_residual_no, and std::move().
Referenced by SourceXtractor::MoffatModelFittingTask::computeProperties(), and SourceXtractor::FlexibleModelFittingPrior::setupPrior().
|
private |
Definition at line 83 of file ResidualEstimator.h.
Referenced by populateResiduals(), and registerBlockProvider().
|
private |
Definition at line 82 of file ResidualEstimator.h.
Referenced by numberOfResiduals(), populateResiduals(), and registerBlockProvider().