Skip to content

floatvec

Math for vectors (arrays) of numbers

floatvec · Math for vectors (arrays) of numbers

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
4740floatvecfloatvec1.1.1FUNCMITC
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d-rNoYesNoYesyesno

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY1.1.119 18 17 16 15floatvec-
RPMPIGSTY1.1.119 18 17 16 15floatvec_$v-
DEBPIGSTY1.1.119 18 17 16 15postgresql-$v-floatvec-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1
el8.aarch64N/APIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1
el9.x86_64PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1
el9.aarch64PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1
el10.x86_64PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1
el10.aarch64PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1
d12.x86_64PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1
d12.aarch64PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1
d13.x86_64PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1
d13.aarch64PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1
u22.x86_64PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1
u22.aarch64PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1
u24.x86_64PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1
u24.aarch64PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1
u26.x86_64PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1
u26.aarch64PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1PIGSTY 1.1.1
PackageVersionOSORGSIZEFile URL
floatvec_191.1.1el9.x86_64pigsty33.1 KiBfloatvec_19-1.1.1-1PGSTY.el9.x86_64.rpm
floatvec_191.1.1el9.aarch64pigsty34.3 KiBfloatvec_19-1.1.1-1PGSTY.el9.aarch64.rpm
floatvec_191.1.1el10.x86_64pigsty33.3 KiBfloatvec_19-1.1.1-1PGSTY.el10.x86_64.rpm
floatvec_191.1.1el10.aarch64pigsty34.7 KiBfloatvec_19-1.1.1-1PGSTY.el10.aarch64.rpm
postgresql-19-floatvec1.1.1d12.x86_64pigsty24.1 KiBpostgresql-19-floatvec_1.1.1-1PGSTY~bookworm_amd64.deb
postgresql-19-floatvec1.1.1d12.aarch64pigsty25.4 KiBpostgresql-19-floatvec_1.1.1-1PGSTY~bookworm_arm64.deb
postgresql-19-floatvec1.1.1d13.x86_64pigsty24.1 KiBpostgresql-19-floatvec_1.1.1-1PGSTY~trixie_amd64.deb
postgresql-19-floatvec1.1.1d13.aarch64pigsty25.4 KiBpostgresql-19-floatvec_1.1.1-1PGSTY~trixie_arm64.deb
postgresql-19-floatvec1.1.1u22.x86_64pigsty25.3 KiBpostgresql-19-floatvec_1.1.1-1PGSTY~jammy_amd64.deb
postgresql-19-floatvec1.1.1u22.aarch64pigsty26.8 KiBpostgresql-19-floatvec_1.1.1-1PGSTY~jammy_arm64.deb
postgresql-19-floatvec1.1.1u24.x86_64pigsty25.3 KiBpostgresql-19-floatvec_1.1.1-1PGSTY~noble_amd64.deb
postgresql-19-floatvec1.1.1u24.aarch64pigsty26.7 KiBpostgresql-19-floatvec_1.1.1-1PGSTY~noble_arm64.deb
postgresql-19-floatvec1.1.1u26.x86_64pigsty25.7 KiBpostgresql-19-floatvec_1.1.1-1PGSTY~resolute_amd64.deb
postgresql-19-floatvec1.1.1u26.aarch64pigsty27.1 KiBpostgresql-19-floatvec_1.1.1-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
floatvec_181.1.1el8.x86_64pigsty32.7 KiBfloatvec_18-1.1.1-1PGSTY.el8.x86_64.rpm
floatvec_181.1.1el8.aarch64pigsty33.6 KiBfloatvec_18-1.1.1-1PGSTY.el8.aarch64.rpm
floatvec_181.1.1el9.x86_64pigsty33.1 KiBfloatvec_18-1.1.1-1PGSTY.el9.x86_64.rpm
floatvec_181.1.1el9.aarch64pigsty34.3 KiBfloatvec_18-1.1.1-1PGSTY.el9.aarch64.rpm
floatvec_181.1.1el10.x86_64pigsty33.3 KiBfloatvec_18-1.1.1-1PGSTY.el10.x86_64.rpm
floatvec_181.1.1el10.aarch64pigsty34.7 KiBfloatvec_18-1.1.1-1PGSTY.el10.aarch64.rpm
postgresql-18-floatvec1.1.1d12.x86_64pigsty24.1 KiBpostgresql-18-floatvec_1.1.1-1PGSTY~bookworm_amd64.deb
postgresql-18-floatvec1.1.1d12.aarch64pigsty25.4 KiBpostgresql-18-floatvec_1.1.1-1PGSTY~bookworm_arm64.deb
postgresql-18-floatvec1.1.1d13.x86_64pigsty24.0 KiBpostgresql-18-floatvec_1.1.1-1PGSTY~trixie_amd64.deb
postgresql-18-floatvec1.1.1d13.aarch64pigsty25.3 KiBpostgresql-18-floatvec_1.1.1-1PGSTY~trixie_arm64.deb
postgresql-18-floatvec1.1.1u22.x86_64pigsty25.3 KiBpostgresql-18-floatvec_1.1.1-1PGSTY~jammy_amd64.deb
postgresql-18-floatvec1.1.1u22.aarch64pigsty26.8 KiBpostgresql-18-floatvec_1.1.1-1PGSTY~jammy_arm64.deb
postgresql-18-floatvec1.1.1u24.x86_64pigsty25.3 KiBpostgresql-18-floatvec_1.1.1-1PGSTY~noble_amd64.deb
postgresql-18-floatvec1.1.1u24.aarch64pigsty26.7 KiBpostgresql-18-floatvec_1.1.1-1PGSTY~noble_arm64.deb
postgresql-18-floatvec1.1.1u26.x86_64pigsty25.7 KiBpostgresql-18-floatvec_1.1.1-1PGSTY~resolute_amd64.deb
postgresql-18-floatvec1.1.1u26.aarch64pigsty27.1 KiBpostgresql-18-floatvec_1.1.1-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
floatvec_171.1.1el8.x86_64pigsty32.7 KiBfloatvec_17-1.1.1-1PGSTY.el8.x86_64.rpm
floatvec_171.1.1el8.aarch64pigsty33.2 KiBfloatvec_17-1.1.1-1PGSTY.el8.aarch64.rpm
floatvec_171.1.1el9.x86_64pigsty32.8 KiBfloatvec_17-1.1.1-1PGSTY.el9.x86_64.rpm
floatvec_171.1.1el9.aarch64pigsty33.9 KiBfloatvec_17-1.1.1-1PGSTY.el9.aarch64.rpm
floatvec_171.1.1el10.x86_64pigsty33.3 KiBfloatvec_17-1.1.1-1PGSTY.el10.x86_64.rpm
floatvec_171.1.1el10.aarch64pigsty34.6 KiBfloatvec_17-1.1.1-1PGSTY.el10.aarch64.rpm
postgresql-17-floatvec1.1.1d12.x86_64pigsty24.1 KiBpostgresql-17-floatvec_1.1.1-1PGSTY~bookworm_amd64.deb
postgresql-17-floatvec1.1.1d12.aarch64pigsty25.4 KiBpostgresql-17-floatvec_1.1.1-1PGSTY~bookworm_arm64.deb
postgresql-17-floatvec1.1.1d13.x86_64pigsty24.1 KiBpostgresql-17-floatvec_1.1.1-1PGSTY~trixie_amd64.deb
postgresql-17-floatvec1.1.1d13.aarch64pigsty25.3 KiBpostgresql-17-floatvec_1.1.1-1PGSTY~trixie_arm64.deb
postgresql-17-floatvec1.1.1u22.x86_64pigsty25.9 KiBpostgresql-17-floatvec_1.1.1-1PGSTY~jammy_amd64.deb
postgresql-17-floatvec1.1.1u22.aarch64pigsty27.4 KiBpostgresql-17-floatvec_1.1.1-1PGSTY~jammy_arm64.deb
postgresql-17-floatvec1.1.1u24.x86_64pigsty25.3 KiBpostgresql-17-floatvec_1.1.1-1PGSTY~noble_amd64.deb
postgresql-17-floatvec1.1.1u24.aarch64pigsty26.7 KiBpostgresql-17-floatvec_1.1.1-1PGSTY~noble_arm64.deb
postgresql-17-floatvec1.1.1u26.x86_64pigsty25.6 KiBpostgresql-17-floatvec_1.1.1-1PGSTY~resolute_amd64.deb
postgresql-17-floatvec1.1.1u26.aarch64pigsty27.0 KiBpostgresql-17-floatvec_1.1.1-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
floatvec_161.1.1el8.x86_64pigsty32.7 KiBfloatvec_16-1.1.1-1PGSTY.el8.x86_64.rpm
floatvec_161.1.1el8.aarch64pigsty33.2 KiBfloatvec_16-1.1.1-1PGSTY.el8.aarch64.rpm
floatvec_161.1.1el9.x86_64pigsty32.8 KiBfloatvec_16-1.1.1-1PGSTY.el9.x86_64.rpm
floatvec_161.1.1el9.aarch64pigsty33.9 KiBfloatvec_16-1.1.1-1PGSTY.el9.aarch64.rpm
floatvec_161.1.1el10.x86_64pigsty33.3 KiBfloatvec_16-1.1.1-1PGSTY.el10.x86_64.rpm
floatvec_161.1.1el10.aarch64pigsty34.6 KiBfloatvec_16-1.1.1-1PGSTY.el10.aarch64.rpm
postgresql-16-floatvec1.1.1d12.x86_64pigsty24.1 KiBpostgresql-16-floatvec_1.1.1-1PGSTY~bookworm_amd64.deb
postgresql-16-floatvec1.1.1d12.aarch64pigsty25.4 KiBpostgresql-16-floatvec_1.1.1-1PGSTY~bookworm_arm64.deb
postgresql-16-floatvec1.1.1d13.x86_64pigsty24.1 KiBpostgresql-16-floatvec_1.1.1-1PGSTY~trixie_amd64.deb
postgresql-16-floatvec1.1.1d13.aarch64pigsty25.4 KiBpostgresql-16-floatvec_1.1.1-1PGSTY~trixie_arm64.deb
postgresql-16-floatvec1.1.1u22.x86_64pigsty25.9 KiBpostgresql-16-floatvec_1.1.1-1PGSTY~jammy_amd64.deb
postgresql-16-floatvec1.1.1u22.aarch64pigsty27.5 KiBpostgresql-16-floatvec_1.1.1-1PGSTY~jammy_arm64.deb
postgresql-16-floatvec1.1.1u24.x86_64pigsty25.3 KiBpostgresql-16-floatvec_1.1.1-1PGSTY~noble_amd64.deb
postgresql-16-floatvec1.1.1u24.aarch64pigsty26.7 KiBpostgresql-16-floatvec_1.1.1-1PGSTY~noble_arm64.deb
postgresql-16-floatvec1.1.1u26.x86_64pigsty25.6 KiBpostgresql-16-floatvec_1.1.1-1PGSTY~resolute_amd64.deb
postgresql-16-floatvec1.1.1u26.aarch64pigsty27.0 KiBpostgresql-16-floatvec_1.1.1-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
floatvec_151.1.1el8.x86_64pigsty32.4 KiBfloatvec_15-1.1.1-1PGSTY.el8.x86_64.rpm
floatvec_151.1.1el8.aarch64pigsty32.9 KiBfloatvec_15-1.1.1-1PGSTY.el8.aarch64.rpm
floatvec_151.1.1el9.x86_64pigsty32.8 KiBfloatvec_15-1.1.1-1PGSTY.el9.x86_64.rpm
floatvec_151.1.1el9.aarch64pigsty33.5 KiBfloatvec_15-1.1.1-1PGSTY.el9.aarch64.rpm
floatvec_151.1.1el10.x86_64pigsty33.1 KiBfloatvec_15-1.1.1-1PGSTY.el10.x86_64.rpm
floatvec_151.1.1el10.aarch64pigsty34.0 KiBfloatvec_15-1.1.1-1PGSTY.el10.aarch64.rpm
postgresql-15-floatvec1.1.1d12.x86_64pigsty23.7 KiBpostgresql-15-floatvec_1.1.1-1PGSTY~bookworm_amd64.deb
postgresql-15-floatvec1.1.1d12.aarch64pigsty24.5 KiBpostgresql-15-floatvec_1.1.1-1PGSTY~bookworm_arm64.deb
postgresql-15-floatvec1.1.1d13.x86_64pigsty23.7 KiBpostgresql-15-floatvec_1.1.1-1PGSTY~trixie_amd64.deb
postgresql-15-floatvec1.1.1d13.aarch64pigsty24.6 KiBpostgresql-15-floatvec_1.1.1-1PGSTY~trixie_arm64.deb
postgresql-15-floatvec1.1.1u22.x86_64pigsty25.8 KiBpostgresql-15-floatvec_1.1.1-1PGSTY~jammy_amd64.deb
postgresql-15-floatvec1.1.1u22.aarch64pigsty26.9 KiBpostgresql-15-floatvec_1.1.1-1PGSTY~jammy_arm64.deb
postgresql-15-floatvec1.1.1u24.x86_64pigsty24.8 KiBpostgresql-15-floatvec_1.1.1-1PGSTY~noble_amd64.deb
postgresql-15-floatvec1.1.1u24.aarch64pigsty25.8 KiBpostgresql-15-floatvec_1.1.1-1PGSTY~noble_arm64.deb
postgresql-15-floatvec1.1.1u26.x86_64pigsty25.3 KiBpostgresql-15-floatvec_1.1.1-1PGSTY~resolute_amd64.deb
postgresql-15-floatvec1.1.1u26.aarch64pigsty26.5 KiBpostgresql-15-floatvec_1.1.1-1PGSTY~resolute_arm64.deb

Source

pig build pkg floatvec;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install floatvec;		# install by package name

pig install floatvec -v 19;   # install for PG 19
pig install floatvec -v 18;   # install for PG 18
pig install floatvec -v 17;   # install for PG 17
pig install floatvec -v 16;   # install for PG 16
pig install floatvec -v 15;   # install for PG 15

Create this extension with:

CREATE EXTENSION floatvec;

Usage

floatvec: element-by-element arithmetic on PostgreSQL arrays

Provides basic arithmetic functions for operating on arrays treated as vectors. Supports SMALLINT, INTEGER, BIGINT, REAL, and DOUBLE PRECISION.

CREATE EXTENSION floatvec;

Functions

Each function accepts two arrays of the same length, or an array and a scalar, or a scalar and an array. Both arguments must be of the same type.

FunctionDescription
vec_add(a, b)Element-by-element addition
vec_sub(a, b)Element-by-element subtraction
vec_mul(a, b)Element-by-element multiplication
vec_div(a, b)Element-by-element division
vec_pow(a, b)Element-by-element exponentiation

Examples

-- Array + Array
SELECT vec_add(ARRAY[1,2,3], ARRAY[10,20,30]);  -- {11,22,33}

-- Array * Scalar
SELECT vec_mul(ARRAY[1.0, 2.0, 3.0], 2.0);     -- {2.0, 4.0, 6.0}

-- Scalar - Array
SELECT vec_sub(10, ARRAY[1,2,3]);               -- {9,8,7}

Table reader