Rosetta  3.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Namespaces | Functions
util.hh File Reference

small bundle of utilities for dealing with numbers. More...

#include <numeric/types.hh>
#include <numeric/numeric.functions.hh>
#include <utility/vector1.hh>
#include <limits>
#include <cmath>
#include <algorithm>

Namespaces

 numeric
 Unit headers.
 

Functions

template<typename Number >
Number numeric::clamp (Number value, Number lower_bound, Number upper_bound)
 Clamps to the closed interval [lower_bound, upper_bound]. Templated type must implement operator<. More...
 
double numeric::log (double x, double base)
 Computes log(x) in the given base. More...
 
template<typename T >
bool numeric::isnan (T value)
 portable check to see if a value is NaN. More...
 
template<typename T >
bool numeric::isinf (T value)
 
bool numeric::equal_by_epsilon (numeric::Real value1, numeric::Real value2, numeric::Real epsilon)
 are two Real values are equal up to some epsilon More...
 
numeric::Real numeric::median (utility::vector1< numeric::Real > const &values)
 Returns the median from a vector1 of Real values. More...
 
numeric::Real numeric::mean (utility::vector1< numeric::Real > const &values)
 
template<typename T >
numeric::max (utility::vector1< T > const &values)
 
template<typename T >
numeric::min (utility::vector1< T > const &values)
 
Real numeric::boltzmann_accept_probability (Real const score_before, Real const score_after, Real const temperature)
 Calculates the acceptance probability of a given score-change at the given temperature, generally used in simulated annealing algorithms. Returns a value in the range (0-1). More...
 
template<typename T >
numeric::find_nearest_value (typename utility::vector1< T > const &input_list, T key, platform::Size min_index, platform::Size max_index)
 recursive binary search that finds the value closest to key. Call find_nearest_value(input_list,value) instead. It's the driver function for this function. This fails miserably (and silently!) on a non-sorted vector, so don't do that!. More...
 
template<typename T >
numeric::find_nearest_value (typename utility::vector1< T > const &input_list, T key)
 given a vector and an input value, return the value in the vector that is closest to the input This is a wrapper for find_nearest_value(input_list,key,min,max) and insures that you're sorted. More...
 

Detailed Description

small bundle of utilities for dealing with numbers.

Author
James Thompson