Skip to content

Commit 80380ce

Browse files
committed
dense/model: remove unnecessary PROXSUITE_CHECK_SIZE
- use already defined `PROXSUITE_CHECK_ARGUMENT_SIZE` which is using `PROXSUITE_THROW_PRETTY`
1 parent c6b138b commit 80380ce

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

include/proxsuite/proxqp/dense/model.hpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,16 @@ struct Model
100100

101101
bool is_valid(const bool box_constraints)
102102
{
103-
#define PROXSUITE_CHECK_SIZE(size, expected_size) \
104-
if (size != 0) { \
105-
if (!(size == expected_size)) \
106-
return false; \
107-
}
108-
109103
// check that all matrices and vectors of qpmodel have the correct size
110104
// and that H and C have expected properties
111105
PROXSUITE_CHECK_ARGUMENT_SIZE(g.size(), dim, "g has not the expected size.")
112106
PROXSUITE_CHECK_ARGUMENT_SIZE(b.size(), n_eq, "b has not the expected size.")
113107
PROXSUITE_CHECK_ARGUMENT_SIZE(l.size(), n_in, "l has not the expected size.")
114108
PROXSUITE_CHECK_ARGUMENT_SIZE(u.size(), n_in, "u has not the expected size.")
109+
if (box_constraints) {
110+
PROXSUITE_CHECK_ARGUMENT_SIZE(u_box.size(), dim, "u_box has not the expected size");
111+
PROXSUITE_CHECK_ARGUMENT_SIZE(l_box.size(), dim, "l_box has not the expected size");
112+
}
115113
if (H.size()) {
116114
PROXSUITE_CHECK_ARGUMENT_SIZE(H.rows(), dim, "H has not the expected number of rows.");
117115
PROXSUITE_CHECK_ARGUMENT_SIZE(H.cols(), dim, "H has not the expected number of cols.");
@@ -127,7 +125,6 @@ struct Model
127125
PROXSUITE_THROW_PRETTY(C.isZero(), std::invalid_argument, "C is zero, while n_in != 0.");
128126
}
129127
return true;
130-
#undef PROXSUITE_CHECK_SIZE
131128
}
132129
};
133130

0 commit comments

Comments
 (0)