跳转到主要内容

floatvec

数组类型数学运算扩展

floatvec · 数组类型数学运算扩展

概览

ID扩展软件包版本类别许可证编程语言
4740floatvecfloatvec1.1.1FUNCMITC
属性可执行文件动态库需要预加载需要建扩展可迁移可信
--s-d-r否是否是是否

软件包

类型仓库版本兼容的 PostgreSQL 大版本包名模式依赖
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
软件包版本平台仓库大小下载
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
软件包版本平台仓库大小下载
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
软件包版本平台仓库大小下载
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
软件包版本平台仓库大小下载
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
软件包版本平台仓库大小下载
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

源码

pig build pkg floatvec;		# build rpm/deb

安装

启用 PGDG 和 PIGSTY 仓库并更新缓存。

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

使用 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 EXTENSION floatvec;

用法

floatvec: PostgreSQL 数组的逐元素算术运算

提供将数组视为向量进行基本算术运算的函数。支持 SMALLINT、INTEGER、BIGINT、REAL 和 DOUBLE PRECISION 类型。

CREATE EXTENSION floatvec;

函数

每个函数接受两个相同长度的数组,或一个数组和一个标量,或一个标量和一个数组。两个参数必须是相同类型。

函数说明
vec_add(a, b)逐元素加法
vec_sub(a, b)逐元素减法
vec_mul(a, b)逐元素乘法
vec_div(a, b)逐元素除法
vec_pow(a, b)逐元素乘方

示例

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

-- 数组 * 标量
SELECT vec_mul(ARRAY[1.0, 2.0, 3.0], 2.0);     -- {2.0, 4.0, 6.0}

-- 标量 - 数组
SELECT vec_sub(10, ARRAY[1,2,3]);               -- {9,8,7}

表格阅读器