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
cLinearEquation.h
Go to the documentation of this file.
1 /**
2  * @file cLinearEquation
3  * file name: cLinearEquation.h
4  * @author Betti Oesterholz
5  * @date 11.06.2010
6  * @mail webmaster@BioKom.info
7  *
8  * System: C++
9  *
10  * This header specifies a class for a equiation.
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 class for a equiation.
28  * The equiation has the form:
29  * constant = vecFactors[0] * x_0 + ... + vecFactors[n] * x_n
30  *
31  * The elements are:
32  * - constant: a constant for the equiation
33  * - vecFactors[i]: the factors for the equiation
34  * - x_i: variables for the equiation, theas are not given explicite
35  *
36  */
37 /*
38 History:
39 11.06.2010 Oesterholz created
40 20.01.2011 Oesterholz Methods isNull(), isSolvebel() and
41  getNumberOfFactorsNotNull() added
42 */
43 
44 #ifndef ___C_LINEAR_EQUATION_H__
45 #define ___C_LINEAR_EQUATION_H__
46 
47 #include "version.h"
48 
49 #include <vector>
50 #include <ostream>
51 
52 using namespace std;
53 
54 
55 namespace fib{
56 
57 namespace algorithms{
58 
59 namespace nLinearEquation{
60 
61 
62 template <class tFactors>
64 public:
65  /**
66  * The constant factor for the equiation.
67  */
68  tFactors constant;
69 
70  /**
71  * The factors for the equiation.
72  */
73  vector< tFactors > vecFactors;
74 
75 
76  /**
77  * standardconstructor
78  *
79  * @param uiInNumberOfFactors the number of factors in the to create
80  * equiation (they will be initialisized with 1)
81  * @param inConstant the constant for the equiation (@see constant)
82  */
83  cLinearEquation( unsigned long uiInNumberOfFactors = 1,
84  tFactors inConstant = 0.0 );
85 
86  /**
87  * This operator adds the given linear equiation to this equiation.
88  * For this all correspondending factors and the constant will be added.
89  *
90  * @see operator+=()
91  * @param linInequiation the inequiation to add to this inequiation
92  * @return a reference to this inequiation
93  */
94  cLinearEquation & operator+( const cLinearEquation & equiation );
95 
96  /**
97  * This operator adds the given linear equiation to this equiation.
98  * For this all correspondending factors and the constant will be added.
99  *
100  * @see operator+()
101  * @param linInequiation the inequiation to add to this inequiation
102  */
103  void operator+=( const cLinearEquation & equiation );
104 
105  /**
106  * This method multiplies the inequiation with the given factor.
107  *
108  * @param value the value, with which to multiply this inequiation
109  * @return a reference to this inequiation
110  */
111  cLinearEquation & mult( tFactors value );
112 
113  /**
114  * @return true if all factors and the constant are 0, else false
115  */
116  bool isNull() const;
117 
118  /**
119  * @return true if the equiation is solvebel, else false (all factors
120  * are 0, but the constant is not 0)
121  */
122  bool isSolvebel() const;
123 
124  /**
125  * @return the number of factors which are not 0
126  */
127  unsigned long getNumberOfFactorsNotNull() const;
128 
129  /**
130  * This method print the inequiation in a readebel form to the given
131  * output stream outputSream.
132  *
133  * @param outputStream the stream wher to print this inequiation to
134  */
135  void print( ostream & outputStream );
136 
137 };
138 
139 
140 };//end namespace nLinearEquation
141 };//end namespace algorithms
142 };//end namespace fib
143 
144 //include template implementation
145 #include "../src/cLinearEquation.cpp"
146 
147 
148 
149 #endif //___C_LINEAR_EQUATION_H__