Skip to content

Commit d3ef182

Browse files
bodonoclaude
andcommitted
chore: remove dead code, add source file comments, fix comment style
Dead code removed: - Remove commented-out un_normalize_a_p() from scs_matrix.c (25 lines) and its commented-out declaration from scs_matrix.h - Remove duplicate cumsum() declaration from scs_matrix.h (already in csparse.h) Source file doc comments added: - exp_cone.c, rw.c, linalg.c, normalize.c, util.c Comment style consistency: - Convert // C++ comments to /* */ C comments in cones.h and util_spectral_cones.h to match the rest of the codebase Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent 251022d commit d3ef182

File tree

9 files changed

+33
-40
lines changed

9 files changed

+33
-40
lines changed

include/cones.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ extern "C" {
1212
#include <string.h>
1313

1414
#ifdef USE_SPECTRAL_CONES
15-
#include "util_spectral_cones.h" // for newton_stats
15+
#include "util_spectral_cones.h" /* for Newton_stats */
1616

17-
// macro for time measurements of SpectralSCS
17+
/* macro for time measurements of SpectralSCS */
1818
#ifdef SPECTRAL_TIMING_FLAG
1919
#define SPECTRAL_TIMING(action) action
2020
#else
@@ -55,7 +55,7 @@ struct SCS_CONE_WORK {
5555
Value_index *work_ell1;
5656
scs_float *work_ell1_proj;
5757

58-
// used for timing spectral vector cone and spectral matrix cone projections
58+
/* used for timing spectral vector cone and spectral matrix cone projections */
5959
SPECTRAL_TIMING(scs_float tot_time_mat_cone_proj;)
6060
SPECTRAL_TIMING(scs_float tot_time_vec_cone_proj;)
6161

include/util_spectral_cones.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void non_neg_proj(const scs_float *src, scs_float *dst, scs_int n);
2323
scs_float sum_log(const scs_float *x, scs_int n);
2424
scs_float min_vec(const scs_float *vec, scs_int n);
2525

26-
// used for sorting in ell1-norm cone and sum of largest cone.
26+
/* used for sorting in ell1-norm cone and sum of largest cone. */
2727
typedef struct {
2828
scs_float value;
2929
int index;
@@ -32,10 +32,10 @@ typedef struct {
3232
typedef struct {
3333
int iter;
3434

35-
// if plain Newton computed the projection or if an IPM was used
35+
/* if plain Newton computed the projection or if an IPM was used */
3636
int newton_success;
3737

38-
// dual_res, pri_res, complementarity for the projection problem
38+
/* dual_res, pri_res, complementarity for the projection problem */
3939
scs_float residuals[3];
4040
} Newton_stats;
4141

linsys/scs_matrix.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -456,30 +456,3 @@ ScsScaling *SCS(normalize_a_p)(ScsMatrix *P, ScsMatrix *A, ScsConeWork *cone) {
456456
return scal;
457457
}
458458

459-
/*
460-
void SCS(un_normalize_a_p)(ScsMatrix *A, ScsMatrix *P, const ScsScaling *scal) {
461-
scs_int i, j;
462-
scs_float *D = scal->D;
463-
scs_float *E = scal->E;
464-
for (i = 0; i < A->n; ++i) {
465-
SCS(scale_array)
466-
(&(A->x[A->p[i]]), 1. / E[i], A->p[i + 1] - A->p[i]);
467-
}
468-
for (i = 0; i < A->n; ++i) {
469-
for (j = A->p[i]; j < A->p[i + 1]; ++j) {
470-
A->x[j] /= D[A->i[j]];
471-
}
472-
}
473-
if (P) {
474-
for (i = 0; i < P->n; ++i) {
475-
SCS(scale_array)
476-
(&(P->x[P->p[i]]), 1. / E[i], P->p[i + 1] - P->p[i]);
477-
}
478-
for (i = 0; i < P->n; ++i) {
479-
for (j = P->p[i]; j < P->p[i + 1]; ++j) {
480-
P->x[j] /= E[P->i[j]];
481-
}
482-
}
483-
}
484-
}
485-
*/

linsys/scs_matrix.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,13 @@ extern "C" {
2020
* boundaries */
2121
ScsScaling *SCS(normalize_a_p)(ScsMatrix *P, ScsMatrix *A, ScsConeWork *cone);
2222

23-
/* unnormalizes A matrix, unnormalizes by w->D and w->E */
24-
/* void SCS(un_normalize_a_p)(ScsMatrix *A, ScsMatrix *P, const ScsScaling
25-
* *scal);
26-
*/
27-
2823
/* to free the memory allocated in a ScsMatrix (called on A and P at finish) */
2924
void SCS(free_scs_matrix)(ScsMatrix *A);
3025

3126
/* copies A (instead of in-place normalization), returns 0 for failure,
3227
* allocates memory for dstp */
3328
scs_int SCS(copy_matrix)(ScsMatrix **dstp, const ScsMatrix *src);
3429

35-
scs_float SCS(cumsum)(scs_int *p, scs_int *c, scs_int n);
36-
3730
/**
3831
* Validate the linear system inputs, returns < 0 if not valid inputs.
3932
*

src/exp_cone.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Exponential cone projection via Newton's method.
3+
* Handles both primal and dual exponential cones using Moreau decomposition.
4+
*/
5+
16
#include "cones.h"
27
#include "glbopts.h"
38
#include "linalg.h"

src/linalg.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
* Dense linear algebra operations: norms, dot products, scaling, axpy.
3+
* Has two implementations: a plain C fallback and an optimized BLAS version
4+
* (selected at compile time via USE_LAPACK).
5+
*/
6+
17
#include "linalg.h"
28
#include "scs_blas.h"
39
#include <math.h>

src/normalize.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
* Problem data normalization (equilibration) of b and c vectors,
3+
* and solution normalization/un-normalization routines.
4+
* Matrix normalization (A, P) is in linsys/scs_matrix.c.
5+
*/
6+
17
#include "normalize.h"
28

39
#include "linalg.h"

src/rw.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Read/write routines for serializing SCS problem data to binary files
3+
* and logging solve progress to CSV. Compiled as no-ops when NO_READ_WRITE=1.
4+
*/
5+
16
#include "rw.h"
27

38
#include <errno.h>

src/util.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Utility functions: platform-specific timers, deep copy helpers for
3+
* ScsData/ScsSettings, memory deallocation, and default settings.
4+
*/
5+
16
#include "util.h"
27

38
#include "glbopts.h"

0 commit comments

Comments
 (0)