Skip to content
floatvec

floatvec

floatvec : Math for vectors (arrays) of numbers

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
4730
floatvec
floatvec
1.1.1
FUNC
MIT
C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d-r
No
Yes
No
Yes
yes
no
Relationships
See Also
pg_rational
uint
uint128
numeral
aggs_for_vecs
aggs_for_arrays
arraymath
financial

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
PIGSTY
1.1.1
18
17
16
15
14
floatvec-
RPM
PIGSTY
1.1.1
18
17
16
15
14
floatvec_$v-
DEB
PIGSTY
1.1.1
18
17
16
15
14
postgresql-$v-floatvec-
Linux / PGPG18PG17PG16PG15PG14
el8.x86_64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
el8.aarch64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
el9.x86_64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
el9.aarch64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
el10.x86_64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
el10.aarch64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
d12.x86_64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
d12.aarch64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
d13.x86_64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
d13.aarch64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
u22.x86_64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
u22.aarch64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
u24.x86_64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
u24.aarch64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
u26.x86_64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
u26.aarch64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PackageVersionOSORGSIZEFile URL
floatvec_181.1.1el8.x86_64pigsty18.1 KiBfloatvec_18-1.1.1-1PIGSTY.el8.x86_64.rpm
floatvec_181.1.1el8.aarch64pigsty19.3 KiBfloatvec_18-1.1.1-1PIGSTY.el8.aarch64.rpm
floatvec_181.1.1el9.x86_64pigsty18.0 KiBfloatvec_18-1.1.1-1PIGSTY.el9.x86_64.rpm
floatvec_181.1.1el9.aarch64pigsty19.2 KiBfloatvec_18-1.1.1-1PIGSTY.el9.aarch64.rpm
floatvec_181.1.1el10.x86_64pigsty17.8 KiBfloatvec_18-1.1.1-1PIGSTY.el10.x86_64.rpm
floatvec_181.1.1el10.aarch64pigsty19.5 KiBfloatvec_18-1.1.1-1PIGSTY.el10.aarch64.rpm
postgresql-18-floatvec1.1.1d12.x86_64pigsty24.0 KiBpostgresql-18-floatvec_1.1.1-1PIGSTY~bookworm_amd64.deb
postgresql-18-floatvec1.1.1d12.aarch64pigsty25.3 KiBpostgresql-18-floatvec_1.1.1-1PIGSTY~bookworm_arm64.deb
postgresql-18-floatvec1.1.1d13.x86_64pigsty24.0 KiBpostgresql-18-floatvec_1.1.1-1PIGSTY~trixie_amd64.deb
postgresql-18-floatvec1.1.1d13.aarch64pigsty25.3 KiBpostgresql-18-floatvec_1.1.1-1PIGSTY~trixie_arm64.deb
postgresql-18-floatvec1.1.1u22.x86_64pigsty25.2 KiBpostgresql-18-floatvec_1.1.1-1PIGSTY~jammy_amd64.deb
postgresql-18-floatvec1.1.1u22.aarch64pigsty26.7 KiBpostgresql-18-floatvec_1.1.1-1PIGSTY~jammy_arm64.deb
postgresql-18-floatvec1.1.1u24.x86_64pigsty25.2 KiBpostgresql-18-floatvec_1.1.1-1PIGSTY~noble_amd64.deb
postgresql-18-floatvec1.1.1u24.aarch64pigsty26.7 KiBpostgresql-18-floatvec_1.1.1-1PIGSTY~noble_arm64.deb
postgresql-18-floatvec1.1.1u26.x86_64pigsty25.6 KiBpostgresql-18-floatvec_1.1.1-1PIGSTY~resolute_amd64.deb
postgresql-18-floatvec1.1.1u26.aarch64pigsty27.0 KiBpostgresql-18-floatvec_1.1.1-1PIGSTY~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 via package name, for the active PG version

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
pig install floatvec -v 14;   # install for PG 14

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}
Last updated on