mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-17 01:34:35 +08:00
Try double
This commit is contained in:
20
.github/workflows/build.yml
vendored
20
.github/workflows/build.yml
vendored
@@ -79,23 +79,3 @@ jobs:
|
|||||||
shell: cmd
|
shell: cmd
|
||||||
- if: ${{ failure() }}
|
- if: ${{ failure() }}
|
||||||
run: cat regression.diffs
|
run: cat regression.diffs
|
||||||
i386:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container:
|
|
||||||
image: debian:11
|
|
||||||
options: --platform linux/386
|
|
||||||
steps:
|
|
||||||
- run: apt-get update && apt-get install -y build-essential git libipc-run-perl postgresql-13 postgresql-server-dev-13 sudo
|
|
||||||
- run: service postgresql start
|
|
||||||
- run: |
|
|
||||||
git clone https://github.com/${{ github.repository }}.git pgvector
|
|
||||||
cd pgvector
|
|
||||||
git fetch origin ${{ github.ref }}
|
|
||||||
git reset --hard FETCH_HEAD
|
|
||||||
make
|
|
||||||
make install
|
|
||||||
chown -R postgres .
|
|
||||||
sudo -u postgres make installcheck
|
|
||||||
sudo -u postgres make prove_installcheck
|
|
||||||
env:
|
|
||||||
PG_CFLAGS: -Wall -Wextra -Werror -Wno-unused-parameter -Wno-sign-compare
|
|
||||||
|
|||||||
@@ -755,7 +755,6 @@ normalize_l2(PG_FUNCTION_ARGS)
|
|||||||
Vector *a = PG_GETARG_VECTOR_P(0);
|
Vector *a = PG_GETARG_VECTOR_P(0);
|
||||||
float *ax = a->x;
|
float *ax = a->x;
|
||||||
double norm = 0.0;
|
double norm = 0.0;
|
||||||
float normf;
|
|
||||||
Vector *result;
|
Vector *result;
|
||||||
float *rx;
|
float *rx;
|
||||||
|
|
||||||
@@ -767,13 +766,12 @@ normalize_l2(PG_FUNCTION_ARGS)
|
|||||||
norm += (double) ax[i] * (double) ax[i];
|
norm += (double) ax[i] * (double) ax[i];
|
||||||
|
|
||||||
norm = sqrt(norm);
|
norm = sqrt(norm);
|
||||||
normf = (float) norm;
|
|
||||||
|
|
||||||
if (normf > 0)
|
if (norm > 0)
|
||||||
{
|
{
|
||||||
/* Auto-vectorized */
|
/* Auto-vectorized */
|
||||||
for (int i = 0, imax = a->dim; i < imax; i++)
|
for (int i = 0, imax = a->dim; i < imax; i++)
|
||||||
rx[i] = ax[i] / normf;
|
rx[i] = ax[i] / norm;
|
||||||
|
|
||||||
/* Check for overflow */
|
/* Check for overflow */
|
||||||
for (int i = 0, imax = a->dim; i < imax; i++)
|
for (int i = 0, imax = a->dim; i < imax; i++)
|
||||||
|
|||||||
Reference in New Issue
Block a user