Added a requires clause to the set_tolerance() member function and

renamed clear() to clear_dictionary().

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402249
This commit is contained in:
Davis King 2008-05-21 22:57:36 +00:00
parent 8e51330251
commit 13ed137cb2
2 changed files with 13 additions and 7 deletions

View File

@ -36,11 +36,18 @@ namespace dlib
kernel(kernel_),
tolerance(tolerance_)
{
clear();
clear_dictionary();
}
void set_tolerance (scalar_type tolerance_)
{
// make sure requires clause is not broken
DLIB_ASSERT(tolerance_ >= 0,
"\tvoid krls::set_tolerance"
<< "\n\tinvalid tolerance value"
<< "\n\ttolerance: " << tolerance_
<< "\n\tthis: " << this
);
tolerance = tolerance_;
}
@ -49,7 +56,7 @@ namespace dlib
return tolerance;
}
void clear ()
void clear_dictionary ()
{
dictionary.clear();
alpha.clear();

View File

@ -56,6 +56,8 @@ namespace dlib
scalar_type tolerance_
);
/*!
requires
- tolerance_ >= 0
ensures
- #get_tolerance() == tolerance_
!*/
@ -73,15 +75,12 @@ namespace dlib
less accurate decision function but also in less support vectors.
!*/
void clear (
void clear_dictionary (
);
/*!
ensures
- clears out all learned data and puts this object back to its
initial state.
- clears out all learned data
(e.g. #get_decision_function().support_vectors.size() == 0)
- #get_tolerance() == get_tolerance()
(i.e. doesn't change the value of the tolerance)
!*/
scalar_type operator() (