Skip to content

Commit

Permalink
Got rid of legacy WDPSK pointer-based constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed May 30, 2013
1 parent 9ace1c2 commit 6790584
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Expand Up @@ -74,7 +74,7 @@ CWeightedDegreePositionStringKernel::CWeightedDegreePositionStringKernel(
}

CWeightedDegreePositionStringKernel::CWeightedDegreePositionStringKernel(
int32_t size, float64_t* w, int32_t d, int32_t mm, int32_t* s, int32_t sl,
int32_t size, SGVector<float64_t> w, int32_t d, int32_t mm, SGVector<int32_t> s,
int32_t mkls)
: CStringKernel<char>(size)
{
Expand All @@ -94,7 +94,7 @@ CWeightedDegreePositionStringKernel::CWeightedDegreePositionStringKernel(
for (int32_t i=0; i<d*(1+max_mismatch); i++)
weights[i]=w[i];

set_shifts(SGVector<int32_t>(SGVector<int32_t>::clone_vector(s,sl), sl));
set_shifts(s);
}

CWeightedDegreePositionStringKernel::CWeightedDegreePositionStringKernel(
Expand Down
4 changes: 2 additions & 2 deletions src/shogun/kernel/string/WeightedDegreePositionStringKernel.h
Expand Up @@ -73,8 +73,8 @@ class CWeightedDegreePositionStringKernel: public CStringKernel<char>
* @param mkl_stepsize MKL stepsize
*/
CWeightedDegreePositionStringKernel(
int32_t size, float64_t* weights, int32_t degree,
int32_t max_mismatch, int32_t* shift, int32_t shift_len,
int32_t size, SGVector<float64_t> weights, int32_t degree,
int32_t max_mismatch, SGVector<int32_t> shifts,
int32_t mkl_stepsize=1);

/** constructor
Expand Down
6 changes: 3 additions & 3 deletions src/shogun/ui/GUIKernel.cpp
Expand Up @@ -297,7 +297,7 @@ CKernel* CGUIKernel::create_weighteddegreepositionstring(

float64_t* weights=get_weights(order, max_mismatch);

CKernel* kern=new CWeightedDegreePositionStringKernel(size, weights, order, max_mismatch, shifts, length);
CKernel* kern=new CWeightedDegreePositionStringKernel(size, SGVector<float64_t>(weights, order*(1+max_mismatch)), order, max_mismatch, SGVector<int32_t>(shifts, length).clone());
if (!kern)
SG_ERROR("Couldn't create WeightedDegreePositionStringKernel with size %d, order %d, max_mismatch %d, length %d, center %d, step %f.\n", size, order, max_mismatch, length, center, step)
else
Expand All @@ -314,7 +314,7 @@ CKernel* CGUIKernel::create_weighteddegreepositionstring3(
{
float64_t* weights=get_weights(order, max_mismatch);

CKernel* kern=new CWeightedDegreePositionStringKernel(size, weights, order, max_mismatch, shifts, length, mkl_stepsize);
CKernel* kern=new CWeightedDegreePositionStringKernel(size, SGVector<float64_t>(weights, order*(1+max_mismatch)), order, max_mismatch, SGVector<int32_t>(shifts, length).clone(), mkl_stepsize);
kern->set_normalizer(new CIdentityKernelNormalizer());

SG_DEBUG("created WeightedDegreePositionStringKernel (%p) with size %d, order %d, max_mismatch %d, length %d and position_weights (MKL stepsize: %d).\n", kern, size, order, max_mismatch, length, mkl_stepsize)
Expand All @@ -338,7 +338,7 @@ CKernel* CGUIKernel::create_weighteddegreepositionstring2(
{
float64_t* weights=get_weights(order, max_mismatch);

CKernel* kern=new CWeightedDegreePositionStringKernel(size, weights, order, max_mismatch, shifts, length);
CKernel* kern=new CWeightedDegreePositionStringKernel(size, SGVector<float64_t>(weights, order*(1+max_mismatch)), order, max_mismatch, SGVector<int32_t>(shifts, length).clone());
if (!use_normalization)
kern->set_normalizer(new CIdentityKernelNormalizer());

Expand Down

0 comments on commit 6790584

Please sign in to comment.