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