Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooVDTHeaders.h
Go to the documentation of this file.
1// Author: Stephan Hageboeck, CERN 2 Sep 2019
2
3/*****************************************************************************
4 * RooFit
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2019, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16
17#ifndef ROOFIT_BATCHCOMPUTE_ROOVDTHEADERS_H
18#define ROOFIT_BATCHCOMPUTE_ROOVDTHEADERS_H
19
20/*
21 * VDT headers for RooFit. Since RooFit cannot directly depend on VDT (it might not be available),
22 * this layer can be used to switch between different implementations.
23 */
24
25#include "RConfigure.h"
26
27#if defined(R__HAS_VDT) && !defined(__CUDACC__)
28#include <vdt/cos.h>
29#include <vdt/exp.h>
30#include <vdt/log.h>
31#include <vdt/sin.h>
32#include <vdt/sqrt.h>
33
34namespace RooBatchCompute {
35
36inline double fast_exp(double x)
37{
38 return vdt::fast_exp(x);
39}
40
41inline double fast_sin(double x)
42{
43 return vdt::fast_sin(x);
44}
45
46inline double fast_cos(double x)
47{
48 return vdt::fast_cos(x);
49}
50
51inline double fast_log(double x)
52{
53 return vdt::fast_log(x);
54}
55
56inline double fast_isqrt(double x)
57{
58 return vdt::fast_isqrt(x);
59}
60
61} // namespace RooBatchCompute
62
63#else
64#include <cmath>
65
66namespace RooBatchCompute {
67
68__roodevice__ inline double fast_exp(double x)
69{
70 return std::exp(x);
71}
72
73__roodevice__ inline double fast_sin(double x)
74{
75 return std::sin(x);
76}
77
78__roodevice__ inline double fast_cos(double x)
79{
80 return std::cos(x);
81}
82
83__roodevice__ inline double fast_log(double x)
84{
85 return std::log(x);
86}
87
88__roodevice__ inline double fast_isqrt(double x)
89{
90 return 1. / std::sqrt(x);
91}
92
93} // namespace RooBatchCompute
94
95#endif // defined(R__HAS_VDT) && !defined(__CUDACC__)
96
97#endif // ROOFIT_BATCHCOMPUTE_ROOVDTHEADERS_H_
#define __roodevice__
Double_t x[n]
Definition legend1.C:17
Namespace for dispatching RooFit computations to various backends.
__roodevice__ double fast_exp(double x)
__roodevice__ double fast_sin(double x)
__roodevice__ double fast_log(double x)
__roodevice__ double fast_cos(double x)
__roodevice__ double fast_isqrt(double x)