@@ -72,7 +72,7 @@ class tree_clusterizer {
7272 m_weightedVectors[i] = v * (float )weight;
7373 root.m_centroid += m_weightedVectors[i];
7474 root.m_total_weight += weight;
75- m_weightedDotProducts[i] = v.dot (v) * weight;
75+ m_weightedDotProducts[i] = ( double ) v.dot (v) * ( double ) weight;
7676 ttsum += m_weightedDotProducts[i];
7777 }
7878 root.m_variance = (float )(ttsum - (root.m_centroid .dot (root.m_centroid ) / root.m_total_weight ));
@@ -289,7 +289,7 @@ class tree_clusterizer {
289289 double sum = 0 ;
290290
291291 for (uint j = 0 ; j < N; j++)
292- sum += axis[j] * covar[i][j];
292+ sum += ( double ) axis[j] * ( double ) covar[i][j];
293293
294294 x[i] = (float )sum;
295295
@@ -464,7 +464,7 @@ void split_vectors(VectorType (&vectors)[64], uint (&weights)[64], uint size, Ve
464464 weightedVectors[i] = v * (float )weight;
465465 centroid += weightedVectors[i];
466466 total_weight += weight;
467- weightedDotProducts[i] = v.dot (v) * weight;
467+ weightedDotProducts[i] = ( double ) v.dot (v) * ( double ) weight;
468468 ttsum += weightedDotProducts[i];
469469 }
470470 float variance = (float )(ttsum - (centroid.dot (centroid) / total_weight));
@@ -520,7 +520,7 @@ void split_vectors(VectorType (&vectors)[64], uint (&weights)[64], uint size, Ve
520520 for (uint i = 0 ; i < N; i++) {
521521 double sum = 0 ;
522522 for (uint j = 0 ; j < N; j++)
523- sum += axis[j] * covar[i][j];
523+ sum += ( double ) axis[j] * ( double ) covar[i][j];
524524 x[i] = (float )sum;
525525 max_sum = i ? math::maximum (max_sum, sum) : sum;
526526 }
0 commit comments