Dune Core Modules (2.7.1)

power.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_COMMON_POWER_HH
4#define DUNE_COMMON_POWER_HH
5
10#include <dune/common/math.hh>
11
12namespace Dune {
13
22 template <int m, int p>
24 {
26 enum { power = Dune::power(m,p) };
27 };
28
29
36 template <int p>
37 struct Power
38 {
39 template <typename T>
40 static constexpr auto eval(const T & a)
41 {
42 return power(a,p);
43 }
44 };
45
46}
47
48#endif
Some useful basic math stuff.
Dune namespace.
Definition: alignedallocator.hh:14
constexpr Mantissa power(Mantissa m, Exponent p)
Power method for integer exponents.
Definition: math.hh:73
Compute power for a run-time mantissa and a compile-time integer exponent.
Definition: power.hh:38
Calculates m^p at compile time.
Definition: power.hh:24
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 12, 23:30, 2024)