diff --git a/dlib/optimization/optimization_solve_qp_using_smo.h b/dlib/optimization/optimization_solve_qp_using_smo.h index b9cb8dcef..a44875046 100644 --- a/dlib/optimization/optimization_solve_qp_using_smo.h +++ b/dlib/optimization/optimization_solve_qp_using_smo.h @@ -632,6 +632,7 @@ namespace dlib for (auto& Q : Q_blocks) { DLIB_CASSERT(Q.nr() == Q.nc(), "All the matrices in Q_blocks have the same dimensions."); + DLIB_CASSERT(Q.size() > 0, "All the matrices in Q_blocks must be non-empty and have the same dimensions."); DLIB_CASSERT(Q.nr() == Q_blocks[0].nr() && Q.nc() == Q_blocks[0].nc(), "All the matrices in Q_blocks have the same dimensions."); } #ifdef ENABLE_ASSERTS diff --git a/dlib/optimization/optimization_solve_qp_using_smo_abstract.h b/dlib/optimization/optimization_solve_qp_using_smo_abstract.h index 6fe2be8bf..5e7d5ec3f 100644 --- a/dlib/optimization/optimization_solve_qp_using_smo_abstract.h +++ b/dlib/optimization/optimization_solve_qp_using_smo_abstract.h @@ -183,8 +183,8 @@ namespace dlib requires - Q_blocks.size() > 0 - Q_blocks.size() == bs.size() == alphas.size() == lowers.size() == uppers.size() - - All the matrices in Q_blocks have the same dimensions. Moreover, they are square - matrices. + - All the matrices in Q_blocks have the same dimensions. Moreover, they are + non-empty square matrices. - All the matrices in bs, Q_offdiag, alphas, lowers, and uppers have the same dimensions. Moreover, they are all column vectors. - Q_blocks[0].nr() == alphas[0].size()