From dd8bf7553d51f5e7c13e6a086aafa3a3bc8ef3b6 Mon Sep 17 00:00:00 2001 From: Davis King Date: Sat, 11 Jun 2016 21:15:04 -0400 Subject: [PATCH] Adjusted asserts to allow mat() to output empty matrices. --- dlib/matrix/matrix_mat.h | 8 ++++---- dlib/matrix/matrix_mat_abstract.h | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dlib/matrix/matrix_mat.h b/dlib/matrix/matrix_mat.h index f2c9b46aa..defc22644 100644 --- a/dlib/matrix/matrix_mat.h +++ b/dlib/matrix/matrix_mat.h @@ -301,9 +301,9 @@ namespace dlib long nr ) { - DLIB_ASSERT(nr > 0 , + DLIB_ASSERT(nr >= 0 , "\tconst matrix_exp mat(ptr, nr)" - << "\n\t nr must be bigger than 0" + << "\n\t nr must be >= 0" << "\n\t nr: " << nr ); typedef op_pointer_to_col_vect op; @@ -409,9 +409,9 @@ namespace dlib long nc ) { - DLIB_ASSERT(nr > 0 && nc > 0 , + DLIB_ASSERT(nr >= 0 && nc >= 0 , "\tconst matrix_exp mat(ptr, nr, nc)" - << "\n\t nr and nc must be bigger than 0" + << "\n\t nr and nc must be >= 0" << "\n\t nr: " << nr << "\n\t nc: " << nc ); diff --git a/dlib/matrix/matrix_mat_abstract.h b/dlib/matrix/matrix_mat_abstract.h index 87d6c1b90..8903f5c33 100644 --- a/dlib/matrix/matrix_mat_abstract.h +++ b/dlib/matrix/matrix_mat_abstract.h @@ -114,8 +114,8 @@ namespace dlib ); /*! requires - - nr > 0 - - ptr == a pointer to at least nr T objects + - nr >= 0 + - ptr == a pointer to at least nr T objects (or the NULL pointer if nr==0) ensures - returns a matrix M such that: - M.nr() == nr @@ -138,9 +138,9 @@ namespace dlib ); /*! requires - - nr > 0 - - nc > 0 - - ptr == a pointer to at least nr*nc T objects + - nr >= 0 + - nc >= 0 + - ptr == a pointer to at least nr*nc T objects (or the NULL pointer if nr*nc==0) ensures - returns a matrix M such that: - M.nr() == nr