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/exp.h"
29#include "vdt/log.h"
30#include "vdt/sqrt.h"
31
32namespace RooBatchCompute{
33
34inline double fast_exp(double x) {
35 return vdt::fast_exp(x);
36}
37
38inline double fast_log(double x) {
39 return vdt::fast_log(x);
40}
41
42inline double fast_isqrt(double x) {
43 return vdt::fast_isqrt(x);
44}
45
46}
47
48#else
49#include <cmath>
50
51namespace RooBatchCompute{
52
53__roodevice__ inline double fast_exp(double x) {
54 return std::exp(x);
55}
56
57__roodevice__ inline double fast_log(double x) {
58 return std::log(x);
59}
60
61__roodevice__ inline double fast_isqrt(double x) {
62 return 1/std::sqrt(x);
63}
64
65}
66
67#endif // defined(R__HAS_VDT) && !defined(__CUDACC__)
68
69#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_log(double x)
__roodevice__ double fast_isqrt(double x)