-
Notifications
You must be signed in to change notification settings - Fork 6
/
sequence.cpp
34 lines (28 loc) · 1.03 KB
/
sequence.cpp
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
#include "sequence.h"
bool TRTC_Sequence(DVVectorLike& vec)
{
static TRTC_For s_for( { "view_vec" }, "idx",
" view_vec[idx]= (decltype(view_vec)::value_t)idx;\n" );
const DeviceViewable* args[] = { &vec };
return s_for.launch_n(vec.size(), args);
}
bool TRTC_Sequence(DVVectorLike& vec, const DeviceViewable& value_init)
{
static TRTC_For s_for(
{ "view_vec", "value_init" }, "idx",
" view_vec[idx]= (decltype(view_vec)::value_t)value_init + (decltype(view_vec)::value_t)idx;\n"
);
const DeviceViewable* args[] = { &vec, &value_init };
s_for.launch_n(vec.size(), args);
return true;
}
bool TRTC_Sequence(DVVectorLike& vec, const DeviceViewable& value_init, const DeviceViewable& value_step)
{
static TRTC_For s_for(
{ "view_vec", "value_init", "value_step" }, "idx",
" view_vec[idx]= (decltype(view_vec)::value_t)value_init + (decltype(view_vec)::value_t)idx*(decltype(view_vec)::value_t)value_step;\n"
);
const DeviceViewable* args[] = { &vec, &value_init, &value_step };
s_for.launch_n(vec.size(), args);
return true;
}