Removed unnecessary castings

This commit is contained in:
Fabio Salvini 2016-12-13 19:03:26 +01:00
parent be875cb5af
commit 7f60341812
5 changed files with 6 additions and 6 deletions

View File

@ -67,7 +67,7 @@ float *compute_jacobi(int rank, int numprocs, int n, float init_value, float thr
for (i = 1; i <= rows; i++) {
for (j = 1; j <= n; j++) {
new_value = 0.25 * (x[IDX(nb, i - 1, j)] + x[IDX(nb, i, j + 1)] + x[IDX(nb, i + 1, j)] + x[IDX(nb, i, j - 1)]);
max_diff = (float) fmaxf(max_diff, fabs(new_value - x[IDX(nb, i, j)]));
max_diff = fmaxf(max_diff, fabs(new_value - x[IDX(nb, i, j)]));
new_x[IDX(nb, i, j)] = new_value;
}
}

View File

@ -77,7 +77,7 @@ float *compute_jacobi(int rank, int numprocs, int n, float init_value, float thr
for (i = 1; i <= rows; i++) {
for (j = 1; j <= n; j++) {
new_value = 0.25 * (x[IDX(nb, i - 1, j)] + x[IDX(nb, i, j + 1)] + x[IDX(nb, i + 1, j)] + x[IDX(nb, i, j - 1)]);
max_diff = (float) fmaxf(max_diff, fabs(new_value - x[IDX(nb, i, j)]));
max_diff = fmaxf(max_diff, fabs(new_value - x[IDX(nb, i, j)]));
new_x[IDX(nb, i, j)] = new_value;
}
}

View File

@ -45,7 +45,7 @@ float *compute_jacobi(int n, float init_value, float threshold, borders b, int *
for (i = 1; i <= n; i++) {
for (j = 1; j <= n; j++) {
new_value = 0.25 * (x[IDX(nb, i - 1, j)] + x[IDX(nb, i, j + 1)] + x[IDX(nb, i + 1, j)] + x[IDX(nb, i, j - 1)]);
max_diff = (float) fmaxf(max_diff, fabs(new_value - x[IDX(nb, i, j)]));
max_diff = fmaxf(max_diff, fabs(new_value - x[IDX(nb, i, j)]));
new_x[IDX(nb, i, j)] = new_value;
}
}

View File

@ -42,7 +42,7 @@ float *compute_jacobi(int n, float init_value, float threshold, borders b, int *
for (i = 1; i <= n; i++) {
for (j = 1; j <= n; j++) {
new_value = 0.25 * (x[IDX(nb, i - 1, j)] + x[IDX(nb, i, j + 1)] + x[IDX(nb, i + 1, j)] + x[IDX(nb, i, j - 1)]);
max_diff = (float) fmaxf(max_diff, fabs(new_value - x[IDX(nb, i, j)]));
max_diff = fmaxf(max_diff, fabs(new_value - x[IDX(nb, i, j)]));
new_x[IDX(nb, i, j)] = new_value;
}
}

View File

@ -59,12 +59,12 @@ float *compute_jacobi(int n, float init_value, float threshold, borders b, int *
diff_vec = _mm_sub_ps(diff_vec, tmp_vec);
_mm_storeu_ps(diffs, diff_vec);
for (k = 0; k < 4; k++) {
max_diff = (float) fmaxf(max_diff, fabs(diffs[k]));
max_diff = fmaxf(max_diff, fabs(diffs[k]));
}
}
for (j = n_mult; j <= n; j++) {
new_value = 0.25 * (x[IDX(nb, i - 1, j)] + x[IDX(nb, i, j + 1)] + x[IDX(nb, i + 1, j)] + x[IDX(nb, i, j - 1)]);
max_diff = (float) fmaxf(max_diff, fabs(new_value - x[IDX(nb, i, j)]));
max_diff = fmaxf(max_diff, fabs(new_value - x[IDX(nb, i, j)]));
new_x[IDX(nb, i, j)] = new_value;
}
}