00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef PPL_Octagonal_Shape_inlines_hh
00025 #define PPL_Octagonal_Shape_inlines_hh 1
00026
00027 #include "Constraint_System.defs.hh"
00028 #include "Constraint_System.inlines.hh"
00029 #include "C_Polyhedron.defs.hh"
00030 #include "Grid.defs.hh"
00031 #include "BD_Shape.defs.hh"
00032 #include "Poly_Con_Relation.defs.hh"
00033 #include "Poly_Gen_Relation.defs.hh"
00034 #include <cassert>
00035 #include <algorithm>
00036
00037 namespace Parma_Polyhedra_Library {
00038
00039
00041 inline dimension_type
00042 coherent_index(const dimension_type i) {
00043 return (i%2) ? i-1 : i+1;
00044 }
00045
00046 template <typename T>
00047 inline dimension_type
00048 Octagonal_Shape<T>::max_space_dimension() {
00049 return OR_Matrix<N>::max_num_rows()/2;
00050 }
00051
00052 template <typename T>
00053 inline bool
00054 Octagonal_Shape<T>::marked_zero_dim_univ() const {
00055 return status.test_zero_dim_univ();
00056 }
00057
00058 template <typename T>
00059 inline bool
00060 Octagonal_Shape<T>::marked_strongly_closed() const {
00061 return status.test_strongly_closed();
00062 }
00063
00064 template <typename T>
00065 inline bool
00066 Octagonal_Shape<T>::marked_empty() const {
00067 return status.test_empty();
00068 }
00069
00070 template <typename T>
00071 inline void
00072 Octagonal_Shape<T>::set_zero_dim_univ() {
00073 status.set_zero_dim_univ();
00074 }
00075
00076 template <typename T>
00077 inline void
00078 Octagonal_Shape<T>::set_empty() {
00079 status.set_empty();
00080 }
00081
00082 template <typename T>
00083 inline void
00084 Octagonal_Shape<T>::set_strongly_closed() {
00085 status.set_strongly_closed();
00086 }
00087
00088 template <typename T>
00089 inline void
00090 Octagonal_Shape<T>::reset_strongly_closed() {
00091 status.reset_strongly_closed();
00092 }
00093
00094 template <typename T>
00095 inline
00096 Octagonal_Shape<T>::Octagonal_Shape(const dimension_type num_dimensions,
00097 const Degenerate_Element kind)
00098 : matrix(num_dimensions), space_dim(num_dimensions), status() {
00099 if (kind == EMPTY)
00100 set_empty();
00101 else if (num_dimensions > 0)
00102
00103 set_strongly_closed();
00104 assert(OK());
00105 }
00106
00107 template <typename T>
00108 inline
00109 Octagonal_Shape<T>::Octagonal_Shape(const Octagonal_Shape& y, Complexity_Class)
00110 : matrix(y.matrix), space_dim(y.space_dim), status(y.status) {
00111 }
00112
00113 template <typename T>
00114 template <typename U>
00115 inline
00116 Octagonal_Shape<T>::Octagonal_Shape(const Octagonal_Shape<U>& y,
00117 Complexity_Class)
00118
00119
00120 : matrix((y.strong_closure_assign(), y.matrix)),
00121 space_dim(y.space_dim),
00122 status() {
00123
00124 if (y.marked_empty())
00125 set_empty();
00126 else if (y.marked_zero_dim_univ())
00127 set_zero_dim_univ();
00128 }
00129
00130 template <typename T>
00131 inline
00132 Octagonal_Shape<T>::Octagonal_Shape(const Constraint_System& cs)
00133 : matrix(cs.space_dimension()),
00134 space_dim(cs.space_dimension()),
00135 status() {
00136 if (cs.space_dimension() > 0)
00137
00138 set_strongly_closed();
00139 add_constraints(cs);
00140 }
00141
00142 template <typename T>
00143 inline
00144 Octagonal_Shape<T>::Octagonal_Shape(const Congruence_System& cgs)
00145 : matrix(cgs.space_dimension()),
00146 space_dim(cgs.space_dimension()),
00147 status() {
00148 if (cgs.space_dimension() > 0)
00149
00150 set_strongly_closed();
00151 add_congruences(cgs);
00152 }
00153
00154 template <typename T>
00155 template <typename Interval>
00156 inline
00157 Octagonal_Shape<T>::Octagonal_Shape(const Box<Interval>& box,
00158 Complexity_Class)
00159 : matrix(box.space_dimension()),
00160 space_dim(box.space_dimension()),
00161 status() {
00162
00163 if (box.is_empty())
00164 set_empty();
00165 else if (box.space_dimension() > 0) {
00166
00167 set_strongly_closed();
00168 refine_with_constraints(box.constraints());
00169 }
00170 }
00171
00172 template <typename T>
00173 inline
00174 Octagonal_Shape<T>::Octagonal_Shape(const Grid& grid,
00175 Complexity_Class)
00176 : matrix(grid.space_dimension()),
00177 space_dim(grid.space_dimension()),
00178 status() {
00179 if (grid.space_dimension() > 0)
00180
00181 set_strongly_closed();
00182
00183 refine_with_congruences(grid.minimized_congruences());
00184 }
00185
00186 template <typename T>
00187 template <typename U>
00188 inline
00189 Octagonal_Shape<T>::Octagonal_Shape(const BD_Shape<U>& bd,
00190 Complexity_Class)
00191 : matrix(bd.space_dimension()),
00192 space_dim(bd.space_dimension()),
00193 status() {
00194
00195 if (bd.is_empty())
00196 set_empty();
00197 else if (bd.space_dimension() > 0) {
00198
00199 set_strongly_closed();
00200 refine_with_constraints(bd.constraints());
00201 }
00202 }
00203
00204 template <typename T>
00205 inline Congruence_System
00206 Octagonal_Shape<T>::congruences() const {
00207 return minimized_congruences();
00208 }
00209
00210 template <typename T>
00211 inline Octagonal_Shape<T>&
00212 Octagonal_Shape<T>::operator=(const Octagonal_Shape& y) {
00213 matrix = y.matrix;
00214 space_dim = y.space_dim;
00215 status = y.status;
00216 return *this;
00217 }
00218
00219 template <typename T>
00220 inline
00221 Octagonal_Shape<T>::~Octagonal_Shape() {
00222 }
00223
00224 template <typename T>
00225 inline void
00226 Octagonal_Shape<T>::swap(Octagonal_Shape& y) {
00227 std::swap(matrix, y.matrix);
00228 std::swap(space_dim, y.space_dim);
00229 std::swap(status, y.status);
00230 }
00231
00232 template <typename T>
00233 inline dimension_type
00234 Octagonal_Shape<T>::space_dimension() const {
00235 return space_dim;
00236 }
00237
00238 template <typename T>
00239 inline bool
00240 Octagonal_Shape<T>::is_discrete() const {
00241 return affine_dimension() == 0;
00242 }
00243
00244 template <typename T>
00245 inline bool
00246 Octagonal_Shape<T>::is_empty() const {
00247 strong_closure_assign();
00248 return marked_empty();
00249 }
00250
00251 template <typename T>
00252 inline bool
00253 Octagonal_Shape<T>::bounds_from_above(const Linear_Expression& expr) const {
00254 return bounds(expr, true);
00255 }
00256
00257 template <typename T>
00258 inline bool
00259 Octagonal_Shape<T>::bounds_from_below(const Linear_Expression& expr) const {
00260 return bounds(expr, false);
00261 }
00262
00263 template <typename T>
00264 inline bool
00265 Octagonal_Shape<T>::maximize(const Linear_Expression& expr,
00266 Coefficient& sup_n, Coefficient& sup_d,
00267 bool& maximum) const {
00268 return max_min(expr, true, sup_n, sup_d, maximum);
00269 }
00270
00271 template <typename T>
00272 inline bool
00273 Octagonal_Shape<T>::maximize(const Linear_Expression& expr,
00274 Coefficient& sup_n, Coefficient& sup_d,
00275 bool& maximum,
00276 Generator& g) const {
00277 return max_min(expr, true, sup_n, sup_d, maximum, g);
00278 }
00279
00280 template <typename T>
00281 inline bool
00282 Octagonal_Shape<T>::minimize(const Linear_Expression& expr,
00283 Coefficient& inf_n, Coefficient& inf_d,
00284 bool& minimum) const {
00285 return max_min(expr, false, inf_n, inf_d, minimum);
00286 }
00287
00288 template <typename T>
00289 inline bool
00290 Octagonal_Shape<T>::minimize(const Linear_Expression& expr,
00291 Coefficient& inf_n, Coefficient& inf_d,
00292 bool& minimum,
00293 Generator& g) const {
00294 return max_min(expr, false, inf_n, inf_d, minimum, g);
00295 }
00296
00297 template <typename T>
00298 inline bool
00299 Octagonal_Shape<T>::is_topologically_closed() const {
00300 return true;
00301 }
00302
00303 template <typename T>
00304 inline void
00305 Octagonal_Shape<T>::topological_closure_assign() {
00306
00307 return;
00308 }
00309
00311 template <typename T>
00312 inline bool
00313 operator==(const Octagonal_Shape<T>& x, const Octagonal_Shape<T>& y) {
00314 if (x.space_dim != y.space_dim)
00315
00316 return false;
00317
00318
00319 if (x.space_dim == 0) {
00320 if (x.marked_empty())
00321 return y.marked_empty();
00322 else
00323 return !y.marked_empty();
00324 }
00325
00326 x.strong_closure_assign();
00327 y.strong_closure_assign();
00328
00329
00330 if (x.marked_empty())
00331 return y.marked_empty();
00332 if (y.marked_empty())
00333 return false;
00334
00335 return x.matrix == y.matrix;
00336 }
00337
00339 template <typename T>
00340 inline bool
00341 operator!=(const Octagonal_Shape<T>& x, const Octagonal_Shape<T>& y) {
00342 return !(x == y);
00343 }
00344
00345 template <typename T>
00346 inline const typename Octagonal_Shape<T>::coefficient_type&
00347 Octagonal_Shape<T>::matrix_at(const dimension_type i,
00348 const dimension_type j) const {
00349 assert(i < matrix.num_rows() && j < matrix.num_rows());
00350 return (j < matrix.row_size(i))
00351 ? matrix[i][j]
00352 : matrix[coherent_index(j)][coherent_index(i)];
00353 }
00354
00355 template <typename T>
00356 inline typename Octagonal_Shape<T>::coefficient_type&
00357 Octagonal_Shape<T>::matrix_at(const dimension_type i,
00358 const dimension_type j) {
00359 assert(i < matrix.num_rows() && j < matrix.num_rows());
00360 return (j < matrix.row_size(i))
00361 ? matrix[i][j]
00362 : matrix[coherent_index(j)][coherent_index(i)];
00363 }
00364
00365 template <typename T>
00366 inline Constraint_System
00367 Octagonal_Shape<T>::minimized_constraints() const {
00368 strong_reduction_assign();
00369 return constraints();
00370 }
00371
00372 template <typename T>
00373 inline void
00374 Octagonal_Shape<T>::add_octagonal_constraint(const dimension_type i,
00375 const dimension_type j,
00376 const N& k) {
00377
00378 #ifndef NDEBUG
00379 assert(i < 2*space_dim && j < 2*space_dim && i != j);
00380 typename OR_Matrix<N>::row_iterator m_i = matrix.row_begin() + i;
00381 assert(j < m_i.row_size());
00382 #endif
00383 N& r_i_j = matrix[i][j];
00384 if (r_i_j > k) {
00385 r_i_j = k;
00386 if (marked_strongly_closed())
00387 reset_strongly_closed();
00388 }
00389 }
00390
00391 template <typename T>
00392 inline void
00393 Octagonal_Shape<T>
00394 ::add_octagonal_constraint(const dimension_type i,
00395 const dimension_type j,
00396 Coefficient_traits::const_reference num,
00397 Coefficient_traits::const_reference den) {
00398 #ifndef NDEBUG
00399
00400 assert(i < 2*space_dim && j < 2*space_dim && i != j);
00401 typename OR_Matrix<N>::row_iterator m_i = matrix.row_begin() + i;
00402 assert(j < m_i.row_size());
00403 assert(den != 0);
00404 #endif
00405 DIRTY_TEMP(N, k);
00406 div_round_up(k, num, den);
00407 add_octagonal_constraint(i, j, k);
00408 }
00409
00410 template <typename T>
00411 inline void
00412 Octagonal_Shape<T>::add_constraints(const Constraint_System& cs) {
00413 for (Constraint_System::const_iterator i = cs.begin(),
00414 i_end = cs.end(); i != i_end; ++i)
00415 add_constraint(*i);
00416 }
00417
00418 template <typename T>
00419 inline void
00420 Octagonal_Shape<T>::add_recycled_constraints(Constraint_System& cs) {
00421 add_constraints(cs);
00422 }
00423
00424 template <typename T>
00425 inline void
00426 Octagonal_Shape<T>::add_recycled_congruences(Congruence_System& cgs) {
00427 add_congruences(cgs);
00428 }
00429
00430 template <typename T>
00431 inline void
00432 Octagonal_Shape<T>::add_congruences(const Congruence_System& cgs) {
00433 for (Congruence_System::const_iterator i = cgs.begin(),
00434 cgs_end = cgs.end(); i != cgs_end; ++i)
00435 add_congruence(*i);
00436 }
00437
00438 template <typename T>
00439 inline void
00440 Octagonal_Shape<T>::refine_with_constraint(const Constraint& c) {
00441
00442 if (c.space_dimension() > space_dimension())
00443 throw_dimension_incompatible("refine_with_constraint(c)", c);
00444
00445 if (!marked_empty())
00446 refine_no_check(c);
00447 }
00448
00449 template <typename T>
00450 inline void
00451 Octagonal_Shape<T>::refine_with_constraints(const Constraint_System& cs) {
00452
00453 if (cs.space_dimension() > space_dimension())
00454 throw_generic("refine_with_constraints(cs)",
00455 "cs and *this are space-dimension incompatible");
00456
00457 for (Constraint_System::const_iterator i = cs.begin(),
00458 cs_end = cs.end(); !marked_empty() && i != cs_end; ++i)
00459 refine_no_check(*i);
00460 }
00461
00462 template <typename T>
00463 inline void
00464 Octagonal_Shape<T>::refine_with_congruence(const Congruence& cg) {
00465 const dimension_type cg_space_dim = cg.space_dimension();
00466
00467 if (cg_space_dim > space_dimension())
00468 throw_dimension_incompatible("refine_with_congruence(cg)", cg);
00469
00470 if (!marked_empty())
00471 refine_no_check(cg);
00472 }
00473
00474 template <typename T>
00475 void
00476 Octagonal_Shape<T>::refine_with_congruences(const Congruence_System& cgs) {
00477
00478 if (cgs.space_dimension() > space_dimension())
00479 throw_generic("refine_with_congruences(cgs)",
00480 "cgs and *this are space-dimension incompatible");
00481
00482 for (Congruence_System::const_iterator i = cgs.begin(),
00483 cgs_end = cgs.end(); !marked_empty() && i != cgs_end; ++i)
00484 refine_no_check(*i);
00485 }
00486
00487 template <typename T>
00488 inline void
00489 Octagonal_Shape<T>::refine_no_check(const Congruence& cg) {
00490 assert(!marked_empty());
00491 assert(cg.space_dimension() <= space_dimension());
00492
00493 if (cg.is_proper_congruence()) {
00494 if (cg.is_inconsistent())
00495 set_empty();
00496
00497 return;
00498 }
00499
00500 assert(cg.is_equality());
00501 Constraint c(cg);
00502 refine_no_check(c);
00503 }
00504
00505 template <typename T>
00506 inline bool
00507 Octagonal_Shape<T>::can_recycle_constraint_systems() {
00508 return false;
00509 }
00510
00511 template <typename T>
00512 inline bool
00513 Octagonal_Shape<T>::can_recycle_congruence_systems() {
00514 return false;
00515 }
00516
00517 template <typename T>
00518 inline void
00519 Octagonal_Shape<T>
00520 ::remove_higher_space_dimensions(const dimension_type new_dimension) {
00521
00522 if (new_dimension > space_dim)
00523 throw_dimension_incompatible("remove_higher_space_dimension(nd)",
00524 new_dimension);
00525
00526
00527
00528 if (new_dimension == space_dim) {
00529 assert(OK());
00530 return;
00531 }
00532
00533 strong_closure_assign();
00534 matrix.shrink(new_dimension);
00535
00536
00537 if (new_dimension == 0 && !marked_empty())
00538 set_zero_dim_univ();
00539 space_dim = new_dimension;
00540 assert(OK());
00541 }
00542
00543 template <typename T>
00544 inline void
00545 Octagonal_Shape<T>::widening_assign(const Octagonal_Shape& y, unsigned* tp) {
00546 BHMZ05_widening_assign(y, tp);
00547 }
00548
00549 template <typename T>
00550 inline void
00551 Octagonal_Shape<T>::CC76_extrapolation_assign(const Octagonal_Shape& y,
00552 unsigned* tp) {
00553 static N stop_points[] = {
00554 N(-2, ROUND_UP),
00555 N(-1, ROUND_UP),
00556 N( 0, ROUND_UP),
00557 N( 1, ROUND_UP),
00558 N( 2, ROUND_UP)
00559 };
00560 CC76_extrapolation_assign(y,
00561 stop_points,
00562 stop_points
00563 + sizeof(stop_points)/sizeof(stop_points[0]),
00564 tp);
00565 }
00566
00567 template <typename T>
00568 inline void
00569 Octagonal_Shape<T>::time_elapse_assign(const Octagonal_Shape& y) {
00570
00571 if (space_dimension() != y.space_dimension())
00572 throw_dimension_incompatible("time_elapse_assign(y)", y);
00573
00574 C_Polyhedron px(constraints());
00575 C_Polyhedron py(y.constraints());
00576 px.time_elapse_assign(py);
00577 Octagonal_Shape<T> x(px);
00578 swap(x);
00579 assert(OK());
00580 }
00581
00582 template <typename T>
00583 inline bool
00584 Octagonal_Shape<T>::strictly_contains(const Octagonal_Shape& y) const {
00585 const Octagonal_Shape<T>& x = *this;
00586 return x.contains(y) && !y.contains(x);
00587 }
00588
00589 template <typename T>
00590 inline bool
00591 Octagonal_Shape<T>::upper_bound_assign_if_exact(const Octagonal_Shape& y) {
00592
00593 used(y);
00594 return false;
00595 }
00596
00598 template <typename Temp, typename To, typename T>
00599 inline bool
00600 rectilinear_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00601 const Octagonal_Shape<T>& x,
00602 const Octagonal_Shape<T>& y,
00603 const Rounding_Dir dir,
00604 Temp& tmp0,
00605 Temp& tmp1,
00606 Temp& tmp2) {
00607
00608 if (x.space_dim != y.space_dim)
00609 return false;
00610
00611
00612 if (x.space_dim == 0) {
00613 if (x.marked_empty() == y.marked_empty())
00614 assign_r(r, 0, ROUND_NOT_NEEDED);
00615 else
00616 assign_r(r, PLUS_INFINITY, ROUND_NOT_NEEDED);
00617 return true;
00618 }
00619
00620
00621 x.strong_closure_assign();
00622 y.strong_closure_assign();
00623
00624
00625
00626 if (x.marked_empty() || y.marked_empty()) {
00627 if (x.marked_empty() == y.marked_empty())
00628 assign_r(r, 0, ROUND_NOT_NEEDED);
00629 else
00630 assign_r(r, PLUS_INFINITY, ROUND_NOT_NEEDED);
00631 return true;
00632 }
00633
00634 return rectilinear_distance_assign(r, x.matrix, y.matrix, dir,
00635 tmp0, tmp1, tmp2);
00636 }
00637
00639 template <typename Temp, typename To, typename T>
00640 inline bool
00641 rectilinear_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00642 const Octagonal_Shape<T>& x,
00643 const Octagonal_Shape<T>& y,
00644 const Rounding_Dir dir) {
00645 typedef Checked_Number<Temp, Extended_Number_Policy> Checked_Temp;
00646 DIRTY_TEMP(Checked_Temp, tmp0);
00647 DIRTY_TEMP(Checked_Temp, tmp1);
00648 DIRTY_TEMP(Checked_Temp, tmp2);
00649 return rectilinear_distance_assign(r, x, y, dir, tmp0, tmp1, tmp2);
00650 }
00651
00653 template <typename To, typename T>
00654 inline bool
00655 rectilinear_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00656 const Octagonal_Shape<T>& x,
00657 const Octagonal_Shape<T>& y,
00658 const Rounding_Dir dir) {
00659 return rectilinear_distance_assign<To, To, T>(r, x, y, dir);
00660 }
00661
00663 template <typename Temp, typename To, typename T>
00664 inline bool
00665 euclidean_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00666 const Octagonal_Shape<T>& x,
00667 const Octagonal_Shape<T>& y,
00668 const Rounding_Dir dir,
00669 Temp& tmp0,
00670 Temp& tmp1,
00671 Temp& tmp2) {
00672
00673 if (x.space_dim != y.space_dim)
00674 return false;
00675
00676
00677 if (x.space_dim == 0) {
00678 if (x.marked_empty() == y.marked_empty())
00679 assign_r(r, 0, ROUND_NOT_NEEDED);
00680 else
00681 assign_r(r, PLUS_INFINITY, ROUND_NOT_NEEDED);
00682 return true;
00683 }
00684
00685
00686 x.strong_closure_assign();
00687 y.strong_closure_assign();
00688
00689
00690
00691 if (x.marked_empty() || y.marked_empty()) {
00692 if (x.marked_empty() == y.marked_empty())
00693 assign_r(r, 0, ROUND_NOT_NEEDED);
00694 else
00695 assign_r(r, PLUS_INFINITY, ROUND_NOT_NEEDED);
00696 return true;
00697 }
00698
00699 return euclidean_distance_assign(r, x.matrix, y.matrix, dir,
00700 tmp0, tmp1, tmp2);
00701 }
00702
00704 template <typename Temp, typename To, typename T>
00705 inline bool
00706 euclidean_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00707 const Octagonal_Shape<T>& x,
00708 const Octagonal_Shape<T>& y,
00709 const Rounding_Dir dir) {
00710 typedef Checked_Number<Temp, Extended_Number_Policy> Checked_Temp;
00711 DIRTY_TEMP(Checked_Temp, tmp0);
00712 DIRTY_TEMP(Checked_Temp, tmp1);
00713 DIRTY_TEMP(Checked_Temp, tmp2);
00714 return euclidean_distance_assign(r, x, y, dir, tmp0, tmp1, tmp2);
00715 }
00716
00718 template <typename To, typename T>
00719 inline bool
00720 euclidean_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00721 const Octagonal_Shape<T>& x,
00722 const Octagonal_Shape<T>& y,
00723 const Rounding_Dir dir) {
00724 return euclidean_distance_assign<To, To, T>(r, x, y, dir);
00725 }
00726
00728 template <typename Temp, typename To, typename T>
00729 inline bool
00730 l_infinity_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00731 const Octagonal_Shape<T>& x,
00732 const Octagonal_Shape<T>& y,
00733 const Rounding_Dir dir,
00734 Temp& tmp0,
00735 Temp& tmp1,
00736 Temp& tmp2) {
00737
00738 if (x.space_dim != y.space_dim)
00739 return false;
00740
00741
00742 if (x.space_dim == 0) {
00743 if (x.marked_empty() == y.marked_empty())
00744 assign_r(r, 0, ROUND_NOT_NEEDED);
00745 else
00746 assign_r(r, PLUS_INFINITY, ROUND_NOT_NEEDED);
00747 return true;
00748 }
00749
00750
00751 x.strong_closure_assign();
00752 y.strong_closure_assign();
00753
00754
00755
00756 if (x.marked_empty() || y.marked_empty()) {
00757 if (x.marked_empty() == y.marked_empty())
00758 assign_r(r, 0, ROUND_NOT_NEEDED);
00759 else
00760 assign_r(r, PLUS_INFINITY, ROUND_NOT_NEEDED);
00761 return true;
00762 }
00763
00764 return l_infinity_distance_assign(r, x.matrix, y.matrix, dir,
00765 tmp0, tmp1, tmp2);
00766 }
00767
00769 template <typename Temp, typename To, typename T>
00770 inline bool
00771 l_infinity_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00772 const Octagonal_Shape<T>& x,
00773 const Octagonal_Shape<T>& y,
00774 const Rounding_Dir dir) {
00775 typedef Checked_Number<Temp, Extended_Number_Policy> Checked_Temp;
00776 DIRTY_TEMP(Checked_Temp, tmp0);
00777 DIRTY_TEMP(Checked_Temp, tmp1);
00778 DIRTY_TEMP(Checked_Temp, tmp2);
00779 return l_infinity_distance_assign(r, x, y, dir, tmp0, tmp1, tmp2);
00780 }
00781
00783 template <typename To, typename T>
00784 inline bool
00785 l_infinity_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00786 const Octagonal_Shape<T>& x,
00787 const Octagonal_Shape<T>& y,
00788 const Rounding_Dir dir) {
00789 return l_infinity_distance_assign<To, To, T>(r, x, y, dir);
00790 }
00791
00792 template <typename T>
00793 inline memory_size_type
00794 Octagonal_Shape<T>::total_memory_in_bytes() const {
00795 return sizeof(*this) + external_memory_in_bytes();
00796 }
00797
00798 template <typename T>
00799 inline int32_t
00800 Octagonal_Shape<T>::hash_code() const {
00801 return space_dimension() & 0x7fffffff;
00802 }
00803
00804 }
00805
00806 namespace std {
00807
00809 template <typename T>
00810 inline void
00811 swap(Parma_Polyhedra_Library::Octagonal_Shape<T>& x,
00812 Parma_Polyhedra_Library::Octagonal_Shape<T>& y) {
00813 x.swap(y);
00814 }
00815
00816 }
00817
00818 #endif // !defined(PPL_Octagonal_Shape_inlines_hh)