mirror of
https://github.com/hanzoai/sql-vector.git
synced 2026-10-01 00:37:19 +00:00
Improved naming [skip ci]
(cherry picked from commit 2ae4790189e05729ce7059825ca83ed6f15d56c3)
This commit is contained in:
+9
-9
@@ -202,8 +202,8 @@ ComputeNewCenters(VectorArray samples, float *agg, VectorArray newCenters, int *
|
||||
{
|
||||
float *x = agg + ((int64) i * dimensions);
|
||||
|
||||
for (int k = 0; k < dimensions; k++)
|
||||
x[k] = 0.0;
|
||||
for (int j = 0; j < dimensions; j++)
|
||||
x[j] = 0.0;
|
||||
|
||||
centerCounts[i] = 0;
|
||||
}
|
||||
@@ -224,20 +224,20 @@ ComputeNewCenters(VectorArray samples, float *agg, VectorArray newCenters, int *
|
||||
{
|
||||
/* Double avoids overflow, but requires more memory */
|
||||
/* TODO Update bounds */
|
||||
for (int k = 0; k < dimensions; k++)
|
||||
for (int j = 0; j < dimensions; j++)
|
||||
{
|
||||
if (isinf(x[k]))
|
||||
x[k] = x[k] > 0 ? FLT_MAX : -FLT_MAX;
|
||||
if (isinf(x[j]))
|
||||
x[j] = x[j] > 0 ? FLT_MAX : -FLT_MAX;
|
||||
}
|
||||
|
||||
for (int k = 0; k < dimensions; k++)
|
||||
x[k] /= centerCounts[i];
|
||||
for (int j = 0; j < dimensions; j++)
|
||||
x[j] /= centerCounts[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* TODO Handle empty centers properly */
|
||||
for (int k = 0; k < dimensions; k++)
|
||||
x[k] = RandomDouble();
|
||||
for (int j = 0; j < dimensions; j++)
|
||||
x[j] = RandomDouble();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user