Loading [MathJax]/extensions/tex2jax.js
Thrill
0.1
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
+
Variables
a
b
c
d
f
g
i
k
l
m
n
p
r
s
t
v
w
x
+
Typedefs
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
Enumerations
+
Enumerator
c
d
h
i
m
s
t
w
+
Classes
Class List
Class Index
Class Hierarchy
+
Class Members
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
~
+
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Enumerations
+
Enumerator
a
b
c
d
f
m
n
o
p
r
s
t
v
w
+
Related Functions
o
p
s
+
Files
File List
+
File Members
+
All
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
w
+
Functions
b
c
d
f
g
h
j
l
m
o
p
r
s
t
u
w
Variables
Typedefs
+
Macros
_
a
b
c
d
f
h
i
l
m
o
p
s
t
u
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
power_to_the.hpp
Go to the documentation of this file.
1
/*******************************************************************************
2
* tlx/math/power_to_the.hpp
3
*
4
* power_to_the<D>(x) raises x to the D-th power using log(D) unrolled
5
* multiplications.
6
*
7
* Part of tlx - http://panthema.net/tlx
8
*
9
* Copyright (C) 2019 Manuel Penschuck <tlx@manuel.jetzt>
10
*
11
* All rights reserved. Published under the Boost Software License, Version 1.0
12
******************************************************************************/
13
14
#ifndef TLX_MATH_POWER_TO_THE_HEADER
15
#define TLX_MATH_POWER_TO_THE_HEADER
16
17
#include <
tlx/math/div_ceil.hpp
>
18
19
namespace
tlx
{
20
21
//! \addtogroup tlx_math
22
//! \{
23
24
/******************************************************************************/
25
//! power_to_the<D>(x)
26
27
//! returns x raised to the power of D using log(D) explicit multiplications.
28
template
<
unsigned
D,
typename
T>
29
static
inline
constexpr
30
T
power_to_the
(
T
x
) {
31
// Compiler optimize two calls to the same recursion into one
32
// Tested with GCC 4+, Clang 3+, MSVC 15+
33
return
D
< 1 ? 1
34
:
D
== 1 ?
x
35
:
power_to_the
<
D
/ 2>(
x
) *
power_to_the
<
div_ceil
(
D
, 2)>(
x
);
36
}
37
38
//! \}
39
40
}
// namespace tlx
41
42
#endif // !TLX_MATH_POWER_TO_THE_HEADER
43
44
/******************************************************************************/
T
double T
Definition:
logistic_regression.cpp:34
tlx
Definition:
exclusive_scan.hpp:17
tlx::power_to_the
static constexpr T power_to_the(T x)
power_to_the<D>(x)
Definition:
power_to_the.hpp:30
div_ceil.hpp
gen_data.x
list x
Definition:
gen_data.py:39
gen_data.D
int D
Definition:
gen_data.py:14
tlx::div_ceil
static constexpr auto div_ceil(const IntegralN &n, const IntegralK &k) -> decltype(n+k)
calculate n div k with rounding up, for n and k positive!
Definition:
div_ceil.hpp:25
extlib
tlx
tlx
math
power_to_the.hpp
Generated on Mon Apr 6 2020 09:17:55 for Thrill by
1.8.13