diff --git a/dlib/svm/empirical_kernel_map.h b/dlib/svm/empirical_kernel_map.h index 4ee0cbb3e..b3cea7440 100644 --- a/dlib/svm/empirical_kernel_map.h +++ b/dlib/svm/empirical_kernel_map.h @@ -164,6 +164,23 @@ namespace dlib return distance_function(trans(weights)*vect, dot(vect,vect), kernel, vector_to_matrix(basis)); } + template + void premultiply_projections_by ( + const matrix_exp& mat + ) + { + // make sure requires clause is not broken + DLIB_ASSERT(out_vector_size() != 0 && mat.nc() == out_vector_size(), + "\t void empirical_kernel_map::premultiply_projections_by()" + << "\n\t Invalid inputs to this function." + << "\n\t out_vector_size(): " << out_vector_size() + << "\n\t mat.nc(): " << mat.nc() + << "\n\t this: " << this + ); + + weights = mat*weights; + } + const matrix& project ( const sample_type& samp ) const diff --git a/dlib/svm/empirical_kernel_map_abstract.h b/dlib/svm/empirical_kernel_map_abstract.h index e6fe76748..d79753681 100644 --- a/dlib/svm/empirical_kernel_map_abstract.h +++ b/dlib/svm/empirical_kernel_map_abstract.h @@ -122,6 +122,20 @@ namespace dlib - returns 0 !*/ + template + void premultiply_projections_by ( + const matrix_exp& mat + ); + /*! + requires + - out_vector_size() != 0 + - mat.nc() == out_vector_size() + ensures + - #out_vector_size() == mat.nr() + - TODO explain what this does. introduce functions to get the + weights and basis vectors and relate it to those. + !*/ + const matrix& project ( const sample_type& sample ) const;