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 build a non-defined Mapping. Everything is illegal on such a
41 // Mapping except delete, = and <<. All other operations will *crash*
44 // Cast from float to allow operations with constant values
47 // Standard copy constructor and destructor
48 Mapping(const Mapping &s);
52 Mapping &operator = (const Mapping &m);
55 float operator () (float x) const;
58 Mapping derivative() const;
60 // Composition of Mappings
61 Mapping compose(const Mapping &m) const;
63 // Standard operations
64 Mapping pow(int k) const;
65 Mapping mul(const Mapping &m) const;
66 Mapping div(const Mapping &m) const;
67 Mapping add(const Mapping &m) const;
68 Mapping sub(const Mapping &m) const;
75 // Print the expression
76 void print(ostream &s) const;
79 // I guess we have all the ones we need?
80 Mapping operator + (const Mapping &m);
81 Mapping operator + (const Mapping &ml, const Mapping &mr);
82 Mapping operator - (const Mapping &m);
83 Mapping operator - (const Mapping &ml, const Mapping &mr);
84 Mapping operator * (const Mapping &ml, const Mapping &mr);
85 Mapping operator / (const Mapping &ml, const Mapping &mr);
87 // Be very careful with this operator, it has a lower precedence than
89 Mapping operator ^ (const Mapping &ml, int k);
91 // stream stuff, I dont have the courage to do the >>
92 ostream &operator << (ostream &o, const Mapping &m);
94 Mapping sin(const Mapping &m);
95 Mapping cos(const Mapping &m);
96 Mapping log(const Mapping &m);
97 Mapping exp(const Mapping &m);