mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-11 07:06:57 +08:00
Use consistent naming [skip ci]
This commit is contained in:
@@ -19,11 +19,11 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float (*HalfvecL2DistanceSquared) (int dim, half * ax, half * bx);
|
float (*HalfvecL2SquaredDistance) (int dim, half * ax, half * bx);
|
||||||
float (*HalfvecInnerProduct) (int dim, half * ax, half * bx);
|
float (*HalfvecInnerProduct) (int dim, half * ax, half * bx);
|
||||||
|
|
||||||
static float
|
static float
|
||||||
HalfvecL2DistanceSquaredDefault(int dim, half * ax, half * bx)
|
HalfvecL2SquaredDistanceDefault(int dim, half * ax, half * bx)
|
||||||
{
|
{
|
||||||
float distance = 0.0;
|
float distance = 0.0;
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ HalfvecL2DistanceSquaredDefault(int dim, half * ax, half * bx)
|
|||||||
|
|
||||||
#ifdef HALFVEC_DISPATCH
|
#ifdef HALFVEC_DISPATCH
|
||||||
TARGET_F16C_FMA static float
|
TARGET_F16C_FMA static float
|
||||||
HalfvecL2DistanceSquaredF16cFma(int dim, half * ax, half * bx)
|
HalfvecL2SquaredDistanceF16cFma(int dim, half * ax, half * bx)
|
||||||
{
|
{
|
||||||
float distance;
|
float distance;
|
||||||
int i;
|
int i;
|
||||||
@@ -143,13 +143,13 @@ HalfvecInit(void)
|
|||||||
* Could skip pointer when single function, but no difference in
|
* Could skip pointer when single function, but no difference in
|
||||||
* performance
|
* performance
|
||||||
*/
|
*/
|
||||||
HalfvecL2DistanceSquared = HalfvecL2DistanceSquaredDefault;
|
HalfvecL2SquaredDistance = HalfvecL2SquaredDistanceDefault;
|
||||||
HalfvecInnerProduct = HalfvecInnerProductDefault;
|
HalfvecInnerProduct = HalfvecInnerProductDefault;
|
||||||
|
|
||||||
#ifdef HALFVEC_DISPATCH
|
#ifdef HALFVEC_DISPATCH
|
||||||
if (SupportsFeature(FEATURE_FMA | FEATURE_F16C))
|
if (SupportsFeature(FEATURE_FMA | FEATURE_F16C))
|
||||||
{
|
{
|
||||||
HalfvecL2DistanceSquared = HalfvecL2DistanceSquaredF16cFma;
|
HalfvecL2SquaredDistance = HalfvecL2SquaredDistanceF16cFma;
|
||||||
HalfvecInnerProduct = HalfvecInnerProductF16cFma;
|
HalfvecInnerProduct = HalfvecInnerProductF16cFma;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "halfvec.h"
|
#include "halfvec.h"
|
||||||
|
|
||||||
extern float (*HalfvecL2DistanceSquared) (int dim, half * ax, half * bx);
|
extern float (*HalfvecL2SquaredDistance) (int dim, half * ax, half * bx);
|
||||||
extern float (*HalfvecInnerProduct) (int dim, half * ax, half * bx);
|
extern float (*HalfvecInnerProduct) (int dim, half * ax, half * bx);
|
||||||
|
|
||||||
void HalfvecInit(void);
|
void HalfvecInit(void);
|
||||||
|
|||||||
@@ -813,7 +813,7 @@ halfvec_l2_distance(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
CheckDims(a, b);
|
CheckDims(a, b);
|
||||||
|
|
||||||
PG_RETURN_FLOAT8(sqrt((double) HalfvecL2DistanceSquared(a->dim, a->x, b->x)));
|
PG_RETURN_FLOAT8(sqrt((double) HalfvecL2SquaredDistance(a->dim, a->x, b->x)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -828,7 +828,7 @@ halfvec_l2_squared_distance(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
CheckDims(a, b);
|
CheckDims(a, b);
|
||||||
|
|
||||||
PG_RETURN_FLOAT8((double) HalfvecL2DistanceSquared(a->dim, a->x, b->x));
|
PG_RETURN_FLOAT8((double) HalfvecL2SquaredDistance(a->dim, a->x, b->x));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user