Pgvector.SparseVector (pgvector v0.4.0)

Copy Markdown View Source

A sparse vector struct for pgvector

Summary

Types

t()

A sparse vector

Functions

Returns the number of dimensions

Creates a new sparse vector from its binary representation

Returns the non-zero indices

Creates a new sparse vector from a list, tensor or sparse vector

Creates a new sparse vector from a map of non-zero elements

Returns the non-zero values

Types

t()

@type t() :: %Pgvector.SparseVector{data: binary()}

A sparse vector

Functions

dimensions(vector)

Returns the number of dimensions

from_binary(binary)

Creates a new sparse vector from its binary representation

indices(vector)

Returns the non-zero indices

new(list)

Creates a new sparse vector from a list, tensor or sparse vector

new(map, dimensions)

Creates a new sparse vector from a map of non-zero elements

values(vector)

Returns the non-zero values