Commit 41f2f3e8 authored by Davis King's avatar Davis King

Added a missing requirement and ASSERT.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402954
parent e7abcf74
......@@ -165,6 +165,13 @@ namespace dlib
const kcentroid& x
) const
{
// make sure requires clause is not broken
DLIB_ASSERT(x.get_kernel() == get_kernel(),
"\tscalar_type kcentroid::inner_product(const kcentroid& x)"
<< "\n\tYou can only compare two kcentroid objects if they use the same kernel"
<< "\n\tthis: " << this
);
scalar_type temp = 0;
for (unsigned long i = 0; i < alpha.size(); ++i)
{
......
......@@ -180,6 +180,8 @@ namespace dlib
const kcentroid& x
) const;
/*!
requires
- x.get_kernel() == get_kernel()
ensures
- returns the inner product between x and this centroid object.
!*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment