SourceXtractorPlusPlus  0.11
Please provide a description of the project.
Public Member Functions | Private Attributes | List of all members
ModelFitting::ResidualEstimator Class Reference

Provides to the LeastSquareEngine the residual values. More...

#include <ResidualEstimator.h>

Collaboration diagram for ModelFitting::ResidualEstimator:
[legend]

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 {}
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~ResidualEstimator()

ModelFitting::ResidualEstimator::~ResidualEstimator ( )
virtualdefault

Destructor.

Member Function Documentation

◆ numberOfResiduals()

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().

◆ populateResiduals() [1/3]

template<typename DoubleIter >
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.

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

◆ populateResiduals() [2/3]

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.

◆ populateResiduals() [3/3]

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.

◆ registerBlockProvider()

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(), main(), and SourceXtractor::FlexibleModelFittingPrior::setupPrior().

Here is the call graph for this function:

Member Data Documentation

◆ m_block_provider_list

std::vector<std::unique_ptr<ResidualBlockProvider> > ModelFitting::ResidualEstimator::m_block_provider_list {}
private

Definition at line 83 of file ResidualEstimator.h.

Referenced by populateResiduals(), and registerBlockProvider().

◆ m_residual_no

std::size_t ModelFitting::ResidualEstimator::m_residual_no {0}
private

Definition at line 82 of file ResidualEstimator.h.

Referenced by numberOfResiduals(), and registerBlockProvider().


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