Skip to content

Commit

Permalink
Performance fix for single precision dot operation
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed Apr 7, 2012
1 parent a553686 commit ca1f345
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/shogun/mathematics/Math.cpp
Expand Up @@ -584,13 +584,13 @@ float64_t CMath::dot(const float64_t* v1, const float64_t* v2, int32_t n)
float64_t CMath::dot(
const float32_t* v1, const float32_t* v2, int32_t n)
{
float64_t r=0;
float32_t r=0;
#ifdef HAVE_LAPACK
int32_t skip=1;
r = cblas_sdot(n, v1, skip, v2, skip);
#else
for (int32_t i=0; i<n; i++)
r+=((float64_t)v1[i])*v2[i];
r+=v1[i]*v2[i];
#endif
return r;
}

0 comments on commit ca1f345

Please sign in to comment.