RuleMath.h
1//-*-C++-*-
2/***************************************************************************
3 *
4 * Copyright (C) 2004 by Willem van Straten
5 * Licensed under the Academic Free License version 2.1
6 *
7 ***************************************************************************/
8
9// psrchive/More/MEAL/MEAL/RuleMath.h
10
11#ifndef __MEAL_RuleMath_H
12#define __MEAL_RuleMath_H
13
14#include "MEAL/SumRule.h"
15#include "MEAL/NegationRule.h"
16#include "MEAL/ProductRule.h"
17#include "MEAL/InverseRule.h"
18
19namespace MEAL {
20
21 template<class Type> SumRule<Type>* Sum (Type* a, Type* b)
22 {
24 *sum += a;
25 *sum += b;
26
27 return sum;
28 }
29
30 template<class Type> SumRule<Type>* Difference (Type* a, Type* b)
31 {
33 neg->set_model (b);
34
36 *sum += a;
37 *sum += neg;
38
39 return sum;
40 }
41
42 template<class Type> NegationRule<Type>* Negation (Type* a)
43 {
45 neg->set_model (a);
46 return neg;
47 }
48
49 template<class Type> ProductRule<Type>* Product (Type* a, Type* b)
50 {
52 *product *= a;
53 *product *= b;
54
55 return product;
56 }
57
58 template<class Type> ProductRule<Type>* Quotient (Type* a, Type* b)
59 {
61 inverse->set_model (b);
62
64 *product *= a;
65 *product *= inverse;
66
67 return product;
68 }
69
70}
71
72#endif
73
Computes the inverse of a model and its partial derivatives.
Definition InverseRule.h:21
Computes the inverse of a model and its partial derivatives.
Definition NegationRule.h:21
Represents a product of models.
Definition ProductRule.h:21
Represents a sum of models.
Definition SumRule.h:21
void set_model(T *model)
Set the Function on which the operation will be performed.
Definition UnaryRule.h:67
Namespace in which all modeling and calibration related code is declared.
Definition ExampleComplex2.h:16

Generated using doxygen 1.14.0