Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bugfix in dot product for 32bit,32bit vector dot product computation
  • Loading branch information
ptillet committed Apr 1, 2012
1 parent a1f473c commit 08f27a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/shogun/mathematics/Math.cpp
Expand Up @@ -581,16 +581,16 @@ float64_t CMath::dot(const float64_t* v1, const float64_t* v2, int32_t n)
return r;
}

float32_t CMath::dot(
float64_t CMath::dot(
const float32_t* v1, const float32_t* v2, int32_t n)
{
float64_t r=0;
#ifdef HAVE_LAPACK
int32_t skip=1;
r = cblas_sdot(n, v1, skip, v2, skip);
r = cblas_ddot(n, v1, skip, v2, skip);
#else
for (int32_t i=0; i<n; i++)
r+=v1[i]*v2[i];
r+=((float64_t)v1[i])*v2[i];
#endif
return r;
}
2 changes: 1 addition & 1 deletion src/shogun/mathematics/Math.h
Expand Up @@ -685,7 +685,7 @@ class CMath : public CSGObject
static float64_t dot(const float64_t* v1, const float64_t* v2, int32_t n);

/// compute dot product between v1 and v2 (blas optimized)
static float32_t dot(
static float64_t dot(
const float32_t* v1, const float32_t* v2, int32_t n);

/// compute dot product between v1 and v2 (for 64bit unsigned ints)
Expand Down

0 comments on commit 08f27a3

Please sign in to comment.