Skip to content
Snippets Groups Projects
Commit 5597fb55 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Improved output

parent 7be1971e
No related branches found
No related tags found
1 merge request!150Vectorise kernel
...@@ -31,34 +31,35 @@ int main() { ...@@ -31,34 +31,35 @@ int main() {
printf("\nSerial Output\n"); printf("\nSerial Output\n");
printf("-------------\n"); printf("-------------\n");
for (int i = 0; i <= numPoints; ++i) { for (int i = 0; i < numPoints; ++i) {
const float x = i * 1.f / numPoints; const float x = i * 2.5f / numPoints;
float W, dW; float W, dW;
kernel_deval(x / h, &W, &dW); kernel_deval(x / h, &W, &dW);
printf("h= %f H= %f x=%f W(x,h)=%f dW(x,h)=%f\n", h, h * kernel_gamma, x, W, dW); printf("%2d: h= %f H= %f x=%f W(x,h)=%f dW(x,h)=%f\n", i, h,
h * kernel_gamma, x, W, dW);
} }
printf("\nVector Output for VEC_SIZE=%d\n",VEC_SIZE); printf("\nVector Output for VEC_SIZE=%d\n", VEC_SIZE);
printf("-------------\n"); printf("-------------\n");
for (int i = 0; i < numPoints + 1; i+=VEC_SIZE) { for (int i = 0; i < numPoints; i += VEC_SIZE) {
vector vx, vx_h; vector vx, vx_h;
vector W, dW; vector W, dW;
for (int j = 0; j< VEC_SIZE; j++) { for (int j = 0; j < VEC_SIZE; j++) {
vx.f[j] = (i + j) * 1.f / numPoints; vx.f[j] = (i + j) * 2.5f / numPoints;
} }
vx_h.v = vx.v / vec_set1(h); vx_h.v = vx.v / vec_set1(h);
kernel_deval_vec(&vx_h, &W, &dW); kernel_deval_vec(&vx_h, &W, &dW);
for (int j = 0; j< VEC_SIZE; j++) { for (int j = 0; j < VEC_SIZE; j++) {
printf("h= %f H= %f x=%f W(x,h)=%f dW(x,h)=%f\n", h, h * kernel_gamma, vx.f[j], W.f[j], dW.f[j]); printf("%2d: h= %f H= %f x=%f W(x,h)=%f dW(x,h)=%f\n", i + j, h,
h * kernel_gamma, vx.f[j], W.f[j], dW.f[j]);
} }
} }
return 0; return 0;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment