scitbx::math Namespace Reference

Math utilities. More...


Classes

struct  approx_equal_relatively
 A functor testing whether the relative error between two floating point values is smaller than some tolerance. More...
struct  approx_equal_absolutely
 A functor testing whether the relative error between two floating point values is smaller than some tolerance. More...
class  basic_statistics
 Collection of basic statistics such as min, max, mean, variance. More...
struct  median_statistics
 Median and dispersion around it. More...
class  median_functor
 functor returning a given quantile of a list of data More...
class  continued_fraction
 Continued fraction as rational number. More...
struct  dihedral
struct  erf_engine
 Port of http://www.netlib.org/specfun/erf (as of 2003 Dec 03). More...
struct  floating_point_epsilon
 Dynamic determination of the smallest floating point number such that 1 + floating_point_epsilon() differs from 1. More...
class  golay_24_12_generator
 Generator for the 4096 binary words of the Golay (24,12) code. More...
class  icosahedron
 Cartesian coordinates of points on a sphere. More...
struct  imaginary_unit_t
 The complex number i. More...
class  imaginary
 An imaginary number. More...
class  least_squares_plane
class  linear_correlation
class  linear_regression_core
class  linear_regression
class  mean_and_variance
class  sphere_3d
class  minimum_covering_sphere_3d
 Minimum covering sphere of a set of 3-dimensional points. More...
class  numeric_limits
 Extension of std::numeric_limits for LAPACK-style floating point info. More...
struct  point_to_line_distance
class  principal_axes_of_inertia
class  principal_axes_of_inertia_2d
class  dmatrix
class  correlation
struct  abs_traits
struct  abs_traits< std::complex< T > >
class  unimodular_generator
struct  float_int_conversions
struct  remainder_and_quotient
 Quotient and remainder of x/y for floating point x and y. More...
class  weighted_covariance
 Variance-Covariance of a 2-dimensional distribution (x,y). More...

Namespaces

namespace  accumulator
 Accumulators to compute partial series. Statistics are the main application.
namespace  bessel
 Family of Bessel functions.
namespace  erf_constants
 Port of http://www.netlib.org/specfun/erf (as of 2003 Dec 03).
namespace  gamma
 The Gamma function and some of his/her friends.
namespace  gaussian
 Tools for the handling of Gaussians: a Exp[-b x^2].
namespace  r3_rotation
 Algorithms for R3 (i.e. 3-dimensional space) rotation matrices.

Functions

template<typename FloatType>
af::versa< FloatType,
af::c_grid< 2 > > 
distance_difference_matrix (af::shared< vec3< FloatType > > sites1, af::shared< vec3< FloatType > > sites2)
template<typename FloatType, class Distribution>
af::shared< FloatType > quantiles (const Distribution &dist, std::size_t n)
template<typename FloatType>
FloatType erf (FloatType const &x)
 Approximate values for erf(x).
template<typename FloatType>
af::shared< FloatType > erf (af::const_ref< FloatType > const &x)
template<typename FloatType>
FloatType erfc (FloatType const &x)
 Approximate values for erfc(x).
template<typename FloatType>
FloatType erfcx (FloatType const &x)
 Approximate values for exp(x*x) * erfc(x).
template<typename FloatType>
FloatType trim_cast (FloatType const &value)
 Returns value trimmed to the true precision of FloatType.
int gcd_int_simple (int a, int b)
long gcd_long_simple (long a, long b)
unsigned long gcd_unsigned_long_binary (unsigned long u, unsigned long v)
long gcd_long_binary (long u, long v)
int gcd_int (int a, int b)
long gcd_long (long a, long b)
template<typename T>
std::complex< T > operator* (imaginary_unit_t, std::complex< T > const &z)
template<typename T>
std::complex< T > operator* (std::complex< T > const &z, imaginary_unit_t)
template<typename T>
imaginary< T > operator* (imaginary_unit_t, T b)
template<typename T>
imaginary< T > operator* (T b, imaginary_unit_t)
template<typename T>
imaginary< T > operator/ (T a, imaginary< T > z)
 real / imaginary
template<typename T>
std::complex< T > operator+ (T a, imaginary< T > b)
template<typename T>
std::complex< T > operator+ (imaginary< T > b, T a)
template<typename T>
std::complex< T > operator+ (std::complex< T > const &z, imaginary< T > y)
template<typename T>
std::complex< T > operator+ (imaginary< T > y, std::complex< T > const &z)
template<typename T>
std::complex< T > operator- (std::complex< T > const &z, imaginary< T > y)
template<typename T>
std::complex< T > operator- (imaginary< T > y, std::complex< T > const &z)
template<typename T>
std::complex< T > operator* (std::complex< T > const &z, imaginary< T > y)
template<typename T>
std::complex< T > operator* (imaginary< T > y, std::complex< T > const &z)
template<typename T>
std::complex< T > operator/ (std::complex< T > const &z, imaginary< T > y)
template<typename T>
std::complex< T > operator/ (imaginary< T > y, std::complex< T > const &z)
template<typename FloatType>
void inertia_tensor (af::const_ref< vec3< FloatType > > const &points, vec3< FloatType > const &pivot, sym_mat3< FloatType > &result)
template<typename FloatType>
void inertia_tensor (af::const_ref< vec3< FloatType > > const &points, af::const_ref< FloatType > const &weights, vec3< FloatType > const &pivot, sym_mat3< FloatType > &result)
template<typename FloatType>
sym_mat3< FloatType > inertia_tensor (af::const_ref< vec3< FloatType > > const &points, vec3< FloatType > const &pivot)
template<typename FloatType>
sym_mat3< FloatType > inertia_tensor (af::const_ref< vec3< FloatType > > const &points, af::const_ref< FloatType > const &weights, vec3< FloatType > const &pivot)
template<typename PointType>
PointType interpolate_at_point (PointType const &p0, PointType const &p1, PointType const &p2, PointType const &p3, double t)
template<typename PointType>
PointType interpolate_at_point (af::tiny< PointType, 4 > p, double t)
template<typename PointType>
af::shared< PointType > interpolate_catmull_rom_spline (PointType const &p0, PointType const &p1, PointType const &p2, PointType const &p3, unsigned n_points)
float jacks_expf (float x)
 http://forums.devshed.com/software-design-43/fast-exponential-function-algorithm-60039.html
template<typename FloatType>
FloatType lambertw (FloatType const &x, unsigned max_iterations=100)
 Lambert's W function: w(x)*e^(w(x))=x.
template<typename FloatType>
FloatType linear_interpolation (FloatType const &x, FloatType const &x1, FloatType const &x2, FloatType const &y1, FloatType const &y2)
template<typename IntType>
IntType mod_positive (IntType ix, IntType const &iy)
template<typename IntType>
IntType mod_short (IntType ix, IntType const &iy)
template<typename FloatType>
FloatType fmod_short (FloatType const &x, FloatType const &y)
template<typename T>
af::tiny< vec3< T >, 3 > orthonormal_basis (vec3< T > const &v0, vec3< T > const &v1, bool right_handed=true)
template<typename T>
af::tiny< vec3< T >, 3 > orthonormal_basis (vec3< T > const &v0, int i0, vec3< T > const &v1, int i1, bool right_handed=true)
 Construct a basis whose i0-th and i1-th vectors are built from v0 and v1.
template<typename FloatType>
FloatType signed_phase_error (FloatType const &phi1, FloatType const &phi2, bool deg=false)
template<typename FloatType>
af::shared< FloatType > signed_phase_error (af::const_ref< FloatType > const &phi1, af::const_ref< FloatType > const &phi2, bool deg=false)
template<typename FloatType>
FloatType phase_error (FloatType const &phi1, FloatType const &phi2, bool deg=false)
template<typename FloatType>
af::shared< FloatType > phase_error (af::const_ref< FloatType > const &phi1, af::const_ref< FloatType > const &phi2, bool deg=false)
template<typename FloatType>
FloatType nearest_phase (FloatType const &reference, FloatType const &other, bool deg=false)
template<typename FloatType>
af::shared< FloatType > nearest_phase (af::const_ref< FloatType > const &reference, af::const_ref< FloatType > const &other, bool deg=false)
bool convex_polygons_intersect_2D (af::shared< scitbx::vec2< double > > polygon1, af::shared< scitbx::vec2< double > > polygon2)
 Calculate whether two convex polygons intersect.
template<typename NumType1, typename NumType2>
NumType1 & update_min (NumType1 &m, NumType2 const &x)
template<typename NumType1, typename NumType2>
NumType1 & update_max (NumType1 &m, NumType2 const &x)
template<typename NumType>
NumType norm (NumType x, NumType y)
 Overflow-proof sqrt(x*x + y*y).
template<typename FloatType>
FloatType round (FloatType x, int n_digits=0)
int iround (double x)
int iceil (double x)
int ifloor (double x)
int nearest_integer (double x)
template<typename UnsignedIntType, typename SizeType>
bool unsigned_product_leads_to_overflow (UnsignedIntType *a, SizeType n)
std::pair< int, double > divmod (double x, double y)
template<typename FloatType>
std::complex< FloatType > unit_complex (FloatType const &theta)


Detailed Description

Math utilities.

Function Documentation

bool scitbx::math::convex_polygons_intersect_2D ( af::shared< scitbx::vec2< double > >  polygon1,
af::shared< scitbx::vec2< double > >  polygon2 
)

Calculate whether two convex polygons intersect.

Two dimensional case. It is the responsibility of the caller to assure that the polygons are convex. Also, the vectors describing the vertices must be given in sequential order, either or clockwise or counterclockwise. Algorithm inspired by Greg Magarshak (2000) Theory & Practice, issue 02, Collision Detection, part 2 ( http://www.flipcode.com/archives/Theory_Practice-Issue_02_Collision_Detection_Part_2.shtml )

FloatType scitbx::math::erf ( FloatType const &  x  )  [inline]

Approximate values for erf(x).

See also: scitbx::math::erf_engine

Referenced by term::integral_dx_at_x().

FloatType scitbx::math::erfc ( FloatType const &  x  )  [inline]

Approximate values for erfc(x).

See also: scitbx::math::erf_engine

FloatType scitbx::math::erfcx ( FloatType const &  x  )  [inline]

Approximate values for exp(x*x) * erfc(x).

See also: scitbx::math::erf_engine

float scitbx::math::jacks_expf ( float  x  )  [inline]

http://forums.devshed.com/software-design-43/fast-exponential-function-algorithm-60039.html

The only problem with the original code was the missing test for h != 0. Code further modified by applying obvious optimizations.

FloatType scitbx::math::lambertw ( FloatType const &  x,
unsigned  max_iterations = 100 
) [inline]

Lambert's W function: w(x)*e^(w(x))=x.

Based on the implementation by Gunter Kuhnle, gk@uni-leipzig.de

Algorithm originally developed by Keith Briggs, Department of Plant Sciences, e-mail:kmb28@cam.ac.uk

http://more.btexact.com/people/briggsk2/W-ology.html

See also: http://documents.wolfram.com/mathematica/functions/ProductLog

References floating_point_epsilon::get().

af::shared<FloatType> scitbx::math::quantiles ( const Distribution &  dist,
std::size_t  n 
) [inline]

An array of quantiles of size n. For a given size n, then for k = 1,...,n, the quantiles chosen are (k-.5)/n.

FloatType scitbx::math::trim_cast ( FloatType const &  value  )  [inline]

Returns value trimmed to the true precision of FloatType.

Some optimizers maintain a higher precision for some calculations. To avoid this and trim value to the true precision of FloatType, value is converted to a base-256 string and then back to FloatType.

Referenced by floating_point_epsilon::get().


Generated on Thu Jun 19 15:35:08 2014 for cctbx by  doxygen 1.5.6