MADlib
1.1 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 596 of file svec.sql_in.
float8 [] float8arr_cast_float4 | ( | float4 | ) |
Casts a float4 into a float8 array.
Definition at line 675 of file svec.sql_in.
float8 [] float8arr_cast_float8 | ( | float8 | ) |
Casts a float8 into a float8 array.
Definition at line 679 of file svec.sql_in.
float8 [] float8arr_cast_int2 | ( | int2 | ) |
Casts an int2 into a float8 array.
Definition at line 663 of file svec.sql_in.
float8 [] float8arr_cast_int4 | ( | int4 | ) |
Casts an int4 into a float8 array.
Definition at line 667 of file svec.sql_in.
float8 [] float8arr_cast_int8 | ( | bigint | ) |
Casts an int8 into a float8 array.
Definition at line 671 of file svec.sql_in.
float8 [] float8arr_cast_numeric | ( | numeric | ) |
Casts a numeric into a float8 array.
Definition at line 683 of file svec.sql_in.
svec float8arr_div_float8arr | ( | float8 | [], |
float8 | [] | ||
) |
Divides a float8 array by another, element by element.
Definition at line 542 of file svec.sql_in.
svec float8arr_div_svec | ( | float8 | [], |
svec | |||
) |
Divides a float8 array by an SVEC, element by element.
Definition at line 546 of file svec.sql_in.
boolean float8arr_eq | ( | float8 | [], |
float8 | [] | ||
) |
Returns true if two float8 arrays are equal
Definition at line 502 of file svec.sql_in.
svec float8arr_minus_float8arr | ( | float8 | [], |
float8 | [] | ||
) |
Minus second array from the first array, element by element.
Definition at line 506 of file svec.sql_in.
svec float8arr_minus_svec | ( | float8 | [], |
svec | |||
) |
Minus second SVEC from the first array, element by element.
Definition at line 510 of file svec.sql_in.
svec float8arr_mult_float8arr | ( | float8 | [], |
float8 | [] | ||
) |
Multiplies two float8 arrays, element by element.
Definition at line 530 of file svec.sql_in.
svec float8arr_mult_svec | ( | float8 | [], |
svec | |||
) |
Multiplies an array and an SVEC, element by element.
Definition at line 534 of file svec.sql_in.
svec float8arr_plus_float8arr | ( | float8 | [], |
float8 | [] | ||
) |
Adds two arrays together, element by element.
Definition at line 518 of file svec.sql_in.
svec float8arr_plus_svec | ( | float8 | [], |
svec | |||
) |
Adds an array and an SVEC, element by element.
Definition at line 522 of file svec.sql_in.
float8 l1norm | ( | svec | , |
svec | |||
) |
Computes the l1norm distance between two SVECs.
Definition at line 583 of file svec.sql_in.
float8 l2norm | ( | svec | , |
svec | |||
) |
Computes the l2norm distance between two SVECs.
Definition at line 578 of file svec.sql_in.
aggregate float [] mean | ( | svec | ) |
Aggregate that computes the element-wise mean of a list of vectors.
Definition at line 983 of file svec.sql_in.
svec normalize | ( | svec | ) |
Normalizes an SVEC that is divides all elements by its norm/magnitude.
Definition at line 1062 of file svec.sql_in.
aggregate svec svec_agg | ( | float8 | ) |
Aggregate that turns a list of float8 values into an SVEC.
Definition at line 1013 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 715 of file svec.sql_in.
svec svec_cast_float4 | ( | float4 | ) |
Casts a float4 into an SVEC.
Definition at line 651 of file svec.sql_in.
svec svec_cast_float8 | ( | float8 | ) |
Casts a float8 into an SVEC.
Definition at line 655 of file svec.sql_in.
svec svec_cast_float8arr | ( | float8 | []) |
Casts a float8 into an SVEC.
Definition at line 687 of file svec.sql_in.
svec svec_cast_int2 | ( | int2 | ) |
Casts an int2 into an SVEC.
Definition at line 639 of file svec.sql_in.
svec svec_cast_int4 | ( | int4 | ) |
Casts an int4 into an SVEC.
Definition at line 643 of file svec.sql_in.
svec svec_cast_int8 | ( | bigint | ) |
Casts an int8 into an SVEC.
Definition at line 647 of file svec.sql_in.
svec svec_cast_numeric | ( | numeric | ) |
Casts a numeric into an SVEC.
Definition at line 659 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 691 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 731 of file svec.sql_in.
svec svec_concat | ( | svec | , |
svec | |||
) |
Concatenates two SVECs.
Definition at line 699 of file svec.sql_in.
svec svec_concat_replicate | ( | int4 | , |
svec | |||
) |
Replicates n copies of an SVEC and concatenates them together.
Definition at line 703 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 498 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 461 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 1003 of file svec.sql_in.
integer svec_dimension | ( | svec | ) |
Returns the dimension of an SVEC.
Definition at line 707 of file svec.sql_in.
svec svec_div | ( | svec | , |
svec | |||
) |
Divides the first SVEC by the second, element by element.
Definition at line 478 of file svec.sql_in.
svec svec_div_float8arr | ( | svec | , |
float8 | [] | ||
) |
Divides an SVEC by a float8 array, element by element.
Definition at line 550 of file svec.sql_in.
float8 svec_dmax | ( | float8 | , |
float8 | |||
) |
Basic floating point scalar operator: MAX.
Definition at line 457 of file svec.sql_in.
float8 svec_dmin | ( | float8 | , |
float8 | |||
) |
Basic floating point scalar operator: MIN.
Definition at line 453 of file svec.sql_in.
float8 svec_dot | ( | svec | , |
svec | |||
) |
Computes the dot product of two SVECs.
Definition at line 554 of file svec.sql_in.
float8 svec_dot | ( | float8 | [], |
float8 | [] | ||
) |
Computes the dot product of two float8 arrays.
Definition at line 558 of file svec.sql_in.
float8 svec_dot | ( | svec | , |
float8 | [] | ||
) |
Computes the dot product of an SVEC and a float8 array.
Definition at line 562 of file svec.sql_in.
float8 svec_dot | ( | float8 | [], |
svec | |||
) |
Computes the dot product of a float8 array and an SVEC.
Definition at line 566 of file svec.sql_in.
float8 svec_elsum | ( | svec | ) |
Sums the elements of an SVEC.
Definition at line 614 of file svec.sql_in.
float8 svec_elsum | ( | float8 | []) |
Sums the elements of a float8 array.
Definition at line 618 of file svec.sql_in.
boolean svec_eq | ( | svec | , |
svec | |||
) |
Returns true if two SVECs are equal. If the two SVECs are of different size, then will return false.
Definition at line 490 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 SVECs are of different size, then the function essentially zero-pads the shorter one and performs the comparison.
Definition at line 494 of file svec.sql_in.
svec svec_from_string | ( | text | ) |
Converts a text string to an svec
Definition at line 755 of file svec.sql_in.
int4 svec_hash | ( | svec | ) |
Computes the hash of an SVEC.
Definition at line 735 of file svec.sql_in.
svec svec_in | ( | cstring | ) |
SVEC constructor from CSTRING.
Definition at line 415 of file svec.sql_in.
float8 svec_l1norm | ( | svec | ) |
Computes the l1norm of an SVEC.
Definition at line 588 of file svec.sql_in.
float8 svec_l1norm | ( | float8 | []) |
Computes the l1norm of a float8 array.
Definition at line 592 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 1058 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 1042 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 1054 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 1050 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 1038 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 1034 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 1046 of file svec.sql_in.
float8 svec_l2norm | ( | svec | ) |
Computes the l2norm of an SVEC.
Definition at line 570 of file svec.sql_in.
float8 svec_l2norm | ( | float8 | []) |
Computes the l2norm of a float8 array.
Definition at line 574 of file svec.sql_in.
svec svec_lapply | ( | text | , |
svec | |||
) |
Applies a given function to each element of an SVEC.
Definition at line 711 of file svec.sql_in.
svec svec_log | ( | svec | ) |
Computes the logarithm of each element of the input SVEC.
Definition at line 474 of file svec.sql_in.
svec svec_mean_final | ( | float | []) |
Final function for mean(svec) aggregate
Definition at line 977 of file svec.sql_in.
float [] svec_mean_prefunc | ( | float | [], |
float | [] | ||
) |
Preliminary merge function for mean(svec) aggregate
Definition at line 971 of file svec.sql_in.
float [] svec_mean_transition | ( | float | [], |
svec | |||
) |
Transition function for mean(svec) aggregate
Definition at line 965 of file svec.sql_in.
float8 svec_median | ( | float8 | []) |
Computes the median element of a float8 array.
Definition at line 622 of file svec.sql_in.
float8 svec_median | ( | svec | ) |
Computes the median element of an SVEC.
Definition at line 626 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 1024 of file svec.sql_in.
svec svec_minus | ( | svec | , |
svec | |||
) |
Minus second SVEC from the first, element by element.
Definition at line 470 of file svec.sql_in.
svec svec_minus_float8arr | ( | svec | , |
float8 | [] | ||
) |
Minus second array from the first SVEC, element by element.
Definition at line 514 of file svec.sql_in.
svec svec_mult | ( | svec | , |
svec | |||
) |
Multiplies two SVEVs together, element by element.
Definition at line 482 of file svec.sql_in.
svec svec_mult_float8arr | ( | svec | , |
float8 | [] | ||
) |
Multiplies an SVEC and an array, element by element.
Definition at line 538 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 630 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 634 of file svec.sql_in.
cstring svec_out | ( | svec | ) |
Converts SVEC to CSTRING.
Definition at line 422 of file svec.sql_in.
svec svec_pivot | ( | svec | , |
float8 | |||
) |
Appends an element to the back of an SVEC.
Definition at line 610 of file svec.sql_in.
svec svec_plus | ( | svec | , |
svec | |||
) |
Adds two SVECs together, element by element.
Definition at line 466 of file svec.sql_in.
svec svec_plus_float8arr | ( | svec | , |
float8 | [] | ||
) |
Adds an SVEC and an array, element by element.
Definition at line 526 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 486 of file svec.sql_in.
float8 svec_proj | ( | svec | , |
int4 | |||
) |
Projects onto an element of an SVEC.
Definition at line 719 of file svec.sql_in.
svec svec_recv | ( | internal | ) |
Converts SVEC internal representation to SVEC.
Definition at line 429 of file svec.sql_in.
float8 [] svec_return_array | ( | svec | ) |
Casts an SVEC into a float8 array.
Definition at line 695 of file svec.sql_in.
svec svec_reverse | ( | svec | ) |
Reverses the elements of an SVEC.
Definition at line 727 of file svec.sql_in.
bytea svec_send | ( | svec | ) |
Converts SVEC to BYTEA.
Definition at line 436 of file svec.sql_in.
svec svec_sfv | ( | text | [], |
text | [] | ||
) |
Computes the word-occurence vector of a document
Definition at line 739 of file svec.sql_in.
text [] svec_sort | ( | text | []) |
Sorts an array of texts. This function should be in MADlib common.
Definition at line 744 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 723 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 993 of file svec.sql_in.
text svec_to_string | ( | svec | ) |
Converts an svec to a text string
Definition at line 750 of file svec.sql_in.
set<float8> svec_unnest | ( | svec | ) |
Unnests an SVEC into a table of uncompressed values
Definition at line 606 of file svec.sql_in.
float8 tanimoto_distance | ( | svec | , |
svec | |||
) |
Computes the Tanimoto distance between two SVECs.
Definition at line 601 of file svec.sql_in.