Commit d7b506fa authored by Davis King's avatar Davis King

Made the kernel objects comparable via operator==

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402364
parent dea84fe5
...@@ -50,6 +50,13 @@ namespace dlib ...@@ -50,6 +50,13 @@ namespace dlib
const_cast<scalar_type&>(gamma) = k.gamma; const_cast<scalar_type&>(gamma) = k.gamma;
return *this; return *this;
} }
bool operator== (
const radial_basis_kernel& k
) const
{
return gamma == k.gamma;
}
}; };
template < template <
...@@ -128,6 +135,13 @@ namespace dlib ...@@ -128,6 +135,13 @@ namespace dlib
const_cast<scalar_type&>(degree) = k.degree; const_cast<scalar_type&>(degree) = k.degree;
return *this; return *this;
} }
bool operator== (
const polynomial_kernel& k
) const
{
return (gamma == k.gamma) && (coef == k.coef) && (degree == k.degree);
}
}; };
template < template <
...@@ -187,6 +201,13 @@ namespace dlib ...@@ -187,6 +201,13 @@ namespace dlib
{ {
return trans(a)*b; return trans(a)*b;
} }
bool operator== (
const linear_kernel& k
) const
{
return true;
}
}; };
template < template <
......
...@@ -34,6 +34,8 @@ namespace dlib ...@@ -34,6 +34,8 @@ namespace dlib
dlib/memory_manager/memory_manager_kernel_abstract.h or dlib/memory_manager/memory_manager_kernel_abstract.h or
dlib/memory_manager_global/memory_manager_global_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 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 For examples of kernel functions see the following objects
(e.g. the radial_basis_kernel). (e.g. the radial_basis_kernel).
...@@ -103,6 +105,17 @@ namespace dlib ...@@ -103,6 +105,17 @@ namespace dlib
- returns *this - returns *this
!*/ !*/
bool operator== (
const radial_basis_kernel& k
) const;
/*!
ensures
- if (k and *this are identical) then
- returns true
- else
- returns false
!*/
}; };
template < template <
...@@ -203,6 +216,16 @@ namespace dlib ...@@ -203,6 +216,16 @@ namespace dlib
- returns *this - returns *this
!*/ !*/
bool operator== (
const polynomial_kernel& k
) const;
/*!
ensures
- if (k and *this are identical) then
- returns true
- else
- returns false
!*/
}; };
template < template <
...@@ -258,6 +281,14 @@ namespace dlib ...@@ -258,6 +281,14 @@ namespace dlib
ensures ensures
- returns trans(a)*b - returns trans(a)*b
!*/ !*/
bool operator== (
const linear_kernel& k
) const;
/*!
ensures
- returns true
!*/
}; };
template < template <
......
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