mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-22 03:57:34 +08:00
Compare commits
4 Commits
v0.7.0
...
target-clo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
665b3dfa1c | ||
|
|
ce597f770d | ||
|
|
1234fffcb0 | ||
|
|
e70a47c154 |
@@ -7,6 +7,7 @@
|
||||
- Added `jaccard_distance` function
|
||||
- Added `quantize_binary` function
|
||||
- Added `subvector` function
|
||||
- Added CPU dispatching for distance functions on Linux x86-64
|
||||
- Updated comparison operators to support vectors with different dimensions
|
||||
|
||||
## 0.6.2 (2024-03-18)
|
||||
|
||||
11
src/vector.c
11
src/vector.c
@@ -33,6 +33,13 @@
|
||||
#define STATE_DIMS(x) (ARR_DIMS(x)[0] - 1)
|
||||
#define CreateStateDatums(dim) palloc(sizeof(Datum) * (dim + 1))
|
||||
|
||||
/* target_clones requires glibc */
|
||||
#if defined(__x86_64__) && defined(__gnu_linux__) && defined(__has_attribute) && __has_attribute(target_clones) && !defined(__FMA__)
|
||||
#define VECTOR_DISPATCH __attribute__((target_clones("default", "fma")))
|
||||
#else
|
||||
#define VECTOR_DISPATCH
|
||||
#endif
|
||||
|
||||
PG_MODULE_MAGIC;
|
||||
|
||||
/*
|
||||
@@ -557,7 +564,7 @@ halfvec_to_vector(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
|
||||
static float
|
||||
VECTOR_DISPATCH static float
|
||||
VectorL2SquaredDistance(int dim, float *ax, float *bx)
|
||||
{
|
||||
float distance = 0.0;
|
||||
@@ -604,7 +611,7 @@ vector_l2_squared_distance(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_FLOAT8((double) VectorL2SquaredDistance(a->dim, a->x, b->x));
|
||||
}
|
||||
|
||||
static float
|
||||
VECTOR_DISPATCH static float
|
||||
VectorInnerProduct(int dim, float *ax, float *bx)
|
||||
{
|
||||
float distance = 0.0;
|
||||
|
||||
Reference in New Issue
Block a user