The Fib multimedia system
Fib is a system for storing multimedia data (like images or films).
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cOneAryFunction.h
Go to the documentation of this file.
1 /**
2  * @file cOneAryFunction
3  * file name: cOneAryFunction.h
4  * @author Betti Oesterholz
5  * @date 15.076.2010
6  * @mail webmaster@BioKom.info
7  *
8  * System: C++
9  *
10  * This header specifies a abstract class for a one ary functions.
11  * Copyright (C) @c GPL3 2010 Betti Oesterholz
12  *
13  * This program is free software: you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License (GPL) as
15  * published by the Free Software Foundation, either version 3 of the
16  * License, or any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU Lesser General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program. If not, see <http://www.gnu.org/licenses/>.
25  *
26  *
27  * This header specifies a abstract class for a one ary functions.
28  *
29  */
30 /*
31 History:
32 15.07.2010 Oesterholz created
33 */
34 
35 #ifndef ___N_D_1_C_ONE_ARY_FUNCTION_H__
36 #define ___N_D_1_C_ONE_ARY_FUNCTION_H__
37 
38 #include "version.h"
39 
40 #include "nD1.h"
41 #include "cDataPoint.h"
42 #include "cLinearEquation.h"
43 
44 #include "cUnderFunction.h"
45 #include "cFibVariable.h"
46 
47 #include <vector>
48 
49 using namespace fib;
50 
51 namespace fib{
52 
53 namespace algorithms{
54 
55 namespace nD1{
56 
57 template <class tX, class tY>
59 
60 public:
61 
62  /**
63  * This method evalues the value of this function.
64  *
65  * @param x the input value for the function
66  * @return the evalued value f( x )
67  */
68  virtual tY evalue( const tX & x ) const = 0;
69 
70  /**
71  * This method prints the given this function to the given stream.
72  *
73  * @param outputStream the stream wher to print this function to
74  */
75  virtual void print( ostream & outputStream ) const = 0;
76 
77  /**
78  * This method evalues the error of the given datapoints to the values
79  * this function evalues to.
80  *
81  * The evaluation of the function will be done by evalue().
82  * The error will just be counted, if it is greater than the SAVE_BOUNDERY.
83  * @see evalue()
84  *
85  * @param vecInput the data for wich the error is to evalue
86  * @return a pair with two values:
87  * - the first value is the number of datapoints evalued wrong
88  * - the second value is the sum of the error of all datapoints
89  */
90  virtual pair<unsigned long, tY> evalueError(
91  const vector< cDataPoint< tX, tY> > & vecInput ) const = 0;
92 
93  /**
94  * This method evalues the error of the given datapoints to the values
95  * this function evalues to.
96  * This function will stop the evaluation, if the maximum error maxYError
97  * was reached.
98  *
99  * The evaluation of the function will be done by evalue().
100  * The error will just be counted, if it is greater than the SAVE_BOUNDERY.
101  * @see evalue()
102  *
103  * @param vecInput the data for wich the error is to evalue
104  * @param maxYError the maximum error, at which the evaluation should stop
105  * @return the sum of the error of all datapoints, but maximal maxYError
106  */
107  virtual tY evalueErrorMax( const vector< cDataPoint< tX, tY> > & vecData,
108  const tY maxYError ) const = 0;
109 
110  /**
111  * This method evalues the error of the given range datapoints to the
112  * values this function evalues to.
113  *
114  * The evaluation of the function will be done by evalue().
115  * A datapoint has an error, if it lay outside the datpoint range. The
116  * error is it's distance to the neares datapoint boundery.
117  * The error will just be counted, if it is greater than the SAVE_BOUNDERY.
118  * @see evalue()
119  *
120  * @param vecInput the data for wich the error is to evalue
121  * @return a pair with two values:
122  * - the first value is the number of datapoints evalued wrong
123  * - the second value is the sum of the error of all datapoints
124  */
125  virtual pair<unsigned long, tY> evalueError(
126  const vector< cDataPointRange< tX, tY> > & vecInput ) const = 0;
127 
128  /**
129  * This method evalues the error of the given datapoints to the values
130  * this function evalues to.
131  * This function will stop the evaluation, if the maximum error maxYError
132  * was reached.
133  *
134  * The evaluation of the function will be done by evalue().
135  * A datapoint has an error, if it lay outside the datpoint range. The
136  * error is it's distance to the neares datapoint boundery.
137  * The error will just be counted, if it is greater than the SAVE_BOUNDERY.
138  * @see evalue()
139  *
140  * @param vecInput the data for wich the error is to evalue
141  * @param maxYError the maximum error, at which the evaluation should stop
142  * @return the sum of the error of all datapoints, but maximal maxYError
143  */
144  virtual tY evalueErrorMax( const vector< cDataPointRange< tX, tY> > & vecData,
145  const tY maxYError ) const = 0;
146 
147  /**
148  * This function converts this function, into an fib -underfunction.
149  * Beware: You have to delete the returned fib -underfunction.
150  *
151  * @param pVariable the variable (x) for the function
152  * @return a pointer to the fib -underfunction, wich represents the
153  * same function as this function
154  */
155  virtual cUnderFunction * toFibUnderFunction(
156  cFibVariable * pVariable ) const = 0;
157 
158 
159  /**
160  * This function evalues the function for the given data.
161  * The evalued function will have the order n of the number of given
162  * datapoints.
163  *
164  * @param vecData the data for which to evalue the function
165  * @return if the function for the datapoints could be evalued: the
166  * factors of the evalued function in this function and true, else
167  * false and the factors of this function not changed
168  */
169  virtual bool evalue( const vector< cDataPoint< tX, tY> > & vecData ) = 0;
170 
171 
172 
173 };//end class cOneAryFunction
174 };//end namespace nD1
175 };//end namespace algorithms
176 };//end namespace fib
177 
178 
179 
180 #endif //___N_D_1_C_ONE_ARY_FUNCTION_H__