Belle II Software development
MathHelpers.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11namespace Belle2 {
16
20 template<typename T>
21 inline constexpr T square(const T& x)
22 {
23 return x * x;
24 }
25
28 template<typename T>
29 inline constexpr T cube(const T& x)
30 {
31 return x * x * x;
32 }
33
36 template<typename T>
37 inline constexpr T pow4(const T& x)
38 {
39 const T x2 = square(x);
40 return x2 * x2;
41 }
42
45 template<typename T>
46 inline constexpr T pow5(const T& x)
47 {
48 const T x4 = pow4(x);
49 return x4 * x;
50 }
51
53}
constexpr T cube(const T &x)
Calculate the cube of the input.
Definition MathHelpers.h:29
constexpr T square(const T &x)
Calculate the square of the input.
Definition MathHelpers.h:21
constexpr T pow5(const T &x)
Calculate the fifth power of the input.
Definition MathHelpers.h:46
constexpr T pow4(const T &x)
Calculate the fourth power of the input.
Definition MathHelpers.h:37
Abstract base class for different kinds of events.