ReFRACtor
|
#include <meyer_ml_problem.h>
Public Member Functions | |
MeyerMLProblem (const blitz::Array< double, 1 > &measurement, const blitz::Array< double, 1 > &measurement_error_cov) | |
virtual | ~MeyerMLProblem () |
virtual void | assert_jacobian_correct (const blitz::Array< double, 2 > &k) const |
Conditions that must be satisfied when a derived class computes the Jacobian of the model. More... | |
virtual void | assert_model_correct (const blitz::Array< double, 1 > &m) const |
Conditions that must be satisfied when a derived class computes the model. More... | |
virtual void | assert_parameter_correct (const blitz::Array< double, 1 > &x) const |
Checks that the new input parameters are correct. More... | |
virtual void | assert_parameter_set_correctly () const |
Checks that the parameters are set correctly. More... | |
virtual void | clear () |
Deletes data contents. More... | |
virtual int | expected_parameter_size () const |
Returns the expected size of the parameters. More... | |
virtual int | expected_parameter_size () const |
Returns the expected size of the parameters. More... | |
bool | jacobean_computed () const |
A boolean function to check whether or not the Jacobean of the model is computed. More... | |
virtual blitz::Array< double, 2 > | jacobian () |
Evaluates and returns the Jacobian of the model at the currently set parameter values. More... | |
virtual void | jacobian_eval () |
Evaluates the Jacobian of the model at the currently set parameter values. More... | |
virtual void | jacobian_eval ()=0 |
Evaluates the Jacobian of the model at the currently set parameter values. More... | |
virtual blitz::Array< double, 2 > | jacobian_x (const blitz::Array< double, 1 > &x) |
The model Jacobian with parameters. More... | |
virtual blitz::Array< double, 1 > | measurement () const |
Returns the measured data, to which the model is fit. More... | |
virtual blitz::Array< double, 1 > | measurement_error_cov () const |
Returns the measurement error covariance (implemented as a diagonal matrix). More... | |
virtual int | measurement_size () const |
Returns the size of the measurement data vector. More... | |
virtual blitz::Array< double, 1 > | model () |
Evaluates and returns the model at the currently set parameter values. More... | |
bool | model_computed () const |
A boolean function to check whether or not the model is computed. More... | |
virtual void | model_eval () |
Evaluates the model at the currently set parameter values. More... | |
virtual void | model_eval ()=0 |
Evaluates the model at the currently set parameter values. More... | |
virtual void | model_jacobian (blitz::Array< double, 1 > &m, blitz::Array< double, 2 > &k) |
Evaluates model and its Jacobian together. More... | |
virtual void | model_jacobian_eval () |
Evaluates the model and its Jacobian at the currently set parameter values. More... | |
virtual void | model_jacobian_eval () |
Evaluates the model and its Jacobian at the currently set parameter values. More... | |
virtual void | model_jacobian_x (const blitz::Array< double, 1 > &x, blitz::Array< double, 1 > &m, blitz::Array< double, 2 > &k) |
Model and its Jacobian with parameters. More... | |
virtual blitz::Array< double, 1 > | model_measure_diff () |
Returns model and measurement difference (model - measurement) More... | |
virtual blitz::Array< double, 1 > | model_x (const blitz::Array< double, 1 > &x) |
The model function with parameters. More... | |
virtual int | parameter_size () const |
Returns the size of the parameters. More... | |
virtual void | parameters (const blitz::Array< double, 1 > &x) |
Sets the problem at a new point in the parameter space. More... | |
virtual blitz::Array< double, 1 > | parameters () const |
Returns the current parameters. More... | |
virtual bool | parameters_different (const blitz::Array< double, 1 > &x) const |
Checks whether or not new input parameters are different from the current ones. More... | |
virtual void | print (std::ostream &Os) const |
Print description of object. More... | |
std::string | print_to_string () const |
Print to string. More... | |
virtual void | set (const ModelState &s) |
Makes self a copy of the input state. More... | |
virtual void | set (const ProblemState &s) |
Makes self a copy of the input state. More... | |
void | set_measurement (const blitz::Array< double, 1 > &measurement, const blitz::Array< double, 1 > &measurement_error_cov) |
For setting measurement and the error covariance matrix. More... | |
virtual blitz::Array< double, 2 > | uncert_weighted_jac_inner_product () |
Returns the inner product of the matrix returned by the method uncert_weighted_jacobian() by itself. More... | |
virtual blitz::Array< double, 2 > | uncert_weighted_jacobian () |
Returns the model Jacobian weighted by the inverse of the Cholesky decomposition of the error covariance matrix. More... | |
virtual blitz::Array< double, 1 > | uncert_weighted_model_measure_diff () |
Returns model and measurement difference weighted by the inverse of the Cholesky decomposition of the error covariance matrix. More... | |
Protected Attributes | |
blitz::Array< double, 2 > | K |
blitz::Array< double, 1 > | M |
blitz::Array< double, 1 > | msrmnt |
blitz::Array< double, 1 > | Se |
blitz::Array< double, 1 > | Se_chol |
blitz::Array< double, 1 > | X |
Definition at line 9 of file meyer_ml_problem.h.
MeyerMLProblem::MeyerMLProblem | ( | const blitz::Array< double, 1 > & | measurement, |
const blitz::Array< double, 1 > & | measurement_error_cov | ||
) |
Definition at line 7 of file meyer_ml_problem.cc.
|
inlinevirtual |
Definition at line 13 of file meyer_ml_problem.h.
|
virtualinherited |
Conditions that must be satisfied when a derived class computes the Jacobian of the model.
This method is just the implementation of some conditions that must be satisfied after a derived class computes the Jacobian of the model. The derived class itself calls this method to check the computed Jacobian.
[in] | k | The computed model |
Definition at line 35 of file model_measure.cc.
|
virtualinherited |
Conditions that must be satisfied when a derived class computes the model.
This method is just the implementation of some conditions that must be satisfied after a derived class computes the model. The derived class itself calls this method to check the computed model.
[in] | m | The computed model |
Definition at line 28 of file model_measure.cc.
|
virtualinherited |
Checks that the new input parameters are correct.
This method checks to see whether or not the new input parameters are correct. If the parameters are not correct then it throws an exception.
Definition at line 44 of file problem_state.cc.
|
inlinevirtualinherited |
Checks that the parameters are set correctly.
This method checks to see whether or not the parameters are set correctly. If the parameters are not set correctly then it throws an exception.
Definition at line 197 of file problem_state.h.
|
inlinevirtualinherited |
Deletes data contents.
This method deletes state. If needed, it must be reimplemented by other classes derived from this class to delete other saved components associated with the state as well.
Reimplemented from FullPhysics::ProblemState.
Definition at line 84 of file model_state.h.
|
inlinevirtualinherited |
Returns the expected size of the parameters.
This method must be reimplemented by the problem class the inherits ProblemState. It is only in the context of an optimization problem that one knows what the size of the parameters (number of the dimensions of the parameter space) is.
This method is intentionally implemented here instead of being left as a pure virtual method. The intention is that the user to be able to create an object of this class or its derived classes for the purpose of preserving an older state of a problem if needed.
Reimplemented from FullPhysics::ProblemState.
Definition at line 25 of file model_measure_meyer.h.
|
inlinevirtualinherited |
Returns the expected size of the parameters.
This method must be reimplemented by the problem class the inherits ProblemState. It is only in the context of an optimization problem that one knows what the size of the parameters (number of the dimensions of the parameter space) is.
This method is intentionally implemented here instead of being left as a pure virtual method. The intention is that the user to be able to create an object of this class or its derived classes for the purpose of preserving an older state of a problem if needed.
Reimplemented in FullPhysics::NLLSMaxAPosteriori, FullPhysics::NLLSMaxLikelihood, FullPhysics::NLLSProblemScaled, FullPhysics::ModelMeasureStandard, FullPhysics::ModelMeasureBard, FullPhysics::ModelMeasureMeyer, FullPhysics::FmNLLSProblem, FullPhysics::BardNLLSProblem, FullPhysics::BrownNLLSProblem, FullPhysics::FreudensteinRothNLLSProblem, FullPhysics::HelicalValleyNLLSProblem, FullPhysics::JennrichSampsonNLLSProblem, FullPhysics::MeyerNLLSProblem, FullPhysics::PowellNLLSProblem, FullPhysics::PowellSingularNLLSProblem, and FullPhysics::Rosenbrock2NLLSProblem.
Definition at line 185 of file problem_state.h.
|
inlineinherited |
A boolean function to check whether or not the Jacobean of the model is computed.
Definition at line 367 of file model_measure.h.
|
inlinevirtualinherited |
Evaluates and returns the Jacobian of the model at the currently set parameter values.
All the comments on jacobian_eval() method also apply to this method, and in addition this method returns the evaluated Jacobian.
The sizes of the Jacobian matrix can be obtained in advance:
Definition at line 190 of file model_measure.h.
|
virtualinherited |
Evaluates the Jacobian of the model at the currently set parameter values.
This method must be implemented by the classes derived from this class.
The parameters (the point in the parameter space) must have already been set before calling this method. The parameters are already set if one of the following methods is already called successfully:
If the parameters are already set, then this method evaluate the Jacobian of the model at the currently set parameter values (point in the parameter space).
Implements FullPhysics::ModelMeasure.
Definition at line 21 of file model_measure_meyer.cc.
|
pure virtualinherited |
Evaluates the Jacobian of the model at the currently set parameter values.
This method must be implemented by the classes derived from this class.
The parameters (the point in the parameter space) must have already been set before calling this method. The parameters are already set if one of the following methods is already called successfully:
If the parameters are already set, then this method evaluate the Jacobian of the model at the currently set parameter values (point in the parameter space).
Implemented in FullPhysics::ModelMeasureStandard, FullPhysics::ModelMeasureBard, and FullPhysics::ModelMeasureMeyer.
|
inlinevirtualinherited |
The model Jacobian with parameters.
This method also evaluates the Jacobian; however, it sets the model at the input new point and then evaluates its Jacobian.
The sizes of the Jacobian matrix can be obtained in advance:
[in] | x | New set of parameters |
Definition at line 211 of file model_measure.h.
|
inlinevirtualinherited |
Returns the measured data, to which the model is fit.
Definition at line 283 of file model_measure.h.
|
inlinevirtualinherited |
Returns the measurement error covariance (implemented as a diagonal matrix).
Definition at line 294 of file model_measure.h.
|
inlinevirtualinherited |
Returns the size of the measurement data vector.
This method returns the size of the measured data vector. The following must also be equal to the value returned by measurement_size():
Definition at line 312 of file model_measure.h.
|
inlinevirtualinherited |
Evaluates and returns the model at the currently set parameter values.
All the comments on model_eval() method also apply to this method, and in addition this method returns the evaluated model.
The size of the model vector can be obtained in advance by calling measurement_size().
Definition at line 128 of file model_measure.h.
|
inlineinherited |
A boolean function to check whether or not the model is computed.
Definition at line 356 of file model_measure.h.
|
virtualinherited |
Evaluates the model at the currently set parameter values.
This method must be implemented by the classes derived from this class.
The parameters (the point in the parameter space) must have already been set before calling this method. The parameters are already set if one of the following methods is already called successfully:
If the parameters are already set, then this method evaluate the model at the currently set parameter values (point in the parameter space).
Implements FullPhysics::ModelMeasure.
Definition at line 8 of file model_measure_meyer.cc.
|
pure virtualinherited |
Evaluates the model at the currently set parameter values.
This method must be implemented by the classes derived from this class.
The parameters (the point in the parameter space) must have already been set before calling this method. The parameters are already set if one of the following methods is already called successfully:
If the parameters are already set, then this method evaluate the model at the currently set parameter values (point in the parameter space).
Implemented in FullPhysics::ModelMeasureStandard, FullPhysics::ModelMeasureBard, and FullPhysics::ModelMeasureMeyer.
|
inlinevirtualinherited |
Evaluates model and its Jacobian together.
All the comments on model_jacobian_eval() method also apply to this method, and in addition this method passes to the caller the evaluated model and its Jacobian.
[out] | m | The model |
[out] | k | The Jacobian of the model |
Definition at line 251 of file model_measure.h.
|
virtualinherited |
Evaluates the model and its Jacobian at the currently set parameter values.
The parameters (the point in the parameter space) must have already been set before calling this method. The parameters are already set if one of the following methods is already called successfully:
If the parameters are already set, then this method evaluate the model and its Jacobian at the currently set parameter values (point in the parameter space).
Reimplemented from FullPhysics::ModelMeasure.
Definition at line 36 of file model_measure_meyer.cc.
|
inlinevirtualinherited |
Evaluates the model and its Jacobian at the currently set parameter values.
The parameters (the point in the parameter space) must have already been set before calling this method. The parameters are already set if one of the following methods is already called successfully:
If the parameters are already set, then this method evaluate the model and its Jacobian at the currently set parameter values (point in the parameter space).
Reimplemented in FullPhysics::ModelMeasureStandard, FullPhysics::ModelMeasureBard, and FullPhysics::ModelMeasureMeyer.
Definition at line 233 of file model_measure.h.
|
inlinevirtualinherited |
Model and its Jacobian with parameters.
This method passes to the caller the evaluated model and its Jacobian after setting the problem at the input new point.
[in] | x | New set of parameters |
[out] | m | The model |
[out] | k | The Jacobian of the model |
Definition at line 272 of file model_measure.h.
|
inlinevirtualinherited |
Returns model and measurement difference (model - measurement)
This method is for convenience. It returns the difference of the computed model and the measurement. The difference is not called residual on purpose. The term residual will be used in the context of the Non-Linear (or Linear) Least Squares optimization.
Let the following be the computed model and the measured data respectively
Then this method returns
Definition at line 410 of file model_measure.h.
|
inlinevirtualinherited |
The model function with parameters.
This method also evaluates the model; however, it sets the model at the input new point and then evaluates the model.
The size of the model vector can be obtained in advance by calling measurement_size().
[in] | x | New set of parameters |
Definition at line 147 of file model_measure.h.
|
inlinevirtualinherited |
Returns the size of the parameters.
Definition at line 163 of file problem_state.h.
|
virtualinherited |
Sets the problem at a new point in the parameter space.
The method calls parameters_different() to determine whether or not the new parameters are different:
[in] | x | New set of parameters |
Reimplemented in FullPhysics::NLLSProblemScaled, FullPhysics::NLLSMaxAPosteriori, FullPhysics::NLLSMaxLikelihood, and FullPhysics::ModelMeasureStandard.
Definition at line 36 of file problem_state.cc.
|
inlinevirtualinherited |
Returns the current parameters.
Reimplemented in FullPhysics::NLLSProblemScaled, FullPhysics::NLLSMaxAPosteriori, FullPhysics::NLLSMaxLikelihood, and FullPhysics::ModelMeasureStandard.
Definition at line 153 of file problem_state.h.
|
virtualinherited |
Checks whether or not new input parameters are different from the current ones.
The methods checks to see whether or not the new input parameters (point in the parameter space) are different from the parameters maintained by the object for which the method is called.
If the size of the input parameters is not equal to the expected size of the parameters (check comments on expected_parameter_size), then the method will throw an exception.
If the object for which the method is called has currently no parameters set, then the method returns true. Otherwise, the method uses some algorithm to figure out when the difference is "big enough" to be considered different. If the method determines that the new input parameters are different from the current parameters, then it returns true, otherwise, it returns false.
[in] | x | New set of parameters |
Definition at line 9 of file problem_state.cc.
|
inlinevirtual |
Print description of object.
Reimplemented from FullPhysics::ModelMeasureMeyer.
Definition at line 14 of file meyer_ml_problem.h.
|
inlineinherited |
Print to string.
This is primarily useful for SWIG wrappers to this class, e.g. a to_s method in ruby.
Definition at line 31 of file printable.h.
|
virtualinherited |
Makes self a copy of the input state.
This method makes the object, for which it is called, a copy of the input state.
[in] | s | another ModelState |
Definition at line 7 of file model_state.cc.
|
inlinevirtualinherited |
Makes self a copy of the input state.
This method makes the object, for which it is called, a copy of the input state.
[in] | s | another ProblemState |
Definition at line 88 of file problem_state.h.
|
inherited |
For setting measurement and the error covariance matrix.
[in] | measurement | The measurement to which the model is to be fitted |
[in] | measurement_error_cov | The measurement error covariance matrix assumed to be diagonal (hence simply a vector containing the diagonal) |
Definition at line 9 of file model_measure.cc.
|
virtualinherited |
Returns the inner product of the matrix returned by the method uncert_weighted_jacobian() by itself.
Let the following be the computed model Jacobian and the measurement error covariance matrix respectively:
Then this method returns
Definition at line 54 of file model_measure.cc.
|
virtualinherited |
Returns the model Jacobian weighted by the inverse of the Cholesky decomposition of the error covariance matrix.
This method is for convenience. It returns the model Jacobian weighted by the Cholesky decomposition (roughly speaking the square root) of the error covariance matrix.
Let the following be the computed model Jacobian and the measurement error covariance matrix respectively:
Then the Cholesky decomposition of the error covariance matrix is
and this method returns
The method uncert_weighted_model_measure_diff() is another function of the parameters, and the method uncert_weighted_jacobian() is the Jacobian of uncert_weighted_model_measure_diff().
Definition at line 45 of file model_measure.cc.
|
inlinevirtualinherited |
Returns model and measurement difference weighted by the inverse of the Cholesky decomposition of the error covariance matrix.
This method is for convenience. It returns the difference of the computed model and measurement, model_measure_diff(), weighted by the Cholesky decomposition (roughly speaking the square root) of the error covariance matrix. In the name of this method "uncert" is the short for uncertainty, but probably using the word uncertainty or uncert in the name of this method is a bad Idea. In the implementation of this class the error covariance matrix is implemented as a diagonal matrix. However, if the matrix were not diagonal, still the purpose of this method would be to weight the model and the measurement difference with the Cholesky decomposition of the entire error covariance matrix.
Let the following be the computed model, the measured data, and the measurement error covariance matrix respectively:
Then the Cholesky decomposition of the error covariance matrix is
and this method returns
Definition at line 451 of file model_measure.h.
|
protectedinherited |
Definition at line 99 of file model_state.h.
|
protectedinherited |
Definition at line 98 of file model_state.h.
|
protectedinherited |
Definition at line 512 of file model_measure.h.
|
protectedinherited |
Definition at line 513 of file model_measure.h.
|
protectedinherited |
Definition at line 516 of file model_measure.h.
|
protectedinherited |
Definition at line 222 of file problem_state.h.