Skip to content

Commit

Permalink
add SGVector based dense_dot_vec function wrapping dense_dot to
Browse files Browse the repository at this point in the history
dotfeatures
  • Loading branch information
Soeren Sonnenburg committed Jan 30, 2012
1 parent 66ebf04 commit 7827b83
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/shogun/features/DotFeatures.cpp
Expand Up @@ -59,6 +59,11 @@ CDotFeatures::CDotFeatures(CFile* loader)
init();
}

float64_t CDotFeatures::dense_dot_vec(int32_t vec_idx1, SGVector<float64_t> vec2)
{
return dense_dot(vec_idx1, vec2.vector, vec2.vlen);
}

void CDotFeatures::dense_dot_range(float64_t* output, int32_t start, int32_t stop, float64_t* alphas, float64_t* vec, int32_t dim, float64_t b)
{
ASSERT(output);
Expand Down
7 changes: 7 additions & 0 deletions src/shogun/features/DotFeatures.h
Expand Up @@ -77,6 +77,13 @@ class CDotFeatures : public CFeatures
*/
virtual float64_t dot(int32_t vec_idx1, CDotFeatures* df, int32_t vec_idx2)=0;

/** compute dot product between vector1 and a dense vector
*
* @param vec_idx1 index of first vector
* @param vec2 dense vector
*/
virtual float64_t dense_dot_vec(int32_t vec_idx1, SGVector<float64_t> vec2);

/** compute dot product between vector1 and a dense vector
*
* @param vec_idx1 index of first vector
Expand Down

0 comments on commit 7827b83

Please sign in to comment.