20 using namespace shogun;
29 int32_t size, int32_t l, int32_t
id, int32_t od)
41 int32_t len, int32_t
id, int32_t od)
65 const int32_t PYRAL = 2 *
length - 1;
66 const int32_t pyra_len = num_features-PYRAL+1;
67 const int32_t pyra_len2 = (int32_t) pyra_len/2;
71 SG_DEBUG(
"initializing pyramid weights: size=%ld length=%i\n",
82 PYRAL_pot = DEGREE1_1 ? 1.0 : PYRAL_;
99 for (j = 0; j < pyra_len; j++)
101 for (j = 0; j < pyra_len; j++)
114 float64_t CSimpleLocalityImprovedStringKernel::dot_pyr (
const char*
const x1,
115 const char*
const x2,
const int32_t NOF_NTS,
const int32_t NTWIDTH,
116 const int32_t DEGREE1,
const int32_t DEGREE2,
float64_t *pyra)
118 const int32_t PYRAL = 2*NTWIDTH-1;
121 int32_t DEGREE1_1 = (DEGREE1 & 0x1)==0;
122 int32_t DEGREE1_1n = (DEGREE1 & ~0x1)!=0;
123 int32_t DEGREE1_2 = (DEGREE1 & 0x2)!=0;
124 int32_t DEGREE1_3 = (DEGREE1 & ~0x3)!=0;
125 int32_t DEGREE1_4 = (DEGREE1 & 0x4)!=0;
127 ASSERT((DEGREE1 & ~0x7) == 0)
128 ASSERT((DEGREE2 & ~0x7) == 0)
130 register int32_t conv;
136 for (j = 0; j < PYRAL; j++)
137 conv += (x1[j] == x2[j]) ? 1 : 0;
139 for (i = 0; i < NOF_NTS-PYRAL+1; i++)
143 conv += ((x1[i+PYRAL-1] == x2[i+PYRAL-1]) ? 1 : 0 ) -
144 ((x1[i-1] == x2[i-1]) ? 1 : 0);
147 pot2 = (DEGREE1_1) ? 1.0 : conv2;
153 if (DEGREE1_3 && DEGREE1_4)
160 pot = ((DEGREE2 & 0x1) == 0) ? 1.0 : sum;
161 if ((DEGREE2 & ~0x1) != 0)
164 if ((DEGREE2 & 0x2) != 0)
166 if ((DEGREE2 & ~0x3) != 0)
169 if ((DEGREE2 & 0x4) != 0)
177 int32_t idx_a, int32_t idx_b)
180 bool free_avec, free_bvec;
198 void CSimpleLocalityImprovedStringKernel::init()