From a527b83a8e55f223d1e2c7439679ce61701afe4f Mon Sep 17 00:00:00 2001 From: pants Date: Thu, 8 Sep 2016 13:27:13 -0400 Subject: removed unsigned int usage in gen_laplacian.c --- src/gen_laplacian.c | 66 ++++++++++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/gen_laplacian.c b/src/gen_laplacian.c index 16054e3..73416e4 100644 --- a/src/gen_laplacian.c +++ b/src/gen_laplacian.c @@ -2,15 +2,15 @@ #include "fracture.h" cholmod_sparse *gen_adjacency(const net_t *instance, bool dual, bool breakv, - unsigned int pad, cholmod_common *c) { - unsigned int ne = instance->graph->ne; + uint_t pad, cholmod_common *c) { + uint_t ne = instance->graph->ne; if (!breakv && instance->graph->boundary != TORUS_BOUND && !dual) { ne += instance->graph->bound_inds[2]; } - unsigned int nnz = 2 * ne; + uint_t nnz = 2 * ne; - unsigned int nv; + uint_t nv; if (dual) nv = instance->graph->dnv; else { @@ -29,7 +29,7 @@ cholmod_sparse *gen_adjacency(const net_t *instance, bool dual, bool breakv, t->nnz = nnz; - unsigned int *etv; + uint_t *etv; if (dual) etv = instance->graph->dev; else { @@ -37,12 +37,12 @@ cholmod_sparse *gen_adjacency(const net_t *instance, bool dual, bool breakv, else etv = instance->graph->ev; } - unsigned int count = 0; + uint_t count = 0; - for (unsigned int i = 0; i < instance->graph->ne; i++) { + for (uint_t i = 0; i < instance->graph->ne; i++) { if ((instance->fuses[i] && dual) || (!instance->fuses[i] && !dual)) { - unsigned int v1 = etv[2 * i]; - unsigned int v2 = etv[2 * i + 1]; + uint_t v1 = etv[2 * i]; + uint_t v2 = etv[2 * i + 1]; ri[2 * count] = v1; ci[2 * count] = v2; @@ -54,8 +54,8 @@ cholmod_sparse *gen_adjacency(const net_t *instance, bool dual, bool breakv, count++; } else { - unsigned int v1 = etv[2 * i]; - unsigned int v2 = etv[2 * i + 1]; + uint_t v1 = etv[2 * i]; + uint_t v2 = etv[2 * i + 1]; ri[2 * count] = v1; ci[2 * count] = v2; @@ -70,8 +70,8 @@ cholmod_sparse *gen_adjacency(const net_t *instance, bool dual, bool breakv, } if (!breakv && instance->graph->boundary != TORUS_BOUND && !dual) { - for (unsigned int i = 0; i < 2; i++) { - for (unsigned int j = 0; j < instance->graph->bound_inds[i+1] - instance->graph->bound_inds[i]; j++) { + for (uint_t i = 0; i < 2; i++) { + for (uint_t j = 0; j < instance->graph->bound_inds[i+1] - instance->graph->bound_inds[i]; j++) { ri[2*count] = instance->graph->nv + i; ci[2*count] = instance->graph->bound_verts[instance->graph->bound_inds[i] + j]; ai[2*count] = 1; @@ -93,23 +93,23 @@ cholmod_sparse *gen_adjacency(const net_t *instance, bool dual, bool breakv, cholmod_sparse *gen_laplacian(const net_t *instance, cholmod_common *c, bool symmetric) { const graph_t *network = instance->graph; - unsigned int num_verts = network->nv_break; - unsigned int num_bounds = network->num_bounds; + uint_t num_verts = network->nv_break; + uint_t num_bounds = network->num_bounds; double inf = instance->inf; bool voltage_bound = instance->voltage_bound; - unsigned int *bound_inds = network->bound_inds; - unsigned int *bound_verts = network->bound_verts; + uint_t *bound_inds = network->bound_inds; + uint_t *bound_verts = network->bound_verts; - unsigned int num_gedges; + uint_t num_gedges; if (voltage_bound) { num_gedges = 0; } else { num_gedges = network->bound_inds[num_bounds] + (num_bounds - 2) * 2; } if (network->boundary == TORUS_BOUND) num_gedges = bound_inds[1]; - unsigned int num_gverts = network->break_dim; + uint_t num_gverts = network->break_dim; - unsigned int nnz = num_gverts + 2 * num_gedges; + uint_t nnz = num_gverts + 2 * num_gedges; cholmod_triplet *temp_m = CHOL_F(allocate_triplet)(num_gverts, num_gverts, nnz, 0, CHOLMOD_REAL, c); @@ -120,7 +120,7 @@ cholmod_sparse *gen_laplacian(const net_t *instance, cholmod_common *c, temp_m->nnz = nnz; - for (unsigned int i = 0; i < num_gverts; i++) { + for (uint_t i = 0; i < num_gverts; i++) { rowind[i] = i; colind[i] = i; acoo[i] = 0; @@ -130,15 +130,15 @@ cholmod_sparse *gen_laplacian(const net_t *instance, cholmod_common *c, int_t *ia = (int_t *)adjacency->p; double *aa = (double *)adjacency->x; - for (unsigned int i = 0; i < num_verts; i++) { - for (unsigned int j = 0; j < ia[i + 1] - ia[i]; j++) { + for (uint_t i = 0; i < num_verts; i++) { + for (uint_t j = 0; j < ia[i + 1] - ia[i]; j++) { acoo[i] += aa[ia[i] + j]; } } if (network->boundary == TORUS_BOUND) { - for (unsigned int i = 0; i < network->bound_inds[1]; i++) { - unsigned int vv = network->bound_verts[i]; + for (uint_t i = 0; i < network->bound_inds[1]; i++) { + uint_t vv = network->bound_verts[i]; rowind[num_gverts + 2*i] = vv; colind[num_gverts + 2*i] = network->nv + i; acoo[num_gverts + 2*i] = -1; @@ -155,13 +155,13 @@ cholmod_sparse *gen_laplacian(const net_t *instance, cholmod_common *c, if (network->boundary != EMBEDDED_BOUND) acoo[0]++; if (voltage_bound) { - for (unsigned int i = 0; i < num_bounds; i++) { - for (unsigned int j = 0; j < bound_inds[i + 1] - bound_inds[i]; j++) { + for (uint_t i = 0; i < num_bounds; i++) { + for (uint_t j = 0; j < bound_inds[i + 1] - bound_inds[i]; j++) { acoo[bound_verts[bound_inds[i] + j]]++; } } } else { - for (unsigned int i = 0; i < num_bounds; i++) { + for (uint_t i = 0; i < num_bounds; i++) { rowind[num_verts + i] = num_verts + i; colind[num_verts + i] = num_verts + i; if (i < 2) @@ -173,10 +173,10 @@ cholmod_sparse *gen_laplacian(const net_t *instance, cholmod_common *c, (network->bound_inds[i + 1] - network->bound_inds[i] + 2) * inf; } - unsigned int start = num_gverts; + uint_t start = num_gverts; - for (unsigned int i = 0; i < 2; i++) { - for (unsigned int j = 0; j < bound_inds[i + 1] - bound_inds[i]; j++) { + for (uint_t i = 0; i < 2; i++) { + for (uint_t j = 0; j < bound_inds[i + 1] - bound_inds[i]; j++) { rowind[start + bound_inds[i] + j] = bound_verts[bound_inds[i] + j]; colind[start + bound_inds[i] + j] = num_verts + i; acoo[start + bound_inds[i] + j] = -inf; @@ -189,7 +189,7 @@ cholmod_sparse *gen_laplacian(const net_t *instance, cholmod_common *c, } } - for (unsigned int i = 0; i < num_bounds - 2; i++) { + for (uint_t i = 0; i < num_bounds - 2; i++) { rowind[nnz - 2 * i - 1] = num_verts; colind[nnz - 2 * i - 1] = num_verts + 2 + i; acoo[nnz - 2 * i - 1] = -inf; @@ -207,7 +207,7 @@ cholmod_sparse *gen_laplacian(const net_t *instance, cholmod_common *c, } - for (unsigned int i = 0; i < num_gverts; i++) { + for (uint_t i = 0; i < num_gverts; i++) { if (acoo[i] == 0) acoo[i] = 1; } -- cgit v1.2.3-70-g09d2