mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-01 02:02:10 +08:00
Added normalize_l2 function
This commit is contained in:
@@ -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
|
||||
-------------
|
||||
|
||||
Reference in New Issue
Block a user