mirror of https://github.com/davisking/dlib.git
Made the specs a little more clear and added some more tests
--HG-- extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402310
This commit is contained in:
parent
9328d20991
commit
f8fe979b7a
|
@ -253,13 +253,23 @@ namespace dlib
|
|||
) const;
|
||||
/*!
|
||||
ensures
|
||||
- returns true if the following expression would evaluate incorrectly and false otherwise:
|
||||
for (long r = 0; r < nr(); ++r)
|
||||
for (long c = 0; c < nc(); ++c)
|
||||
item(r,c) = (*this)(r,c)
|
||||
- That is, if this matrix expression aliases item in such a way that a modification
|
||||
to element item(r,c) causes a change in the value of something other than
|
||||
(*this)(r,c) then this function returns true. Otherwise, returns false
|
||||
- if (aliases(item)) then
|
||||
- if (nr() != item.nr() || nc() != item.nc()
|
||||
- returns true
|
||||
(i.e. if this expression has different dimensions than item then
|
||||
we have destructive aliasing)
|
||||
|
||||
- returns true if the following expression would evaluate incorrectly:
|
||||
for (long r = 0; r < nr(); ++r)
|
||||
for (long c = 0; c < nc(); ++c)
|
||||
item(r,c) = (*this)(r,c)
|
||||
- That is, if this matrix expression aliases item in such a way that a modification
|
||||
to element item(r,c) causes a change in the value of something other than
|
||||
(*this)(r,c) then this function returns true.
|
||||
|
||||
- returns false if none of the above conditions say we should return true
|
||||
- else
|
||||
- returns false
|
||||
!*/
|
||||
|
||||
const ref_type& ref (
|
||||
|
|
|
@ -1269,6 +1269,19 @@ namespace
|
|||
DLIB_CASSERT(remove_row(res,2).nr() == 4,"");
|
||||
DLIB_CASSERT(remove_row(res,2).nc() == 5,"");
|
||||
|
||||
temp = matrix<long,5,5>(res_vals);
|
||||
temp = remove_row(res,2);
|
||||
DLIB_CASSERT((temp == matrix<long,4,5>(res_vals_r2)),"");
|
||||
temp = matrix<long,5,5>(res_vals);
|
||||
temp = remove_col(res,3);
|
||||
DLIB_CASSERT((temp == matrix<long,5,4>(res_vals_c3)),"");
|
||||
|
||||
matrix<long,3,1> vect;
|
||||
set_all_elements(vect,1);
|
||||
temp = identity_matrix<long>(3);
|
||||
temp = temp*vect;
|
||||
DLIB_CASSERT(temp == vect,"");
|
||||
|
||||
temp = matrix<long,5,4>(res_vals_c3);
|
||||
DLIB_CASSERT(remove_col(res,3) == temp,"");
|
||||
DLIB_CASSERT(remove_col(res,3)(2,3) == 0,"");
|
||||
|
|
Loading…
Reference in New Issue