00001 #ifndef GRAL_GB_SEQUENCE_MATHEMATICAL_OPERATORS_H
00002 #define GRAL_GB_SEQUENCE_MATHEMATICAL_OPERATORS_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <cmath>
00020
00021 namespace GrAL {
00022
00023 namespace mathematical_operators {
00024
00025 struct floor {
00026 template<class T> T operator()(T const& t) const { return std::floor(t);}
00027 };
00028
00029 struct ceil {
00030 template<class T> T operator()(T const& t) const { return std::ceil(t);}
00031 };
00032
00033 struct round {
00034 template<class T> T operator()(T const& t) const { return std::ceil(t-0.5);}
00035 };
00036
00037 template<class U, class T>
00038 inline T clamp(U const& low, U const& high, T const& t)
00039 { return (t < low ? T(low) : (t > high ? T(high) : t)); }
00040
00041
00042 }
00043
00044 }
00045
00046
00047 #endif
00048