pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
From: jkatz (@jkatz) <noreply+jkatz@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #762: Negative values for the square prevent vector calculations in pgvector/postgress
Date: Tue, 21 Jan 2025 14:18:33 +0000
Message-ID: <gh-pgvector-pgvector-762-c2604862499@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-762@github.com>
References: <gh-pgvector-pgvector-762@github.com>

You can use the `vector_norm` function to make a comparison, though because it's floating point math, you'll want to check if the distance is within some epsilon, e.g.

```sql
SELECT id, vector_norm(vector) BETWEEN 0.99999 AND 1.00001 AS is_normalized
```


view thread (7+ messages)  latest in thread

Message-ID: <gh-pgvector-pgvector-762-c2604862499@github.com>
Permalink:  ../gh-pgvector-pgvector-762-c2604862499@github.com/

 · 


This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox