mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-10 22:56:55 +08:00
Improved performance of cosine distance
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
## 0.4.1 (unreleased)
|
## 0.4.1 (unreleased)
|
||||||
|
|
||||||
|
- Improved performance of cosine distance
|
||||||
- Fixed index scan count
|
- Fixed index scan count
|
||||||
|
|
||||||
## 0.4.0 (2023-01-11)
|
## 0.4.0 (2023-01-11)
|
||||||
|
|||||||
@@ -568,7 +568,7 @@ cosine_distance(PG_FUNCTION_ARGS)
|
|||||||
normb += bx[i] * bx[i];
|
normb += bx[i] * bx[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
PG_RETURN_FLOAT8(1 - (distance / (sqrt(norma) * sqrt(normb))));
|
PG_RETURN_FLOAT8(1 - (distance / sqrt(norma * normb)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user