All Classes Functions Friends
polynomial.h
1 #ifndef _BPAS_POLYNOMIAL_H_
2 #define _BPAS_POLYNOMIAL_H_
3 
4 /**
5  * Abstract Polynomial Classes
6  **/
7 
8 #include "ring.h"
9 
10 typedef int DataType; // Different data type for each concrete polynomial
11 
12 class BPASPolynomial : public BPASRing {
13  public:
14  BPASPolynomial& operator= (BPASPolynomial&);
15  BPASPolynomial& operator+ (BPASPolynomial&);
16  BPASPolynomial& operator+= (BPASPolynomial&);
17  BPASPolynomial& operator- (BPASPolynomial&);
18  BPASPolynomial& operator- ();
19  BPASPolynomial& operator-= (BPASPolynomial&);
20  BPASPolynomial& operator* (BPASPolynomial&);
21  BPASPolynomial& operator*= (BPASPolynomial&);
22  BPASPolynomial& operator/ (BPASPolynomial&);
23  BPASPolynomial& operator/= (BPASPolynomial&);
24  BPASPolynomial& operator^ (int);
25  bool operator== (BPASPolynomial&);
26  bool operator!= (BPASPolynomial&);
27  friend std::ostream& operator<< (std::ostream&, BPASPolynomial&);
28 };
29 
31  public:
32  BPASUnivariatePolynomial& operator+ (DataType);
33  BPASUnivariatePolynomial& operator+= (DataType);
34  BPASUnivariatePolynomial& operator- (DataType);
35  BPASUnivariatePolynomial& operator-= (DataType);
36  BPASUnivariatePolynomial& operator* (DataType);
37  BPASUnivariatePolynomial& operator*= (DataType);
38  BPASUnivariatePolynomial& operator/ (DataType);
39  BPASUnivariatePolynomial& operator/= (DataType);
40  BPASUnivariatePolynomial& operator<< (int);
41  BPASUnivariatePolynomial& operator<<= (int);
42  BPASUnivariatePolynomial& operator>> (int);
43  BPASUnivariatePolynomial& operator>>= (int);
44 
47  BPASUnivariatePolynomial& lazyPseudoDivide(BPASUnivariatePolynomial&, DataType*, DataType*);
48  BPASUnivariatePolynomial& lazyPseudoDivide(BPASUnivariatePolynomial&, BPASUnivariatePolynomial*, DataType*, DataType*);
49  BPASUnivariatePolynomial& pseudoDivide(BPASUnivariatePolynomial&, DataType*);
51  virtual void differentiate(int) = 0;
52  DataType content();
54  std::vector<BPASUnivariatePolynomial&> squareFree();
55 
56  /* Get the degree of the univariate polynomial */
57  virtual int degree() = 0;
58  /* Get the leading coefficient */
59  DataType leadingCoefficient();
60  /* Get a coefficient */
61  DataType coefficient(int);
62  /* Set a coefficient */
63  void setCoefficient(int, DataType);
64  /* Set the variable's name*/
65  virtual void setVariableName (std::string) = 0;
66  /* Get variable name */
67  virtual std::string variable() = 0;
68  /* Is the least signficant coefficient zero */
69  virtual bool isTrailingCoefficientZero() = 0;
70  /* Evaluate the polynomial, given a value of the variable */
71  DataType evaluate(DataType);
72 };
73 
75  public:
76  /* Get the number of variables */
77  virtual int numberOfVariables() = 0;
78  /* Get the number of non-zero terms */
79  virtual int numberOfTerms() = 0;
80  /* Get the degree of a variable */
81  virtual int degree(std::string) = 0;
82  /* Get the leading coefficient */
83  DataType leadingCoefficient();
84  /* Get a coefficient, given the exponent of each variable */
85  DataType coefficient(int, int*);
86  /* Set a coefficient */
87  void setCoefficient(int, int*, DataType);
88  /* Set variables' name */
89  virtual void setVariableNames (std::vector<std::string>) = 0;
90  /* Get variable names */
91  virtual std::vector<std::string> variables() = 0;
92 };
93 
95  public:
96  /* Get the number of variables */
97  virtual int numberOfVariables() = 0;
98  /* Get variable names */
99  virtual std::vector<std::string> variables() = 0;
100  BPASMultivariatePolynomial& select(std::string);
101  BPASTriangularSet& under(std::string);
102  BPASTriangularSet& upper(std::string);
103  BPASMultivariatePolynomial& pseudoDivide (BPASMultivariatePolynomial&, std::vector<BPASMultivariatePolynomial&>*, BPASMultivariatePolynomial*);
104  BPASMultivariatePolynomial& monicDivide (BPASMultivariatePolynomial&, std::vector<BPASMultivariatePolynomial&>*);
105 };
106 
108  public:
110 };
111 
113  public:
114  virtual void canonicalize() = 0;
115  BPASPolynomial& numerator();
116  BPASPolynomial& denominator();
117 };
118 
119 #endif
120 /* This file is part of the BPAS library http://www.bpaslib.org
121 
122  BPAS is free software: you can redistribute it and/or modify
123  it under the terms of the GNU General Public License as published by
124  the Free Software Foundation, either version 3 of the License, or
125  (at your option) any later version.
126 
127  BPAS is distributed in the hope that it will be useful,
128  but WITHOUT ANY WARRANTY; without even the implied warranty of
129  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
130  GNU General Public License for more details.
131 
132  You should have received a copy of the GNU General Public License
133  along with BPAS. If not, see <http://www.gnu.org/licenses/>.
134 
135  Copyright: Changbo Chen <changbo.chen@hotmail.com>
136  Farnam Mansouri <mansouri.farnam@gmail.com>
137  Marc Moreno Maza <moreno@csd.uwo.ca>
138  Ning Xie <nxie6@csd.uwo.ca>
139  Yuzhen Xie <yuzhenxie@yahoo.ca>
140 
141 */
142 
143 
Definition: ring.h:14
Definition: polynomial.h:112
Definition: polynomial.h:12
Definition: polynomial.h:74
Definition: polynomial.h:30
Definition: polynomial.h:94
Definition: ring.h:28
Definition: polynomial.h:107