From 1232be870cff19719a023f0a4cece720b7fb0f3b Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Fri, 29 Jul 2022 17:35:04 -0700 Subject: [PATCH] sfdpgen SparseMatrix_solve: remove 'flag' parameter This is always set to 0 and conveys no information to the caller. --- lib/sfdpgen/post_process.c | 5 ++--- lib/sfdpgen/sparse_solve.c | 3 +-- lib/sfdpgen/sparse_solve.h | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/sfdpgen/post_process.c b/lib/sfdpgen/post_process.c index a16bd785e..a25201dae 100644 --- a/lib/sfdpgen/post_process.c +++ b/lib/sfdpgen/post_process.c @@ -592,7 +592,7 @@ static double uniform_stress_solve(SparseMatrix Lw, double alpha, int dim, doubl double StressMajorizationSmoother_smooth(StressMajorizationSmoother sm, int dim, double *x, int maxit_sm, double tol) { SparseMatrix Lw = sm->Lw, Lwd = sm->Lwd, Lwdd = NULL; - int i, j, k, m, *id, *jd, *iw, *jw, idiag, flag = 0, iter = 0; + int i, j, k, m, *id, *jd, *iw, *jw, idiag, iter = 0; double *w, *dd, *d, *y = NULL, *x0 = NULL, *x00 = NULL, diag, diff = 1, *lambda = sm->lambda, alpha = 0., M = 0.; SparseMatrix Lc = NULL; double dij, dist; @@ -704,10 +704,9 @@ double StressMajorizationSmoother_smooth(StressMajorizationSmoother sm, int dim, if (sm->scheme == SM_SCHEME_UNIFORM_STRESS){ uniform_stress_solve(Lw, alpha, dim, x, y, sm->tol_cg, sm->maxit_cg); } else { - SparseMatrix_solve(Lw, dim, x, y, sm->tol_cg, sm->maxit_cg, &flag); + SparseMatrix_solve(Lw, dim, x, y, sm->tol_cg, sm->maxit_cg); } - if (flag) goto RETURN; #ifdef DEBUG_PRINT if (Verbose) fprintf(stderr, "stress2 = %g\n",get_stress(m, dim, iw, jw, w, d, y, sm->scaling)); #endif diff --git a/lib/sfdpgen/sparse_solve.c b/lib/sfdpgen/sparse_solve.c index f5fefd071..e7a1a83b2 100644 --- a/lib/sfdpgen/sparse_solve.c +++ b/lib/sfdpgen/sparse_solve.c @@ -236,11 +236,10 @@ double cg(Operator Ax, Operator precond, int n, int dim, double *x0, double *rhs return res; } -double SparseMatrix_solve(SparseMatrix A, int dim, double *x0, double *rhs, double tol, int maxit, int *flag){ +double SparseMatrix_solve(SparseMatrix A, int dim, double *x0, double *rhs, double tol, int maxit){ Operator Ax, precond; int n = A->m; double res = 0; - *flag = 0; Ax = Operator_matmul_new(A); precond = Operator_diag_precon_new(A); diff --git a/lib/sfdpgen/sparse_solve.h b/lib/sfdpgen/sparse_solve.h index 39827129e..bfff9db19 100644 --- a/lib/sfdpgen/sparse_solve.h +++ b/lib/sfdpgen/sparse_solve.h @@ -21,7 +21,7 @@ struct Operator_struct { double cg(Operator Ax, Operator precond, int n, int dim, double *x0, double *rhs, double tol, int maxit); -double SparseMatrix_solve(SparseMatrix A, int dim, double *x0, double *rhs, double tol, int maxit, int *flag); +double SparseMatrix_solve(SparseMatrix A, int dim, double *x0, double *rhs, double tol, int maxit); Operator Operator_uniform_stress_matmul(SparseMatrix A, double alpha); -- 2.40.0