Added hamming_distance function

This commit is contained in:
Andrew Kane
2024-01-23 15:01:11 -08:00
parent c8be3a369b
commit 76c6dbb0a0
6 changed files with 82 additions and 0 deletions

View File

@@ -3,3 +3,6 @@
-- remove this single line for Postgres < 13
ALTER TYPE vector SET (STORAGE = external);
CREATE FUNCTION hamming_distance(bytea, bytea) RETURNS float8
AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;

View File

@@ -290,3 +290,8 @@ CREATE OPERATOR CLASS vector_cosine_ops
OPERATOR 1 <=> (vector, vector) FOR ORDER BY float_ops,
FUNCTION 1 vector_negative_inner_product(vector, vector),
FUNCTION 2 vector_norm(vector);
-- bytea functions
CREATE FUNCTION hamming_distance(bytea, bytea) RETURNS float8
AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;