Math constants + configure bugfix backported
authoralpar
Fri, 08 Feb 2008 10:18:55 +0000
changeset 2568046c055217f6
parent 2567 62a9d46303d9
child 2569 12c2c5c4330b
Math constants + configure bugfix backported
from hg a315a588a20d and 761622e5ed4c
configure.ac
demo/descriptor_map_demo.cc
demo/eps_demo.cc
doc/maps.dox
doc/maps2.dox
lemon/Makefile.am
lemon/math.h
lemon/random.h
     1.1 --- a/configure.ac	Fri Feb 08 09:56:46 2008 +0000
     1.2 +++ b/configure.ac	Fri Feb 08 10:18:55 2008 +0000
     1.3 @@ -13,7 +13,7 @@
     1.4  AC_INIT([LEMON], [lemon_version()], [etik-ol@cs.elte.hu], [lemon])
     1.5  AC_CONFIG_AUX_DIR([build-aux])
     1.6  AC_CONFIG_MACRO_DIR([m4])
     1.7 -AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
     1.8 +AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects nostdinc])
     1.9  AC_CONFIG_SRCDIR([lemon/list_graph.h])
    1.10  AC_CONFIG_HEADERS([config.h lemon/config.h])
    1.11  
     2.1 --- a/demo/descriptor_map_demo.cc	Fri Feb 08 09:56:46 2008 +0000
     2.2 +++ b/demo/descriptor_map_demo.cc	Fri Feb 08 10:18:55 2008 +0000
     2.3 @@ -61,7 +61,7 @@
     2.4      : descriptor(_graph), center(_center), radius(_radius) {}
     2.5  
     2.6    Value operator[](const Key& key) const {
     2.7 -    double angle = descriptor[key] * 2 * M_PI 
     2.8 +    double angle = descriptor[key] * 2 * PI 
     2.9        / double(descriptor.inverse().size());
    2.10      double x = std::cos(angle) * radius + center.x;
    2.11      double y = std::sin(angle) * radius + center.y;
     3.1 --- a/demo/eps_demo.cc	Fri Feb 08 09:56:46 2008 +0000
     3.2 +++ b/demo/eps_demo.cc	Fri Feb 08 10:18:55 2008 +0000
     3.3 @@ -47,7 +47,7 @@
     3.4    
     3.5    ed.moveTo(0,1);
     3.6    
     3.7 -  for(d=0;d<M_PI*2*5;d+=.1)
     3.8 +  for(d=0;d<PI*2*5;d+=.1)
     3.9      {
    3.10        ed.lineTo(sin(d*3),cos(d*5));
    3.11      }
     4.1 --- a/doc/maps.dox	Fri Feb 08 09:56:46 2008 +0000
     4.2 +++ b/doc/maps.dox	Fri Feb 08 10:18:55 2008 +0000
     4.3 @@ -106,7 +106,7 @@
     4.4  {
     4.5    typedef double Value;
     4.6    typedef Graph::Edge Key;
     4.7 -  double operator[](Key e) const { return M_PI;}
     4.8 +  double operator[](Key e) const { return PI;}
     4.9  };
    4.10  \endcode
    4.11  
    4.12 @@ -115,7 +115,7 @@
    4.13  \code
    4.14  struct MyMap : public MapBase<Graph::Edge,double>
    4.15  {
    4.16 -  Value operator[](Key e) const { return M_PI;}
    4.17 +  Value operator[](Key e) const { return PI;}
    4.18  };
    4.19  \endcode
    4.20  
     5.1 --- a/doc/maps2.dox	Fri Feb 08 09:56:46 2008 +0000
     5.2 +++ b/doc/maps2.dox	Fri Feb 08 10:18:55 2008 +0000
     5.3 @@ -42,7 +42,7 @@
     5.4  {
     5.5    typedef double Value;
     5.6    typedef Graph::Edge Key;
     5.7 -  double operator[](const Key &e) const { return M_PI;}
     5.8 +  double operator[](const Key &e) const { return PI;}
     5.9  };
    5.10  \endcode
    5.11  
    5.12 @@ -51,7 +51,7 @@
    5.13  \code
    5.14  struct MyMap : public MapBase<Graph::Edge,double>
    5.15  {
    5.16 -  Value operator[](const Key& e) const { return M_PI;}
    5.17 +  Value operator[](const Key& e) const { return PI;}
    5.18  };
    5.19  \endcode
    5.20  
     6.1 --- a/lemon/Makefile.am	Fri Feb 08 09:56:46 2008 +0000
     6.2 +++ b/lemon/Makefile.am	Fri Feb 08 10:18:55 2008 +0000
     6.3 @@ -92,6 +92,7 @@
     6.4  	lemon/lp_utils.h \
     6.5  	lemon/map_iterator.h \
     6.6  	lemon/maps.h \
     6.7 +	lemon/math.h \
     6.8  	lemon/matrix_maps.h \
     6.9  	lemon/max_matching.h \
    6.10  	lemon/min_cost_arborescence.h \
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/lemon/math.h	Fri Feb 08 10:18:55 2008 +0000
     7.3 @@ -0,0 +1,63 @@
     7.4 +/* -*- C++ -*-
     7.5 + *
     7.6 + * This file is a part of LEMON, a generic C++ optimization library
     7.7 + *
     7.8 + * Copyright (C) 2003-2008
     7.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    7.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
    7.11 + *
    7.12 + * Permission to use, modify and distribute this software is granted
    7.13 + * provided that this copyright notice appears in all copies. For
    7.14 + * precise terms see the accompanying LICENSE file.
    7.15 + *
    7.16 + * This software is provided "AS IS" with no warranty of any kind,
    7.17 + * express or implied, and with no claim as to its suitability for any
    7.18 + * purpose.
    7.19 + *
    7.20 + */
    7.21 +
    7.22 +#ifndef LEMON_MATH_H
    7.23 +#define LEMON_MATH_H
    7.24 +
    7.25 +///\ingroup misc
    7.26 +///\file
    7.27 +///\brief Some extensions to the standard \c cmath library.
    7.28 +///
    7.29 +///Some extensions to the standard \c cmath library.
    7.30 +///
    7.31 +///This file includes the standard math library (cmath).
    7.32 +
    7.33 +#include<cmath>
    7.34 +
    7.35 +namespace lemon {
    7.36 +
    7.37 +  /// \addtogroup misc
    7.38 +  /// @{
    7.39 +  
    7.40 +  /// The Euler constant
    7.41 +  const long double E       = 2.7182818284590452353602874713526625L;
    7.42 +  /// log_2(e)
    7.43 +  const long double LOG2E   = 1.4426950408889634073599246810018921L;
    7.44 +  /// log_10(e)
    7.45 +  const long double LOG10E  = 0.4342944819032518276511289189166051L;
    7.46 +  /// ln(2)
    7.47 +  const long double LN2     = 0.6931471805599453094172321214581766L;
    7.48 +  /// ln(10)
    7.49 +  const long double LN10    = 2.3025850929940456840179914546843642L;
    7.50 +  /// pi
    7.51 +  const long double PI      = 3.1415926535897932384626433832795029L;
    7.52 +  /// pi/2
    7.53 +  const long double PI_2    = 1.5707963267948966192313216916397514L;
    7.54 +  /// pi/4
    7.55 +  const long double PI_4    = 0.7853981633974483096156608458198757L;
    7.56 +  /// sqrt(2)
    7.57 +  const long double SQRT2   = 1.4142135623730950488016887242096981L;
    7.58 +  /// 1/sqrt(2)
    7.59 +  const long double SQRT1_2 = 0.7071067811865475244008443621048490L;
    7.60 +  
    7.61 +
    7.62 +  /// @}
    7.63 +
    7.64 +} //namespace lemon
    7.65 +
    7.66 +#endif //LEMON_TOLERANCE_H
     8.1 --- a/lemon/random.h	Fri Feb 08 09:56:46 2008 +0000
     8.2 +++ b/lemon/random.h	Fri Feb 08 10:18:55 2008 +0000
     8.3 @@ -766,7 +766,7 @@
     8.4      {
     8.5        double xi,nu;
     8.6        const double delta = k-std::floor(k);
     8.7 -      const double v0=M_E/(M_E-delta);
     8.8 +      const double v0=E/(E-delta);
     8.9        do {
    8.10  	double V0=1.0-real<double>();
    8.11  	double V1=1.0-real<double>();