Added normalize_l2 function

This commit is contained in:
Andrew Kane
2023-08-09 11:29:14 -07:00
parent 4b887a98ae
commit 47e361a93d
7 changed files with 76 additions and 0 deletions

View File

@@ -48,6 +48,30 @@ SELECT vector_norm('[0,1]');
1
(1 row)
SELECT normalize_l2('[3,4]');
normalize_l2
--------------
[0.6,0.8]
(1 row)
SELECT normalize_l2('[3,0]');
normalize_l2
--------------
[1,0]
(1 row)
SELECT normalize_l2('[0,0.1]');
normalize_l2
--------------
[0,1]
(1 row)
SELECT normalize_l2('[0,0]');
normalize_l2
--------------
[0,0]
(1 row)
SELECT l2_distance('[0,0]', '[3,4]');
l2_distance
-------------