This page covers vector operations and distance functions available in Rockset. Rockset internally handles and manipulates vectors as homogeneous arrays.
Note: Arrays input to vector functions must have the same lengths and the elements must be of the types
Otherwise the functions will throw an error. Various error messages are outlined in the following sections. Operations between an array of
ints and an array of
floats will return an array of
floats. Learn more about type functions.
List of functions defined in this section:
|Computes the cosine similarity of two vectors. Cosine similarity represents the dot product of two vectors divided by their magnitude|
|Computes the dot product of two vectors.|
|Computes the Euclidean distance of two vectors (which is also referred to as the L2 norm). Euclidean distance represents the square root of the sum of squared differences between corresponding elements of two vectors.|
|Adds a scalar of type |
|Divides a vector by a scalar of type |
|Returns the input vector if it fulfills the length and type requirements. Otherwise returns |
|Multiplies a vector by a scalar of type |
|Subtracts a scalar of type |