monomial.h
Go to the documentation of this file.
1 #ifndef MONOMIALH
2 #define MONOMIALH
3 
4 #include "boolean.h"
5 #include "interval.h"
6 #include "variables.h"
7 #include "variable_set.h"
8 
9 #include <stdlib.h>
10 
32 typedef struct {
33  boolean empty;
34  double ct;
36 } Tmonomial;
37 
38 
46 void InitMonomial(Tmonomial *f);
47 
48 
58 void ResetMonomial(Tmonomial *f);
59 
60 
73 void FixVariableInMonomial(unsigned int nv,double v,Tmonomial *f);
74 
91 void ReplaceVariableInMonomial(unsigned int nv,double ct,unsigned int nvNew,Tmonomial *f);
92 
93 
103 boolean EmptyMonomial(Tmonomial *f);
104 
105 
115 boolean CtMonomial(Tmonomial *f);
116 
126 boolean QuadraticMonomial(Tmonomial *f);
127 
128 
138 boolean BilinearMonomial(Tmonomial *f);
139 
149 boolean LinearMonomial(Tmonomial *f);
150 
167 boolean PolynomialMonomial(Tmonomial *f);
168 
180 unsigned int MonomialOrder(Tmonomial *f);
181 
190 void CopyMonomial(Tmonomial *f_dst,Tmonomial *f_orig);
191 
206 unsigned int CmpMonomial(Tmonomial *f1,Tmonomial *f2);
207 
208 
217 void SetMonomialCt(double k,Tmonomial *f);
218 
219 
229 double GetMonomialCt(Tmonomial *f);
230 
241 
250 void AddCt2Monomial(double k,Tmonomial *f);
251 
263 void AddVariable2Monomial(unsigned int fn,unsigned int varid,unsigned int p,Tmonomial *f);
264 
275 
286 double EvaluateMonomial(double *varValues,Tmonomial *f);
287 
298 void EvaluateMonomialInt(Tinterval *varValues,Tinterval *i_out,Tmonomial *f);
299 
309 void DeriveMonomial(unsigned int nv,Tmonomial *df,Tmonomial *f);
310 
311 
326 void PrintMonomial(FILE *file,boolean first,char **varNames,Tmonomial *f);
327 
328 
336 void DeleteMonomial(Tmonomial *f);
337 
338 #endif
Definition of the boolean type.
Definition of the Tvariable_set type and the associated functions.
double ct
Definition: monomial.h:34
void DeriveMonomial(unsigned int nv, Tmonomial *df, Tmonomial *f)
Derives an monomial.
Definition: monomial.c:238
void SetMonomialCt(double k, Tmonomial *f)
Changes the scale factor of a monomial.
Definition: monomial.c:144
void MonomialProduct(Tmonomial *f1, Tmonomial *f2, Tmonomial *f)
Product of two monomials.
Definition: monomial.c:183
boolean LinearMonomial(Tmonomial *f)
Checks if a monomial is lienal: K*x, with K a constant.
Definition: monomial.c:79
Definition of the Tvariables type and the associated functions.
boolean CtMonomial(Tmonomial *f)
Checks if a monomial is constant.
Definition: monomial.c:58
boolean empty
Definition: monomial.h:33
boolean EmptyMonomial(Tmonomial *f)
Checks if a monomial is empty.
Definition: monomial.c:53
void FixVariableInMonomial(unsigned int nv, double v, Tmonomial *f)
Replaces a variable by a constant.
Definition: monomial.c:31
double EvaluateMonomial(double *varValues, Tmonomial *f)
Evaluates a monomial for a given set of value for the variables.
Definition: monomial.c:197
boolean BilinearMonomial(Tmonomial *f)
Checks if a monomial is bilienal: K*x*y, with K a constant.
Definition: monomial.c:71
void ResetMonomial(Tmonomial *f)
Reset the monomial information.
Definition: monomial.c:24
boolean PolynomialMonomial(Tmonomial *f)
Identifies monimials not involving any kind of (trigonomitric function).
Definition: monomial.c:86
unsigned int CmpMonomial(Tmonomial *f1, Tmonomial *f2)
Monomial comparison.
Definition: monomial.c:103
A set of variable indexes with powers.
Definition: variable_set.h:131
Tvariable_set * GetMonomialVariables(Tmonomial *f)
Gets the variables of a monomial.
Definition: monomial.c:153
A scaled product of powers of variables.
Definition: monomial.h:32
void AddVariable2Monomial(unsigned int fn, unsigned int varid, unsigned int p, Tmonomial *f)
Adds a power variable to the monomial.
Definition: monomial.c:171
double GetMonomialCt(Tmonomial *f)
Gets the scale factor of a monomial.
Definition: monomial.c:136
unsigned int MonomialOrder(Tmonomial *f)
Gets the order of a monomial.
Definition: monomial.c:91
void EvaluateMonomialInt(Tinterval *varValues, Tinterval *i_out, Tmonomial *f)
Evaluates a monomial for a given set of ranges for the variables.
Definition: monomial.c:210
void PrintMonomial(FILE *file, boolean first, char **varNames, Tmonomial *f)
Prints a monomial.
Definition: monomial.c:255
void AddCt2Monomial(double k, Tmonomial *f)
Scales a monomial.
Definition: monomial.c:158
Defines a interval.
Definition: interval.h:33
void CopyMonomial(Tmonomial *f_dst, Tmonomial *f_orig)
Copy constructor.
Definition: monomial.c:96
void InitMonomial(Tmonomial *f)
Constructor.
Definition: monomial.c:17
boolean QuadraticMonomial(Tmonomial *f)
Checks if a monomial is quadratic: K*x^2, with K a constant.
Definition: monomial.c:64
Tvariable_set vars
Definition: monomial.h:35
void DeleteMonomial(Tmonomial *f)
Destructor.
Definition: monomial.c:289
void ReplaceVariableInMonomial(unsigned int nv, double ct, unsigned int nvNew, Tmonomial *f)
Replaces a variable.
Definition: monomial.c:42
Definition of the Tinterval type and the associated functions.