2 * O(nlog n) work algorithm (Hillis-Steele)
4 #include "hillis_partial.h"
7 * Hillis/Steele, partial prefix sum version
9 void algorithm (numtype x[], unsigned long size, unsigned int ops[]) {
14 y = malloc(size * sizeof(numtype));
17 for (k=1; k<size; k<<=1) {
18 #pragma omp parallel for shared (x, y, ops, k) private (i)
19 for (i=k; i<size; i++) {
21 printf ("y[%li] = x[%li] + x[%li]; // %li + %li\n", i, i-k, i, x[i-k], x[i]);
25 memcpy (x, y, size * sizeof(numtype));
32 printf ("Has not been freed!!!\n");