00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef PPL_Partially_Reduced_Product_inlines_hh
00024 #define PPL_Partially_Reduced_Product_inlines_hh 1
00025
00026 #include "compiler.hh"
00027
00028 namespace Parma_Polyhedra_Library {
00029
00030 template <typename D1, typename D2, typename R>
00031 inline dimension_type
00032 Partially_Reduced_Product<D1, D2, R>::max_space_dimension() {
00033 return std::min(D1::max_space_dimension(), D2::max_space_dimension());
00034 }
00035
00036 template <typename D1, typename D2, typename R>
00037 inline
00038 Partially_Reduced_Product<D1, D2, R>
00039 ::Partially_Reduced_Product(dimension_type num_dimensions,
00040 const Degenerate_Element kind)
00041 : d1(num_dimensions, kind), d2(num_dimensions, kind) {
00042 set_reduced_flag();
00043 }
00044
00045 template <typename D1, typename D2, typename R>
00046 inline
00047 Partially_Reduced_Product<D1, D2, R>
00048 ::Partially_Reduced_Product(const Congruence_System& ccgs)
00049 : d1(ccgs), d2(ccgs) {
00050 clear_reduced_flag();
00051 }
00052
00053 template <typename D1, typename D2, typename R>
00054 inline
00055 Partially_Reduced_Product<D1, D2, R>
00056 ::Partially_Reduced_Product(Congruence_System& cgs)
00057 : d1(const_cast<const Congruence_System&>(cgs)), d2(cgs) {
00058 clear_reduced_flag();
00059 }
00060
00061 template <typename D1, typename D2, typename R>
00062 inline
00063 Partially_Reduced_Product<D1, D2, R>
00064 ::Partially_Reduced_Product(const Constraint_System& ccs)
00065 : d1(ccs), d2(ccs) {
00066 clear_reduced_flag();
00067 }
00068
00069 template <typename D1, typename D2, typename R>
00070 inline
00071 Partially_Reduced_Product<D1, D2, R>
00072 ::Partially_Reduced_Product(Constraint_System& cs)
00073 : d1(const_cast<const Constraint_System&>(cs)), d2(cs) {
00074 clear_reduced_flag();
00075 }
00076
00077 template <typename D1, typename D2, typename R>
00078 inline
00079 Partially_Reduced_Product<D1, D2, R>
00080 ::Partially_Reduced_Product(const C_Polyhedron& ph,
00081 Complexity_Class complexity)
00082 : d1(ph, complexity), d2(ph, complexity) {
00083 set_reduced_flag();
00084 }
00085
00086 template <typename D1, typename D2, typename R>
00087 inline
00088 Partially_Reduced_Product<D1, D2, R>
00089 ::Partially_Reduced_Product(const NNC_Polyhedron& ph,
00090 Complexity_Class complexity)
00091 : d1(ph, complexity), d2(ph, complexity) {
00092 set_reduced_flag();
00093 }
00094
00095 template <typename D1, typename D2, typename R>
00096 inline
00097 Partially_Reduced_Product<D1, D2, R>
00098 ::Partially_Reduced_Product(const Grid& gr, Complexity_Class)
00099 : d1(gr), d2(gr) {
00100 set_reduced_flag();
00101 }
00102
00103 template <typename D1, typename D2, typename R>
00104 template <typename Interval>
00105 inline
00106 Partially_Reduced_Product<D1, D2, R>
00107 ::Partially_Reduced_Product(const Box<Interval>& box, Complexity_Class)
00108 : d1(box), d2(box) {
00109 set_reduced_flag();
00110 }
00111
00112 template <typename D1, typename D2, typename R>
00113 template <typename U>
00114 inline
00115 Partially_Reduced_Product<D1, D2, R>
00116 ::Partially_Reduced_Product(const BD_Shape<U>& bd, Complexity_Class)
00117 : d1(bd), d2(bd) {
00118 set_reduced_flag();
00119 }
00120
00121 template <typename D1, typename D2, typename R>
00122 template <typename U>
00123 inline
00124 Partially_Reduced_Product<D1, D2, R>
00125 ::Partially_Reduced_Product(const Octagonal_Shape<U>& os, Complexity_Class)
00126 : d1(os), d2(os) {
00127 set_reduced_flag();
00128 }
00129
00130 template <typename D1, typename D2, typename R>
00131 inline
00132 Partially_Reduced_Product<D1, D2, R>
00133 ::Partially_Reduced_Product(const Partially_Reduced_Product& y,
00134 Complexity_Class)
00135 : d1(y.d1), d2(y.d2) {
00136 reduced = y.reduced;
00137 }
00138
00139 template <typename D1, typename D2, typename R>
00140 template <typename E1, typename E2, typename S>
00141 inline
00142 Partially_Reduced_Product<D1, D2, R>
00143 ::Partially_Reduced_Product(const Partially_Reduced_Product<E1, E2, S>& y,
00144 Complexity_Class complexity)
00145 : d1(y.domain1(), complexity), d2(y.domain2(), complexity) {
00146
00147
00148 clear_reduced_flag();
00149 }
00150
00151 template <typename D1, typename D2, typename R>
00152 inline
00153 Partially_Reduced_Product<D1, D2, R>::~Partially_Reduced_Product() {
00154 }
00155
00156 template <typename D1, typename D2, typename R>
00157 inline memory_size_type
00158 Partially_Reduced_Product<D1, D2, R>::external_memory_in_bytes() const {
00159 return d1.external_memory_in_bytes() + d2.external_memory_in_bytes();
00160 }
00161
00162 template <typename D1, typename D2, typename R>
00163 inline memory_size_type
00164 Partially_Reduced_Product<D1, D2, R>::total_memory_in_bytes() const {
00165 return sizeof(*this) + external_memory_in_bytes();
00166 }
00167
00168 template <typename D1, typename D2, typename R>
00169 inline dimension_type
00170 Partially_Reduced_Product<D1, D2, R>::space_dimension() const {
00171 assert(d1.space_dimension() == d2.space_dimension());
00172 return d1.space_dimension();
00173 }
00174
00175 template <typename D1, typename D2, typename R>
00176 inline dimension_type
00177 Partially_Reduced_Product<D1, D2, R>::affine_dimension() const {
00178 reduce();
00179 const dimension_type d1_dim = d1.affine_dimension();
00180 const dimension_type d2_dim = d2.affine_dimension();
00181 return std::min(d1_dim, d2_dim);
00182 }
00183
00184 template <typename D1, typename D2, typename R>
00185 inline void
00186 Partially_Reduced_Product<D1, D2, R>
00187 ::unconstrain(const Variable var) {
00188 reduce();
00189 d1.unconstrain(var);
00190 d2.unconstrain(var);
00191 }
00192
00193 template <typename D1, typename D2, typename R>
00194 inline void
00195 Partially_Reduced_Product<D1, D2, R>
00196 ::unconstrain(const Variables_Set& to_be_unconstrained) {
00197 reduce();
00198 d1.unconstrain(to_be_unconstrained);
00199 d2.unconstrain(to_be_unconstrained);
00200 }
00201
00202 template <typename D1, typename D2, typename R>
00203 inline void
00204 Partially_Reduced_Product<D1, D2, R>
00205 ::intersection_assign(const Partially_Reduced_Product& y) {
00206 d1.intersection_assign(y.d1);
00207 d2.intersection_assign(y.d2);
00208 clear_reduced_flag();
00209 }
00210
00211 template <typename D1, typename D2, typename R>
00212 inline void
00213 Partially_Reduced_Product<D1, D2, R>
00214 ::difference_assign(const Partially_Reduced_Product& y) {
00215 reduce();
00216 y.reduce();
00217 d1.difference_assign(y.d1);
00218 d2.difference_assign(y.d2);
00219
00220 clear_reduced_flag();
00221 }
00222
00223 template <typename D1, typename D2, typename R>
00224 inline void
00225 Partially_Reduced_Product<D1, D2, R>
00226 ::upper_bound_assign(const Partially_Reduced_Product& y) {
00227 reduce();
00228 y.reduce();
00229 d1.upper_bound_assign(y.d1);
00230 d2.upper_bound_assign(y.d2);
00231
00232
00233
00234 }
00235
00236 template <typename D1, typename D2, typename R>
00237 inline bool
00238 Partially_Reduced_Product<D1, D2, R>
00239 ::upper_bound_assign_if_exact(const Partially_Reduced_Product& y) {
00240 reduce();
00241 y.reduce();
00242 D1 d1_copy = d1;
00243 bool ub_exact = d1_copy.upper_bound_assign_if_exact(y.d1);
00244 if (!ub_exact)
00245 return false;
00246 ub_exact = d2.upper_bound_assign_if_exact(y.d2);
00247 if (!ub_exact)
00248 return false;
00249 std::swap(d1,d1_copy);
00250 return true;
00251 }
00252
00253 template <typename D1, typename D2, typename R>
00254 inline void
00255 Partially_Reduced_Product<D1, D2, R>
00256 ::affine_image(Variable var,
00257 const Linear_Expression& expr,
00258 Coefficient_traits::const_reference denominator) {
00259 d1.affine_image(var, expr, denominator);
00260 d2.affine_image(var, expr, denominator);
00261 }
00262
00263 template <typename D1, typename D2, typename R>
00264 inline void
00265 Partially_Reduced_Product<D1, D2, R>
00266 ::affine_preimage(Variable var,
00267 const Linear_Expression& expr,
00268 Coefficient_traits::const_reference denominator) {
00269 d1.affine_preimage(var, expr, denominator);
00270 d2.affine_preimage(var, expr, denominator);
00271 }
00272
00273 template <typename D1, typename D2, typename R>
00274 inline void
00275 Partially_Reduced_Product<D1, D2, R>
00276 ::generalized_affine_image(Variable var,
00277 const Relation_Symbol relsym,
00278 const Linear_Expression& expr,
00279 Coefficient_traits::const_reference denominator) {
00280 d1.generalized_affine_image(var, relsym, expr, denominator);
00281 d2.generalized_affine_image(var, relsym, expr, denominator);
00282 }
00283
00284 template <typename D1, typename D2, typename R>
00285 inline void
00286 Partially_Reduced_Product<D1, D2, R>
00287 ::generalized_affine_preimage(Variable var,
00288 const Relation_Symbol relsym,
00289 const Linear_Expression& expr,
00290 Coefficient_traits::const_reference denominator) {
00291 d1.generalized_affine_preimage(var, relsym, expr, denominator);
00292 d2.generalized_affine_preimage(var, relsym, expr, denominator);
00293 }
00294
00295 template <typename D1, typename D2, typename R>
00296 inline void
00297 Partially_Reduced_Product<D1, D2, R>
00298 ::generalized_affine_image(const Linear_Expression& lhs,
00299 const Relation_Symbol relsym,
00300 const Linear_Expression& rhs) {
00301 d1.generalized_affine_image(lhs, relsym, rhs);
00302 d2.generalized_affine_image(lhs, relsym, rhs);
00303 }
00304
00305 template <typename D1, typename D2, typename R>
00306 inline void
00307 Partially_Reduced_Product<D1, D2, R>
00308 ::generalized_affine_preimage(const Linear_Expression& lhs,
00309 const Relation_Symbol relsym,
00310 const Linear_Expression& rhs) {
00311 d1.generalized_affine_preimage(lhs, relsym, rhs);
00312 d2.generalized_affine_preimage(lhs, relsym, rhs);
00313 }
00314
00315
00316 template <typename D1, typename D2, typename R>
00317 inline void
00318 Partially_Reduced_Product<D1, D2, R>
00319 ::bounded_affine_image(Variable var,
00320 const Linear_Expression& lb_expr,
00321 const Linear_Expression& ub_expr,
00322 Coefficient_traits::const_reference denominator) {
00323 d1.bounded_affine_image(var, lb_expr, ub_expr, denominator);
00324 d2.bounded_affine_image(var, lb_expr, ub_expr, denominator);
00325
00326 clear_reduced_flag();
00327 }
00328
00329 template <typename D1, typename D2, typename R>
00330 inline void
00331 Partially_Reduced_Product<D1, D2, R>
00332 ::bounded_affine_preimage(Variable var,
00333 const Linear_Expression& lb_expr,
00334 const Linear_Expression& ub_expr,
00335 Coefficient_traits::const_reference denominator) {
00336 d1.bounded_affine_preimage(var, lb_expr, ub_expr, denominator);
00337 d2.bounded_affine_preimage(var, lb_expr, ub_expr, denominator);
00338
00339 clear_reduced_flag();
00340 }
00341
00342 template <typename D1, typename D2, typename R>
00343 inline void
00344 Partially_Reduced_Product<D1, D2, R>
00345 ::time_elapse_assign(const Partially_Reduced_Product& y) {
00346 reduce();
00347 d1.time_elapse_assign(y.d1);
00348 d2.time_elapse_assign(y.d2);
00349
00350 clear_reduced_flag();
00351 }
00352
00353 template <typename D1, typename D2, typename R>
00354 inline void
00355 Partially_Reduced_Product<D1, D2, R>::topological_closure_assign() {
00356 d1.topological_closure_assign();
00357 d2.topological_closure_assign();
00358 }
00359
00360 template <typename D1, typename D2, typename R>
00361 inline void
00362 Partially_Reduced_Product<D1, D2, R>::swap(Partially_Reduced_Product& y) {
00363 std::swap(d1, y.d1);
00364 std::swap(d2, y.d2);
00365 std::swap(reduced, y.reduced);
00366 }
00367
00368 template <typename D1, typename D2, typename R>
00369 inline void
00370 Partially_Reduced_Product<D1, D2, R>::add_constraint(const Constraint& c) {
00371 d1.add_constraint(c);
00372 d2.add_constraint(c);
00373 clear_reduced_flag();
00374 }
00375
00376 template <typename D1, typename D2, typename R>
00377 inline void
00378 Partially_Reduced_Product<D1, D2, R>::refine_with_constraint(const Constraint& c) {
00379 d1.refine_with_constraint(c);
00380 d2.refine_with_constraint(c);
00381 clear_reduced_flag();
00382 }
00383
00384 template <typename D1, typename D2, typename R>
00385 inline void
00386 Partially_Reduced_Product<D1, D2, R>::add_congruence(const Congruence& cg) {
00387 d1.add_congruence(cg);
00388 d2.add_congruence(cg);
00389 clear_reduced_flag();
00390 }
00391
00392 template <typename D1, typename D2, typename R>
00393 inline void
00394 Partially_Reduced_Product<D1, D2, R>::refine_with_congruence(const Congruence& cg) {
00395 d1.refine_with_congruence(cg);
00396 d2.refine_with_congruence(cg);
00397 clear_reduced_flag();
00398 }
00399
00400 template <typename D1, typename D2, typename R>
00401 inline void
00402 Partially_Reduced_Product<D1, D2, R>
00403 ::add_constraints(const Constraint_System& cs) {
00404 d1.add_constraints(cs);
00405 d2.add_constraints(cs);
00406 clear_reduced_flag();
00407 }
00408
00409 template <typename D1, typename D2, typename R>
00410 inline void
00411 Partially_Reduced_Product<D1, D2, R>
00412 ::refine_with_constraints(const Constraint_System& cs) {
00413 d1.refine_with_constraints(cs);
00414 d2.refine_with_constraints(cs);
00415 clear_reduced_flag();
00416 }
00417
00418 template <typename D1, typename D2, typename R>
00419 inline void
00420 Partially_Reduced_Product<D1, D2, R>
00421 ::add_congruences(const Congruence_System& cgs) {
00422 d1.add_congruences(cgs);
00423 d2.add_congruences(cgs);
00424 clear_reduced_flag();
00425 }
00426
00427 template <typename D1, typename D2, typename R>
00428 inline void
00429 Partially_Reduced_Product<D1, D2, R>
00430 ::refine_with_congruences(const Congruence_System& cgs) {
00431 d1.refine_with_congruences(cgs);
00432 d2.refine_with_congruences(cgs);
00433 clear_reduced_flag();
00434 }
00435
00436 template <typename D1, typename D2, typename R>
00437 inline Partially_Reduced_Product<D1, D2, R>&
00438 Partially_Reduced_Product<D1, D2, R>
00439 ::operator=(const Partially_Reduced_Product& y) {
00440 d1 = y.d1;
00441 d2 = y.d2;
00442 reduced = y.reduced;
00443 return *this;
00444 }
00445
00446 template <typename D1, typename D2, typename R>
00447 inline const D1&
00448 Partially_Reduced_Product<D1, D2, R>::domain1() const {
00449 reduce();
00450 return d1;
00451 }
00452
00453 template <typename D1, typename D2, typename R>
00454 inline const D2&
00455 Partially_Reduced_Product<D1, D2, R>::domain2() const {
00456 reduce();
00457 return d2;
00458 }
00459
00460 template <typename D1, typename D2, typename R>
00461 inline bool
00462 Partially_Reduced_Product<D1, D2, R>::is_empty() const {
00463 reduce();
00464 return d1.is_empty() || d2.is_empty();
00465 }
00466
00467 template <typename D1, typename D2, typename R>
00468 inline bool
00469 Partially_Reduced_Product<D1, D2, R>::is_universe() const {
00470 return d1.is_universe() && d2.is_universe();
00471 }
00472
00473 template <typename D1, typename D2, typename R>
00474 inline bool
00475 Partially_Reduced_Product<D1, D2, R>::is_topologically_closed() const {
00476 reduce();
00477 return d1.is_topologically_closed() && d2.is_topologically_closed();
00478 }
00479
00480 template <typename D1, typename D2, typename R>
00481 inline bool
00482 Partially_Reduced_Product<D1, D2, R>
00483 ::is_disjoint_from(const Partially_Reduced_Product& y) const {
00484 reduce();
00485 y.reduce();
00486 return d1.is_disjoint_from(y.d1) || d2.is_disjoint_from(y.d2);
00487 }
00488
00489 template <typename D1, typename D2, typename R>
00490 inline bool
00491 Partially_Reduced_Product<D1, D2, R>::is_discrete() const {
00492 reduce();
00493 return d1.is_discrete() || d2.is_discrete();
00494 }
00495
00496 template <typename D1, typename D2, typename R>
00497 inline bool
00498 Partially_Reduced_Product<D1, D2, R>::is_bounded() const {
00499 reduce();
00500 return d1.is_bounded() || d2.is_bounded();
00501 }
00502
00503 template <typename D1, typename D2, typename R>
00504 inline bool
00505 Partially_Reduced_Product<D1, D2, R>
00506 ::bounds_from_above(const Linear_Expression& expr) const {
00507 reduce();
00508 return d1.bounds_from_above(expr) || d2.bounds_from_above(expr);
00509 }
00510
00511 template <typename D1, typename D2, typename R>
00512 inline bool
00513 Partially_Reduced_Product<D1, D2, R>
00514 ::bounds_from_below(const Linear_Expression& expr) const {
00515 reduce();
00516 return d1.bounds_from_below(expr) || d2.bounds_from_below(expr);
00517 }
00518
00519 template <typename D1, typename D2, typename R>
00520 inline bool
00521 Partially_Reduced_Product<D1, D2, R>::constrains(Variable var) const {
00522 reduce();
00523 return d1.constrains(var) || d2.constrains(var);
00524 }
00525
00526 template <typename D1, typename D2, typename R>
00527 inline void
00528 Partially_Reduced_Product<D1, D2, R>
00529 ::widening_assign(const Partially_Reduced_Product& y,
00530 unsigned* tp) {
00531
00532
00533
00534
00535
00536 reduce();
00537 y.reduce();
00538 d1.widening_assign(y.d1, tp);
00539 d2.widening_assign(y.d2, tp);
00540 }
00541
00542 template <typename D1, typename D2, typename R>
00543 inline void
00544 Partially_Reduced_Product<D1, D2, R>
00545 ::add_space_dimensions_and_embed(dimension_type m) {
00546 d1.add_space_dimensions_and_embed(m);
00547 d2.add_space_dimensions_and_embed(m);
00548 }
00549
00550 template <typename D1, typename D2, typename R>
00551 inline void
00552 Partially_Reduced_Product<D1, D2, R>
00553 ::add_space_dimensions_and_project(dimension_type m) {
00554 d1.add_space_dimensions_and_project(m);
00555 d2.add_space_dimensions_and_project(m);
00556 }
00557
00558 template <typename D1, typename D2, typename R>
00559 inline void
00560 Partially_Reduced_Product<D1, D2, R>
00561 ::concatenate_assign(const Partially_Reduced_Product& y) {
00562 d1.concatenate_assign(y.d1);
00563 d2.concatenate_assign(y.d2);
00564 if (!is_reduced() || !y.is_reduced())
00565 clear_reduced_flag();
00566 }
00567
00568 template <typename D1, typename D2, typename R>
00569 inline void
00570 Partially_Reduced_Product<D1, D2, R>
00571 ::remove_space_dimensions(const Variables_Set& to_be_removed) {
00572 d1.remove_space_dimensions(to_be_removed);
00573 d2.remove_space_dimensions(to_be_removed);
00574 }
00575
00576 template <typename D1, typename D2, typename R>
00577 inline void
00578 Partially_Reduced_Product<D1, D2, R>
00579 ::remove_higher_space_dimensions(dimension_type new_dimension) {
00580 d1.remove_higher_space_dimensions(new_dimension);
00581 d2.remove_higher_space_dimensions(new_dimension);
00582 }
00583
00584 template <typename D1, typename D2, typename R>
00585 template <typename Partial_Function>
00586 inline void
00587 Partially_Reduced_Product<D1, D2, R>
00588 ::map_space_dimensions(const Partial_Function& pfunc) {
00589 d1.map_space_dimensions(pfunc);
00590 d2.map_space_dimensions(pfunc);
00591 }
00592
00593 template <typename D1, typename D2, typename R>
00594 inline void
00595 Partially_Reduced_Product<D1, D2, R>
00596 ::expand_space_dimension(Variable var, dimension_type m) {
00597 d1.expand_space_dimension(var, m);
00598 d2.expand_space_dimension(var, m);
00599 }
00600
00601 template <typename D1, typename D2, typename R>
00602 inline void
00603 Partially_Reduced_Product<D1, D2, R>
00604 ::fold_space_dimensions(const Variables_Set& to_be_folded,
00605 Variable var) {
00606 d1.fold_space_dimensions(to_be_folded, var);
00607 d2.fold_space_dimensions(to_be_folded, var);
00608 }
00609
00610 template <typename D1, typename D2, typename R>
00611 inline bool
00612 Partially_Reduced_Product<D1, D2, R>
00613 ::contains(const Partially_Reduced_Product& y) const {
00614 reduce();
00615 y.reduce();
00616 return d1.contains(y.d1) && d2.contains(y.d2);
00617 }
00618
00619 template <typename D1, typename D2, typename R>
00620 inline bool
00621 Partially_Reduced_Product<D1, D2, R>
00622 ::strictly_contains(const Partially_Reduced_Product& y) const {
00623 reduce();
00624 y.reduce();
00625 return (d1.contains(y.d1) && d2.strictly_contains(y.d2))
00626 || (d2.contains(y.d2) && d1.strictly_contains(y.d1));
00627 }
00628
00629 template <typename D1, typename D2, typename R>
00630 inline bool
00631 Partially_Reduced_Product<D1, D2, R>::reduce() const {
00632 Partially_Reduced_Product& dp
00633 = const_cast<Partially_Reduced_Product&>(*this);
00634 if (dp.is_reduced())
00635 return false;
00636 R r;
00637 r.product_reduce(dp.d1, dp.d2);
00638 set_reduced_flag();
00639 return true;
00640 }
00641
00642 template <typename D1, typename D2, typename R>
00643 inline bool
00644 Partially_Reduced_Product<D1, D2, R>::is_reduced() const {
00645 return reduced;
00646 }
00647
00648 template <typename D1, typename D2, typename R>
00649 inline void
00650 Partially_Reduced_Product<D1, D2, R>::clear_reduced_flag() const {
00651 const_cast<Partially_Reduced_Product&>(*this).reduced = false;
00652 }
00653
00654 template <typename D1, typename D2, typename R>
00655 inline void
00656 Partially_Reduced_Product<D1, D2, R>::set_reduced_flag() const {
00657 const_cast<Partially_Reduced_Product&>(*this).reduced = true;
00658 }
00659
00660
00661 PPL_OUTPUT_3_PARAM_TEMPLATE_DEFINITIONS(D1, D2, R, Partially_Reduced_Product)
00662
00663 template <typename D1, typename D2, typename R>
00664 inline void
00665 Partially_Reduced_Product<D1, D2, R>::ascii_dump(std::ostream& s) const {
00666 const char yes = '+';
00667 const char no = '-';
00668 s << "Partially_Reduced_Product\n";
00669 s << (reduced ? yes : no) << "reduced\n";
00670 s << "Domain 1:\n";
00671 d1.ascii_dump(s);
00672 s << "Domain 2:\n";
00673 d2.ascii_dump(s);
00674 }
00675
00676 template <typename D1, typename D2, typename R>
00677 inline int32_t
00678 Partially_Reduced_Product<D1, D2, R>::hash_code() const {
00679 return space_dimension() & 0x7fffffff;
00680 }
00681
00683 template <typename D1, typename D2, typename R>
00684 inline bool
00685 operator==(const Partially_Reduced_Product<D1, D2, R>& x,
00686 const Partially_Reduced_Product<D1, D2, R>& y) {
00687 x.reduce();
00688 y.reduce();
00689 return x.d1 == y.d1 && x.d2 == y.d2;
00690 }
00691
00693 template <typename D1, typename D2, typename R>
00694 inline bool
00695 operator!=(const Partially_Reduced_Product<D1, D2, R>& x,
00696 const Partially_Reduced_Product<D1, D2, R>& y) {
00697 return !(x == y);
00698 }
00699
00701 template <typename D1, typename D2, typename R>
00702 inline std::ostream&
00703 IO_Operators::operator<<(std::ostream& s, const Partially_Reduced_Product<D1, D2, R>& pd) {
00704 return s << "Domain 1:\n"
00705 << pd.d1
00706 << "Domain 2:\n"
00707 << pd.d2;
00708 }
00709
00710 }
00711
00712 namespace Parma_Polyhedra_Library {
00713
00714 template <typename D1, typename D2>
00715 inline
00716 No_Reduction<D1, D2>::No_Reduction() {
00717 }
00718
00719 template <typename D1, typename D2>
00720 void No_Reduction<D1, D2>::product_reduce(D1&, D2&) {
00721 }
00722
00723 template <typename D1, typename D2>
00724 inline
00725 No_Reduction<D1, D2>::~No_Reduction() {
00726 }
00727
00728 template <typename D1, typename D2>
00729 inline
00730 Constraints_Reduction<D1, D2>::Constraints_Reduction() {
00731 }
00732
00733 template <typename D1, typename D2>
00734 void Constraints_Reduction<D1, D2>::product_reduce(D1& d1, D2& d2) {
00735 if (d2.is_empty()) {
00736 if (!d1.is_empty()) {
00737 D1 new_d1(d1.space_dimension(), EMPTY);
00738 std::swap(d1, new_d1);
00739 }
00740 }
00741 else if (d1.is_empty()) {
00742 D2 new_d2(d2.space_dimension(), EMPTY);
00743 std::swap(d2, new_d2);
00744 }
00745 else {
00746 d1.refine_with_constraints(d2.minimized_constraints());
00747 d2.refine_with_constraints(d1.minimized_constraints());
00748 }
00749 }
00750
00751 template <typename D1, typename D2>
00752 inline
00753 Constraints_Reduction<D1, D2>::~Constraints_Reduction() {
00754 }
00755
00756 }
00757
00759 template <typename D1, typename D2, typename R>
00760 inline void
00761 std::swap(Parma_Polyhedra_Library::Partially_Reduced_Product<D1, D2, R>& x,
00762 Parma_Polyhedra_Library::Partially_Reduced_Product<D1, D2, R>& y) {
00763 x.swap(y);
00764 }
00765
00766 #endif // !defined(PPL_Partially_Reduced_Product_inlines_hh)