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

ResidualBlockProvider implementation for adding a prior to a parameter engine value. More...

#include <EngineValueResidual.h>

Inheritance diagram for ModelFitting::EngineValueResidual:
Collaboration diagram for ModelFitting::EngineValueResidual:

Public Member Functions

 EngineValueResidual (EngineParameter &parameter, double expected_value, double weight=1.)
 Constructs a new instance of EngineValueResidual.
virtual ~EngineValueResidual ()
 Destructor.
std::size_t numberOfResiduals () const override
 Always returns 1, as this class creates a single residual.
void populateResidualBlock (IterType output_iter) override
Public Member Functions inherited from ModelFitting::ResidualBlockProvider
virtual ~ResidualBlockProvider ()=default
 Destructor.

Private Attributes

double m_residual

Additional Inherited Members

Public Types inherited from ModelFitting::ResidualBlockProvider
using IterType = double*

Detailed Description

ResidualBlockProvider implementation for adding a prior to a parameter engine value.

The residual is calculated as:

\[ r = w*(P_c-P_p) \]

where:

  • \(w\): is the weight of the residual
  • \(P_c\): is the current engine value of the parameter
  • \(P_p\): is the prior expected engine value of the parameter

Definition at line 46 of file EngineValueResidual.h.

Constructor & Destructor Documentation

◆ EngineValueResidual()

ModelFitting::EngineValueResidual::EngineValueResidual ( EngineParameter & parameter,
double expected_value,
double weight = 1. )

Constructs a new instance of EngineValueResidual.

Note that this class will add an observer to the parameter which requires that the EngineValueResidual instance is still alive when it is called. For this reason, any updates of a parameter value after a related EngineValueResidual is deleted, leeds to undefined behavior.

Parameters
parameterA reference to the parameter the residual is calculated for
expected_valueThe prior expected engine value
weightThe weight or the residual

Definition at line 33 of file EngineValueResidual.cpp.

References ModelFitting::BasicParameter::addObserver(), ModelFitting::computeResidual(), ModelFitting::EngineParameter::getEngineValue(), and m_residual.

Here is the call graph for this function:

◆ ~EngineValueResidual()

ModelFitting::EngineValueResidual::~EngineValueResidual ( )
virtualdefault

Destructor.

Member Function Documentation

◆ numberOfResiduals()

std::size_t ModelFitting::EngineValueResidual::numberOfResiduals ( ) const
overridevirtual

Always returns 1, as this class creates a single residual.

Implements ModelFitting::ResidualBlockProvider.

Definition at line 43 of file EngineValueResidual.cpp.

◆ populateResidualBlock()

void ModelFitting::EngineValueResidual::populateResidualBlock ( IterType output_iter)
overridevirtual

Updates the value where the iterator points with the value of the residual for the current value of the parameter

Implements ModelFitting::ResidualBlockProvider.

Definition at line 47 of file EngineValueResidual.cpp.

References m_residual.

Member Data Documentation

◆ m_residual

double ModelFitting::EngineValueResidual::m_residual
private

Definition at line 80 of file EngineValueResidual.h.

Referenced by EngineValueResidual(), and populateResidualBlock().


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