From cdb7e1aa01eb590caaff63426aa6e33ff56c5d9b Mon Sep 17 00:00:00 2001 From: Davis King Date: Sun, 1 Jun 2008 22:58:08 +0000 Subject: [PATCH] Fixed some bugs in the require clause of the subm and set_subm functions. Also suppressed some compiler warnings. --HG-- extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402289 --- dlib/matrix/matrix_utilities.h | 10 +++++----- dlib/matrix/matrix_utilities_abstract.h | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dlib/matrix/matrix_utilities.h b/dlib/matrix/matrix_utilities.h index 1b105444b..8e7c3f774 100644 --- a/dlib/matrix/matrix_utilities.h +++ b/dlib/matrix/matrix_utilities.h @@ -1375,7 +1375,7 @@ namespace dlib long nc ) { - DLIB_ASSERT(r >= 0 && c >= 0 && r+nr < m.nr() && c+nc < m.nc(), + DLIB_ASSERT(r >= 0 && c >= 0 && r+nr <= m.nr() && c+nc <= m.nc(), "\tconst matrix_exp subm(const matrix_exp& m, r, c, nr, nc)" << "\n\tYou have specified invalid sub matrix dimensions" << "\n\tm.nr(): " << m.nr() @@ -1510,7 +1510,7 @@ namespace dlib const matrix_exp& exp ) { - DLIB_ASSERT( exp.nr() == rect.height() && exp.nc() == rect.width(), + DLIB_ASSERT( exp.nr() == (long)rect.height() && exp.nc() == (long)rect.width(), "\tassignable_matrix_expression set_subm()" << "\n\tYou have tried to assign to this object using a matrix that isn't the right size" << "\n\texp.nr() (source matrix): " << exp.nr() @@ -1552,7 +1552,7 @@ namespace dlib private: matrix& m; - const rectangle& rect; + const rectangle rect; }; @@ -1587,7 +1587,7 @@ namespace dlib long nc ) { - DLIB_ASSERT(r >= 0 && c >= 0 && r+nr < m.nr() && c+nc < m.nc(), + DLIB_ASSERT(r >= 0 && c >= 0 && r+nr <= m.nr() && c+nc <= m.nc(), "\tassignable_matrix_expression set_subm(matrix& m, r, c, nr, nc)" << "\n\tYou have specified invalid sub matrix dimensions" << "\n\tm.nr(): " << m.nr() @@ -1688,7 +1688,7 @@ namespace dlib const matrix_exp& exp ) { - DLIB_ASSERT( exp.nc() == 1 && exp.nc() == m.nc(), + DLIB_ASSERT( exp.nr() == 1 && exp.nc() == m.nc(), "\tassignable_matrix_expression set_rowm()" << "\n\tYou have tried to assign to this object using a matrix that isn't the right size" << "\n\texp.nr() (source matrix): " << exp.nr() diff --git a/dlib/matrix/matrix_utilities_abstract.h b/dlib/matrix/matrix_utilities_abstract.h index 7512d9e0f..6cf968425 100644 --- a/dlib/matrix/matrix_utilities_abstract.h +++ b/dlib/matrix/matrix_utilities_abstract.h @@ -204,9 +204,9 @@ namespace dlib /*! requires - row >= 0 - - row + nr < m.nr() + - row + nr <= m.nr() - col >= 0 - - col + nc < m.nc() + - col + nc <= m.nc() ensures - returns a matrix R such that: - R.nr() == nr @@ -279,9 +279,9 @@ namespace dlib /*! requires - row >= 0 - - row + nr < m.nr() + - row + nr <= m.nr() - col >= 0 - - col + nc < m.nc() + - col + nc <= m.nc() ensures - statements of the following form: - set_subm(m,row,col,nr,nc) = some_matrix;