Commit 184f0ce3 authored by Davis King's avatar Davis King

Made the members of the function object non-const since

that was sort of obnoxious.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402404
parent 1e77987c
...@@ -29,10 +29,10 @@ namespace dlib ...@@ -29,10 +29,10 @@ namespace dlib
typedef matrix<scalar_type,0,1,mem_manager_type> scalar_vector_type; typedef matrix<scalar_type,0,1,mem_manager_type> scalar_vector_type;
typedef matrix<sample_type,0,1,mem_manager_type> sample_vector_type; typedef matrix<sample_type,0,1,mem_manager_type> sample_vector_type;
const scalar_vector_type alpha; scalar_vector_type alpha;
const scalar_type b; scalar_type b;
const K kernel_function; K kernel_function;
const sample_vector_type support_vectors; sample_vector_type support_vectors;
decision_function ( decision_function (
) : b(0), kernel_function(K()) {} ) : b(0), kernel_function(K()) {}
...@@ -64,10 +64,10 @@ namespace dlib ...@@ -64,10 +64,10 @@ namespace dlib
{ {
if (this != &d) if (this != &d)
{ {
const_cast<scalar_vector_type&>(alpha) = d.alpha; alpha = d.alpha;
const_cast<scalar_type&>(b) = d.b; b = d.b;
const_cast<K&>(kernel_function) = d.kernel_function; kernel_function = d.kernel_function;
const_cast<sample_vector_type&>(support_vectors) = d.support_vectors; support_vectors = d.support_vectors;
} }
return *this; return *this;
} }
...@@ -121,10 +121,10 @@ namespace dlib ...@@ -121,10 +121,10 @@ namespace dlib
typedef matrix<sample_type,0,1,mem_manager_type> sample_vector_type; typedef matrix<sample_type,0,1,mem_manager_type> sample_vector_type;
try try
{ {
deserialize(const_cast<scalar_vector_type&>(item.alpha), in); deserialize(item.alpha, in);
deserialize(const_cast<scalar_type&>(item.b), in); deserialize(item.b, in);
deserialize(const_cast<K&>(item.kernel_function), in); deserialize(item.kernel_function, in);
deserialize(const_cast<sample_vector_type&>(item.support_vectors), in); deserialize(item.support_vectors, in);
} }
catch (serialization_error e) catch (serialization_error e)
{ {
...@@ -143,9 +143,9 @@ namespace dlib ...@@ -143,9 +143,9 @@ namespace dlib
typedef typename K::sample_type sample_type; typedef typename K::sample_type sample_type;
typedef typename K::mem_manager_type mem_manager_type; typedef typename K::mem_manager_type mem_manager_type;
const scalar_type a; scalar_type a;
const scalar_type b; scalar_type b;
const decision_function<K> decision_funct; decision_function<K> decision_funct;
probabilistic_decision_function ( probabilistic_decision_function (
) : a(0), b(0), decision_funct(decision_function<K>()) {} ) : a(0), b(0), decision_funct(decision_function<K>()) {}
...@@ -174,9 +174,9 @@ namespace dlib ...@@ -174,9 +174,9 @@ namespace dlib
{ {
if (this != &d) if (this != &d)
{ {
const_cast<scalar_type&>(a) = d.a; a = d.a;
const_cast<scalar_type&>(b) = d.b; b = d.b;
const_cast<decision_function<K>&>(decision_funct) = d.decision_funct; decision_funct = d.decision_funct;
} }
return *this; return *this;
} }
...@@ -221,9 +221,9 @@ namespace dlib ...@@ -221,9 +221,9 @@ namespace dlib
typedef typename K::scalar_type scalar_type; typedef typename K::scalar_type scalar_type;
try try
{ {
deserialize(const_cast<scalar_type&>(item.a), in); deserialize(item.a, in);
deserialize(const_cast<scalar_type&>(item.b), in); deserialize(item.b, in);
deserialize(const_cast<decision_function<K>&>(item.decision_funct), in); deserialize(item.decision_funct, in);
} }
catch (serialization_error& e) catch (serialization_error& e)
{ {
...@@ -245,10 +245,10 @@ namespace dlib ...@@ -245,10 +245,10 @@ namespace dlib
typedef matrix<scalar_type,0,1,mem_manager_type> scalar_vector_type; typedef matrix<scalar_type,0,1,mem_manager_type> scalar_vector_type;
typedef matrix<sample_type,0,1,mem_manager_type> sample_vector_type; typedef matrix<sample_type,0,1,mem_manager_type> sample_vector_type;
const scalar_vector_type alpha; scalar_vector_type alpha;
const scalar_type b; scalar_type b;
const K kernel_function; K kernel_function;
const sample_vector_type support_vectors; sample_vector_type support_vectors;
distance_function ( distance_function (
) : b(0), kernel_function(K()) {} ) : b(0), kernel_function(K()) {}
...@@ -280,10 +280,10 @@ namespace dlib ...@@ -280,10 +280,10 @@ namespace dlib
{ {
if (this != &d) if (this != &d)
{ {
const_cast<scalar_vector_type&>(alpha) = d.alpha; alpha = d.alpha;
const_cast<scalar_type&>(b) = d.b; b = d.b;
const_cast<K&>(kernel_function) = d.kernel_function; kernel_function = d.kernel_function;
const_cast<sample_vector_type&>(support_vectors) = d.support_vectors; support_vectors = d.support_vectors;
} }
return *this; return *this;
} }
...@@ -357,10 +357,10 @@ namespace dlib ...@@ -357,10 +357,10 @@ namespace dlib
typedef matrix<sample_type,0,1,mem_manager_type> sample_vector_type; typedef matrix<sample_type,0,1,mem_manager_type> sample_vector_type;
try try
{ {
deserialize(const_cast<scalar_vector_type&>(item.alpha), in); deserialize(item.alpha, in);
deserialize(const_cast<scalar_type&>(item.b), in); deserialize(item.b, in);
deserialize(const_cast<K&>(item.kernel_function), in); deserialize(item.kernel_function, in);
deserialize(const_cast<sample_vector_type&>(item.support_vectors), in); deserialize(item.support_vectors, in);
} }
catch (serialization_error e) catch (serialization_error e)
{ {
......
...@@ -37,10 +37,10 @@ namespace dlib ...@@ -37,10 +37,10 @@ namespace dlib
typedef matrix<scalar_type,0,1,mem_manager_type> scalar_vector_type; typedef matrix<scalar_type,0,1,mem_manager_type> scalar_vector_type;
typedef matrix<sample_type,0,1,mem_manager_type> sample_vector_type; typedef matrix<sample_type,0,1,mem_manager_type> sample_vector_type;
const scalar_vector_type alpha; scalar_vector_type alpha;
const scalar_type b; scalar_type b;
const K kernel_function; K kernel_function;
const sample_vector_type support_vectors; sample_vector_type support_vectors;
decision_function ( decision_function (
); );
...@@ -140,9 +140,9 @@ namespace dlib ...@@ -140,9 +140,9 @@ namespace dlib
typedef typename K::sample_type sample_type; typedef typename K::sample_type sample_type;
typedef typename K::mem_manager_type mem_manager_type; typedef typename K::mem_manager_type mem_manager_type;
const scalar_type a; scalar_type a;
const scalar_type b; scalar_type b;
const decision_function<K> decision_funct; decision_function<K> decision_funct;
probabilistic_decision_function ( probabilistic_decision_function (
); );
...@@ -248,10 +248,10 @@ namespace dlib ...@@ -248,10 +248,10 @@ namespace dlib
typedef matrix<scalar_type,0,1,mem_manager_type> scalar_vector_type; typedef matrix<scalar_type,0,1,mem_manager_type> scalar_vector_type;
typedef matrix<sample_type,0,1,mem_manager_type> sample_vector_type; typedef matrix<sample_type,0,1,mem_manager_type> sample_vector_type;
const scalar_vector_type alpha; scalar_vector_type alpha;
const scalar_type b; scalar_type b;
const K kernel_function; K kernel_function;
const sample_vector_type support_vectors; sample_vector_type support_vectors;
distance_function ( distance_function (
); );
...@@ -319,7 +319,7 @@ namespace dlib ...@@ -319,7 +319,7 @@ namespace dlib
) const ) const
/*! /*!
ensures ensures
- returns the distance between the point in kernel space represented by *this and x. - returns the distance between the points in kernel space represented by *this and x.
!*/ !*/
{ {
scalar_type temp = 0; scalar_type temp = 0;
......
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