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 (Runtime Model §9.1, “No state across pulls”).
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§
- StrTo
VecF64 str_to_vec_f64(s)— a JSON array of numbers as avec_f64wire, such as a window of samples foris_stable. Fails by name on anything that is not a JSON array of numbers.- StrTo
VecI32 str_to_vec_i32(s)— a JSON array of integers as avec_i32wire.- StrTo
VecI64 str_to_vec_i64(s)— a JSON array of integers as avec_i64wire.- VecAt
I32 vec_at_i32(v, i)— the element ati, or0past the end.- VecAt
I64 vec_at_i64(v, i)— the element ati, or0past the end.- VecContains
I32 vec_contains_i32(v, x)—1whenxappears in the list, else0.- VecContains
I64 vec_contains_i64(v, x)—1whenxappears in the list, else0.- VecCount
Below I32 vec_count_below_i32(v, x)— how many elements are less thanx.- VecCount
Below I64 vec_count_below_i64(v, x)— how many elements are less thanx.- VecIntersect
Count I32 vec_intersect_count_i32(a, b)— how many distinct values appear in both lists.- VecIntersect
Count I64 vec_intersect_count_i64(a, b)— how many distinct values appear in both lists.- VecLen
I32 vec_len_i32(v)— how many elements the list holds.- VecLen
I64 vec_len_i64(v)— how many elements the list holds.- VecMax
I32 vec_max_i32(v)— the largest element, or0for an empty list.- VecMax
I64 vec_max_i64(v)— the largest element, or0for an empty list.- VecMin
I32 vec_min_i32(v)— the smallest element, or0for an empty list.- VecMin
I64 vec_min_i64(v)— the smallest element, or0for an empty list.- VecPosition
I32 vec_position_i32(v, x)— the index of the firstx, or the list’s length when it does not appear.- VecPosition
I64 vec_position_i64(v, x)— the index of the firstx, or the list’s length when it does not appear.- VecSet
EqI32 vec_set_eq_i32(a, b)—1when both lists hold the same set of values, whatever their order or repetition.- VecSet
EqI64 vec_set_eq_i64(a, b)—1when both lists hold the same set of values, whatever their order or repetition.