xc
FunctionFromPointsR_R.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // xc utils library; general purpose classes and functions.
4 //
5 // Copyright (C) Luis C. Pérez Tato
6 //
7 // XC utils is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // This software is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program.
19 // If not, see <http://www.gnu.org/licenses/>.
20 //----------------------------------------------------------------------------
21 //FunctionFromPointsR_R.h
22 
23 #ifndef FUNCTIONFROMPOINTSR_R_H
24 #define FUNCTIONFROMPOINTSR_R_H
25 
26 #include "FunctionFromPointsR_T.h"
27 #include <deque>
28 
29 typedef std::deque<double> dq_double;
30 
37  {
38  public:
39  FunctionFromPointsR_R::const_iterator PosMax(void) const;
41  FunctionFromPointsR_R &operator=(const double &);
43  double Max(void) const
44  { return (*PosMax()).second; }
46  double AbcisaMax(void) const
47  { return (*PosMax()).first; }
48  FunctionFromPointsR_R::const_iterator PosMin(void) const;
50  double Min(void) const
51  { return (*PosMin()).second; }
53  double AbcisaMin(void) const
54  { return (*PosMin()).first; }
55  double getArea(void) const;
56  double firstX(void) const;
57  double firstY(void) const;
58  double lastX(void) const;
59  double lastY(void) const;
60  dq_double Dominio(void) const;
61  dq_double Abcisas(void) const;
62  dq_double Ordenadas(void) const;
63  dq_double Ceros(void) const;
64 
65  FunctionFromPointsR_R sub(const double &x0,const double &x1) const;
66  FunctionFromPointsR_R getNeg(void) const;
68  FunctionFromPointsR_R &operator+=(const double &);
69  FunctionFromPointsR_R &operator+=(const FunctionFromPointsR_R &);
70  FunctionFromPointsR_R &operator-=(const double &);
71  FunctionFromPointsR_R &operator-=(const FunctionFromPointsR_R &);
72  FunctionFromPointsR_R &operator*=(const double &);
73  FunctionFromPointsR_R &operator*=(const FunctionFromPointsR_R &);
74  FunctionFromPointsR_R &operator/=(const double &);
75  FunctionFromPointsR_R &operator/=(const FunctionFromPointsR_R &);
76  FunctionFromPointsR_R integra(const double &x0,const double &x1,const double &delta= -1.0) const;
77 
78  };
79 
80 FunctionFromPointsR_R asigna(const FunctionFromPointsR_R &,const double &);
81 FunctionFromPointsR_R operator+(const FunctionFromPointsR_R &,const double &);
83 inline FunctionFromPointsR_R operator+(const double &c,const FunctionFromPointsR_R &f)
84  { return f+c;}
85 inline FunctionFromPointsR_R operator-(const FunctionFromPointsR_R &f,const double &c)
86  { return f+(-c); }
87 inline FunctionFromPointsR_R operator-(const double &c,const FunctionFromPointsR_R &f)
88  { return c+f.getNeg();}
90 FunctionFromPointsR_R operator*(const double &,const FunctionFromPointsR_R &);
91 inline FunctionFromPointsR_R operator*(const FunctionFromPointsR_R &f,const double &c)
92  { return c*f; }
94 inline FunctionFromPointsR_R operator/(const FunctionFromPointsR_R &f,const double &c)
95  { return (1.0/c)*f; }
97 
98 #endif
double Max(void) const
Return the maximum value de las ordenadas definidas.
Definition: FunctionFromPointsR_R.h:43
double AbcisaMin(void) const
Return the abcisa correspondiente al valor mínimo de las ordenadas definidas.
Definition: FunctionFromPointsR_R.h:53
double Min(void) const
Return el valor mínimo de las ordenadas definidas.
Definition: FunctionFromPointsR_R.h:50
function from R to T defined on a set of points.
Definition: FunctionFromPointsR_T.h:37
FunctionFromPointsR_R & operator=(const FunctionFromPointsR_R &)
Operador asignación.
Definition: FunctionFromPointsR_R.cc:27
FunctionFromPointsR_R integra(const double &x0, const double &x1, const double &delta=-1.0) const
Return the function that results from the integration between x0 and x1.
Definition: FunctionFromPointsR_R.cc:255
FunctionFromPointsR_R::const_iterator PosMin(void) const
Return the position of the minimum.
Definition: FunctionFromPointsR_R.cc:55
dq_double Abcisas(void) const
Return the abcissae of the function definition points.
Definition: FunctionFromPointsR_R.cc:79
FunctionFromPointsR_R & Neg(void)
Change the sign of the function.
Definition: FunctionFromPointsR_R.cc:206
double getArea(void) const
Return the area enclosed by the function.
Definition: FunctionFromPointsR_R.cc:160
FunctionFromPointsR_R sub(const double &x0, const double &x1) const
Return the part of the function between x0 and x1.
Definition: FunctionFromPointsR_R.cc:197
FunctionFromPointsR_R::const_iterator PosMax(void) const
Return the position of the maximum.
Definition: FunctionFromPointsR_R.cc:41
dq_double Ceros(void) const
Return the roots of the function.
Definition: FunctionFromPointsR_R.cc:99
dq_double Dominio(void) const
Return the function domain.
Definition: FunctionFromPointsR_R.cc:70
FunctionFromPointsR_R getNeg(void) const
Return the function with the opposite sign.
Definition: FunctionFromPointsR_R.cc:202
double AbcisaMax(void) const
Return the abcisa correspondiente al valor máximo de las ordenadas definidas.
Definition: FunctionFromPointsR_R.h:46
f:R->R function defined on a set of points.
Definition: FunctionFromPointsR_R.h:36
dq_double Ordenadas(void) const
Return las ordenadas correspondientes a cada abcisa.
Definition: FunctionFromPointsR_R.cc:89