gtsam
3rdparty
Eigen
Eigen
src
Core
arch
GPU
Eigen/src/Core/arch/GPU/MathFunctions.h
Go to the documentation of this file.
1
// This file is part of Eigen, a lightweight C++ template library
2
// for linear algebra.
3
//
4
// Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>
5
//
6
// This Source Code Form is subject to the terms of the Mozilla
7
// Public License v. 2.0. If a copy of the MPL was not distributed
8
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
10
#ifndef EIGEN_MATH_FUNCTIONS_GPU_H
11
#define EIGEN_MATH_FUNCTIONS_GPU_H
12
13
namespace
Eigen
{
14
15
namespace
internal
{
16
17
// Make sure this is only available when targeting a GPU: we don't want to
18
// introduce conflicts between these packet_traits definitions and the ones
19
// we'll use on the host side (SSE, AVX, ...)
20
#if defined(EIGEN_GPUCC) && defined(EIGEN_USE_GPU)
21
template
<>
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE
22
float4 plog<float4>(
const
float4&
a
)
23
{
24
return
make_float4(logf(
a
.x), logf(
a
.y), logf(
a
.z), logf(
a
.w));
25
}
26
27
template
<>
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE
28
double2
plog<double2>(
const
double2
&
a
)
29
{
30
using ::log
;
31
return
make_double2(
log
(
a
.x),
log
(
a
.y));
32
}
33
34
template
<>
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE
35
float4 plog1p<float4>(
const
float4&
a
)
36
{
37
return
make_float4(log1pf(
a
.x), log1pf(
a
.y), log1pf(
a
.z), log1pf(
a
.w));
38
}
39
40
template
<>
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE
41
double2
plog1p<double2>(
const
double2
&
a
)
42
{
43
return
make_double2(
log1p
(
a
.x),
log1p
(
a
.y));
44
}
45
46
template
<>
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE
47
float4 pexp<float4>(
const
float4&
a
)
48
{
49
return
make_float4(expf(
a
.x), expf(
a
.y), expf(
a
.z), expf(
a
.w));
50
}
51
52
template
<>
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE
53
double2
pexp<double2>(
const
double2
&
a
)
54
{
55
using ::exp
;
56
return
make_double2(
exp
(
a
.x),
exp
(
a
.y));
57
}
58
59
template
<>
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE
60
float4 pexpm1<float4>(
const
float4&
a
)
61
{
62
return
make_float4(expm1f(
a
.x), expm1f(
a
.y), expm1f(
a
.z), expm1f(
a
.w));
63
}
64
65
template
<>
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE
66
double2
pexpm1<double2>(
const
double2
&
a
)
67
{
68
return
make_double2(
expm1
(
a
.x),
expm1
(
a
.y));
69
}
70
71
template
<>
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE
72
float4 psqrt<float4>(
const
float4&
a
)
73
{
74
return
make_float4(sqrtf(
a
.x), sqrtf(
a
.y), sqrtf(
a
.z), sqrtf(
a
.w));
75
}
76
77
template
<>
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE
78
double2
psqrt<double2>(
const
double2
&
a
)
79
{
80
using ::sqrt
;
81
return
make_double2(
sqrt
(
a
.x),
sqrt
(
a
.y));
82
}
83
84
template
<>
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE
85
float4 prsqrt<float4>(
const
float4&
a
)
86
{
87
return
make_float4(rsqrtf(
a
.x), rsqrtf(
a
.y), rsqrtf(
a
.z), rsqrtf(
a
.w));
88
}
89
90
template
<>
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE
91
double2
prsqrt<double2>(
const
double2
&
a
)
92
{
93
return
make_double2(
rsqrt
(
a
.x),
rsqrt
(
a
.y));
94
}
95
96
97
#endif
98
99
}
// end namespace internal
100
101
}
// end namespace Eigen
102
103
#endif // EIGEN_MATH_FUNCTIONS_GPU_H
EIGEN_DEVICE_FUNC
#define EIGEN_DEVICE_FUNC
Definition:
Macros.h:976
Eigen
Namespace containing all symbols from the Eigen library.
Definition:
jet.h:637
double2
Definition:
dd_real.h:74
log
const EIGEN_DEVICE_FUNC LogReturnType log() const
Definition:
ArrayCwiseUnaryOps.h:128
exp
const EIGEN_DEVICE_FUNC ExpReturnType exp() const
Definition:
ArrayCwiseUnaryOps.h:97
expm1
double expm1(double x)
Definition:
unity.c:106
EIGEN_STRONG_INLINE
#define EIGEN_STRONG_INLINE
Definition:
Macros.h:917
log1p
double log1p(double x)
Definition:
unity.c:49
rsqrt
const EIGEN_DEVICE_FUNC RsqrtReturnType rsqrt() const
Definition:
ArrayCwiseUnaryOps.h:203
a
ArrayXXi a
Definition:
Array_initializer_list_23_cxx11.cpp:1
internal
Definition:
BandTriangularSolver.h:13
ceres::sqrt
Jet< T, N > sqrt(const Jet< T, N > &f)
Definition:
jet.h:418
gtsam
Author(s):
autogenerated on Tue Jun 25 2024 03:01:33