[Lemon-commits] alpar: r3450 - in lemon/trunk: . demo doc lemon
Lemon SVN
svn at lemon.cs.elte.hu
Fri Feb 8 11:18:57 CET 2008
Author: alpar
Date: Fri Feb 8 11:18:55 2008
New Revision: 3450
Added:
lemon/trunk/lemon/math.h
Modified:
lemon/trunk/configure.ac
lemon/trunk/demo/descriptor_map_demo.cc
lemon/trunk/demo/eps_demo.cc
lemon/trunk/doc/maps.dox
lemon/trunk/doc/maps2.dox
lemon/trunk/lemon/Makefile.am
lemon/trunk/lemon/random.h
Log:
Math constants + configure bugfix backported
from hg a315a588a20d and 761622e5ed4c
Modified: lemon/trunk/configure.ac
==============================================================================
--- lemon/trunk/configure.ac (original)
+++ lemon/trunk/configure.ac Fri Feb 8 11:18:55 2008
@@ -13,7 +13,7 @@
AC_INIT([LEMON], [lemon_version()], [etik-ol at cs.elte.hu], [lemon])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
-AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
+AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects nostdinc])
AC_CONFIG_SRCDIR([lemon/list_graph.h])
AC_CONFIG_HEADERS([config.h lemon/config.h])
Modified: lemon/trunk/demo/descriptor_map_demo.cc
==============================================================================
--- lemon/trunk/demo/descriptor_map_demo.cc (original)
+++ lemon/trunk/demo/descriptor_map_demo.cc Fri Feb 8 11:18:55 2008
@@ -61,7 +61,7 @@
: descriptor(_graph), center(_center), radius(_radius) {}
Value operator[](const Key& key) const {
- double angle = descriptor[key] * 2 * M_PI
+ double angle = descriptor[key] * 2 * PI
/ double(descriptor.inverse().size());
double x = std::cos(angle) * radius + center.x;
double y = std::sin(angle) * radius + center.y;
Modified: lemon/trunk/demo/eps_demo.cc
==============================================================================
--- lemon/trunk/demo/eps_demo.cc (original)
+++ lemon/trunk/demo/eps_demo.cc Fri Feb 8 11:18:55 2008
@@ -47,7 +47,7 @@
ed.moveTo(0,1);
- for(d=0;d<M_PI*2*5;d+=.1)
+ for(d=0;d<PI*2*5;d+=.1)
{
ed.lineTo(sin(d*3),cos(d*5));
}
Modified: lemon/trunk/doc/maps.dox
==============================================================================
--- lemon/trunk/doc/maps.dox (original)
+++ lemon/trunk/doc/maps.dox Fri Feb 8 11:18:55 2008
@@ -106,7 +106,7 @@
{
typedef double Value;
typedef Graph::Edge Key;
- double operator[](Key e) const { return M_PI;}
+ double operator[](Key e) const { return PI;}
};
\endcode
@@ -115,7 +115,7 @@
\code
struct MyMap : public MapBase<Graph::Edge,double>
{
- Value operator[](Key e) const { return M_PI;}
+ Value operator[](Key e) const { return PI;}
};
\endcode
Modified: lemon/trunk/doc/maps2.dox
==============================================================================
--- lemon/trunk/doc/maps2.dox (original)
+++ lemon/trunk/doc/maps2.dox Fri Feb 8 11:18:55 2008
@@ -42,7 +42,7 @@
{
typedef double Value;
typedef Graph::Edge Key;
- double operator[](const Key &e) const { return M_PI;}
+ double operator[](const Key &e) const { return PI;}
};
\endcode
@@ -51,7 +51,7 @@
\code
struct MyMap : public MapBase<Graph::Edge,double>
{
- Value operator[](const Key& e) const { return M_PI;}
+ Value operator[](const Key& e) const { return PI;}
};
\endcode
Modified: lemon/trunk/lemon/Makefile.am
==============================================================================
--- lemon/trunk/lemon/Makefile.am (original)
+++ lemon/trunk/lemon/Makefile.am Fri Feb 8 11:18:55 2008
@@ -92,6 +92,7 @@
lemon/lp_utils.h \
lemon/map_iterator.h \
lemon/maps.h \
+ lemon/math.h \
lemon/matrix_maps.h \
lemon/max_matching.h \
lemon/min_cost_arborescence.h \
Added: lemon/trunk/lemon/math.h
==============================================================================
--- (empty file)
+++ lemon/trunk/lemon/math.h Fri Feb 8 11:18:55 2008
@@ -0,0 +1,63 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_MATH_H
+#define LEMON_MATH_H
+
+///\ingroup misc
+///\file
+///\brief Some extensions to the standard \c cmath library.
+///
+///Some extensions to the standard \c cmath library.
+///
+///This file includes the standard math library (cmath).
+
+#include<cmath>
+
+namespace lemon {
+
+ /// \addtogroup misc
+ /// @{
+
+ /// The Euler constant
+ const long double E = 2.7182818284590452353602874713526625L;
+ /// log_2(e)
+ const long double LOG2E = 1.4426950408889634073599246810018921L;
+ /// log_10(e)
+ const long double LOG10E = 0.4342944819032518276511289189166051L;
+ /// ln(2)
+ const long double LN2 = 0.6931471805599453094172321214581766L;
+ /// ln(10)
+ const long double LN10 = 2.3025850929940456840179914546843642L;
+ /// pi
+ const long double PI = 3.1415926535897932384626433832795029L;
+ /// pi/2
+ const long double PI_2 = 1.5707963267948966192313216916397514L;
+ /// pi/4
+ const long double PI_4 = 0.7853981633974483096156608458198757L;
+ /// sqrt(2)
+ const long double SQRT2 = 1.4142135623730950488016887242096981L;
+ /// 1/sqrt(2)
+ const long double SQRT1_2 = 0.7071067811865475244008443621048490L;
+
+
+ /// @}
+
+} //namespace lemon
+
+#endif //LEMON_TOLERANCE_H
Modified: lemon/trunk/lemon/random.h
==============================================================================
--- lemon/trunk/lemon/random.h (original)
+++ lemon/trunk/lemon/random.h Fri Feb 8 11:18:55 2008
@@ -766,7 +766,7 @@
{
double xi,nu;
const double delta = k-std::floor(k);
- const double v0=M_E/(M_E-delta);
+ const double v0=E/(E-delta);
do {
double V0=1.0-real<double>();
double V1=1.0-real<double>();
More information about the Lemon-commits
mailing list