Skip to content

Commit 44a6ce6

Browse files
committed
clean up a bit
1 parent ca4bbb2 commit 44a6ce6

16 files changed

Lines changed: 73 additions & 1531 deletions

CMakeLists.txt

Lines changed: 0 additions & 87 deletions
This file was deleted.

TODO.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
4. in the refactor, add consts
22
10. For performance reasons, is it useful to have a dense matmul with A and B as dense matrices?
33
11. right matmul, add broadcasting logic as in left matmul. Is this necessary?
4-
5-
Going through all atoms to see that sparsity pattern is computed in initialization of hessian:
6-
3. trace - not ok

include/problem.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "expr.h"
55
#include "utils/CSR_Matrix.h"
66
#include "utils/Timer.h"
7+
#include <stdbool.h>
78

89
typedef struct
910
{
@@ -13,7 +14,10 @@ typedef struct
1314
double time_eval_hessian;
1415
double time_forward_obj;
1516
double time_forward_constraints;
16-
} stats;
17+
18+
int nnz_affine;
19+
int nnz_nonlinear;
20+
} Diff_engine_stats;
1721

1822
typedef struct problem
1923
{
@@ -38,11 +42,13 @@ typedef struct problem
3842
bool jacobian_called;
3943

4044
/* Statistics for performance measurement */
41-
stats stats;
45+
Diff_engine_stats stats;
46+
bool verbose;
4247
} problem;
4348

4449
/* Retains objective and constraints (shared ownership with caller) */
45-
problem *new_problem(expr *objective, expr **constraints, int n_constraints);
50+
problem *new_problem(expr *objective, expr **constraints, int n_constraints,
51+
bool verbose);
4652
void problem_init_derivatives(problem *prob);
4753
void free_problem(problem *prob);
4854

python/problem/make_problem.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ static PyObject *py_make_problem(PyObject *self, PyObject *args)
77
{
88
PyObject *obj_capsule;
99
PyObject *constraints_list;
10-
if (!PyArg_ParseTuple(args, "OO", &obj_capsule, &constraints_list))
10+
int verbose = 1;
11+
if (!PyArg_ParseTuple(args, "OO|p", &obj_capsule, &constraints_list, &verbose))
1112
{
1213
return NULL;
1314
}
@@ -49,7 +50,8 @@ static PyObject *py_make_problem(PyObject *self, PyObject *args)
4950
}
5051
}
5152

52-
problem *prob = new_problem(objective, constraints, (int) n_constraints);
53+
problem *prob =
54+
new_problem(objective, constraints, (int) n_constraints, verbose);
5355
free(constraints);
5456

5557
if (!prob)

0 commit comments

Comments
 (0)