SourceXtractorPlusPlus
0.16
Please provide a description of the project.
|
ResidualBlockProvider for weighted comparison between data and a model. More...
#include <DataVsModelResiduals.h>
Public Member Functions | |
DataVsModelResiduals (DataType data, ModelType model, WeightType weight, Comparator comparator) | |
Constructs a new instance of DataVsModelResiduals. More... | |
virtual | ~DataVsModelResiduals () |
Destructor. More... | |
std::size_t | numberOfResiduals () const override |
void | populateResidualBlock (IterType output_iter) override |
Updates the values where the iterator points with the residuals. More... | |
![]() | |
virtual | ~ResidualBlockProvider ()=default |
Destructor. More... | |
Private Types | |
using | DataTraits = DataVsModelInputTraits< DataType > |
using | ModelTraits = DataVsModelInputTraits< ModelType > |
using | WeightTraits = DataVsModelInputTraits< WeightType > |
Private Attributes | |
DataType | m_data |
ModelType | m_model |
WeightType | m_weight |
Comparator | m_comparator |
std::size_t | m_residual_no |
Additional Inherited Members | |
![]() | |
using | IterType = double * |
ResidualBlockProvider for weighted comparison between data and a model.
The residuals are computed using the following equation:
\[ r_i = g_{(d_i, m_i, w_i)} \]
where:
This class is designed to be as flexible as possible, so it can be used for comparing a wide range or data types (arrays, images, etc), with different cost functions. This flexibility is achieved in two ways.
First, the cost method (the way the residuals are computed) can be defined by the user by using the Comparator template parameter. The Comparator can be any type which behaves like a function (function pointer, functor, lambda, etc) as long as it has the signature void(double d, double m, double w).
Second, the types of the classes which provide the data, model and weight values are all templated, so any type can be used. To be fully flexible, the DataVsModelResiduals class does not access directly these type methods to not imply any restrictions on the possible container types. Instead, it uses the DataVsModelInputTraits class, which is responsible for redirecting the calls to the underlying type. Note that the default implementation of this class covers all the STL containers, so they can be used out-of-the-box. To use incompatible underlying types, one just needs to create a specialization of the DataVsModelInputTraits (see the DataVsModelInputTraits documentation for more details).
DataType | The type used for accessing the data point values |
ModelType | The type used for accessing the model values |
WeightType | The type used for accessing the weight values |
Comparator | The function type to use for computing the residuals |
Definition at line 78 of file DataVsModelResiduals.h.
|
private |
Definition at line 82 of file DataVsModelResiduals.h.
|
private |
Definition at line 83 of file DataVsModelResiduals.h.
|
private |
Definition at line 84 of file DataVsModelResiduals.h.
ModelFitting::DataVsModelResiduals< DataType, ModelType, WeightType, Comparator >::DataVsModelResiduals | ( | DataType | data, |
ModelType | model, | ||
WeightType | weight, | ||
Comparator | comparator | ||
) |
Constructs a new instance of DataVsModelResiduals.
The DataVsModelResiduals keeps internally copies of all the parameters of the constructor. Modifications done after the DataVsModelResiduals is created will not be visible by the DataVsModelResiduals instance.
data | The data to compute the residuals for |
model | The model values for the same points as the data |
weight | The weights of the data points |
comparator | The function to use for computing the residuals |
ElementsException | If the data, model or weight have different sizes |
|
virtual |
Destructor.
|
overridevirtual |
Returns the number of residuals produced by this residual provider (same as the number of data points)
Implements ModelFitting::ResidualBlockProvider.
|
overridevirtual |
Updates the values where the iterator points with the residuals.
Implements ModelFitting::ResidualBlockProvider.
|
private |
Definition at line 124 of file DataVsModelResiduals.h.
|
private |
Definition at line 121 of file DataVsModelResiduals.h.
|
private |
Definition at line 122 of file DataVsModelResiduals.h.
|
private |
Definition at line 125 of file DataVsModelResiduals.h.
|
private |
Definition at line 123 of file DataVsModelResiduals.h.