9 #include <thrust/device_vector.h>
10 #include <thrust/transform.h>
11 #include <thrust/sequence.h>
12 #include <thrust/copy.h>
13 #include <thrust/fill.h>
14 #include <thrust/replace.h>
15 #include <thrust/functional.h>
16 #include <thrust/reduce.h>
27 thrust::device_vector<int> X(n);
28 thrust::device_vector<int> Y(n);
29 thrust::device_vector<int> Z(n);
32 thrust::sequence(X.begin(), X.end());
35 thrust::transform(X.begin(), X.end(), Y.begin(), thrust::negate<int>());
41 thrust::transform(X.begin(), X.end(), Z.begin(), Y.begin(), thrust::modulus<int>());
44 thrust::replace(Y.begin(), Y.end(), 1, 10);
47 thrust::copy(Y.begin(), Y.begin()+20, std::ostream_iterator<int>(std::cout,
"\n"));
50 thrust::device_vector<float> X2(n);
51 thrust::sequence( X2.begin(), X2.end() );
53 printf(
"sum is %12.1f\n", xsum );