Added a missing requires clause to the kkmeans object.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402367
This commit is contained in:
Davis King 2008-07-03 23:08:59 +00:00
parent 3946767f6e
commit 828f7bbb87
2 changed files with 11 additions and 0 deletions

View File

@ -58,6 +58,15 @@ namespace dlib
unsigned long i unsigned long i
) const ) const
{ {
// make sure requires clause is not broken
DLIB_ASSERT(i < number_of_centers(),
"\tkcentroid kkmeans::get_kcentroid(i)"
<< "\n\tYou have given an invalid value for i"
<< "\n\ti: " << i
<< "\n\tnumber_of_centers(): " << number_of_centers()
<< "\n\tthis: " << this
);
return *centers[i]; return *centers[i];
} }

View File

@ -65,6 +65,8 @@ namespace dlib
unsigned long i unsigned long i
) const; ) const;
/*! /*!
requires
- i < number_of_centers()
ensures ensures
- returns a const reference to the ith kcentroid object contained in - returns a const reference to the ith kcentroid object contained in
this object. Each kcentroid represents one of the centers found this object. Each kcentroid represents one of the centers found