MADlib
0.7 A newer version is available
User Documentation
|
SQL type definitions and functions for sparse vector data type svec
More...
Go to the source code of this file.
Functions | |
svec | svec_in (cstring) |
cstring | svec_out (svec) |
svec | svec_recv (internal) |
bytea | svec_send (svec) |
float8 | svec_dmin (float8, float8) |
float8 | svec_dmax (float8, float8) |
svec | svec_count (svec, svec) |
svec | svec_plus (svec, svec) |
svec | svec_minus (svec, svec) |
svec | svec_log (svec) |
svec | svec_div (svec, svec) |
svec | svec_mult (svec, svec) |
svec | svec_pow (svec, svec) |
boolean | svec_eq (svec, svec) |
boolean | svec_eq_non_zero (svec, svec) |
boolean | svec_contains (svec, svec) |
boolean | float8arr_eq (float8[], float8[]) |
svec | float8arr_minus_float8arr (float8[], float8[]) |
svec | float8arr_minus_svec (float8[], svec) |
svec | svec_minus_float8arr (svec, float8[]) |
svec | float8arr_plus_float8arr (float8[], float8[]) |
svec | float8arr_plus_svec (float8[], svec) |
svec | svec_plus_float8arr (svec, float8[]) |
svec | float8arr_mult_float8arr (float8[], float8[]) |
svec | float8arr_mult_svec (float8[], svec) |
svec | svec_mult_float8arr (svec, float8[]) |
svec | float8arr_div_float8arr (float8[], float8[]) |
svec | float8arr_div_svec (float8[], svec) |
svec | svec_div_float8arr (svec, float8[]) |
float8 | svec_dot (svec, svec) |
float8 | svec_dot (float8[], float8[]) |
float8 | svec_dot (svec, float8[]) |
float8 | svec_dot (float8[], svec) |
float8 | svec_l2norm (svec) |
float8 | svec_l2norm (float8[]) |
float8 | l2norm (svec, svec) |
float8 | l1norm (svec, svec) |
float8 | svec_l1norm (svec) |
float8 | svec_l1norm (float8[]) |
float8 | angle (svec, svec) |
float8 | tanimoto_distance (svec, svec) |
set< float8 > | svec_unnest (svec) |
svec | svec_pivot (svec, float8) |
float8 | svec_elsum (svec) |
float8 | svec_elsum (float8[]) |
float8 | svec_median (float8[]) |
float8 | svec_median (svec) |
int8[] | svec_nonbase_positions (svec, float8) |
float8[] | svec_nonbase_values (svec, float8) |
svec | svec_cast_int2 (int2) |
svec | svec_cast_int4 (int4) |
svec | svec_cast_int8 (bigint) |
svec | svec_cast_float4 (float4) |
svec | svec_cast_float8 (float8) |
svec | svec_cast_numeric (numeric) |
float8[] | float8arr_cast_int2 (int2) |
float8[] | float8arr_cast_int4 (int4) |
float8[] | float8arr_cast_int8 (bigint) |
float8[] | float8arr_cast_float4 (float4) |
float8[] | float8arr_cast_float8 (float8) |
float8[] | float8arr_cast_numeric (numeric) |
svec | svec_cast_float8arr (float8[]) |
svec | svec_cast_positions_float8arr (int8[], float8[], int8, float8) |
float8[] | svec_return_array (svec) |
svec | svec_concat (svec, svec) |
svec | svec_concat_replicate (int4, svec) |
integer | svec_dimension (svec) |
svec | svec_lapply (text, svec) |
svec | svec_append (svec, float8, int8) |
float8 | svec_proj (svec, int4) |
svec | svec_subvec (svec, int4, int4) |
svec | svec_reverse (svec) |
svec | svec_change (svec, int4, svec) |
int4 | svec_hash (svec) |
svec | svec_sfv (text[], text[]) |
text[] | svec_sort (text[]) |
text | svec_to_string (svec) |
svec | svec_from_string (text) |
float[] | svec_mean_transition (float[], svec) |
float[] | svec_mean_prefunc (float[], float[]) |
svec | svec_mean_final (float[]) |
aggregate float[] | mean (svec) |
aggregate svec | svec_sum (svec) |
aggregate svec | svec_count_nonzero (svec) |
aggregate svec | svec_agg (float8) |
aggregate svec | svec_median_inmemory (float8) |
bool | svec_l2_lt (svec, svec) |
bool | svec_l2_le (svec, svec) |
bool | svec_l2_eq (svec, svec) |
bool | svec_l2_ne (svec, svec) |
bool | svec_l2_gt (svec, svec) |
bool | svec_l2_ge (svec, svec) |
integer | svec_l2_cmp (svec, svec) |
svec | normalize (svec) |
Definition in file svec.sql_in.
float8 angle | ( | svec | , |
svec | |||
) |
Computes the angle between two SVECs in radians.
Definition at line 567 of file svec.sql_in.
float8 [] float8arr_cast_float4 | ( | float4 | ) |
Casts a float4 into a float8 array.
Definition at line 646 of file svec.sql_in.
float8 [] float8arr_cast_float8 | ( | float8 | ) |
Casts a float8 into a float8 array.
Definition at line 650 of file svec.sql_in.
float8 [] float8arr_cast_int2 | ( | int2 | ) |
Casts an int2 into a float8 array.
Definition at line 634 of file svec.sql_in.
float8 [] float8arr_cast_int4 | ( | int4 | ) |
Casts an int4 into a float8 array.
Definition at line 638 of file svec.sql_in.
float8 [] float8arr_cast_int8 | ( | bigint | ) |
Casts an int8 into a float8 array.
Definition at line 642 of file svec.sql_in.
float8 [] float8arr_cast_numeric | ( | numeric | ) |
Casts a numeric into a float8 array.
Definition at line 654 of file svec.sql_in.
svec float8arr_div_float8arr | ( | float8 | [], |
float8 | [] | ||
) |
Divides a float8 array by another, element by element.
Definition at line 513 of file svec.sql_in.
svec float8arr_div_svec | ( | float8 | [], |
svec | |||
) |
Divides a float8 array by an SVEC, element by element.
Definition at line 517 of file svec.sql_in.
boolean float8arr_eq | ( | float8 | [], |
float8 | [] | ||
) |
Returns true if two float8 arrays are equal
Definition at line 473 of file svec.sql_in.
svec float8arr_minus_float8arr | ( | float8 | [], |
float8 | [] | ||
) |
Minus second array from the first array, element by element.
Definition at line 477 of file svec.sql_in.
svec float8arr_minus_svec | ( | float8 | [], |
svec | |||
) |
Minus second SVEC from the first array, element by element.
Definition at line 481 of file svec.sql_in.
svec float8arr_mult_float8arr | ( | float8 | [], |
float8 | [] | ||
) |
Multiplies two float8 arrays, element by element.
Definition at line 501 of file svec.sql_in.
svec float8arr_mult_svec | ( | float8 | [], |
svec | |||
) |
Multiplies an array and an SVEC, element by element.
Definition at line 505 of file svec.sql_in.
svec float8arr_plus_float8arr | ( | float8 | [], |
float8 | [] | ||
) |
Adds two arrays together, element by element.
Definition at line 489 of file svec.sql_in.
svec float8arr_plus_svec | ( | float8 | [], |
svec | |||
) |
Adds an array and an SVEC, element by element.
Definition at line 493 of file svec.sql_in.
float8 l1norm | ( | svec | , |
svec | |||
) |
Computes the l1norm distance between two SVECs.
Definition at line 554 of file svec.sql_in.
float8 l2norm | ( | svec | , |
svec | |||
) |
Computes the l2norm distance between two SVECs.
Definition at line 549 of file svec.sql_in.
aggregate float [] mean | ( | svec | ) |
Aggregate that computes the element-wise mean of a list of vectors.
Definition at line 954 of file svec.sql_in.
svec normalize | ( | svec | ) |
Normalizes an SVEC that is divides all elements by its norm/magnitude.
Definition at line 1033 of file svec.sql_in.
aggregate svec svec_agg | ( | float8 | ) |
Aggregate that turns a list of float8 values into an SVEC.
Definition at line 984 of file svec.sql_in.
svec svec_append | ( | svec | , |
float8 | , | ||
int8 | |||
) |
Appends a run-length block to the back of an SVEC.
Definition at line 686 of file svec.sql_in.
svec svec_cast_float4 | ( | float4 | ) |
Casts a float4 into an SVEC.
Definition at line 622 of file svec.sql_in.
svec svec_cast_float8 | ( | float8 | ) |
Casts a float8 into an SVEC.
Definition at line 626 of file svec.sql_in.
svec svec_cast_float8arr | ( | float8 | [] | ) |
Casts a float8 into an SVEC.
Definition at line 658 of file svec.sql_in.
svec svec_cast_int2 | ( | int2 | ) |
Casts an int2 into an SVEC.
Definition at line 610 of file svec.sql_in.
svec svec_cast_int4 | ( | int4 | ) |
Casts an int4 into an SVEC.
Definition at line 614 of file svec.sql_in.
svec svec_cast_int8 | ( | bigint | ) |
Casts an int8 into an SVEC.
Definition at line 618 of file svec.sql_in.
svec svec_cast_numeric | ( | numeric | ) |
Casts a numeric into an SVEC.
Definition at line 630 of file svec.sql_in.
svec svec_cast_positions_float8arr | ( | int8 | [], |
float8 | [], | ||
int8 | , | ||
float8 | |||
) |
Casts an array of int8 positions, float8 values into an SVEC.
Definition at line 662 of file svec.sql_in.
svec svec_change | ( | svec | , |
int4 | , | ||
svec | |||
) |
Replaces the subvector of a given SVEC at a given start index with another SVEC. Note that element index should start at 1.
Definition at line 702 of file svec.sql_in.
svec svec_concat | ( | svec | , |
svec | |||
) |
Concatenates two SVECs.
Definition at line 670 of file svec.sql_in.
svec svec_concat_replicate | ( | int4 | , |
svec | |||
) |
Replicates n copies of an SVEC and concatenates them together.
Definition at line 674 of file svec.sql_in.
boolean svec_contains | ( | svec | , |
svec | |||
) |
Returns true if left svec contains right one, meaning that every non-zero value in the right svec equals left one
Definition at line 469 of file svec.sql_in.
svec svec_count | ( | svec | , |
svec | |||
) |
Counts the number of non-zero entries in the input vector; the second argument is capped at 1, then added to the first; used as the sfunc in the svec_count_nonzero() aggregate below.
Definition at line 432 of file svec.sql_in.
aggregate svec svec_count_nonzero | ( | svec | ) |
Aggregate that provides a tally of nonzero entries in a list of vectors.
Definition at line 974 of file svec.sql_in.
integer svec_dimension | ( | svec | ) |
Returns the dimension of an SVEC.
Definition at line 678 of file svec.sql_in.
svec svec_div | ( | svec | , |
svec | |||
) |
Divides the first SVEC by the second, element by element.
Definition at line 449 of file svec.sql_in.
svec svec_div_float8arr | ( | svec | , |
float8 | [] | ||
) |
Divides an SVEC by a float8 array, element by element.
Definition at line 521 of file svec.sql_in.
float8 svec_dmax | ( | float8 | , |
float8 | |||
) |
Basic floating point scalar operator: MAX.
Definition at line 428 of file svec.sql_in.
float8 svec_dmin | ( | float8 | , |
float8 | |||
) |
Basic floating point scalar operator: MIN.
Definition at line 424 of file svec.sql_in.
float8 svec_dot | ( | svec | , |
svec | |||
) |
Computes the dot product of two SVECs.
Definition at line 525 of file svec.sql_in.
float8 svec_dot | ( | float8 | [], |
float8 | [] | ||
) |
Computes the dot product of two float8 arrays.
Definition at line 529 of file svec.sql_in.
float8 svec_dot | ( | svec | , |
float8 | [] | ||
) |
Computes the dot product of an SVEC and a float8 array.
Definition at line 533 of file svec.sql_in.
float8 svec_dot | ( | float8 | [], |
svec | |||
) |
Computes the dot product of a float8 array and an SVEC.
Definition at line 537 of file svec.sql_in.
float8 svec_elsum | ( | svec | ) |
Sums the elements of an SVEC.
Definition at line 585 of file svec.sql_in.
float8 svec_elsum | ( | float8 | [] | ) |
Sums the elements of a float8 array.
Definition at line 589 of file svec.sql_in.
boolean svec_eq | ( | svec | , |
svec | |||
) |
Returns true if two SVECs are equal. If the two SVEC's are of different size, then will return false.
Definition at line 461 of file svec.sql_in.
boolean svec_eq_non_zero | ( | svec | , |
svec | |||
) |
Returns true if two SVECs are equal, not counting zeros (zero equals anything). If the two SVEC's are of different size, then the function essentially zero-pads the shorter one and performs the comparison.
Definition at line 465 of file svec.sql_in.
svec svec_from_string | ( | text | ) |
Converts a text string to an svec
Definition at line 726 of file svec.sql_in.
int4 svec_hash | ( | svec | ) |
Computes the hash of an SVEC.
Definition at line 706 of file svec.sql_in.
svec svec_in | ( | cstring | ) |
SVEC constructor from CSTRING.
Definition at line 386 of file svec.sql_in.
float8 svec_l1norm | ( | svec | ) |
Computes the l1norm of an SVEC.
Definition at line 559 of file svec.sql_in.
float8 svec_l1norm | ( | float8 | [] | ) |
Computes the l1norm of a float8 array.
Definition at line 563 of file svec.sql_in.
integer svec_l2_cmp | ( | svec | , |
svec | |||
) |
Returns a value indicating the relative values of the l2 norms of two SVECs.
Definition at line 1029 of file svec.sql_in.
bool svec_l2_eq | ( | svec | , |
svec | |||
) |
Returns true if the l2 norm of the first SVEC is equal to that of the second SVEC.
Definition at line 1013 of file svec.sql_in.
bool svec_l2_ge | ( | svec | , |
svec | |||
) |
Returns true if the l2 norm of the first SVEC is greater than or equal to that of the second SVEC.
Definition at line 1025 of file svec.sql_in.
bool svec_l2_gt | ( | svec | , |
svec | |||
) |
Returns true if the l2 norm of the first SVEC is greater than that of the second SVEC.
Definition at line 1021 of file svec.sql_in.
bool svec_l2_le | ( | svec | , |
svec | |||
) |
Returns true if the l2 norm of the first SVEC is less than or equal to that of the second SVEC.
Definition at line 1009 of file svec.sql_in.
bool svec_l2_lt | ( | svec | , |
svec | |||
) |
Returns true if the l2 norm of the first SVEC is less than that of the second SVEC.
Definition at line 1005 of file svec.sql_in.
bool svec_l2_ne | ( | svec | , |
svec | |||
) |
Returns true if the l2 norm of the first SVEC is not equal to that of the second SVEC.
Definition at line 1017 of file svec.sql_in.
float8 svec_l2norm | ( | svec | ) |
Computes the l2norm of an SVEC.
Definition at line 541 of file svec.sql_in.
float8 svec_l2norm | ( | float8 | [] | ) |
Computes the l2norm of a float8 array.
Definition at line 545 of file svec.sql_in.
svec svec_lapply | ( | text | , |
svec | |||
) |
Applies a given function to each element of an SVEC.
Definition at line 682 of file svec.sql_in.
svec svec_log | ( | svec | ) |
Computes the logarithm of each element of the input SVEC.
Definition at line 445 of file svec.sql_in.
svec svec_mean_final | ( | float | [] | ) |
Final function for mean(svec) aggregate
Definition at line 948 of file svec.sql_in.
float [] svec_mean_prefunc | ( | float | [], |
float | [] | ||
) |
Preliminary merge function for mean(svec) aggregate
Definition at line 942 of file svec.sql_in.
float [] svec_mean_transition | ( | float | [], |
svec | |||
) |
Transition function for mean(svec) aggregate
Definition at line 936 of file svec.sql_in.
float8 svec_median | ( | float8 | [] | ) |
Computes the median element of a float8 array.
Definition at line 593 of file svec.sql_in.
float8 svec_median | ( | svec | ) |
Computes the median element of an SVEC.
Definition at line 597 of file svec.sql_in.
aggregate svec svec_median_inmemory | ( | float8 | ) |
Aggregate that computes the median element of a list of float8 values.
Definition at line 995 of file svec.sql_in.
svec svec_minus | ( | svec | , |
svec | |||
) |
Minus second SVEC from the first, element by element.
Definition at line 441 of file svec.sql_in.
svec svec_minus_float8arr | ( | svec | , |
float8 | [] | ||
) |
Minus second array from the first SVEC, element by element.
Definition at line 485 of file svec.sql_in.
svec svec_mult | ( | svec | , |
svec | |||
) |
Multiplies two SVEVs together, element by element.
Definition at line 453 of file svec.sql_in.
svec svec_mult_float8arr | ( | svec | , |
float8 | [] | ||
) |
Multiplies an SVEC and an array, element by element.
Definition at line 509 of file svec.sql_in.
int8 [] svec_nonbase_positions | ( | svec | , |
float8 | |||
) |
Compares an SVEC to a float8, and returns positions of all elements not equal to the float as an array. Element index here starts at 0.
Definition at line 601 of file svec.sql_in.
float8 [] svec_nonbase_values | ( | svec | , |
float8 | |||
) |
Compares an SVEC to a float8, and returns values of all elements not equal to the float as an array.
Definition at line 605 of file svec.sql_in.
cstring svec_out | ( | svec | ) |
Converts SVEC to CSTRING.
Definition at line 393 of file svec.sql_in.
svec svec_pivot | ( | svec | , |
float8 | |||
) |
Appends an element to the back of an SVEC.
Definition at line 581 of file svec.sql_in.
svec svec_plus | ( | svec | , |
svec | |||
) |
Adds two SVECs together, element by element.
Definition at line 437 of file svec.sql_in.
svec svec_plus_float8arr | ( | svec | , |
float8 | [] | ||
) |
Adds an SVEC and an array, element by element.
Definition at line 497 of file svec.sql_in.
svec svec_pow | ( | svec | , |
svec | |||
) |
Raises each element of the first SVEC to the power given by second SVEC, which must have dimension 1 (a scalar).
Definition at line 457 of file svec.sql_in.
float8 svec_proj | ( | svec | , |
int4 | |||
) |
Projects onto an element of an SVEC.
Definition at line 690 of file svec.sql_in.
svec svec_recv | ( | internal | ) |
Converts SVEC internal representation to SVEC.
Definition at line 400 of file svec.sql_in.
float8 [] svec_return_array | ( | svec | ) |
Casts an SVEC into a float8 array.
Definition at line 666 of file svec.sql_in.
svec svec_reverse | ( | svec | ) |
Reverses the elements of an SVEC.
Definition at line 698 of file svec.sql_in.
bytea svec_send | ( | svec | ) |
Converts SVEC to BYTEA.
Definition at line 407 of file svec.sql_in.
svec svec_sfv | ( | text | [], |
text | [] | ||
) |
Computes the word-occurence vector of a document
Definition at line 710 of file svec.sql_in.
text [] svec_sort | ( | text | [] | ) |
Sorts an array of texts. This function should be in MADlib common.
Definition at line 715 of file svec.sql_in.
svec svec_subvec | ( | svec | , |
int4 | , | ||
int4 | |||
) |
Extracts a subvector of an SVEC given the subvector's start and end indices.
Definition at line 694 of file svec.sql_in.
aggregate svec svec_sum | ( | svec | ) |
Aggregate that provides the element-wise sum of a list of vectors.
Definition at line 964 of file svec.sql_in.
text svec_to_string | ( | svec | ) |
Converts an svec to a text string
Definition at line 721 of file svec.sql_in.
set<float8> svec_unnest | ( | svec | ) |
Unnests an SVEC into a table of uncompressed values
Definition at line 577 of file svec.sql_in.
float8 tanimoto_distance | ( | svec | , |
svec | |||
) |
Computes the Tanimoto distance between two SVECs.
Definition at line 572 of file svec.sql_in.