/usr/include/dune/common/math.hh is in libdune-common-dev 2.2.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=4 sts=2:
#ifndef DUNE_MATH_HH
#define DUNE_MATH_HH
/** \file
* \brief Some useful basic math stuff
*/
#include <cmath>
namespace Dune
{
/**
\brief Provides commonly used mathematical constants.
a struct that is specialized for types repesenting real or complex
numbers. I provides commonly used mathematical constants with the
required accuary for the specified type.
*/
template< class Field >
struct MathematicalConstants;
/**
\brief Standard implementation of MathematicalConstants.
This implementation will work with all built-in floating point
types. It provides
* e as std::exp(1.0)
* pi as std::acos(-1.0)
*/
template< class T >
struct StandardMathematicalConstants
{
static T e ()
{
static const T e = std::exp( T( 1 ) );
return e;
}
static T pi ()
{
static const T pi = std::acos( T( -1 ) );
return pi;
}
};
#ifndef DOXYGEN
// MathematicalConstants for float
// -------------------------------
template<>
struct MathematicalConstants< float >
: public StandardMathematicalConstants< float >
{};
// MathematicalConstants for double
// --------------------------------
template<>
struct MathematicalConstants< double >
: public StandardMathematicalConstants< double >
{};
// MathematicalConstants for long double
// -------------------------------------
template<>
struct MathematicalConstants< long double >
: public StandardMathematicalConstants< long double >
{};
#endif // DOXYGEN
}
#endif // #ifndef DUNE_MATH_HH
|