From 668bd2d618bc166e0c7ad3ba919f3091bde2acdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 10 Jun 2021 16:14:43 +0200 Subject: [PATCH] Add clear() and resize() to OSQP traits --- .../CGAL/OSQP_quadratic_program_traits.h | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Solver_interface/include/CGAL/OSQP_quadratic_program_traits.h b/Solver_interface/include/CGAL/OSQP_quadratic_program_traits.h index 51e68a4f583..4249e3e39e7 100644 --- a/Solver_interface/include/CGAL/OSQP_quadratic_program_traits.h +++ b/Solver_interface/include/CGAL/OSQP_quadratic_program_traits.h @@ -84,8 +84,29 @@ public: } public: - /// \cond SKIP_IN_MANUAL + /// Reset the problem, removing all existing entries and setting sizes to `0`. + void clear() + { + n = m = 0; + P_vec.clear(); + A_vec.clear(); + q_vec.clear(); + l_vec.clear(); + u_vec.clear(); + } + /// Change the number of variables and the number of constraints of the problem. + /// + /// \warning Calling this function also clears all previous entries. + void resize(const int new_n, + const int new_m = 0) + { + clear(); + n = new_n; + m = new_m; + } + + /// \cond SKIP_IN_MANUAL void set_P(const std::size_t i, const std::size_t j, const FT value) { if(j < i)