mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-02 18:50:56 +08:00
Fixed kmeans for inner product
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
## 0.1.4 (unreleased)
|
||||
|
||||
- Fixed kmeans for inner product
|
||||
- Fixed multiple definition error with GCC 10
|
||||
|
||||
## 0.1.3 (2021-05-06)
|
||||
|
||||
@@ -42,9 +42,10 @@ SampleCallback(Relation index, CALLBACK_ITEM_POINTER, Datum *values,
|
||||
return;
|
||||
|
||||
/* Normalize the value */
|
||||
if (buildstate->normprocinfo != NULL)
|
||||
/* Use KMEANS_NORM_PROC for spherical distance function */
|
||||
if (buildstate->kmeansnormprocinfo != NULL)
|
||||
{
|
||||
if (!IvfflatNormValue(buildstate->normprocinfo, buildstate->collation, &value, buildstate->normvec))
|
||||
if (!IvfflatNormValue(buildstate->kmeansnormprocinfo, buildstate->collation, &value, buildstate->normvec))
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -275,6 +276,7 @@ InitBuildState(IvfflatBuildState * buildstate, Relation heap, Relation index, In
|
||||
/* Get support functions */
|
||||
buildstate->procinfo = index_getprocinfo(index, 1, IVFFLAT_DISTANCE_PROC);
|
||||
buildstate->normprocinfo = IvfflatOptionalProcInfo(index, IVFFLAT_NORM_PROC);
|
||||
buildstate->kmeansnormprocinfo = IvfflatOptionalProcInfo(index, IVFFLAT_KMEANS_NORM_PROC);
|
||||
buildstate->collation = index->rd_indcollation[0];
|
||||
|
||||
/* Create tuple description for sorting */
|
||||
|
||||
@@ -81,6 +81,7 @@ typedef struct IvfflatBuildState
|
||||
/* Support functions */
|
||||
FmgrInfo *procinfo;
|
||||
FmgrInfo *normprocinfo;
|
||||
FmgrInfo *kmeansnormprocinfo;
|
||||
Oid collation;
|
||||
|
||||
/* Variables */
|
||||
|
||||
Reference in New Issue
Block a user