Commit 89f3e775 authored by Davis King's avatar Davis King

Added compile time assert checks on the type given to the kernels.

parent 1f97eedc
......@@ -29,6 +29,9 @@ namespace dlib
typedef T sample_type;
typedef typename T::mem_manager_type mem_manager_type;
// T must be capable of representing a column vector.
COMPILE_TIME_ASSERT(T::NC == 1 || T::NC == 0);
radial_basis_kernel(const scalar_type g) : gamma(g) {}
radial_basis_kernel() : gamma(0.1) {}
radial_basis_kernel(
......@@ -133,6 +136,9 @@ namespace dlib
typedef T sample_type;
typedef typename T::mem_manager_type mem_manager_type;
// T must be capable of representing a column vector.
COMPILE_TIME_ASSERT(T::NC == 1 || T::NC == 0);
polynomial_kernel(const scalar_type g, const scalar_type c, const scalar_type d) : gamma(g), coef(c), degree(d) {}
polynomial_kernel() : gamma(1), coef(0), degree(1) {}
polynomial_kernel(
......@@ -244,6 +250,9 @@ namespace dlib
typedef T sample_type;
typedef typename T::mem_manager_type mem_manager_type;
// T must be capable of representing a column vector.
COMPILE_TIME_ASSERT(T::NC == 1 || T::NC == 0);
sigmoid_kernel(const scalar_type g, const scalar_type c) : gamma(g), coef(c) {}
sigmoid_kernel() : gamma(0.1), coef(-1.0) {}
sigmoid_kernel(
......@@ -349,6 +358,9 @@ namespace dlib
typedef T sample_type;
typedef typename T::mem_manager_type mem_manager_type;
// T must be capable of representing a column vector.
COMPILE_TIME_ASSERT(T::NC == 1 || T::NC == 0);
scalar_type operator() (
const sample_type& a,
const sample_type& b
......
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