11 #ifndef __MEAL_NegationRule_H
12 #define __MEAL_NegationRule_H
14 #include "MEAL/UnaryRule.h"
20 class NegationRule : public UnaryRule<T>
25 typedef typename T::Result Result;
45 void calculate (Result& result, std::vector<Result>* gradient);
54 result->set_model (model);
62 return "NegationRule<" + std::string(T::Name)+ ">";
68 std::vector<Result>* grad)
71 throw Error (InvalidState, "MEAL::NegationRule::calculate",
72 "no model to evaluate");
75 std::cerr << "MEAL::NegationRule::calculate" << std::endl;
77 result = - this->model->evaluate (grad);
80 std::cerr << "MEAL::NegationRule::calculate result\n"
81 " " << result << std::endl;
86 for ( unsigned igrad=0; igrad<grad->size(); igrad++)
87 (*grad)[igrad] *= -1.0;
90 std::cerr << "MEAL::NegationRule::calculate gradient\n";
91 for ( unsigned i=0; i<grad->size(); i++)
93 << i << ":" << this->get_infit(i) << "=" << (*grad)[i] << std::endl;
NegationRule< T > * negation(T *model) Returns a new negation of the model. Definition: NegationRule.h:56
Computes the inverse of a model and its partial derivatives. Definition: NegationRule.h:25
Namespace in which all modeling and calibration related code is declared. Definition: ExampleComplex2.h:16
std::string get_name() const Return the name of the class. Definition: NegationRule.h:60
void calculate(Result &result, std::vector< Result > *gradient) Return the Result and its gradient. Definition: NegationRule.h:67
Generated using doxygen 1.8.17
|