2 ///////////////////////////////////////////////////////////////////////////
3 // This program is free software: you can redistribute it and/or modify //
4 // it under the terms of the version 3 of the GNU General Public License //
5 // as published by the Free Software Foundation. //
7 // This program is distributed in the hope that it will be useful, but //
8 // WITHOUT ANY WARRANTY; without even the implied warranty of //
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
10 // General Public License for more details. //
12 // You should have received a copy of the GNU General Public License //
13 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
15 // Written and (C) by Francois Fleuret //
16 // Contact <francois.fleuret@idiap.ch> for comments & bug reports //
17 ///////////////////////////////////////////////////////////////////////////
26 // We have a bunch of such classes inside
32 // We'll need this one from time to time, but nobody is supposed to
33 // use it from "outside"
37 // This is the variable
38 const static Mapping X;
40 // This builds a non-defined Mapping. Everything is illegal on such
41 // a Mapping except delete, = and <<. All other operations will
45 // Cast from float to allow operations with constant values
48 // Standard copy constructor and destructor
49 Mapping(const Mapping &s);
53 Mapping &operator = (const Mapping &m);
56 float operator () (float x) const;
59 Mapping derivative() const;
61 // Composition of Mappings
62 Mapping compose(const Mapping &m) const;
64 // Standard operations
65 Mapping pow(int k) const;
66 Mapping mul(const Mapping &m) const;
67 Mapping div(const Mapping &m) const;
68 Mapping add(const Mapping &m) const;
69 Mapping sub(const Mapping &m) const;
76 // Print the expression
77 void print(ostream &s) const;
80 // I guess we have all the ones we need?
81 Mapping operator + (const Mapping &m);
82 Mapping operator + (const Mapping &ml, const Mapping &mr);
83 Mapping operator - (const Mapping &m);
84 Mapping operator - (const Mapping &ml, const Mapping &mr);
85 Mapping operator * (const Mapping &ml, const Mapping &mr);
86 Mapping operator / (const Mapping &ml, const Mapping &mr);
88 // Be very careful with this operator, it has a lower precedence than
90 Mapping operator ^ (const Mapping &ml, int k);
92 // stream stuff, I dont have the courage to do the >>
93 ostream &operator << (ostream &o, const Mapping &m);
95 Mapping sin(const Mapping &m);
96 Mapping cos(const Mapping &m);
97 Mapping log(const Mapping &m);
98 Mapping exp(const Mapping &m);