(Event+Time).Variant Operators  2.3
Operators for Timed Discrete Event Systems in Dioids
polyEd.h
Go to the documentation of this file.
1 #ifndef POLYED_H
2 #define POLYED_H
3 
4 #include "Ed.h"
5 #include "../wrapperMMGD/matrixWrapper.h"
6 #include "../wrapperMMGD/seriesWrapper.h"
7 #include "../common/ISterm.h"
8 #include "../wrapperMMGD/polyWrapper.h"
9 
15 namespace etvo
16 {
17 
29  class seriesEd; // anticipate declaration
30 
31 class polyEd:public ISterm
32 {
33 public:
35  static polyEd Epsilon();
37  static polyEd E();
39  static polyEd Top();
40 
42  polyEd();
44  polyEd(bool TopNotE); //true Top false E
46  polyEd(const Ed & m);
49  polyEd(const std::vector<Ed> & v);
50 
52  bool isCanon() const;
54  void canon();
55 
57  bool isE() const;
58 
60  polyEd oplus(const polyEd &p) const;
62  polyEd operator+(const polyEd &p) const;
64  polyEd oplusCD(const polyEd &p) const;
66  polyEd operator+(const Ed & m)const;
67 
69  void add(const Ed & m);
71  polyEd operator+=(const Ed & m);
72 
74  polyEd operator*(const polyEd & p) const;
76  polyEd otimes(const polyEd &p) const;
78  polyEd operator*(const Ed & m) const;
79 
80  static polyEd otimes(const Ed & m,const polyEd & p);
82  polyEd otimesCD(const polyEd &p) const;
83 
85  polyEd inf(const polyEd & p) const;
88  polyEd infCD(const polyEd & p) const;
89 
95  seriesEd star() const;
96 
98  polyEd lfrac(const polyEd &) const;
101  polyEd lfracCD(const polyEd &) const;
103  polyEd lfrac(const Ed & m) const;
105  polyEd rfrac(const polyEd &) const;
108  polyEd rfracCD(const polyEd &) const;
110  polyEd rfrac(const Ed & m) const;
111 
113  bool operator==(const polyEd &) const;
115  bool operator!=(const polyEd &) const;
117  bool operator<=(const polyEd &) const;
119  bool operator>=(const polyEd & ) const;
120 
123  static polyEd toPolyEd(const poly & p);
125  poly toPoly() const;
127  static polyEd toCausal(const polyEd & p);
130  Ed getFirstDif(const polyEd & p) const;
131 
133  polyEd transientStar(int Tmax) const;
134 
136  void getMaxGain(unsigned int & mu, unsigned int & beta) const;
138  void getLcmGain(unsigned int & mu, unsigned int & beta) const;
140  std::pair<unsigned int, unsigned int> getPeriodicity() const;
141 
143  std::vector<Ed> getTerms() const;
145  void removeTerm(unsigned idx);
146 
148  Ed operator[](unsigned idx) const;
150  unsigned int size() const;
151 
153  std::string toString() const;
155  std::string toStringAsMuVar() const;
156 
157 
158 
165  matrix<poly> getCore(unsigned ratio=1) const;
166 
168  static polyEd coreToPolyEd(const matrix<poly>& core);
169 
173  static etvo::matrix<poly> getMatN(unsigned size);
174 
176  matrix<poly> getCoreMax(unsigned ratio=1) const;
177 
180 
181  polyEd odot(const polyEd &p) const;
182  polyEd osum(const polyEd &p) const;
183 
184 private:
185  void sort();
186  void simplify();
187  //void SimplifyUpTo(unsigned idx); //TODO to improve the sum with Ed
188  std::vector<Ed> _poly;
189 };
190 std::ostream & operator<<(std::ostream & st,const polyEd & p);
191 }
192 #endif // POLYED_H
bool operator>=(const polyEd &) const
Check order on polynomials in E[[d]].
Definition: polyEd.cpp:460
static polyEd toCausal(const polyEd &p)
returns a causal polynomial in E[[d]]
Definition: polyEd.cpp:494
bool isE() const
check if is equal to E()=g0.d0
Definition: polyEd.cpp:65
polyEd otimesCD(const polyEd &p) const
Product of polynomials in E[[d]] via a Core Decomposition (see j.Trunk thesis)
Definition: polyEd.cpp:265
polyEd rfrac(const polyEd &) const
Computation of the right-multiplication residuation: p1.rfrac(p2) =p1/p2= greatest x s...
Definition: polyEd.cpp:369
Class for polynomials in the semiring E[[d]].
Definition: polyEd.h:31
polyEd operator+=(const Ed &m)
Lies on polyEd::add(const Ed & m) method.
Definition: polyEd.cpp:184
matrix< poly > getCore(unsigned ratio=1) const
Definition: polyEd.cpp:637
polyEd lfrac(const polyEd &) const
Computation of the left-multiplication residuation: p1.lfrac(p2) =p2= greatest x s.t. p2.x <= p1.
Definition: polyEd.cpp:324
the script description of a color in POV-Ray
Definition: PovRay.h:38
polyEd lfracCD(const polyEd &) const
Definition: polyEd.cpp:339
polyEd oplusCD(const polyEd &p) const
Sum of polynomials in E[[d]] via a Core Decomposition (see J.Trunk Thesis)
Definition: polyEd.cpp:97
polyEd operator*(const polyEd &p) const
Product of polynomials in E[[d]].
Definition: polyEd.cpp:209
polyEd infCD(const polyEd &p) const
Definition: polyEd.cpp:298
std::ostream & operator<<(std::ostream &f, const dDd &m)
Definition: dDd.cpp:313
bool operator==(const polyEd &) const
Check equality.
Definition: polyEd.cpp:410
Definition: matrixWrapper.h:33
void removeTerm(unsigned idx)
remove term number i in the polynomial
Definition: polyEd.cpp:583
Definition: etvoException.cpp:5
static polyEd Top()
Top element.
Definition: polyEd.cpp:19
polyEd()
default initialization to Epsilon
Definition: polyEd.cpp:23
polyEd transientStar(int Tmax) const
Do not use it. Use polyEd::star(). Only for DEBUGGING purpose.
Definition: polyEd.cpp:518
unsigned int size() const
Returns the size = the number of monomials. For Epsilon and Top, size=0.
Definition: polyEd.cpp:594
polyEd operator+(const polyEd &p) const
Sum of polynomials in E[[d]].
Definition: polyEd.cpp:74
polyEd inf(const polyEd &p) const
Infimum of two polynomials in E[[d]] : p1.inf(p2) = greatest x s.t. x<=p1 and x<=p2.
Definition: polyEd.cpp:281
seriesEd star() const
Definition: polyEd.cpp:317
void canon()
set to the canonical form
Definition: polyEd.cpp:58
std::pair< unsigned int, unsigned int > getPeriodicity() const
Returns the periodicity as a pair.
Definition: polyEd.cpp:571
bool operator<=(const polyEd &) const
Check order on polynomials in E[[d]].
Definition: polyEd.cpp:440
bool isCanon() const
Check if a polyEd is in canonical form, say for a sum w_id^t_i, w_i and t_i are strictly ordered...
Definition: polyEd.cpp:41
void getLcmGain(unsigned int &mu, unsigned int &beta) const
Gives th Least Common multiple of gains.
Definition: polyEd.cpp:554
void add(const Ed &m)
The current polynomial pcur is modified as pcur=pcur+m.
Definition: polyEd.cpp:151
std::string toStringAsMuVar() const
returns a string that gives the description of the current polynomial as a sum of g^n...
Definition: polyEd.cpp:617
static polyEd E()
E element.
Definition: polyEd.cpp:17
polyEd otimes(const polyEd &p) const
Product of polynomials in E[[d]].
Definition: polyEd.cpp:226
bool operator!=(const polyEd &) const
Check difference.
Definition: polyEd.cpp:425
std::vector< Ed > getTerms() const
return the monomials as a collection of Ed terms
Definition: polyEd.cpp:578
Ed operator[](unsigned idx) const
Returns a copy of monomial in position idx in the polynomial.
Definition: polyEd.cpp:589
polyEd oplus(const polyEd &p) const
Sum of polynomials in E[[d]].
Definition: polyEd.cpp:92
Class for ultimately-periodic series in the semiring E[[d]]. In a general way, the series are describ...
Definition: seriesEd.h:40
static polyEd coreToPolyEd(const matrix< poly > &core)
computes the recomposition of a polyEd polynomial from a Core Decomposition core. ...
Definition: polyEd.cpp:685
Ed getFirstDif(const polyEd &p) const
Definition: polyEd.cpp:507
Class for monomials in the semiring E[[d]].
Definition: Ed.h:24
poly toPoly() const
The zero-slice polynomial in MinMax[[g,d]].
Definition: polyEd.cpp:482
polyEd rfracCD(const polyEd &) const
Definition: polyEd.cpp:382
matrix< poly > getCoreMax(unsigned ratio=1) const
returns the maximal Core matrix<poly> (in MinMax[[g,d]]) of the current polynomial ...
Definition: polyEd.cpp:722
static etvo::matrix< poly > getMatN(unsigned size)
Definition: polyEd.cpp:709
static polyEd Epsilon()
Epsilon element.
Definition: polyEd.cpp:15
static polyEd toPolyEd(const poly &p)
An injection from MinMax[[g,d]] to E[[d]].
Definition: polyEd.cpp:466
Wrapper class to mmgd::poly from from MinMaxGD library.
Definition: polyWrapper.h:34
void getMaxGain(unsigned int &mu, unsigned int &beta) const
Gives the maximal gain.
Definition: polyEd.cpp:535
Abstract base class to handle Idempotent Semiring terms.
Definition: ISterm.h:27
Used to generate POV-Ray scripts to draw 3D descriptions of polyEd and polyTg objects.
Definition: PovRay.h:19
void toPov(graphicPR::PovRay &pov, graphicPR::PovRay::Color c)
used in the creation of POV-Ray script for a polyEd object
Definition: polyEd.cpp:730
std::string toString() const
returns a string that gives the description of the current polynomial. Is depending on the canonical ...
Definition: polyEd.cpp:599