PPL  0.12.1
math_utilities.defs.hh
Go to the documentation of this file.
00001 /* Declarations of some math utility functions.
00002    Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
00003    Copyright (C) 2010-2012 BUGSENG srl (http://bugseng.com)
00004 
00005 This file is part of the Parma Polyhedra Library (PPL).
00006 
00007 The PPL is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 3 of the License, or (at your
00010 option) any later version.
00011 
00012 The PPL is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with this program; if not, write to the Free Software Foundation,
00019 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
00020 
00021 For the most up-to-date information see the Parma Polyhedra Library
00022 site: http://bugseng.com/products/ppl/ . */
00023 
00024 #ifndef PPL_math_utilities_defs_hh
00025 #define PPL_math_utilities_defs_hh 1
00026 
00027 #include "Coefficient.types.hh"
00028 #include "Checked_Number.defs.hh"
00029 #include <gmpxx.h>
00030 
00031 namespace Parma_Polyhedra_Library {
00032 
00033 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00034 
00035 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00036 template <typename T>
00037 typename Enable_If<Is_Native_Or_Checked<T>::value, void>::type
00038 numer_denom(const T& from,
00039             Coefficient& numer, Coefficient& denom);
00040 
00041 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00042 
00043 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00044 template <typename T>
00045 typename Enable_If<Is_Native_Or_Checked<T>::value, void>::type
00046 div_round_up(T& to,
00047              Coefficient_traits::const_reference x,
00048              Coefficient_traits::const_reference y);
00049 
00050 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00051 
00052 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00053 template <typename N>
00054 void
00055 min_assign(N& x, const N& y);
00056 
00057 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00058 
00059 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00060 template <typename N>
00061 void
00062 max_assign(N& x, const N& y);
00063 
00064 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00065 
00066 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00067 template <typename T>
00068 typename Enable_If<Is_Native_Or_Checked<T>::value, bool>::type
00069 is_even(const T& x);
00070 
00071 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00072 
00073 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00074 template <typename T>
00075 typename Enable_If<Is_Native_Or_Checked<T>::value, bool>::type
00076 is_additive_inverse(const T& x, const T& y);
00077 
00078 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00079 
00087 #endif
00088 void
00089 normalize2(Coefficient_traits::const_reference x,
00090            Coefficient_traits::const_reference y,
00091            Coefficient& n_x, Coefficient& n_y);
00092 
00093 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00094 
00095 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00096 bool
00097 is_canonical(const mpq_class& x);
00098 
00099 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00100 
00101 #endif
00102 template <typename T>
00103 T
00104 low_bits_mask(unsigned n);
00105 
00106 } // namespace Parma_Polyhedra_Library
00107 
00108 #include "math_utilities.inlines.hh"
00109 
00110 #endif // !defined(PPL_math_utilities_defs_hh)