Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ComputeFunctions.cxx
Go to the documentation of this file.
1/*
2 * Project: RooFit
3 * Authors:
4 * Emmanouil Michalainas, CERN, Summer 2019
5 *
6 * Copyright (c) 2021, CERN
7 *
8 * Redistribution and use in source and binary forms,
9 * with or without modification, are permitted according to the terms
10 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
11 */
12
13/**
14\file ComputeFunctions.cxx
15
16This file contains vectorizable computation functions for PDFs and other Roofit objects.
17The same source file can also be compiled with nvcc. All functions have a single `Batches`
18object as an argument passed by value, which contains all the information necessary for the
19computation. In case of cuda computations, the loops have a step (stride) the size of the grid
20which allows for reusing the same code as the cpu implementations, easier debugging and in terms
21of performance, maximum memory coalescing. For more details, see
22https://developer.nvidia.com/blog/cuda-pro-tip-write-flexible-kernels-grid-stride-loops/
23**/
24
25#include "RooBatchCompute.h"
26#include "RooNaNPacker.h"
27#include "RooVDTHeaders.h"
28#include "Batches.h"
29
30#include <TMath.h>
31
33
34#include <algorithm>
35#include <limits>
36#include <vector>
37
38#ifdef __CUDACC__
39#define BEGIN blockDim.x *blockIdx.x + threadIdx.x
40#define STEP blockDim.x *gridDim.x
41#else
42#define BEGIN 0
43#define STEP 1
44#endif // #ifdef __CUDACC__
45
46namespace RooBatchCompute {
47namespace RF_ARCH {
48
50{
51 const int nPdfs = batches.nExtra;
52 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
53 batches.output[i] = batches.extra[0] * batches.args[0][i];
54 }
55 for (int pdf = 1; pdf < nPdfs; pdf++) {
56 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
57 batches.output[i] += batches.extra[pdf] * batches.args[pdf][i];
58 }
59 }
60}
61
63{
64 Batch m = batches.args[0];
65 Batch m0 = batches.args[1];
66 Batch c = batches.args[2];
67 Batch p = batches.args[3];
68 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
69 const double t = m[i] / m0[i];
70 const double u = 1 - t * t;
71 batches.output[i] = c[i] * u + p[i] * fast_log(u);
72 }
73 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
74 if (m[i] >= m0[i]) {
75 batches.output[i] = 0.0;
76 } else {
77 batches.output[i] = m[i] * fast_exp(batches.output[i]);
78 }
79 }
80}
81
83{
84 Batch coef0 = batches.args[0];
85 Batch coef1 = batches.args[1];
86 Batch tagFlav = batches.args[2];
87 Batch delMistag = batches.args[3];
88 Batch mixState = batches.args[4];
89 Batch mistag = batches.args[5];
90
91 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
92 batches.output[i] =
93 coef0[i] * (1.0 - tagFlav[i] * delMistag[0]) + coef1[i] * (mixState[i] * (1.0 - 2.0 * mistag[0]));
94 }
95}
96
98{
99 const int nCoef = batches.nExtra - 2;
100 const int degree = nCoef - 1;
101 const double xmin = batches.extra[nCoef];
102 const double xmax = batches.extra[nCoef + 1];
103 Batch xData = batches.args[0];
104
105 // The binomial coefficients are applied on the fly in the evaluation loops
106 // below. Note for the CUDA case: the coefficients must not be applied to
107 // batches.extra in-place, because the extra arguments live in global device
108 // memory that is shared by all threads.
109
110 if (STEP == 1) {
111 double X[bufferSize];
112 double _1_X[bufferSize];
113 double powX[bufferSize];
114 double pow_1_X[bufferSize];
115 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
116 powX[i] = pow_1_X[i] = 1.0;
117 X[i] = (xData[i] - xmin) / (xmax - xmin);
118 _1_X[i] = 1 - X[i];
119 batches.output[i] = 0.0;
120 }
121
122 // raising 1-x to the power of degree
123 for (int k = 2; k <= degree; k += 2) {
124 for (size_t i = BEGIN; i < batches.nEvents; i += STEP)
125 pow_1_X[i] *= _1_X[i] * _1_X[i];
126 }
127
128 if (degree % 2 == 1) {
129 for (size_t i = BEGIN; i < batches.nEvents; i += STEP)
130 pow_1_X[i] *= _1_X[i];
131 }
132
133 // inverting 1-x ---> 1/(1-x)
134 for (size_t i = BEGIN; i < batches.nEvents; i += STEP)
135 _1_X[i] = 1 / _1_X[i];
136
137 double binomial = 1.0;
138 for (int k = 0; k < nCoef; k++) {
139 const double coef = batches.extra[k] * binomial;
140 binomial = (binomial * (degree - k)) / (k + 1);
141 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
142 batches.output[i] += coef * powX[i] * pow_1_X[i];
143
144 // calculating next power for x and 1-x
145 powX[i] *= X[i];
146 pow_1_X[i] *= _1_X[i];
147 }
148 }
149 } else {
150 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
151 batches.output[i] = 0.0;
152 const double X = (xData[i] - xmin) / (xmax - xmin);
153 double powX = 1.0;
154 double pow_1_X = 1.0;
155 for (int k = 1; k <= degree; k++)
156 pow_1_X *= 1 - X;
157 const double _1_X = 1 / (1 - X);
158 double binomial = 1.0;
159 for (int k = 0; k < nCoef; k++) {
160 batches.output[i] += batches.extra[k] * binomial * powX * pow_1_X;
161 binomial = (binomial * (degree - k)) / (k + 1);
162 powX *= X;
163 pow_1_X *= _1_X;
164 }
165 }
166 }
167}
168
170{
171 Batch X = batches.args[0];
172 Batch M = batches.args[1];
173 Batch SL = batches.args[2];
174 Batch SR = batches.args[3];
175 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
176 double arg = X[i] - M[i];
177 if (arg < 0) {
178 arg /= SL[i];
179 } else {
180 arg /= SR[i];
181 }
182 batches.output[i] = fast_exp(-0.5 * arg * arg);
183 }
184}
185
187{
188 Batch X = batches.args[0];
189 Batch M = batches.args[1];
190 Batch W = batches.args[2];
191 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
192 const double arg = X[i] - M[i];
193 batches.output[i] = 1 / (arg * arg + 0.25 * W[i] * W[i]);
194 }
195}
196
198{
199 Batch X = batches.args[0];
200 Batch XP = batches.args[1];
201 Batch SP = batches.args[2];
202 Batch XI = batches.args[3];
203 Batch R1 = batches.args[4];
204 Batch R2 = batches.args[5];
205 const double r3 = log(2.0);
206 const double r6 = exp(-6.0);
207 const double r7 = 2 * sqrt(2 * log(2.0));
208
209 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
210 const double r1 = XI[i] * fast_isqrt(XI[i] * XI[i] + 1);
211 const double r4 = 1 / fast_isqrt(XI[i] * XI[i] + 1);
212 const double hp = 1 / (SP[i] * r7);
213 const double x1 = XP[i] + 0.5 * SP[i] * r7 * (r1 - 1);
214 const double x2 = XP[i] + 0.5 * SP[i] * r7 * (r1 + 1);
215
216 double r5 = 1.0;
217 if (XI[i] > r6 || XI[i] < -r6)
218 r5 = XI[i] / fast_log(r4 + XI[i]);
219
220 double factor = 1;
221 double y = X[i] - x1;
222 double Yp = XP[i] - x1;
223 double yi = r4 - XI[i];
224 double rho = R1[i];
225 if (X[i] >= x2) {
226 factor = -1;
227 y = X[i] - x2;
228 Yp = XP[i] - x2;
229 yi = r4 + XI[i];
230 rho = R2[i];
231 }
232
233 batches.output[i] = rho * y * y / Yp / Yp - r3 + factor * 4 * r3 * y * hp * r5 * r4 / yi / yi;
234 if (X[i] >= x1 && X[i] < x2) {
235 batches.output[i] =
236 fast_log(1 + 4 * XI[i] * r4 * (X[i] - XP[i]) * hp) / fast_log(1 + 2 * XI[i] * (XI[i] - r4));
237 batches.output[i] *= -batches.output[i] * r3;
238 }
239 if (X[i] >= x1 && X[i] < x2 && XI[i] < r6 && XI[i] > -r6)
240 batches.output[i] = -4 * r3 * (X[i] - XP[i]) * (X[i] - XP[i]) * hp * hp;
241 }
242 for (size_t i = BEGIN; i < batches.nEvents; i += STEP)
243 batches.output[i] = fast_exp(batches.output[i]);
244}
245
247{
248 Batch M = batches.args[0];
249 Batch M0 = batches.args[1];
250 Batch S = batches.args[2];
251 Batch A = batches.args[3];
252 Batch N = batches.args[4];
253 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
254 const double t = (M[i] - M0[i]) / S[i];
255 if ((A[i] > 0 && t >= -A[i]) || (A[i] < 0 && -t >= A[i])) {
256 batches.output[i] = -0.5 * t * t;
257 } else {
258 batches.output[i] = N[i] / (N[i] - A[i] * A[i] - A[i] * t);
259 batches.output[i] = fast_log(batches.output[i]);
260 batches.output[i] *= N[i];
261 batches.output[i] -= 0.5 * A[i] * A[i];
262 }
263 }
264 for (size_t i = BEGIN; i < batches.nEvents; i += STEP)
265 batches.output[i] = fast_exp(batches.output[i]);
266}
267
269{
270 Batch xData = batches.args[0];
271 const int nCoef = batches.nExtra - 2;
272 const double xmin = batches.extra[nCoef];
273 const double xmax = batches.extra[nCoef + 1];
274
275 if (STEP == 1) {
276 double prev[bufferSize][2];
277 double X[bufferSize];
278
279 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
280 // set a0-->prev[i][0] and a1-->prev[i][1]
281 // and x tranfsformed to range[-1..1]-->X[i]
282 prev[i][0] = batches.output[i] = 1.0;
283 prev[i][1] = X[i] = 2 * (xData[i] - 0.5 * (xmax + xmin)) / (xmax - xmin);
284 }
285 for (int k = 0; k < nCoef; k++) {
286 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
287 batches.output[i] += prev[i][1] * batches.extra[k];
288
289 // compute next order
290 const double next = 2 * X[i] * prev[i][1] - prev[i][0];
291 prev[i][0] = prev[i][1];
292 prev[i][1] = next;
293 }
294 }
295 } else {
296 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
297 double prev0 = 1.0;
298 double prev1 = 2 * (xData[i] - 0.5 * (xmax + xmin)) / (xmax - xmin);
299 double X = prev1;
300 batches.output[i] = 1.0;
301 for (int k = 0; k < nCoef; k++) {
302 batches.output[i] += prev1 * batches.extra[k];
303
304 // compute next order
305 const double next = 2 * X * prev1 - prev0;
306 prev0 = prev1;
307 prev1 = next;
308 }
309 }
310 }
311}
312
314{
315 Batch X = batches.args[0];
316 const double ndof = batches.extra[0];
317 const double gamma = 1 / std::tgamma(ndof / 2.0);
318 for (size_t i = BEGIN; i < batches.nEvents; i += STEP)
319 batches.output[i] = gamma;
320
321 constexpr double ln2 = 0.693147180559945309417232121458;
322 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
323 double arg = (ndof - 2) * fast_log(X[i]) - X[i] - ndof * ln2;
324 batches.output[i] *= fast_exp(0.5 * arg);
325 }
326}
327
329{
330 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
331 batches.output[i] = 0.0 + (batches.args[0][i] == 1.0);
332 }
333}
334
336{
337 Batch DM = batches.args[0];
338 Batch DM0 = batches.args[1];
339 Batch C = batches.args[2];
340 Batch A = batches.args[3];
341 Batch B = batches.args[4];
342 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
343 const double ratio = DM[i] / DM0[i];
344 const double arg1 = (DM0[i] - DM[i]) / C[i];
345 const double arg2 = A[i] * fast_log(ratio);
346 batches.output[i] = (1 - fast_exp(arg1)) * fast_exp(arg2) + B[i] * (ratio - 1);
347 }
348
349 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
350 if (batches.output[i] < 0)
351 batches.output[i] = 0;
352 }
353}
354
356{
357 int lowestOrder = batches.extra[0];
358 int nTerms = batches.extra[1];
359 auto x = batches.args[0];
360
361 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
362 batches.output[i] = 0.0;
363 double xTmp = std::pow(x[i], lowestOrder);
364 for (int k = 0; k < nTerms; ++k) {
365 batches.output[i] += batches.args[k + 1][i] * xTmp;
366 xTmp *= x[i];
367 }
368 batches.output[i] = std::exp(batches.output[i]);
369 }
370}
371
373{
374 Batch x = batches.args[0];
375 Batch c = batches.args[1];
376 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
377 batches.output[i] = fast_exp(x[i] * c[i]);
378 }
379}
380
382{
383 Batch x = batches.args[0];
384 Batch c = batches.args[1];
385 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
386 batches.output[i] = fast_exp(-x[i] * c[i]);
387 }
388}
389
391{
392 Batch X = batches.args[0];
393 Batch G = batches.args[1];
394 Batch B = batches.args[2];
395 Batch M = batches.args[3];
396 double gamma = -std::lgamma(G[0]);
397 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
398 if (X[i] == M[i]) {
399 batches.output[i] = int(G[i] == 1.0) / B[i];
400 } else if (G._isVector) {
401 batches.output[i] = -std::lgamma(G[i]);
402 } else {
403 batches.output[i] = gamma;
404 }
405 }
406
407 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
408 if (X[i] != M[i]) {
409 const double invBeta = 1 / B[i];
410 double arg = (X[i] - M[i]) * invBeta;
411 batches.output[i] -= arg;
412 arg = fast_log(arg);
413 batches.output[i] += arg * (G[i] - 1);
414 batches.output[i] = fast_exp(batches.output[i]);
415 batches.output[i] *= invBeta;
416 }
417 }
418}
419
421{
422 const double root2 = std::sqrt(2.);
423 const double root2pi = std::sqrt(2. * std::atan2(0., -1.));
424
425 const bool isMinus = batches.extra[0] < 0.0;
426 const bool isPlus = batches.extra[0] > 0.0;
427
428 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
429
430 const double x = batches.args[0][i];
431 const double mean = batches.args[1][i] * batches.args[2][i];
432 const double sigma = batches.args[3][i] * batches.args[4][i];
433 const double tau = batches.args[5][i];
434
435 if (tau == 0.0) {
436 // Straight Gaussian, used for unconvoluted PDF or expBasis with 0 lifetime
437 double xprime = (x - mean) / sigma;
438 double result = std::exp(-0.5 * xprime * xprime) / (sigma * root2pi);
439 if (!isMinus && !isPlus)
440 result *= 2;
441 batches.output[i] = result;
442 } else {
443 // Convolution with exp(-t/tau)
444 const double xprime = (x - mean) / tau;
445 const double c = sigma / (root2 * tau);
446 const double u = xprime / (2 * c);
447
448 double result = 0.0;
449 if (!isMinus)
450 result += RooHeterogeneousMath::evalCerf(0, -u, c).real();
451 if (!isPlus)
452 result += RooHeterogeneousMath::evalCerf(0, u, c).real();
453 batches.output[i] = result;
454 }
455 }
456}
457
459{
460 auto x = batches.args[0];
461 auto mean = batches.args[1];
462 auto sigma = batches.args[2];
463 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
464 const double arg = x[i] - mean[i];
465 const double halfBySigmaSq = -0.5 / (sigma[i] * sigma[i]);
466 batches.output[i] = fast_exp(arg * arg * halfBySigmaSq);
467 }
468}
469
471{
472 auto x = batches.args[0];
473 auto mean = batches.args[1];
474 auto sigma = batches.args[2];
475 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
476 const double arg = x[i] - mean[i];
477 const double halfBySigmaSq = -0.5 / (sigma[i] * sigma[i]);
478 batches.output[i] = arg * arg * halfBySigmaSq;
479 }
480}
481
483{
484 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
485 batches.output[i] = batches.args[0][i];
486 }
487}
488
490{
491 for (size_t i = BEGIN; i < batches.nEvents; i += STEP)
492 batches.output[i] = -fast_log(batches.args[0][i]);
493 // Multiply by weights if they exist
494 if (batches.extra[0]) {
495 for (size_t i = BEGIN; i < batches.nEvents; i += STEP)
496 batches.output[i] *= batches.args[1][i];
497 }
498}
499
501{
502 Batch mass = batches.args[0];
503 Batch mu = batches.args[1];
504 Batch lambda = batches.args[2];
505 Batch gamma = batches.args[3];
506 Batch delta = batches.args[4];
507 const double sqrtTwoPi = std::sqrt(TMath::TwoPi());
508 const double massThreshold = batches.extra[0];
509
510 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
511 const double arg = (mass[i] - mu[i]) / lambda[i];
512#ifdef R__HAS_VDT
513 const double asinh_arg = fast_log(arg + 1 / fast_isqrt(arg * arg + 1));
514#else
515 const double asinh_arg = asinh(arg);
516#endif
517 const double expo = gamma[i] + delta[i] * asinh_arg;
518 const double result =
519 delta[i] * fast_exp(-0.5 * expo * expo) * fast_isqrt(1. + arg * arg) / (sqrtTwoPi * lambda[i]);
520
521 const double passThrough = mass[i] >= massThreshold;
522 batches.output[i] = result * passThrough;
523 }
524}
525
526/* Actual computation of Landau(x,mean,sigma) in a vectorization-friendly way
527 * Code copied from function landau_pdf (math/mathcore/src/PdfFuncMathCore.cxx)
528 * and rewritten to enable vectorization.
529 */
531{
532 auto case0 = [](double x) {
533 const double a1[3] = {0.04166666667, -0.01996527778, 0.02709538966};
534 const double u = fast_exp(x + 1.0);
535 return 0.3989422803 * fast_exp(-1 / u - 0.5 * (x + 1)) * (1 + (a1[0] + (a1[1] + a1[2] * u) * u) * u);
536 };
537 auto case1 = [](double x) {
538 constexpr double p1[5] = {0.4259894875, -0.1249762550, 0.03984243700, -0.006298287635, 0.001511162253};
539 constexpr double q1[5] = {1.0, -0.3388260629, 0.09594393323, -0.01608042283, 0.003778942063};
540 const double u = fast_exp(-x - 1);
541 return fast_exp(-u - 0.5 * (x + 1)) * (p1[0] + (p1[1] + (p1[2] + (p1[3] + p1[4] * x) * x) * x) * x) /
542 (q1[0] + (q1[1] + (q1[2] + (q1[3] + q1[4] * x) * x) * x) * x);
543 };
544 auto case2 = [](double x) {
545 constexpr double p2[5] = {0.1788541609, 0.1173957403, 0.01488850518, -0.001394989411, 0.0001283617211};
546 constexpr double q2[5] = {1.0, 0.7428795082, 0.3153932961, 0.06694219548, 0.008790609714};
547 return (p2[0] + (p2[1] + (p2[2] + (p2[3] + p2[4] * x) * x) * x) * x) /
548 (q2[0] + (q2[1] + (q2[2] + (q2[3] + q2[4] * x) * x) * x) * x);
549 };
550 auto case3 = [](double x) {
551 constexpr double p3[5] = {0.1788544503, 0.09359161662, 0.006325387654, 0.00006611667319, -0.000002031049101};
552 constexpr double q3[5] = {1.0, 0.6097809921, 0.2560616665, 0.04746722384, 0.006957301675};
553 return (p3[0] + (p3[1] + (p3[2] + (p3[3] + p3[4] * x) * x) * x) * x) /
554 (q3[0] + (q3[1] + (q3[2] + (q3[3] + q3[4] * x) * x) * x) * x);
555 };
556 auto case4 = [](double x) {
557 constexpr double p4[5] = {0.9874054407, 118.6723273, 849.2794360, -743.7792444, 427.0262186};
558 constexpr double q4[5] = {1.0, 106.8615961, 337.6496214, 2016.712389, 1597.063511};
559 const double u = 1 / x;
560 return u * u * (p4[0] + (p4[1] + (p4[2] + (p4[3] + p4[4] * u) * u) * u) * u) /
561 (q4[0] + (q4[1] + (q4[2] + (q4[3] + q4[4] * u) * u) * u) * u);
562 };
563 auto case5 = [](double x) {
564 constexpr double p5[5] = {1.003675074, 167.5702434, 4789.711289, 21217.86767, -22324.94910};
565 constexpr double q5[5] = {1.0, 156.9424537, 3745.310488, 9834.698876, 66924.28357};
566 const double u = 1 / x;
567 return u * u * (p5[0] + (p5[1] + (p5[2] + (p5[3] + p5[4] * u) * u) * u) * u) /
568 (q5[0] + (q5[1] + (q5[2] + (q5[3] + q5[4] * u) * u) * u) * u);
569 };
570 auto case6 = [](double x) {
571 constexpr double p6[5] = {1.000827619, 664.9143136, 62972.92665, 475554.6998, -5743609.109};
572 constexpr double q6[5] = {1.0, 651.4101098, 56974.73333, 165917.4725, -2815759.939};
573 const double u = 1 / x;
574 return u * u * (p6[0] + (p6[1] + (p6[2] + (p6[3] + p6[4] * u) * u) * u) * u) /
575 (q6[0] + (q6[1] + (q6[2] + (q6[3] + q6[4] * u) * u) * u) * u);
576 };
577 auto case7 = [](double x) {
578 const double a2[2] = {-1.845568670, -4.284640743};
579 const double u = 1 / (x - x * fast_log(x) / (x + 1));
580 return u * u * (1 + (a2[0] + a2[1] * u) * u);
581 };
582
583 Batch X = batches.args[0];
584 Batch M = batches.args[1];
585 Batch S = batches.args[2];
586
587 for (size_t i = BEGIN; i < batches.nEvents; i += STEP)
588 batches.output[i] = (X[i] - M[i]) / S[i];
589
590 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
591 if (S[i] <= 0.0) {
592 batches.output[i] = 0;
593 } else if (batches.output[i] < -5.5) {
594 batches.output[i] = case0(batches.output[i]);
595 } else if (batches.output[i] < -1.0) {
596 batches.output[i] = case1(batches.output[i]);
597 } else if (batches.output[i] < 1.0) {
598 batches.output[i] = case2(batches.output[i]);
599 } else if (batches.output[i] < 5.0) {
600 batches.output[i] = case3(batches.output[i]);
601 } else if (batches.output[i] < 12.0) {
602 batches.output[i] = case4(batches.output[i]);
603 } else if (batches.output[i] < 50.0) {
604 batches.output[i] = case5(batches.output[i]);
605 } else if (batches.output[i] < 300.) {
606 batches.output[i] = case6(batches.output[i]);
607 } else {
608 batches.output[i] = case7(batches.output[i]);
609 }
610 }
611}
612
614{
615 Batch X = batches.args[0];
616 Batch M0 = batches.args[1];
617 Batch K = batches.args[2];
618 constexpr double rootOf2pi = 2.506628274631000502415765284811;
619 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
620 double lnxOverM0 = fast_log(X[i] / M0[i]);
621 double lnk = fast_log(K[i]);
622 if (lnk < 0)
623 lnk = -lnk;
624 double arg = lnxOverM0 / lnk;
625 arg *= -0.5 * arg;
626 batches.output[i] = fast_exp(arg) / (X[i] * lnk * rootOf2pi);
627 }
628}
629
631{
632 Batch X = batches.args[0];
633 Batch M0 = batches.args[1];
634 Batch K = batches.args[2];
635 constexpr double rootOf2pi = 2.506628274631000502415765284811;
636 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
637 double lnxOverM0 = fast_log(X[i]) - M0[i];
638 double lnk = K[i];
639 if (lnk < 0)
640 lnk = -lnk;
641 double arg = lnxOverM0 / lnk;
642 arg *= -0.5 * arg;
643 batches.output[i] = fast_exp(arg) / (X[i] * lnk * rootOf2pi);
644 }
645}
646
647/// Add the evaluation error counts of the normalization compute functions to
648/// the first three extra args.
649__roodevice__ inline void addEvalErrorCounts(Batches &batches, int nType0, int nType1, int nType2)
650{
651 // The counters live in memory that is shared between all threads in the
652 // CUDA case, so they need to be accumulated atomically there. On the CPU,
653 // every task works on its own copy of the extra args.
654#ifdef __CUDACC__
655 if (nType0 > 0)
656 atomicAdd(&batches.extra[0], double(nType0));
657 if (nType1 > 0)
658 atomicAdd(&batches.extra[1], double(nType1));
659 if (nType2 > 0)
660 atomicAdd(&batches.extra[2], double(nType2));
661#else
662 batches.extra[0] = batches.extra[0] + nType0;
663 batches.extra[1] = batches.extra[1] + nType1;
664 batches.extra[2] = batches.extra[2] + nType2;
665#endif
666}
667
669{
670 auto rawVal = batches.args[0];
671 auto normVal = batches.args[1];
672
673 int nEvalErrorsType0 = 0;
674 int nEvalErrorsType1 = 0;
675 int nEvalErrorsType2 = 0;
676
677 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
678 double out = 0.0;
679 // batches.output[i] = rawVal[i] / normVar[i];
680 if (normVal[i] < 0. || (normVal[i] == 0. && rawVal[i] != 0)) {
681 // Unreasonable normalisations. A zero integral can be tolerated if the function vanishes, though.
682 out = RooNaNPacker::packFloatIntoNaN(-normVal[i] + (rawVal[i] < 0. ? -rawVal[i] : 0.));
683 nEvalErrorsType0++;
684 } else if (rawVal[i] < 0.) {
685 // The pdf value is less than zero.
686 out = RooNaNPacker::packFloatIntoNaN(-rawVal[i]);
687 nEvalErrorsType1++;
688 } else if (std::isnan(rawVal[i])) {
689 // The pdf value is Not-a-Number.
690 out = rawVal[i];
691 nEvalErrorsType2++;
692 } else {
693 out = (rawVal[i] == 0. && normVal[i] == 0.) ? 0. : rawVal[i] / normVal[i];
694 }
695 batches.output[i] = out;
696 }
697
698 addEvalErrorCounts(batches, nEvalErrorsType0, nEvalErrorsType1, nEvalErrorsType2);
699}
700
701/// Logarithm of the normalized pdf for one event, with the same evaluation
702/// errors as computeNormalizedPdf().
703template <bool NumIsLog>
704__roodevice__ inline double logNormalizedPdf(double num, double den, double logDen, int *nEvalErrors)
705{
706 const bool numIsZero = NumIsLog ? num == -INFINITY : num == 0.;
707 const bool numIsNegative = !NumIsLog && num < 0.;
708 if (den < 0. || (den == 0. && !numIsZero)) {
709 nEvalErrors[0]++;
710 return RooNaNPacker::packFloatIntoNaN(-den + (numIsNegative ? -num : 0.));
711 }
712 if (numIsNegative) {
713 nEvalErrors[1]++;
715 }
716 if (std::isnan(num)) {
717 nEvalErrors[2]++;
718 return num;
719 }
720 return numIsZero ? -INFINITY : (NumIsLog ? num : std::log(num)) - logDen;
721}
722
723/// The input modes are template parameters, so that no logarithms are
724/// evaluated speculatively.
725template <bool NumIsLog, bool ScalarDen>
727{
728 auto rawVal = batches.args[0];
729 auto normVal = batches.args[1];
730 const double scalarLogDen = ScalarDen ? std::log(normVal[0]) : 0.;
731 int nEvalErrors[3] = {0, 0, 0};
732
733 // Loop without branches for the regular events, which the compiler can
734 // vectorize if no logarithms are taken. The other events, with evaluation
735 // errors or zero pdf values, are recomputed afterwards.
736 auto isRegular = [&](std::size_t i) {
737 return normVal[i] > 0. && (NumIsLog ? rawVal[i] > -INFINITY : rawVal[i] > 0.);
738 };
739 bool allRegular = true;
740 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
741 const double logNum = NumIsLog ? rawVal[i] : std::log(rawVal[i]);
742 batches.output[i] = logNum - (ScalarDen ? scalarLogDen : std::log(normVal[i]));
743 allRegular &= isRegular(i);
744 }
745 if (!allRegular) {
746 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
747 if (!isRegular(i)) {
748 const double logDen = ScalarDen ? scalarLogDen : std::log(normVal[i]);
749 batches.output[i] = logNormalizedPdf<NumIsLog>(rawVal[i], normVal[i], logDen, nEvalErrors);
750 }
751 }
752 }
753
754 addEvalErrorCounts(batches, nEvalErrors[0], nEvalErrors[1], nEvalErrors[2]);
755}
756
757/// Like computeNormalizedPdf(), but outputs the logarithm. The pdf values are
758/// given as logarithms if `extra[3]` is nonzero.
760{
761 const bool numIsLog = batches.extra[3] != 0.;
762 const bool scalarDen = !batches.args[1]._isVector;
763 if (numIsLog && scalarDen) {
764 computeLogNormalizedPdfImpl<true, true>(batches);
765 } else if (numIsLog) {
766 computeLogNormalizedPdfImpl<true, false>(batches);
767 } else if (scalarDen) {
768 computeLogNormalizedPdfImpl<false, true>(batches);
769 } else {
770 computeLogNormalizedPdfImpl<false, false>(batches);
771 }
772}
773
774/* TMath::ASinH(x) needs to be replaced with ln( x + sqrt(x^2+1))
775 * argasinh -> the argument of TMath::ASinH()
776 * argln -> the argument of the logarithm that replaces AsinH
777 * asinh -> the value that the function evaluates to
778 *
779 * ln is the logarithm that was solely present in the initial
780 * formula, that is before the asinh replacement
781 */
783{
784 Batch X = batches.args[0];
785 Batch P = batches.args[1];
786 Batch W = batches.args[2];
787 Batch T = batches.args[3];
788 constexpr double xi = 2.3548200450309494; // 2 Sqrt( Ln(4) )
789 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
790 double argasinh = 0.5 * xi * T[i];
791 double argln = argasinh + 1 / fast_isqrt(argasinh * argasinh + 1);
792 double asinh = fast_log(argln);
793
794 double argln2 = 1 - (X[i] - P[i]) * T[i] / W[i];
795 double ln = fast_log(argln2);
796 batches.output[i] = ln / asinh;
797 batches.output[i] *= -0.125 * xi * xi * batches.output[i];
798 batches.output[i] -= 2.0 / xi / xi * asinh * asinh;
799 }
800
801 // faster if you exponentiate in a separate loop (dark magic!)
802 for (size_t i = BEGIN; i < batches.nEvents; i += STEP)
803 batches.output[i] = fast_exp(batches.output[i]);
804}
805
807{
808 Batch x = batches.args[0];
809 Batch mean = batches.args[1];
810 bool protectNegative = batches.extra[0];
811 bool noRounding = batches.extra[1];
812 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
813 const double x_i = noRounding ? x[i] : floor(x[i]);
814 batches.output[i] = std::lgamma(x_i + 1.);
815 }
816
817 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
818 const double x_i = noRounding ? x[i] : floor(x[i]);
819 const double logMean = fast_log(mean[i]);
820 const double logPoisson = x_i * logMean - mean[i] - batches.output[i];
821 batches.output[i] = fast_exp(logPoisson);
822
823 // Cosmetics
824 if (x_i < 0) {
825 batches.output[i] = 0;
826 } else if (x_i == 0) {
827 batches.output[i] = 1 / fast_exp(mean[i]);
828 }
829
830 if (protectNegative && mean[i] < 0)
831 batches.output[i] = 1.E-3;
832 }
833}
834
836{
837 const int nCoef = batches.extra[0];
838 const std::size_t nEvents = batches.nEvents;
839 Batch x = batches.args[nCoef];
840
841 for (size_t i = BEGIN; i < nEvents; i += STEP) {
842 batches.output[i] = batches.args[nCoef - 1][i];
843 }
844
845 // Indexes are in range 0..nCoef-1 but coefList[nCoef-1] has already been
846 // processed.
847 for (int k = nCoef - 2; k >= 0; k--) {
848 for (size_t i = BEGIN; i < nEvents; i += STEP) {
849 batches.output[i] = batches.args[k][i] + x[i] * batches.output[i];
850 }
851 }
852}
853
855{
856 const int nCoef = batches.extra[0];
857 Batch x = batches.args[0];
858
859 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
860 batches.output[i] = 0.0;
861 for (int k = 0; k < nCoef; ++k) {
862 batches.output[i] += batches.args[2 * k + 1][i] * std::pow(x[i], batches.args[2 * k + 2][i]);
863 }
864 }
865}
866
868{
869 const int nPdfs = batches.extra[0];
870 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
871 batches.output[i] = 1.;
872 }
873 for (int pdf = 0; pdf < nPdfs; pdf++) {
874 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
875 batches.output[i] *= batches.args[pdf][i];
876 }
877 }
878}
879
880/// Logarithm of the product of the factors [begin, end) for event `i`. The
881/// binary exponent is kept separate, so that the product can't underflow.
882__roodevice__ inline double logOfProduct(Batches const &batches, std::size_t begin, std::size_t end, std::size_t i)
883{
884 constexpr double ln2 = 0.693147180559945309417232121458176568;
885 // The mantissa stays within [2^-256, 2^256] and the factors are brought
886 // into [2^-512, 2^512], so their product is always a normal double.
887 double mantissa = 1.0;
888 int exponent = 0;
889 for (std::size_t k = begin; k < end; ++k) {
890 double factor = batches.args[k][i];
891 int e = 0;
892 if (std::abs(factor) < 0x1p-512 || std::abs(factor) > 0x1p512) {
893 factor = std::frexp(factor, &e);
894 exponent += e;
895 }
896 mantissa *= factor;
897 if (std::abs(mantissa) < 0x1p-256 || std::abs(mantissa) > 0x1p256) {
898 mantissa = std::frexp(mantissa, &e);
899 exponent += e;
900 }
901 }
902 if (std::isnan(mantissa)) {
903 return mantissa; // with the payload of the NaN factor
904 }
905 // Pack a negative product into a NaN, like computeNormalizedPdf does.
906 return mantissa < 0. ? RooNaNPacker::packFloatIntoNaN(-std::ldexp(mantissa, exponent))
907 : std::log(mantissa) + exponent * ln2;
908}
909
910/// Logarithm of a product. The first `extra[0]` factors are given as
911/// logarithms and are summed, the others are multiplied.
913{
914 const std::size_t nLogFactors = batches.extra[0];
915 const std::size_t nFactors = batches.nBatches;
916 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
917 batches.output[i] = 0.0;
918 }
919 for (std::size_t k = 0; k < nLogFactors; ++k) {
920 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
921 batches.output[i] += batches.args[k][i];
922 }
923 }
924 if (nLogFactors == nFactors) {
925 return;
926 }
927#ifdef __CUDACC__
928 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
929 batches.output[i] += logOfProduct(batches, nLogFactors, nFactors, i);
930 }
931#else
932 // Multiply in a vectorizable loop, keeping track of the smallest partial
933 // product. If that is a normal number and the product didn't overflow,
934 // no precision was lost. Otherwise, the event is recomputed with
935 // logOfProduct().
936 double prod[bufferSize];
937 double minProd[bufferSize];
938 std::fill_n(prod, batches.nEvents, 1.0);
939 std::fill_n(minProd, batches.nEvents, 1.0);
940 for (std::size_t k = nLogFactors; k < nFactors; ++k) {
941 for (std::size_t i = 0; i < batches.nEvents; ++i) {
942 prod[i] *= batches.args[k][i];
943 minProd[i] = std::min(minProd[i], prod[i]);
944 }
945 }
946 for (std::size_t i = 0; i < batches.nEvents; ++i) {
947 if (minProd[i] >= std::numeric_limits<double>::min() && prod[i] <= std::numeric_limits<double>::max()) {
948 batches.output[i] += std::log(prod[i]);
949 } else {
950 batches.output[i] += logOfProduct(batches, nLogFactors, nFactors, i);
951 }
952 }
953#endif
954}
955
957{
958 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
959 batches.output[i] = batches.args[0][i] / batches.args[1][i];
960 }
961}
962
964{
965
966 const bool isMinus = batches.extra[0] < 0.0;
967 const bool isPlus = batches.extra[0] > 0.0;
968 for (std::size_t i = BEGIN; i < batches.nEvents; i += STEP) {
969 double x = batches.args[0][i];
970 // Enforce sign compatibility
971 const bool isOutOfSign = (isMinus && x > 0.0) || (isPlus && x < 0.0);
972 batches.output[i] = isOutOfSign ? 0.0 : fast_exp(-std::abs(x) / batches.args[1][i]);
973 }
974}
975
977{
978 const bool isMinus = batches.extra[0] < 0.0;
979 const bool isPlus = batches.extra[0] > 0.0;
980 for (std::size_t i = BEGIN; i < batches.nEvents; i += STEP) {
981 double x = batches.args[0][i];
982 // Enforce sign compatibility
983 const bool isOutOfSign = (isMinus && x > 0.0) || (isPlus && x < 0.0);
984 batches.output[i] =
985 isOutOfSign ? 0.0 : fast_exp(-std::abs(x) / batches.args[1][i]) * fast_sin(x * batches.args[2][i]);
986 }
987}
988
990{
991 const bool isMinus = batches.extra[0] < 0.0;
992 const bool isPlus = batches.extra[0] > 0.0;
993 for (std::size_t i = BEGIN; i < batches.nEvents; i += STEP) {
994 double x = batches.args[0][i];
995 // Enforce sign compatibility
996 const bool isOutOfSign = (isMinus && x > 0.0) || (isPlus && x < 0.0);
997 batches.output[i] =
998 isOutOfSign ? 0.0 : fast_exp(-std::abs(x) / batches.args[1][i]) * fast_cos(x * batches.args[2][i]);
999 }
1000}
1001
1003{
1004 const bool isMinus = batches.extra[0] < 0.0;
1005 const bool isPlus = batches.extra[0] > 0.0;
1006 for (std::size_t i = BEGIN; i < batches.nEvents; i += STEP) {
1007 double x = batches.args[0][i];
1008 // Enforce sign compatibility
1009 const bool isOutOfSign = (isMinus && x > 0.0) || (isPlus && x < 0.0);
1010 if (isOutOfSign) {
1011 batches.output[i] = 0.0;
1012 } else {
1013 const double tscaled = std::abs(x) / batches.args[1][i];
1014 batches.output[i] = fast_exp(-tscaled) * tscaled;
1015 }
1016 }
1017}
1018
1020{
1021 const bool isMinus = batches.extra[0] < 0.0;
1022 const bool isPlus = batches.extra[0] > 0.0;
1023 for (std::size_t i = BEGIN; i < batches.nEvents; i += STEP) {
1024 double x = batches.args[0][i];
1025 // Enforce sign compatibility
1026 const bool isOutOfSign = (isMinus && x > 0.0) || (isPlus && x < 0.0);
1027 if (isOutOfSign) {
1028 batches.output[i] = 0.0;
1029 } else {
1030 const double tscaled = std::abs(x) / batches.args[1][i];
1031 batches.output[i] = fast_exp(-tscaled) * tscaled * tscaled;
1032 }
1033 }
1034}
1035
1037{
1038 const bool isMinus = batches.extra[0] < 0.0;
1039 const bool isPlus = batches.extra[0] > 0.0;
1040 for (std::size_t i = BEGIN; i < batches.nEvents; i += STEP) {
1041 double x = batches.args[0][i];
1042 // Enforce sign compatibility
1043 const bool isOutOfSign = (isMinus && x > 0.0) || (isPlus && x < 0.0);
1044 batches.output[i] =
1045 isOutOfSign ? 0.0 : fast_exp(-std::abs(x) / batches.args[1][i]) * sinh(x * batches.args[2][i] * 0.5);
1046 }
1047}
1048
1050{
1051 const bool isMinus = batches.extra[0] < 0.0;
1052 const bool isPlus = batches.extra[0] > 0.0;
1053 for (std::size_t i = BEGIN; i < batches.nEvents; i += STEP) {
1054 double x = batches.args[0][i];
1055 // Enforce sign compatibility
1056 const bool isOutOfSign = (isMinus && x > 0.0) || (isPlus && x < 0.0);
1057 batches.output[i] =
1058 isOutOfSign ? 0.0 : fast_exp(-std::abs(x) / batches.args[1][i]) * cosh(x * batches.args[2][i] * .5);
1059 }
1060}
1061
1063{
1064 Batch X = batches.args[0];
1065 Batch M = batches.args[1];
1066 Batch W = batches.args[2];
1067 Batch S = batches.args[3];
1068 const double invSqrt2 = 0.707106781186547524400844362105;
1069 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
1070 const double arg = (X[i] - M[i]) * (X[i] - M[i]);
1071 if (S[i] == 0.0 && W[i] == 0.0) {
1072 batches.output[i] = 1.0;
1073 } else if (S[i] == 0.0) {
1074 batches.output[i] = 1 / (arg + 0.25 * W[i] * W[i]);
1075 } else if (W[i] == 0.0) {
1076 batches.output[i] = fast_exp(-0.5 * arg / (S[i] * S[i]));
1077 } else {
1078 batches.output[i] = invSqrt2 / S[i];
1079 }
1080 }
1081
1082 for (size_t i = BEGIN; i < batches.nEvents; i += STEP) {
1083 if (S[i] != 0.0 && W[i] != 0.0) {
1084 if (batches.output[i] < 0)
1085 batches.output[i] = -batches.output[i];
1086 const double factor = W[i] > 0.0 ? 0.5 : -0.5;
1087 RooHeterogeneousMath::STD::complex<double> z(batches.output[i] * (X[i] - M[i]),
1088 factor * batches.output[i] * W[i]);
1089 batches.output[i] *= RooHeterogeneousMath::faddeeva(z).real();
1090 }
1091 }
1092}
1093
1094/// Returns a std::vector of pointers to the compute functions in this file.
1140} // End namespace RF_ARCH
1141} // End namespace RooBatchCompute
#define __roodevice__
Definition AccHeaders.h:35
#define __rooglobal__
Definition AccHeaders.h:37
#define RF_ARCH
#define STEP
#define BEGIN
#define c(i)
Definition RSha256.hxx:101
#define e(i)
Definition RSha256.hxx:103
#define X(type, name)
#define N
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
float xmin
float xmax
std::size_t nEvents
Definition Batches.h:46
double *__restrict output
Definition Batches.h:49
std::size_t nBatches
Definition Batches.h:47
const Double_t sigma
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
__rooglobal__ void computeBreitWigner(Batches &batches)
__rooglobal__ void computeNovosibirsk(Batches &batches)
__rooglobal__ void computeExpPoly(Batches &batches)
__rooglobal__ void computeChiSquare(Batches &batches)
__roodevice__ void addEvalErrorCounts(Batches &batches, int nType0, int nType1, int nType2)
Add the evaluation error counts of the normalization compute functions to the first three extra args.
__rooglobal__ void computeDeltaFunction(Batches &batches)
__rooglobal__ void computeGamma(Batches &batches)
__rooglobal__ void computeLogProdPdf(Batches &batches)
Logarithm of a product.
__rooglobal__ void computeTruthModelQuadBasis(Batches &batches)
__roodevice__ double logOfProduct(Batches const &batches, std::size_t begin, std::size_t end, std::size_t i)
Logarithm of the product of the factors [begin, end) for event i.
__rooglobal__ void computeTruthModelExpBasis(Batches &batches)
__rooglobal__ void computeTruthModelLinBasis(Batches &batches)
__rooglobal__ void computeLognormalStandard(Batches &batches)
__rooglobal__ void computeTruthModelCoshBasis(Batches &batches)
__rooglobal__ void computeAddPdf(Batches &batches)
__rooglobal__ void computeBifurGauss(Batches &batches)
__rooglobal__ void computeTruthModelSinhBasis(Batches &batches)
__rooglobal__ void computeLognormal(Batches &batches)
__rooglobal__ void computeArgusBG(Batches &batches)
__rooglobal__ void computeGaussian(Batches &batches)
__rooglobal__ void computeLandau(Batches &batches)
__rooglobal__ void computeTruthModelSinBasis(Batches &batches)
__rooglobal__ void computeLogGaussian(Batches &batches)
__rooglobal__ void computePower(Batches &batches)
__rooglobal__ void computeExponentialNeg(Batches &batches)
__rooglobal__ void computePoisson(Batches &batches)
__rooglobal__ void computeJohnson(Batches &batches)
__rooglobal__ void computeBMixDecay(Batches &batches)
__rooglobal__ void computeChebychev(Batches &batches)
__rooglobal__ void computeNormalizedPdf(Batches &batches)
__rooglobal__ void computeBernstein(Batches &batches)
__rooglobal__ void computeRatio(Batches &batches)
__roodevice__ double logNormalizedPdf(double num, double den, double logDen, int *nEvalErrors)
Logarithm of the normalized pdf for one event, with the same evaluation errors as computeNormalizedPd...
__rooglobal__ void computePolynomial(Batches &batches)
__rooglobal__ void computeExponential(Batches &batches)
__rooglobal__ void computeTruthModelCosBasis(Batches &batches)
__rooglobal__ void computeLogNormalizedPdf(Batches &batches)
Like computeNormalizedPdf(), but outputs the logarithm.
__roodevice__ void computeLogNormalizedPdfImpl(Batches &batches)
The input modes are template parameters, so that no logarithms are evaluated speculatively.
__rooglobal__ void computeGaussModelExpBasis(Batches &batches)
__rooglobal__ void computeBukin(Batches &batches)
__rooglobal__ void computeDstD0BG(Batches &batches)
__rooglobal__ void computeNegativeLogarithms(Batches &batches)
__rooglobal__ void computeIdentity(Batches &batches)
__rooglobal__ void computeCBShape(Batches &batches)
__rooglobal__ void computeProdPdf(Batches &batches)
__rooglobal__ void computeVoigtian(Batches &batches)
std::vector< void(*)(Batches &)> getFunctions()
Namespace for dispatching RooFit computations to various backends.
__roodevice__ double fast_exp(double x)
__roodevice__ double fast_sin(double x)
constexpr std::size_t bufferSize
__roodevice__ double fast_log(double x)
__roodevice__ double fast_cos(double x)
__roodevice__ double fast_isqrt(double x)
STD::complex< double > faddeeva(STD::complex< double > z)
STD::complex< double > evalCerf(double swt, double u, double c)
constexpr Double_t TwoPi()
Definition TMath.h:47
static double packFloatIntoNaN(float payload)
Pack float into mantissa of a NaN.
TMarker m
Definition textangle.C:8