mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-11 23:26:55 +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);
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
MemoryContext oldCtx = MemoryContextSwitchTo(normCtx);
|
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 center = PointerGetDatum(VectorArrayGet(centers, j));
|
||||||
Datum newCenter = IvfflatNormValue(normalizeprocinfo, collation, center);
|
Datum newCenter = IvfflatNormValue(normalizeprocinfo, collation, center);
|
||||||
@@ -483,6 +483,9 @@ ElkanKmeans(Relation index, VectorArray samples, VectorArray centers, IvfflatTyp
|
|||||||
else
|
else
|
||||||
elog(ERROR, "Unsupported type");
|
elog(ERROR, "Unsupported type");
|
||||||
|
|
||||||
|
aggCenters->length = aggCenters->maxlen;
|
||||||
|
newCenters->length = newCenters->maxlen;
|
||||||
|
|
||||||
#ifdef IVFFLAT_MEMORY
|
#ifdef IVFFLAT_MEMORY
|
||||||
ShowMemoryUsage(oldCtx, totalSize);
|
ShowMemoryUsage(oldCtx, totalSize);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user