mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-01 02:02:10 +08:00
Set length for newCenters and aggCenters [skip ci]
This commit is contained in:
@@ -99,7 +99,7 @@ NormCenters(FmgrInfo *normalizeprocinfo, Oid collation, VectorArray centers)
|
||||
ALLOCSET_DEFAULT_SIZES);
|
||||
MemoryContext oldCtx = MemoryContextSwitchTo(normCtx);
|
||||
|
||||
for (int j = 0; j < centers->maxlen; j++)
|
||||
for (int j = 0; j < centers->length; j++)
|
||||
{
|
||||
Datum center = PointerGetDatum(VectorArrayGet(centers, j));
|
||||
Datum newCenter = IvfflatNormValue(normalizeprocinfo, collation, center);
|
||||
@@ -483,6 +483,9 @@ ElkanKmeans(Relation index, VectorArray samples, VectorArray centers, IvfflatTyp
|
||||
else
|
||||
elog(ERROR, "Unsupported type");
|
||||
|
||||
aggCenters->length = aggCenters->maxlen;
|
||||
newCenters->length = newCenters->maxlen;
|
||||
|
||||
#ifdef IVFFLAT_MEMORY
|
||||
ShowMemoryUsage(oldCtx, totalSize);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user