Skip to main content

Module vector_set

Module vector_set 

Source
Expand description

Element and set operations over the integer vector carriers.

The float vector nodes (super::vector_math) compute over embeddings; these read integer vectors as lists: how many elements, what is at an index, does a value appear, where, and how two lists compare as sets. A host holding a list of ordinals — the records matching a label, the queries matching a predicate — asks these the questions it would otherwise ask a counter.

That is the point of them. A rank (“how many matching records come before this one”) and a cardinality (“how many match at all”) look like things a counter produces as records go by, but both are pure functions of the list and the record: the rank is the position, the cardinality is the length. Written that way the answer is owned by its inputs, replays from its coordinates, and agrees on every engine and every fiber, where a counter’s answer depends on how many times it was called (Host Request: Running Counts and Accumulation).

Each operation exists for vec_i32 and vec_i64, since the carrier is part of the wire’s type and polydat does not silently widen one to the other. An index or a value that is out of range answers rather than panicking, because a miss is an ordinary result here: vec_position returns the length when the value is absent, which is “past the end” and the same convention vec_len bounds.

Structs§

StrToVecI32
str_to_vec_i32(s) — a JSON array of integers as a vec_i32 wire.
StrToVecI64
str_to_vec_i64(s) — a JSON array of integers as a vec_i64 wire.
VecAtI32
vec_at_i32(v, i) — the element at i, or 0 past the end.
VecAtI64
vec_at_i64(v, i) — the element at i, or 0 past the end.
VecContainsI32
vec_contains_i32(v, x) — 1 when x appears in the list, else 0.
VecContainsI64
vec_contains_i64(v, x) — 1 when x appears in the list, else 0.
VecCountBelowI32
vec_count_below_i32(v, x) — how many elements are less than x.
VecCountBelowI64
vec_count_below_i64(v, x) — how many elements are less than x.
VecIntersectCountI32
vec_intersect_count_i32(a, b) — how many distinct values appear in both lists.
VecIntersectCountI64
vec_intersect_count_i64(a, b) — how many distinct values appear in both lists.
VecLenI32
vec_len_i32(v) — how many elements the list holds.
VecLenI64
vec_len_i64(v) — how many elements the list holds.
VecMaxI32
vec_max_i32(v) — the largest element, or 0 for an empty list.
VecMaxI64
vec_max_i64(v) — the largest element, or 0 for an empty list.
VecMinI32
vec_min_i32(v) — the smallest element, or 0 for an empty list.
VecMinI64
vec_min_i64(v) — the smallest element, or 0 for an empty list.
VecPositionI32
vec_position_i32(v, x) — the index of the first x, or the list’s length when it does not appear.
VecPositionI64
vec_position_i64(v, x) — the index of the first x, or the list’s length when it does not appear.
VecSetEqI32
vec_set_eq_i32(a, b) — 1 when both lists hold the same set of values, whatever their order or repetition.
VecSetEqI64
vec_set_eq_i64(a, b) — 1 when both lists hold the same set of values, whatever their order or repetition.