PPL  1.2
Expression_Adapter_inlines.hh
Go to the documentation of this file.
1 /* Expression_Adapter class implementation: inline functions.
2  Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
3  Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
4 
5 This file is part of the Parma Polyhedra Library (PPL).
6 
7 The PPL is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 The PPL is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
20 
21 For the most up-to-date information see the Parma Polyhedra Library
22 site: http://bugseng.com/products/ppl/ . */
23 
24 #ifndef PPL_Expression_Adapter_inlines_hh
25 #define PPL_Expression_Adapter_inlines_hh 1
26 
27 #include "Variables_Set_defs.hh"
28 
29 namespace Parma_Polyhedra_Library {
30 
31 template <typename T>
32 inline
34  : raw_(expr) {
35 }
36 
37 template <typename T>
40  return inner_type(raw_);
41 }
42 
43 template <typename T>
44 inline Representation
46  return inner().representation();
47 }
48 
49 template <typename T>
52  return inner().begin();
53 }
54 
55 template <typename T>
58  return inner().end();
59 }
60 
61 template <typename T>
64  return inner().lower_bound(v);
65 }
66 
67 template <typename T>
68 inline dimension_type
70  return inner().space_dimension();
71 }
72 
73 template <typename T>
74 inline Coefficient_traits::const_reference
76  return inner().coefficient(v);
77 }
78 
79 template <typename T>
80 inline Coefficient_traits::const_reference
82  return inner().inhomogeneous_term();
83 }
84 
85 template <typename T>
86 inline bool
88  return inner().is_zero();
89 }
90 
91 template <typename T>
92 inline bool
94  return inner().all_homogeneous_terms_are_zero();
95 }
96 
97 template <typename T>
98 template <typename Expression>
99 inline bool
100 Expression_Adapter<T>::is_equal_to(const Expression& y) const {
101  return inner().is_equal_to(y);
102 }
103 
104 template <typename T>
105 inline bool
107 ::all_zeroes(const Variables_Set& vars) const {
108  return inner().all_zeroes(vars);
109 }
110 
111 template <typename T>
112 inline Coefficient_traits::const_reference
114  return inner().get(i);
115 }
116 
117 template <typename T>
118 inline Coefficient_traits::const_reference
120  return inner().get(v);
121 }
122 
123 template <typename T>
124 inline bool
126  dimension_type end) const {
127  return inner().all_zeroes(start, end);
128 }
129 
130 template <typename T>
131 inline dimension_type
133  dimension_type end) const {
134  return inner().num_zeroes(start, end);
135 }
136 
137 template <typename T>
138 inline Coefficient
140  dimension_type end) const {
141  return inner().gcd(start, end);
142 }
143 
144 template <typename T>
145 inline dimension_type
147  return inner().last_nonzero();
148 }
149 
150 template <typename T>
151 inline dimension_type
153  dimension_type last) const {
154  return inner().last_nonzero(first, last);
155 }
156 
157 template <typename T>
158 inline dimension_type
160  dimension_type last) const {
161  return inner().first_nonzero(first, last);
162 }
163 
164 template <typename T>
165 inline bool
168  dimension_type start, dimension_type end) const {
169  return inner().all_zeroes_except(vars, start, end);
170 }
171 
172 template <typename T>
173 inline void
175 ::has_a_free_dimension_helper(std::set<dimension_type>& x) const {
176  inner().has_a_free_dimension_helper(x);
177 }
178 
179 template <typename T>
180 template <typename Expression>
181 inline bool
183 ::is_equal_to(const Expression& y,
184  dimension_type start, dimension_type end) const {
185  return inner().is_equal_to(y, start, end);
186 }
187 
188 template <typename T>
189 template <typename Expression>
190 inline bool
192 ::is_equal_to(const Expression& y,
193  Coefficient_traits::const_reference c1,
194  Coefficient_traits::const_reference c2,
195  dimension_type start, dimension_type end) const {
196  return inner().is_equal_to(y, c1, c2, start, end);
197 }
198 
199 template <typename T>
200 inline void
202  inner().get_row(r);
203 }
204 
205 template <typename T>
206 inline void
208  inner().get_row(r);
209 }
210 
211 template <typename T>
212 template <typename Expression>
213 inline bool
215 ::have_a_common_variable(const Expression& y,
216  Variable first, Variable last) const {
217  return inner().have_a_common_variable(y, first, last);
218 }
219 
220 template <typename T>
221 inline
224  : base_type(expr) {
225 }
226 
227 } // namespace Parma_Polyhedra_Library
228 
229 #endif // !defined(PPL_Expression_Adapter_inlines_hh)
T::raw_type raw_type
The raw, completely unwrapped type.
A finite sequence of coefficients.
size_t dimension_type
An unsigned integral type for representing space dimensions.
An std::set of variables' indexes.
An adapter for Linear_Expression objects.
T::const_reference inner_type
The type obtained by one-level unwrapping.
Expression_Adapter(const raw_type &expr)
Constructor.
bool all_zeroes(const Variables_Set &vars) const
Returns true if the coefficient of each variable in vars is zero.
bool is_equal_to(const Expression &y) const
Returns true if *this is equal to y.
A finite sparse sequence of coefficients.
void has_a_free_dimension_helper(std::set< dimension_type > &x) const
Removes from set x all the indexes of nonzero elements in *this.
A dimension of the vector space.
raw_type::const_iterator const_iterator
The type of const iterators on coefficients.
dimension_type num_zeroes(dimension_type start, dimension_type end) const
Returns the number of zero coefficient in [start, end).
dimension_type first_nonzero(dimension_type first, dimension_type last) const
inner_type inner() const
Returns an adapter after one-level unwrapping.
Representation representation() const
Returns the current representation of *this.
PPL_COEFFICIENT_TYPE Coefficient
An alias for easily naming the type of PPL coefficients.
Coefficient_traits::const_reference coefficient(Variable v) const
Returns the coefficient of v in *this.
bool have_a_common_variable(const Expression &y, Variable first, Variable last) const
Coefficient_traits::const_reference get(dimension_type i) const
Returns the i -th coefficient.
bool is_zero() const
Returns true if and only if *this is zero.
The entire library is confined to this namespace.
Definition: version.hh:61
bool all_zeroes_except(const Variables_Set &vars, dimension_type start, dimension_type end) const
Returns true if all coefficients in [start,end), except those corresponding to variables in vars...
void get_row(Dense_Row &r) const
Sets r to a copy of the row as adapted by *this.
bool all_homogeneous_terms_are_zero() const
Returns true if and only if all the homogeneous terms of *this are zero.
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
const_iterator begin() const
Iterator pointing to the first nonzero variable coefficient.
Coefficient gcd(dimension_type start, dimension_type end) const
Returns the gcd of the nonzero coefficients in [start,end). Returns zero if all the coefficients in t...
Coefficient_traits::const_reference inhomogeneous_term() const
Returns the inhomogeneous term of *this.
const_iterator end() const
Iterator pointing after the last nonzero variable coefficient.