mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-03 19:20:56 +08:00
Fixed compilation warning with MSVC and Postgres 16 - fixes #598
Co-authored-by: Xing Guo <higuoxing@gmail.com>
This commit is contained in:
72
src/vector.c
72
src/vector.c
@@ -181,7 +181,7 @@ float_underflow_error(void)
|
||||
/*
|
||||
* Convert textual representation to internal representation
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_in);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_in);
|
||||
Datum
|
||||
vector_in(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -294,7 +294,7 @@ vector_in(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Convert internal representation to textual representation
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_out);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_out);
|
||||
Datum
|
||||
vector_out(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -348,7 +348,7 @@ PrintVector(char *msg, Vector * vector)
|
||||
/*
|
||||
* Convert type modifier
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_typmod_in);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_typmod_in);
|
||||
Datum
|
||||
vector_typmod_in(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -379,7 +379,7 @@ vector_typmod_in(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Convert external binary representation to internal representation
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_recv);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_recv);
|
||||
Datum
|
||||
vector_recv(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -413,7 +413,7 @@ vector_recv(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Convert internal representation to the external binary representation
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_send);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_send);
|
||||
Datum
|
||||
vector_send(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -433,7 +433,7 @@ vector_send(PG_FUNCTION_ARGS)
|
||||
* Convert vector to vector
|
||||
* This is needed to check the type modifier
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector);
|
||||
Datum
|
||||
vector(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -448,7 +448,7 @@ vector(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Convert array to vector
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(array_to_vector);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(array_to_vector);
|
||||
Datum
|
||||
array_to_vector(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -522,7 +522,7 @@ array_to_vector(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Convert vector to float4[]
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_to_float4);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_to_float4);
|
||||
Datum
|
||||
vector_to_float4(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -546,7 +546,7 @@ vector_to_float4(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Convert half vector to vector
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(halfvec_to_vector);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(halfvec_to_vector);
|
||||
Datum
|
||||
halfvec_to_vector(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -584,7 +584,7 @@ VectorL2SquaredDistance(int dim, float *ax, float *bx)
|
||||
/*
|
||||
* Get the L2 distance between vectors
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(l2_distance);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(l2_distance);
|
||||
Datum
|
||||
l2_distance(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -600,7 +600,7 @@ l2_distance(PG_FUNCTION_ARGS)
|
||||
* Get the L2 squared distance between vectors
|
||||
* This saves a sqrt calculation
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_l2_squared_distance);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_l2_squared_distance);
|
||||
Datum
|
||||
vector_l2_squared_distance(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -627,7 +627,7 @@ VectorInnerProduct(int dim, float *ax, float *bx)
|
||||
/*
|
||||
* Get the inner product of two vectors
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(inner_product);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(inner_product);
|
||||
Datum
|
||||
inner_product(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -642,7 +642,7 @@ inner_product(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Get the negative inner product of two vectors
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_negative_inner_product);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_negative_inner_product);
|
||||
Datum
|
||||
vector_negative_inner_product(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -676,7 +676,7 @@ VectorCosineSimilarity(int dim, float *ax, float *bx)
|
||||
/*
|
||||
* Get the cosine distance between two vectors
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(cosine_distance);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(cosine_distance);
|
||||
Datum
|
||||
cosine_distance(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -708,7 +708,7 @@ cosine_distance(PG_FUNCTION_ARGS)
|
||||
* Currently uses angular distance since needs to satisfy triangle inequality
|
||||
* Assumes inputs are unit vectors (skips norm)
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_spherical_distance);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_spherical_distance);
|
||||
Datum
|
||||
vector_spherical_distance(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -745,7 +745,7 @@ VectorL1Distance(int dim, float *ax, float *bx)
|
||||
/*
|
||||
* Get the L1 distance between two vectors
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(l1_distance);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(l1_distance);
|
||||
Datum
|
||||
l1_distance(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -760,7 +760,7 @@ l1_distance(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Get the dimensions of a vector
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_dims);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_dims);
|
||||
Datum
|
||||
vector_dims(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -772,7 +772,7 @@ vector_dims(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Get the L2 norm of a vector
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_norm);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_norm);
|
||||
Datum
|
||||
vector_norm(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -790,7 +790,7 @@ vector_norm(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Normalize a vector with the L2 norm
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(l2_normalize);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(l2_normalize);
|
||||
Datum
|
||||
l2_normalize(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -829,7 +829,7 @@ l2_normalize(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Add vectors
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_add);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_add);
|
||||
Datum
|
||||
vector_add(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -862,7 +862,7 @@ vector_add(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Subtract vectors
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_sub);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_sub);
|
||||
Datum
|
||||
vector_sub(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -895,7 +895,7 @@ vector_sub(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Multiply vectors
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_mul);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_mul);
|
||||
Datum
|
||||
vector_mul(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -931,7 +931,7 @@ vector_mul(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Concatenate vectors
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_concat);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_concat);
|
||||
Datum
|
||||
vector_concat(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -955,7 +955,7 @@ vector_concat(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Quantize a vector
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(binary_quantize);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(binary_quantize);
|
||||
Datum
|
||||
binary_quantize(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -973,7 +973,7 @@ binary_quantize(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Get a subvector
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(subvector);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(subvector);
|
||||
Datum
|
||||
subvector(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -1047,7 +1047,7 @@ vector_cmp_internal(Vector * a, Vector * b)
|
||||
/*
|
||||
* Less than
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_lt);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_lt);
|
||||
Datum
|
||||
vector_lt(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -1060,7 +1060,7 @@ vector_lt(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Less than or equal
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_le);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_le);
|
||||
Datum
|
||||
vector_le(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -1073,7 +1073,7 @@ vector_le(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Equal
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_eq);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_eq);
|
||||
Datum
|
||||
vector_eq(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -1086,7 +1086,7 @@ vector_eq(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Not equal
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_ne);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_ne);
|
||||
Datum
|
||||
vector_ne(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -1099,7 +1099,7 @@ vector_ne(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Greater than or equal
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_ge);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_ge);
|
||||
Datum
|
||||
vector_ge(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -1112,7 +1112,7 @@ vector_ge(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Greater than
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_gt);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_gt);
|
||||
Datum
|
||||
vector_gt(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -1125,7 +1125,7 @@ vector_gt(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Compare vectors
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_cmp);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_cmp);
|
||||
Datum
|
||||
vector_cmp(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -1138,7 +1138,7 @@ vector_cmp(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Accumulate vectors
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_accum);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_accum);
|
||||
Datum
|
||||
vector_accum(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -1199,7 +1199,7 @@ vector_accum(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Combine vectors or half vectors (also used for halfvec_combine)
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_combine);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_combine);
|
||||
Datum
|
||||
vector_combine(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -1270,7 +1270,7 @@ vector_combine(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Average vectors
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(vector_avg);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(vector_avg);
|
||||
Datum
|
||||
vector_avg(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -1304,7 +1304,7 @@ vector_avg(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Convert sparse vector to dense vector
|
||||
*/
|
||||
PGDLLEXPORT PG_FUNCTION_INFO_V1(sparsevec_to_vector);
|
||||
FUNCTION_PREFIX PG_FUNCTION_INFO_V1(sparsevec_to_vector);
|
||||
Datum
|
||||
sparsevec_to_vector(PG_FUNCTION_ARGS)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user