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
This commit is contained in:
Davis King 2008-06-01 22:58:08 +00:00
parent 7cc8219894
commit cdb7e1aa01
2 changed files with 9 additions and 9 deletions

View File

@ -1375,7 +1375,7 @@ namespace dlib
long nc 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)" "\tconst matrix_exp subm(const matrix_exp& m, r, c, nr, nc)"
<< "\n\tYou have specified invalid sub matrix dimensions" << "\n\tYou have specified invalid sub matrix dimensions"
<< "\n\tm.nr(): " << m.nr() << "\n\tm.nr(): " << m.nr()
@ -1510,7 +1510,7 @@ namespace dlib
const matrix_exp<EXP>& exp const matrix_exp<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()" "\tassignable_matrix_expression set_subm()"
<< "\n\tYou have tried to assign to this object using a matrix that isn't the right size" << "\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() << "\n\texp.nr() (source matrix): " << exp.nr()
@ -1552,7 +1552,7 @@ namespace dlib
private: private:
matrix<T,NR,NC,mm>& m; matrix<T,NR,NC,mm>& m;
const rectangle& rect; const rectangle rect;
}; };
@ -1587,7 +1587,7 @@ namespace dlib
long nc 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)" "\tassignable_matrix_expression set_subm(matrix& m, r, c, nr, nc)"
<< "\n\tYou have specified invalid sub matrix dimensions" << "\n\tYou have specified invalid sub matrix dimensions"
<< "\n\tm.nr(): " << m.nr() << "\n\tm.nr(): " << m.nr()
@ -1688,7 +1688,7 @@ namespace dlib
const matrix_exp<EXP>& exp const matrix_exp<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()" "\tassignable_matrix_expression set_rowm()"
<< "\n\tYou have tried to assign to this object using a matrix that isn't the right size" << "\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() << "\n\texp.nr() (source matrix): " << exp.nr()

View File

@ -204,9 +204,9 @@ namespace dlib
/*! /*!
requires requires
- row >= 0 - row >= 0
- row + nr < m.nr() - row + nr <= m.nr()
- col >= 0 - col >= 0
- col + nc < m.nc() - col + nc <= m.nc()
ensures ensures
- returns a matrix R such that: - returns a matrix R such that:
- R.nr() == nr - R.nr() == nr
@ -279,9 +279,9 @@ namespace dlib
/*! /*!
requires requires
- row >= 0 - row >= 0
- row + nr < m.nr() - row + nr <= m.nr()
- col >= 0 - col >= 0
- col + nc < m.nc() - col + nc <= m.nc()
ensures ensures
- statements of the following form: - statements of the following form:
- set_subm(m,row,col,nr,nc) = some_matrix; - set_subm(m,row,col,nr,nc) = some_matrix;