Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/numeric/interval/compare/explicit.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* Boost interval/compare/explicit.hpp template implementation file
0002  *
0003  * Copyright 2000 Jens Maurer
0004  * Copyright 2002 Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion
0005  *
0006  * Distributed under the Boost Software License, Version 1.0.
0007  * (See accompanying file LICENSE_1_0.txt or
0008  * copy at http://www.boost.org/LICENSE_1_0.txt)
0009  */
0010 
0011 #ifndef BOOST_NUMERIC_INTERVAL_COMPARE_EXPLICIT_HPP
0012 #define BOOST_NUMERIC_INTERVAL_COMPARE_EXPLICIT_HPP
0013 
0014 #include <boost/numeric/interval/detail/interval_prototype.hpp>
0015 
0016 namespace boost {
0017 namespace numeric {
0018 namespace interval_lib {
0019 
0020 /*
0021  * Certainly... operations
0022  */
0023 
0024 template<class T, class Policies1, class Policies2> inline
0025 bool cerlt(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
0026 {
0027   return x.upper() < y.lower();
0028 }
0029 
0030 template<class T, class Policies> inline
0031 bool cerlt(const interval<T, Policies>& x, const T& y)
0032 {
0033   return x.upper() < y;
0034 }
0035 
0036 template<class T, class Policies> inline
0037 bool cerlt(const T& x, const interval<T, Policies>& y)
0038 {
0039   return x < y.lower();
0040 }
0041 
0042 template<class T, class Policies1, class Policies2> inline
0043 bool cerle(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
0044 {
0045   return x.upper() <= y.lower();
0046 }
0047 
0048 template<class T, class Policies> inline
0049 bool cerle(const interval<T, Policies>& x, const T& y)
0050 {
0051   return x.upper() <= y;
0052 }
0053 
0054 template<class T, class Policies> inline
0055 bool cerle(const T& x, const interval<T, Policies>& y)
0056 {
0057   return x <= y.lower();
0058 }
0059 
0060 template<class T, class Policies1, class Policies2> inline
0061 bool cergt(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
0062 {
0063   return x.lower() > y.upper();
0064 }
0065 
0066 template<class T, class Policies> inline
0067 bool cergt(const interval<T, Policies>& x, const T& y)
0068 {
0069   return x.lower() > y;
0070 }
0071 
0072 template<class T, class Policies> inline
0073 bool cergt(const T& x, const interval<T, Policies>& y)
0074 {
0075   return x > y.upper();
0076 }
0077 
0078 template<class T, class Policies1, class Policies2> inline
0079 bool cerge(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
0080 {
0081   return x.lower() >= y.upper();
0082 }
0083 
0084 template<class T, class Policies> inline
0085 bool cerge(const interval<T, Policies>& x, const T& y)
0086 {
0087   return x.lower() >= y;
0088 }
0089 
0090 template<class T, class Policies> inline
0091 bool cerge(const T& x, const interval<T, Policies>& y)
0092 {
0093   return x >= y.upper();
0094 }
0095 
0096 template<class T, class Policies1, class Policies2> inline
0097 bool cereq(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
0098 {
0099   return x.lower() == y.upper() && y.lower() == x.upper();
0100 }
0101 
0102 template<class T, class Policies> inline
0103 bool cereq(const interval<T, Policies>& x, const T& y)
0104 {
0105   return x.lower() == y && x.upper() == y;
0106 }
0107 
0108 template<class T, class Policies> inline
0109 bool cereq(const T& x, const interval<T, Policies>& y)
0110 {
0111   return x == y.lower() && x == y.upper();
0112 }
0113 
0114 template<class T, class Policies1, class Policies2> inline
0115 bool cerne(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
0116 {
0117   return x.upper() < y.lower() || y.upper() < x.lower();
0118 }
0119 
0120 template<class T, class Policies> inline
0121 bool cerne(const interval<T, Policies>& x, const T& y)
0122 {
0123   return x.upper() < y || y < x.lower();
0124 }
0125 
0126 template<class T, class Policies> inline
0127 bool cerne(const T& x, const interval<T, Policies>& y)
0128 {
0129   return x < y.lower() || y.upper() < x;
0130 }
0131 
0132 /*
0133  * Possibly... comparisons
0134  */
0135 
0136 template<class T, class Policies1, class Policies2> inline
0137 bool poslt(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
0138 {
0139   return x.lower() < y.upper();
0140 }
0141 
0142 template<class T, class Policies> inline
0143 bool poslt(const interval<T, Policies>& x, const T& y)
0144 {
0145   return x.lower() < y;
0146 }
0147 
0148 template<class T, class Policies> inline
0149 bool poslt(const T& x, const interval<T, Policies>& y)
0150 {
0151   return x < y.upper();
0152 }
0153 
0154 template<class T, class Policies1, class Policies2> inline
0155 bool posle(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
0156 {
0157   return x.lower() <= y.upper();
0158 }
0159 
0160 template<class T, class Policies> inline
0161 bool posle(const interval<T, Policies>& x, const T& y)
0162 {
0163   return x.lower() <= y;
0164 }
0165 
0166 template<class T, class Policies> inline
0167 bool posle(const T& x, const interval<T, Policies>& y)
0168 {
0169   return x <= y.upper();
0170 }
0171 
0172 template<class T, class Policies1, class Policies2> inline
0173 bool posgt(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
0174 {
0175   return x.upper() > y.lower();
0176 }
0177 
0178 template<class T, class Policies> inline
0179 bool posgt(const interval<T, Policies>& x, const T& y)
0180 {
0181   return x.upper() > y;
0182 }
0183 
0184 template<class T, class Policies> inline
0185 bool posgt(const T& x, const interval<T, Policies> & y)
0186 {
0187   return x > y.lower();
0188 }
0189 
0190 template<class T, class Policies1, class Policies2> inline
0191 bool posge(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
0192 {
0193   return x.upper() >= y.lower();
0194 }
0195 
0196 template<class T, class Policies> inline
0197 bool posge(const interval<T, Policies>& x, const T& y)
0198 {
0199   return x.upper() >= y;
0200 }
0201 
0202 template<class T, class Policies> inline
0203 bool posge(const T& x, const interval<T, Policies>& y)
0204 {
0205   return x >= y.lower();
0206 }
0207 
0208 template<class T, class Policies1, class Policies2> inline
0209 bool poseq(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
0210 {
0211   return x.upper() >= y.lower() && y.upper() >= x.lower();
0212 }
0213 
0214 template<class T, class Policies> inline
0215 bool poseq(const interval<T, Policies>& x, const T& y)
0216 {
0217   return x.upper() >= y && y >= x.lower();
0218 }
0219 
0220 template<class T, class Policies> inline
0221 bool poseq(const T& x, const interval<T, Policies>& y)
0222 {
0223   return x >= y.lower() && y.upper() >= x;
0224 }
0225 
0226 template<class T, class Policies1, class Policies2> inline
0227 bool posne(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
0228 {
0229   return x.upper() != y.lower() || y.upper() != x.lower();
0230 }
0231 
0232 template<class T, class Policies> inline
0233 bool posne(const interval<T, Policies>& x, const T& y)
0234 {
0235   return x.upper() != y || y != x.lower();
0236 }
0237 
0238 template<class T, class Policies> inline
0239 bool posne(const T& x, const interval<T, Policies>& y)
0240 {
0241   return x != y.lower() || y.upper() != x;
0242 }
0243 
0244 } // namespace interval_lib
0245 } // namespace numeric
0246 } //namespace boost
0247 
0248 #endif // BOOST_NUMERIC_INTERVAL_COMPARE_EXPLICIT_HPP