The library documents itself · Numeric & optimization
stzVectorIndex
13 own methods · 0 forms written with extensions, listed under their method
the source: base/number/stzVectorIndex.ring(opens in a new tab) · All classes · The area reference: Numeric & optimization
Under each method, its extensions (Q CS XT Z ZZ IB W U): bold and ticked, it exists; struck, it does not. The extensions and what they mean
Examples: 0 come from the library's tests; 4 were composed from each method's signature and run for this page, on a fresh object, for example o1 = new stzVectorIndex([ [1,2], [3,4] ]). 9 methods have none yet. Examples run on 2026-10-03 12:54 inside the library at commit 0e72e2e2c.
Method
Explanation, as the source carries it
init
paVectors is a list of equal-length lists of numbers -- one row per vector.no extension
SetTrees
More trees means better recall at the same budget, and a bigger index.no extension
:Euclidean compares positions, :Cosine compares directions. Text embeddings almost always want :Cosine. 1 examples runno extension
SetSeed
The forest is random; the seed makes it reproducible, so a recall figure is a property of the code and not of the run that produced it.no extension
Trees
(no comment in the source: the name reads as a sentence) treesno extension
composed example
o1 = new stzVectorIndex([ [1,2], [3,4] ]) ? o1.Trees() #--> 10composed from the signature, run for this page
Metric
(no comment in the source: the name reads as a sentence) metricno extension
composed example
o1 = new stzVectorIndex([ [1,2], [3,4] ]) ? o1.Metric() #--> euclideancomposed from the signature, run for this page
Count
(no comment in the source: the name reads as a sentence) countno extension
composed example
o1 = new stzVectorIndex([ [1,2], [3,4] ]) ? o1.Count() #--> 2composed from the signature, run for this page
Dimensions
(no comment in the source: the name reads as a sentence) dimensionsno extension
composed example
o1 = new stzVectorIndex([ [1,2], [3,4] ]) ? o1.Dimensions() #--> 2composed from the signature, run for this page
Search
The distance is SQUARED Euclidean over the stored vectors -- squared because the square root changes nothing about the ordering and costs a call per candidate. In :Cosine mode the vectors are unit-length, so the distance is 2 - 2*cos and CosineSimilarityTo() reads it back as a cosine.also written: Nearestno extension
SearchWithBudget
The same, with the candidate budget stated. Bigger budget, better recall, more work. 0 asks for the default.no extension
SearchExact
The exact answer by full scan -- O(n) and the ground truth. Use it on a small corpus, or to measure what the approximate path is missing.also written: NearestExactno extension
RecallAgainstExact
THIS IS THE METHOD THAT MAKES THE INDEX HONEST. Measure it on your own vectors before trusting a budget -- recall depends on the data, not just on the settings, and no default can promise a number.no extension
Cosine similarity of a stored vector to a query, recovered from the stored distance. Only meaningful in :Cosine mode, where both are unit vectors and d^2 = 2 - 2*cos. 1 examples runno extension

