Made the kernel objects comparable via operator==

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402364
pull/2/head
Davis King 16 years ago
parent dea84fe508
commit d7b506fa43

@ -50,6 +50,13 @@ namespace dlib
const_cast<scalar_type&>(gamma) = k.gamma;
return *this;
}
bool operator== (
const radial_basis_kernel& k
) const
{
return gamma == k.gamma;
}
};
template <
@ -128,6 +135,13 @@ namespace dlib
const_cast<scalar_type&>(degree) = k.degree;
return *this;
}
bool operator== (
const polynomial_kernel& k
) const
{
return (gamma == k.gamma) && (coef == k.coef) && (degree == k.degree);
}
};
template <
@ -187,6 +201,13 @@ namespace dlib
{
return trans(a)*b;
}
bool operator== (
const linear_kernel& k
) const
{
return true;
}
};
template <

@ -34,6 +34,8 @@ namespace dlib
dlib/memory_manager/memory_manager_kernel_abstract.h or
dlib/memory_manager_global/memory_manager_global_kernel_abstract.h or
dlib/memory_manager_stateless/memory_manager_stateless_kernel_abstract.h
- an overloaded == operator that tells you if two kernels are
identical or not.
For examples of kernel functions see the following objects
(e.g. the radial_basis_kernel).
@ -103,6 +105,17 @@ namespace dlib
- returns *this
!*/
bool operator== (
const radial_basis_kernel& k
) const;
/*!
ensures
- if (k and *this are identical) then
- returns true
- else
- returns false
!*/
};
template <
@ -203,6 +216,16 @@ namespace dlib
- returns *this
!*/
bool operator== (
const polynomial_kernel& k
) const;
/*!
ensures
- if (k and *this are identical) then
- returns true
- else
- returns false
!*/
};
template <
@ -258,6 +281,14 @@ namespace dlib
ensures
- returns trans(a)*b
!*/
bool operator== (
const linear_kernel& k
) const;
/*!
ensures
- returns true
!*/
};
template <

Loading…
Cancel
Save