ATLAS Offline Software
Control
CxxUtils
CxxUtils
sincos.h
Go to the documentation of this file.
1
// This file's extension implies that it's C, but it's really -*- C++ -*-.
2
3
/*
4
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
// $Id: sincos.h,v 1.1 2008-11-24 04:34:07 ssnyder Exp $
8
17
#ifndef CXXUTILS_SINCOS_H
18
#define CXXUTILS_SINCOS_H
19
20
21
#include <cmath>
22
23
24
namespace
CxxUtils
{
25
26
75
struct
sincos
76
{
77
// cppcheck-suppress uninitMemberVar ; false positive
79
sincos
(
double
x
)
80
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
81
// Inline assembly version. Uses x87 FPU.
82
{ __asm __volatile__ (
"fsincos\n\t"
:
"=t"
(
cs
),
"=u"
(
sn
) :
"0"
(
x
)); }
83
#elif defined(__USE_GNU)
84
// Version using the GNU sincos() function.
85
{
::sincos
(
x
, &
sn
, &
cs
); }
86
#else
87
// Generic version.
88
:
sn
(
std::sin
(
x
)),
cs
(
std::cos
(
x
)) {}
89
#endif
90
92
double
sn
;
93
95
double
cs
;
96
98
double
apply
(
double
a
,
double
b
)
const
{
return
a
*
sn
+
b
*
cs
; }
99
101
double
apply2
(
double
a
,
double
b
,
double
c
)
const
102
{
return
a
*
sn
*
sn
+
b
*
sn
*
cs
+
c
*
cs
*
cs
; }
103
};
104
105
106
}
// namespace CxxUtils
107
108
109
#endif //not CXXUTILS_SINCOS_H
CxxUtils::sincos::apply
double apply(double a, double b) const
Definition:
sincos.h:98
CxxUtils::sincos::sincos
sincos(double x)
Calculate sine and cosine of x.
Definition:
sincos.h:79
drawFromPickle.cos
cos
Definition:
drawFromPickle.py:36
x
#define x
CxxUtils::sincos::cs
double cs
Definition:
sincos.h:95
CxxUtils
Definition:
aligned_vector.h:29
CxxUtils::sincos::apply2
double apply2(double a, double b, double c) const
Definition:
sincos.h:101
plotBeamSpotMon.b
b
Definition:
plotBeamSpotMon.py:77
CxxUtils::sincos::sn
double sn
Definition:
sincos.h:92
a
TList * a
Definition:
liststreamerinfos.cxx:10
CxxUtils::sincos
Helper to simultaneously calculate sin and cos of the same angle.
Definition:
sincos.h:76
drawFromPickle.sin
sin
Definition:
drawFromPickle.py:36
python.compressB64.c
def c
Definition:
compressB64.py:93
Generated on Thu Nov 7 2024 21:26:10 for ATLAS Offline Software by
1.8.18