From 313e53d23efda67aec33259cff95b5992ca63301 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Tue, 15 Feb 2022 18:46:12 +1100 Subject: [PATCH] neatogen: [nfc] remove some unnecessary parens --- lib/neatogen/constrained_majorization.c | 2 +- lib/neatogen/constrained_majorization_ipsep.c | 2 +- lib/neatogen/matrix_ops.c | 2 +- lib/neatogen/stress.c | 22 +++++++++---------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/neatogen/constrained_majorization.c b/lib/neatogen/constrained_majorization.c index 12e0e8549..7d6b49a67 100644 --- a/lib/neatogen/constrained_majorization.c +++ b/lib/neatogen/constrained_majorization.c @@ -273,7 +273,7 @@ int stress_majorization_with_hierarchy(vtx_data * graph, /* Input graph in spars for (i = 0; i < dim; i++) { coords[i] = f_storage + i * n; for (j = 0; j < n; j++) { - coords[i][j] = (float) (d_coords[i][j]); + coords[i][j] = (float)d_coords[i][j]; } } diff --git a/lib/neatogen/constrained_majorization_ipsep.c b/lib/neatogen/constrained_majorization_ipsep.c index d52e9af6a..988099d70 100644 --- a/lib/neatogen/constrained_majorization_ipsep.c +++ b/lib/neatogen/constrained_majorization_ipsep.c @@ -252,7 +252,7 @@ int stress_majorization_cola(vtx_data * graph, /* Input graph in sparse represen for (i = 0; i < dim; i++) { coords[i] = f_storage + i * n; for (j = 0; j < n; j++) { - coords[i][j] = j < orig_n ? (float) (d_coords[i][j]) : 0; + coords[i][j] = j < orig_n ? (float)d_coords[i][j] : 0; } } diff --git a/lib/neatogen/matrix_ops.c b/lib/neatogen/matrix_ops.c index 633f2c0d8..2cb9314d4 100644 --- a/lib/neatogen/matrix_ops.c +++ b/lib/neatogen/matrix_ops.c @@ -306,7 +306,7 @@ void vecscale(double *vec1, int beg, int end, double alpha, double *vec2) /* Returns 2-norm of a double n-vector over range. */ double norm(double *vec, int beg, int end) { - return (sqrt(dot(vec, beg, end, vec))); + return sqrt(dot(vec, beg, end, vec)); } void orthog1(int n, double *vec /* vector to be orthogonalized against 1 */ diff --git a/lib/neatogen/stress.c b/lib/neatogen/stress.c index 24bf9f096..8b9ee8505 100644 --- a/lib/neatogen/stress.c +++ b/lib/neatogen/stress.c @@ -63,14 +63,14 @@ static double compute_stressf(float **coords, float *lap, int dim, int n, int ex if (exp == 2) { #ifdef Dij2 Dij = 1.0 / sqrt(lap[count]); - sum += (Dij - dist) * (Dij - dist) * (lap[count]); + sum += (Dij - dist) * (Dij - dist) * lap[count]; #else Dij = 1.0 / lap[count]; - sum += (Dij - dist) * (Dij - dist) * (lap[count]); + sum += (Dij - dist) * (Dij - dist) * lap[count]; #endif } else { Dij = 1.0 / lap[count]; - sum += (Dij - dist) * (Dij - dist) * (lap[count]); + sum += (Dij - dist) * (Dij - dist) * lap[count]; } } } @@ -579,7 +579,7 @@ static int sparse_stress_subspace_majorization_kD(vtx_data * graph, /* Input gra /* random initialization */ for (k = 0; k < dim; k++) { for (i = 0; i < subspace_dim; i++) { - directions[k][i] = (double) (rand()) / RAND_MAX; + directions[k][i] = (double) rand() / RAND_MAX; } } } @@ -764,7 +764,7 @@ float *compute_apsp_packed(vtx_data * graph, int n) for (i = 0; i < n; i++) { bfs(i, graph, n, Di, &Q); for (j = i; j < n; j++) { - Dij[count++] = ((float) Di[j]); + Dij[count++] = (float)Di[j]; } } free(Di); @@ -954,14 +954,14 @@ int stress_majorization_kD_mkernel(vtx_data * graph, /* Input graph in sparse re ** Layout initialization ** **************************/ - if (smart_ini && (n > 1)) { + if (smart_ini && n > 1) { havePinned = 0; /* optimize layout quickly within subspace */ /* perform at most 50 iterations within 30-D subspace to get an estimate */ if (sparse_stress_subspace_majorization_kD(graph, n, nedges_graph, d_coords, dim, smart_ini, exp, - (model == MODEL_SUBSET), 50, + model == MODEL_SUBSET, 50, neighborhood_radius_subspace, num_pivots_stress) < 0) { iterations = -1; @@ -990,7 +990,7 @@ int stress_majorization_kD_mkernel(vtx_data * graph, /* Input graph in sparse re } if (Verbose) fprintf(stderr, ": %.2f sec", elapsed_sec()); - if ((n == 1) || (maxi == 0)) + if (n == 1 || maxi == 0) return 0; if (Verbose) { @@ -1003,7 +1003,7 @@ int stress_majorization_kD_mkernel(vtx_data * graph, /* Input graph in sparse re for (i = 0; i < dim; i++) { coords[i] = f_storage + i * n; for (j = 0; j < n; j++) { - coords[i][j] = ((float) d_coords[i][j]); + coords[i][j] = (float)d_coords[i][j]; } } @@ -1011,7 +1011,7 @@ int stress_majorization_kD_mkernel(vtx_data * graph, /* Input graph in sparse re /* which is \sum_{i