diff --git a/dlib/svm/function.h b/dlib/svm/function.h index 074e38e17..2b19a3fd6 100644 --- a/dlib/svm/function.h +++ b/dlib/svm/function.h @@ -29,10 +29,10 @@ namespace dlib typedef matrix scalar_vector_type; typedef matrix sample_vector_type; - const scalar_vector_type alpha; - const scalar_type b; - const K kernel_function; - const sample_vector_type support_vectors; + scalar_vector_type alpha; + scalar_type b; + K kernel_function; + sample_vector_type support_vectors; decision_function ( ) : b(0), kernel_function(K()) {} @@ -64,10 +64,10 @@ namespace dlib { if (this != &d) { - const_cast(alpha) = d.alpha; - const_cast(b) = d.b; - const_cast(kernel_function) = d.kernel_function; - const_cast(support_vectors) = d.support_vectors; + alpha = d.alpha; + b = d.b; + kernel_function = d.kernel_function; + support_vectors = d.support_vectors; } return *this; } @@ -121,10 +121,10 @@ namespace dlib typedef matrix sample_vector_type; try { - deserialize(const_cast(item.alpha), in); - deserialize(const_cast(item.b), in); - deserialize(const_cast(item.kernel_function), in); - deserialize(const_cast(item.support_vectors), in); + deserialize(item.alpha, in); + deserialize(item.b, in); + deserialize(item.kernel_function, in); + deserialize(item.support_vectors, in); } catch (serialization_error e) { @@ -143,9 +143,9 @@ namespace dlib typedef typename K::sample_type sample_type; typedef typename K::mem_manager_type mem_manager_type; - const scalar_type a; - const scalar_type b; - const decision_function decision_funct; + scalar_type a; + scalar_type b; + decision_function decision_funct; probabilistic_decision_function ( ) : a(0), b(0), decision_funct(decision_function()) {} @@ -174,9 +174,9 @@ namespace dlib { if (this != &d) { - const_cast(a) = d.a; - const_cast(b) = d.b; - const_cast&>(decision_funct) = d.decision_funct; + a = d.a; + b = d.b; + decision_funct = d.decision_funct; } return *this; } @@ -221,9 +221,9 @@ namespace dlib typedef typename K::scalar_type scalar_type; try { - deserialize(const_cast(item.a), in); - deserialize(const_cast(item.b), in); - deserialize(const_cast&>(item.decision_funct), in); + deserialize(item.a, in); + deserialize(item.b, in); + deserialize(item.decision_funct, in); } catch (serialization_error& e) { @@ -245,10 +245,10 @@ namespace dlib typedef matrix scalar_vector_type; typedef matrix sample_vector_type; - const scalar_vector_type alpha; - const scalar_type b; - const K kernel_function; - const sample_vector_type support_vectors; + scalar_vector_type alpha; + scalar_type b; + K kernel_function; + sample_vector_type support_vectors; distance_function ( ) : b(0), kernel_function(K()) {} @@ -280,10 +280,10 @@ namespace dlib { if (this != &d) { - const_cast(alpha) = d.alpha; - const_cast(b) = d.b; - const_cast(kernel_function) = d.kernel_function; - const_cast(support_vectors) = d.support_vectors; + alpha = d.alpha; + b = d.b; + kernel_function = d.kernel_function; + support_vectors = d.support_vectors; } return *this; } @@ -357,10 +357,10 @@ namespace dlib typedef matrix sample_vector_type; try { - deserialize(const_cast(item.alpha), in); - deserialize(const_cast(item.b), in); - deserialize(const_cast(item.kernel_function), in); - deserialize(const_cast(item.support_vectors), in); + deserialize(item.alpha, in); + deserialize(item.b, in); + deserialize(item.kernel_function, in); + deserialize(item.support_vectors, in); } catch (serialization_error e) { diff --git a/dlib/svm/function_abstract.h b/dlib/svm/function_abstract.h index a3affd82a..b0296ec2b 100644 --- a/dlib/svm/function_abstract.h +++ b/dlib/svm/function_abstract.h @@ -37,10 +37,10 @@ namespace dlib typedef matrix scalar_vector_type; typedef matrix sample_vector_type; - const scalar_vector_type alpha; - const scalar_type b; - const K kernel_function; - const sample_vector_type support_vectors; + scalar_vector_type alpha; + scalar_type b; + K kernel_function; + sample_vector_type support_vectors; decision_function ( ); @@ -140,9 +140,9 @@ namespace dlib typedef typename K::sample_type sample_type; typedef typename K::mem_manager_type mem_manager_type; - const scalar_type a; - const scalar_type b; - const decision_function decision_funct; + scalar_type a; + scalar_type b; + decision_function decision_funct; probabilistic_decision_function ( ); @@ -248,10 +248,10 @@ namespace dlib typedef matrix scalar_vector_type; typedef matrix sample_vector_type; - const scalar_vector_type alpha; - const scalar_type b; - const K kernel_function; - const sample_vector_type support_vectors; + scalar_vector_type alpha; + scalar_type b; + K kernel_function; + sample_vector_type support_vectors; distance_function ( ); @@ -319,7 +319,7 @@ namespace dlib ) const /*! 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;