SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
ModelFitting::ResidualEstimator Class Reference

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

#include <ResidualEstimator.h>

Collaboration diagram for ModelFitting::ResidualEstimator:

Public Member Functions

virtual ~ResidualEstimator ()
 Destructor.
void registerBlockProvider (std::unique_ptr< ResidualBlockProvider > provider)
 Registers a ResidualBlockProvider to the ResidualEstimator.
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]

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() [2/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.

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

Here is the call graph for this function:

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

Member Data Documentation

◆ m_block_provider_list

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

◆ m_residual_no

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

Definition at line 82 of file ResidualEstimator.h.

Referenced by numberOfResiduals(), populateResiduals(), and registerBlockProvider().


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