Hallo,
I will calculate the standard deviation from 10000 values. But i don’t know which thrust function i need for the operation at line nine.
This is pseudocode:
// All Points
int A_keys[9] = { 1, 1, 1, 2, 3, 3, 4, 4, 4};
float A_vals[9] = {30, 40, 29, 35, 33, 35, 28, 42, 32};
// Averages (I could calculate this successful)
int B_keys[4] = { 1, 2, 3, 4};
float B_avgs[4] = {33, 35, 34, 36};
int B_n[4] = { 3, 1, 2, 3};
float A_avgs[9];
// Here I search a function, that copy the B_avgs-Array into the A_avgs-Array
// Than I would have this:
// A_keys[9] = { 1, 1, 1, 2, 3, 3, 4, 4, 4};
// A_vals[9] = {30, 40, 29, 35, 33, 35, 28, 42, 38};
// A_avgs[9] = {33, 33, 33, 35, 34, 34, 36, 36, 36};
// now i can Calculate it:
float A_diff[9];
thrust::transform(A_vals, A_vals+9, A_avgs, A_diff, thrust::minus<float>());
float A_modu[9];
thrust::transform(A_diff, A_diff+9, A_modu, thrust::modulus<float>());
int C_keys[4];
int C_vals[4];
thrust::reduce_by_key(A_keys[9], A_keys[9] + 9, A_modu, C_keys, C_vals, thrust::equal_to<int>, thrust::plus<int>);
// ... and so on. This is than not the problem.
Thank you for your help!
p.s. sorry for my “simple” english :D