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
{
78
sincos
(
double
x
)
79
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
80
// Inline assembly version. Uses x87 FPU.
81
{ __asm __volatile__ (
"fsincos\n\t"
:
"=t"
(
cs
),
"=u"
(
sn
) :
"0"
(
x
)); }
82
#elif defined(__USE_GNU)
83
// Version using the GNU sincos() function.
84
{
::sincos
(
x
, &
sn
, &
cs
); }
85
#else
86
// Generic version.
87
:
sn
(
std::sin
(
x
)),
cs
(
std::cos
(
x
)) {}
88
#endif
89
91
double
sn
;
92
94
double
cs
;
95
97
double
apply
(
double
a
,
double
b
)
const
{
return
a
*
sn
+
b
*
cs
; }
98
100
double
apply2
(
double
a
,
double
b
,
double
c
)
const
101
{
return
a
*
sn
*
sn
+
b
*
sn
*
cs
+
c
*
cs
*
cs
; }
102
};
103
104
105
}
// namespace CxxUtils
106
107
108
#endif //not CXXUTILS_SINCOS_H
CxxUtils::sincos::apply
double apply(double a, double b) const
Definition:
sincos.h:97
CxxUtils::sincos::sincos
sincos(double x)
Calculate sine and cosine of x.
Definition:
sincos.h:78
drawFromPickle.cos
cos
Definition:
drawFromPickle.py:36
x
#define x
CxxUtils::sincos::cs
double cs
Definition:
sincos.h:94
CxxUtils
Definition:
aligned_vector.h:29
CxxUtils::sincos::apply2
double apply2(double a, double b, double c) const
Definition:
sincos.h:100
plotBeamSpotMon.b
b
Definition:
plotBeamSpotMon.py:77
CxxUtils::sincos::sn
double sn
Definition:
sincos.h:91
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 Sat Dec 21 2024 21:18:18 for ATLAS Offline Software by
1.8.18