From 5675235d23f2a0b4a83853a364777b8e6d1f638e Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Tue, 15 Feb 2022 19:04:42 +1100 Subject: [PATCH] neatogen: [nfc] reflow some code This appears to be two copies of the same copy-pasted code. --- lib/neatogen/constrained_majorization.c | 9 +++------ lib/neatogen/constrained_majorization_ipsep.c | 9 +++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/neatogen/constrained_majorization.c b/lib/neatogen/constrained_majorization.c index ea1723d5f..e83e5bf60 100644 --- a/lib/neatogen/constrained_majorization.c +++ b/lib/neatogen/constrained_majorization.c @@ -348,19 +348,16 @@ int stress_majorization_with_hierarchy(vtx_data * graph, /* Input graph in spars */ for (k = 0; k < dim; k++) { set_vector_valf(len, coords[k][i], tmp_coords); - vectors_mult_additionf(len, tmp_coords, -1, - coords[k] + i + 1); + vectors_mult_additionf(len, tmp_coords, -1, coords[k] + i + 1); square_vec(len, tmp_coords); - vectors_additionf(len, tmp_coords, dist_accumulator, - dist_accumulator); + vectors_additionf(len, tmp_coords, dist_accumulator, dist_accumulator); } /* convert to 1/d_{ij} */ invert_sqrt_vec(len, dist_accumulator); /* detect overflows */ for (j = 0; j < len; j++) { - if (dist_accumulator[j] >= FLT_MAX - || dist_accumulator[j] < 0) { + if (dist_accumulator[j] >= FLT_MAX || dist_accumulator[j] < 0) { dist_accumulator[j] = 0; } } diff --git a/lib/neatogen/constrained_majorization_ipsep.c b/lib/neatogen/constrained_majorization_ipsep.c index 988099d70..fce7362c1 100644 --- a/lib/neatogen/constrained_majorization_ipsep.c +++ b/lib/neatogen/constrained_majorization_ipsep.c @@ -303,19 +303,16 @@ int stress_majorization_cola(vtx_data * graph, /* Input graph in sparse represen */ for (k = 0; k < dim; k++) { set_vector_valf(len, coords[k][i], tmp_coords); - vectors_mult_additionf(len, tmp_coords, -1, - coords[k] + i + 1); + vectors_mult_additionf(len, tmp_coords, -1, coords[k] + i + 1); square_vec(len, tmp_coords); - vectors_additionf(len, tmp_coords, dist_accumulator, - dist_accumulator); + vectors_additionf(len, tmp_coords, dist_accumulator, dist_accumulator); } /* convert to 1/d_{ij} */ invert_sqrt_vec(len, dist_accumulator); /* detect overflows */ for (j = 0; j < len; j++) { - if (dist_accumulator[j] >= FLT_MAX - || dist_accumulator[j] < 0) { + if (dist_accumulator[j] >= FLT_MAX || dist_accumulator[j] < 0) { dist_accumulator[j] = 0; } } -- 2.40.0