-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgVegasFunc.cu
79 lines (71 loc) · 1.7 KB
/
gVegasFunc.cu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include "vegasconst.h"
#define CUDART_PI_F 3.141592654f
__device__
float func(float* rx, float wgt)
{
float value = 0.f;
for (int i=0;i<g_ndim;i++) {
value += rx[i]*rx[i];
}
return value;
}
__device__
float oscillate(float* rx, float wgt, float* dillate, float* offset)
{
float value = 0.f;
for (int i = 0; i < g_ndim; i++) {
value += dillate[i] * rx[i];
}
value += CUDART_PI_F * offset[0];
value = cosf(value);
return value;
}
__device__
float prodpeak(float* rx, float wgt, float* move, float* offset)
{
float value = 1.f;
for (int i = 0; i < g_ndim; i++) {
value *= 1.f / ((rx[i]-move[i])*(rx[i]-move[i]) + (1.f/offset[i])*(1.f/offset[i]));
}
return value;
}
__device__
float cornerpeak(float* rx, float wgt, float* offset)
{
float value = 1.f;
for (int i = 0; i < g_ndim; i++) {
value += offset[i] * rx[i];
}
value = 1.f / powf(value, (float)(g_ndim+1));
return value;
}
__device__
float gaussian(float* rx, float wgt, float* move, float* offset)
{
float value = 0.f;
for (int i = 0; i < g_ndim; i++) {
value = value - offset[i]*offset[i]*(rx[i]-move[i])*(rx[i]-move[i]);
}
value = expf(value);
return value;
}
__device__
float czerocont(float* rx, float wgt, float* move, float* offset)
{
float value = 0.f;
for (int i = 0; i < g_ndim; i++) {
value = value - offset[i]*fabsf(rx[i]-move[i]);
}
value = expf(value);
return value;
}
__device__
float discont(float* rx, float wgt, float* limit, float* offset)
{
float value = 0.f;
for (int i = 0; i < g_ndim; i++) {
value += offset[i]*rx[i];
}
value = expf(value) * (float)((1-(rx[0] > limit[0]))*(1-(rx[1] > limit[0])));
return value;
}