#ifndef STORM_UTILITY_CONSTANTS_H_ #define STORM_UTILITY_CONSTANTS_H_ #ifdef max # undef max #endif #ifdef min # undef min #endif #include #include #include #include #include #include "storm/utility/NumberTraits.h" namespace storm { // Forward-declare MatrixEntry class. namespace storage { template class MatrixEntry; } template struct NumberTraits; namespace utility { namespace detail { template struct ElementLess { typedef std::less type; }; struct DoubleLess { bool operator()(double a, double b) const { return b - a > 1e-17; } }; template<> struct ElementLess { typedef DoubleLess type; }; template struct ElementGreater { typedef std::greater type; }; struct DoubleGreater { bool operator()(double a, double b) const { return a - b > 1e-17; } }; template<> struct ElementGreater { typedef DoubleGreater type; }; } template using ElementLess = typename detail::ElementLess::type; template using ElementGreater = typename detail::ElementGreater::type; template ValueType one(); template ValueType zero(); template ValueType infinity(); template bool isOne(ValueType const& a); template bool isZero(ValueType const& a); bool isAlmostZero(double const& a); bool isAlmostOne(double const& a); template bool isConstant(ValueType const& a); template bool isInfinity(ValueType const& a); template bool isInteger(ValueType const& number); template TargetType convertNumber(SourceType const& number); template std::pair asFraction(ValueType const& number); template ValueType simplify(ValueType value); template storm::storage::MatrixEntry& simplify(storm::storage::MatrixEntry& matrixEntry); template storm::storage::MatrixEntry&& simplify(storm::storage::MatrixEntry&& matrixEntry); template std::pair minmax(std::vector const& values); template ValueType minimum(std::vector const& values); template ValueType maximum(std::vector const& values); template< typename K, typename ValueType> std::pair minmax(std::map const& values); template< typename K, typename ValueType> ValueType minimum(std::map const& values); template ValueType maximum(std::map const& values); template ValueType pow(ValueType const& value, uint_fast64_t exponent); template ValueType max(ValueType const& first, ValueType const& second); template ValueType min(ValueType const& first, ValueType const& second); template ValueType sqrt(ValueType const& number); template ValueType abs(ValueType const& number); template ValueType floor(ValueType const& number); template ValueType ceil(ValueType const& number); template ValueType log(ValueType const& number); template ValueType log10(ValueType const& number); template typename NumberTraits::IntegerType trunc(ValueType const& number); template typename NumberTraits::IntegerType numerator(RationalType const& number); template typename NumberTraits::IntegerType denominator(RationalType const& number); /*! * (Integer-)Divides the dividend by the divisor and returns the result plus the remainder. */ template std::pair divide(IntegerType const& dividend, IntegerType const& divisor); template IntegerType mod(IntegerType const& first, IntegerType const& second); template std::string to_string(ValueType const& value); } } #endif /* STORM_UTILITY_CONSTANTS_H_ */