Implementation of matrix operations in SQL. More...
Functions | |
text | matrix_info (text message) |
text | matrix_info () |
matrix_result | matrix_mult (text matrix_a, text a_args, text matrix_b, text b_args, text matrix_out, text out_args) |
Multiplies two matrices. It requires that all the values are NON-NULL. This is the sparse representation of the matrix where the matrix elements are indexed by the row and column index. More... | |
matrix_result | matrix_mult (text matrix_a, text a_args, text matrix_b, text b_args, text matrix_out) |
text | matrix_mult (text message) |
text | matrix_mult () |
matrix_result | matrix_add (text matrix_a, text a_args, text matrix_b, text b_args, text matrix_out, text out_args) |
Adds two matrices. It requires that all the values are NON-NULL. This is the sparse representation of the matrix where the matrix elements are indexed by the row and column index. More... | |
matrix_result | matrix_add (text matrix_a, text a_args, text matrix_b, text b_args, text matrix_out) |
text | matrix_add (text message) |
text | matrix_add () |
matrix_result | matrix_sub (text matrix_a, text a_args, text matrix_b, text b_args, text matrix_out, text out_args) |
Subs two matrices. It requires that all the values are NON-NULL. This is the sparse representation of the matrix where the matrix elements are indexed by the row and column id. More... | |
matrix_result | matrix_sub (text matrix_a, text a_args, text matrix_b, text b_args, text matrix_out) |
text | matrix_sub (text message) |
text | matrix_sub () |
float8[] | matrix_extract_row (text matrix_in, text in_args, integer index) |
Extract row from matrix given row index. It requires that all the values are NON-NULL. This is the dense or sparse representation of the matrix where the matrix elements are indexed by row id for dense and by the row and column id for sparse. More... | |
text | matrix_extract_row (text message) |
text | matrix_extract_row () |
float8[] | matrix_extract_col (text matrix_in, text in_args, integer index) |
Extract column from matrix given column index. It requires that all the values are NON-NULL. This is the dense or sparse representation of the matrix where the matrix elements are indexed by row id for dense and by the row and column id for sparse. More... | |
text | matrix_extract_col (text message) |
text | matrix_extract_col () |
matrix_result | matrix_max (text matrix_in, text in_args, integer dim, text matrix_out, boolean fetch_index) |
Get max value along dimension from matrix. Also returns corresponding index if set fetch_index. It requires that all the values are NON-NULL. This is the dense or sparse representation of the matrix where the matrix elements are indexed by row id for dense and by the row and column id for sparse. More... | |
text | matrix_max (text message) |
text | matrix_max () |
matrix_result | matrix_min (text matrix_in, text in_args, integer dim, text matrix_out, boolean fetch_index) |
Get min value along dimension from matrix. Also returns corresponding index if set fetch_index. It requires that all the values are NON-NULL. This is the dense or sparse representation of the matrix where the matrix elements are indexed by row id for dense and by the row and column id for sparse. More... | |
text | matrix_min (text message) |
text | matrix_min () |
float8[] | matrix_sum (text matrix_in, text in_args, integer dim) |
Calculate sum along dimension for matrix. It requires that all the values are NON-NULL. This is the sparse representation of the matrix where the matrix elements are indexed by the row and column id. More... | |
text | matrix_sum (text message) |
text | matrix_sum () |
float8[] | matrix_mean (text matrix_in, text in_args, integer dim) |
Calculate mean along dimension for matrix. It requires that all the values are NON-NULL. This is the sparse representation of the matrix where the matrix elements are indexed by the row and column id. More... | |
text | matrix_mean (text message) |
text | matrix_mean () |
matrix_result | matrix_scalar_mult (text matrix_in, text in_args, float8 scalar, text matrix_out, text out_args) |
Multiplies one matrix with scalar. It requires that all the values are NON-NULL. This is the sparse representation of the matrix where the matrix elements are indexed by the row and column id. More... | |
text | matrix_scalar_mult (text message) |
text | matrix_scalar_mult () |
float8[] | matrix_vec_mult (text matrix_in, text in_args, float8[] vector) |
Multiplies one matrix with vector. It requires that all the values are NON-NULL. This is the sparse representation of the matrix where the matrix elements are indexed by the row and column id. More... | |
text | matrix_vec_mult (text message) |
text | matrix_vec_mult () |
matrix_result | matrix_elem_mult (text matrix_a, text a_args, text matrix_b, text b_args, text matrix_out, text out_args) |
Multiplies two matrices by element. It requires that all the values are NON-NULL. This is the sparse representation of the matrix where the matrix elements are indexed by the row and column id. More... | |
matrix_result | matrix_elem_mult (text matrix_a, text a_args, text matrix_b, text b_args, text matrix_out) |
text | matrix_elem_mult (text message) |
text | matrix_elem_mult () |
matrix_result | matrix_trans (text matrix_in, text in_args, text matrix_out, text out_args, boolean use_temp_table) |
Transpose matrix. It requires that all the values are NON-NULL. This is the sparse representation of the matrix where the matrix elements are indexed by the row and column index. More... | |
matrix_result | matrix_trans (text matrix_in, text in_args, text matrix_out, text out_args) |
matrix_result | matrix_trans (text matrix_in, text in_args, text matrix_out) |
text | matrix_trans (text message) |
text | matrix_trans () |
matrix_result | matrix_sparsify (text matrix_in, text in_args, text matrix_out, text out_args, boolean use_temp_table) |
Converts matrix to sparse representation. It requires that all the values are NON-NULL. This is the dense representation of the matrix where the matrix elements are indexed by the row and column index. More... | |
matrix_result | matrix_sparsify (text matrix_in, text in_args, text matrix_out, text out_args) |
matrix_result | matrix_sparsify (text matrix_in, text in_args, text matrix_out) |
text | matrix_sparsify (text message) |
text | matrix_sparsify () |
matrix_result | matrix_densify (text matrix_in, text in_args, text matrix_out, text out_args, boolean use_temp_table) |
Converts matrix to dense representation. It requires that all the values are NON-NULL. This is the sparse representation of the matrix where the matrix elements are indexed by the row index. More... | |
matrix_result | matrix_densify (text matrix_in, text in_args, text matrix_out, text out_args) |
matrix_result | matrix_densify (text matrix_in, text in_args, text matrix_out) |
text | matrix_densify (text message) |
text | matrix_densify () |
void | matrix_scale_and_add (text matrix_a, text a_args, text matrix_b, text b_args, float8 scale, text matrix_out, text out_args) |
Scale and add matrix operation ( R <- A + sB) More... | |
float8 | matrix_norm (text matrix_in, text in_args, text norm_type) |
Compute matrix norm (of various types) More... | |
float8 | matrix_norm (text matrix_in, text in_args) |
Compute matrix norm of fro. More... | |
matrix_result | matrix_block_mult (text matrix_a, text a_args, text matrix_b, text b_args, text matrix_out, text out_args) |
matrix_result | matrix_block_square (text matrix_in, text in_args, text matrix_out, text out_args) |
matrix_result | matrix_block_trans (text matrix_in, text in_args, text matrix_out, text out_args, boolean use_temp_table) |
matrix_result | matrix_block_trans (text matrix_in, text in_args, text matrix_out, text out_args) |
matrix_result | matrix_square (text matrix_in, text in_args, text matrix_out, text out_args) |
Calculate square of matrix. It requires that all the values are NON-NULL. This is the dense representation of the matrix where the matrix elements are indexed by the row index. More... | |
matrix_result | matrix_square (text matrix_in, text in_args, text matrix_out) |
integer[] | __rand_vector (integer dim) |
integer[] | __rand_block (integer row_dim, integer col_dim) |
integer[] | __rand_block (integer dim) |
set< float8[]> | __matrix_row_split (float8[] row_in, integer size) |
float8[] | __matrix_densify_sfunc (float8[] state, integer col_dim, integer col_id, float8 val) |
aggregate float8[] | __matrix_densify_agg (integer, integer, float8) |
float8[] | __matrix_blockize_sfunc (float8[] state, integer row_id, float8[] row_vec, integer rsize) |
aggregate float8[] | __matrix_blockize_agg (integer, float8[], integer) |
float8[] | __matrix_unblockize_sfunc (float8[] state, integer total_col_dim, integer col_id, float8[] row_vec) |
aggregate float8[] | __matrix_unblockize_agg (integer, integer, float8[]) |
float8[] | matrix_mem_mult (float[] matrix_a, float[] matrix_b, boolean trans_b) |
float8[] | matrix_mem_mult (float[] matrix_a, float[] matrix_b) |
float8[] | matrix_mem_trans (float[] matrix) |
float8[] | __matrix_mem_sum_sfunc (float[] state, float[] matrix) |
aggregate float8[] | __matrix_mem_sum (float8[]) |
matrix_result | __matrix_column_to_array_format (text matrix_in, text row_id, text matrix_out, boolean istemp) |
matrix_result | matrix_blockize (text matrix_in, text in_args, integer rsize, integer csize, text matrix_out, text out_args) |
matrix_result | matrix_blockize (text matrix_in, text in_args, integer rsize, integer csize, text matrix_out) |
matrix_result | matrix_unblockize (text matrix_in, text in_args, text matrix_out, text out_args) |
set< float8[]> | __matrix_unnest_block (float8[] block) |
aggregate float8 [] __matrix_blockize_agg | ( | integer | , |
float8 | [], | ||
integer | |||
) |
float8 [] __matrix_blockize_sfunc | ( | float8[] | state, |
integer | row_id, | ||
float8[] | row_vec, | ||
integer | rsize | ||
) |
matrix_result __matrix_column_to_array_format | ( | text | matrix_in, |
text | row_id, | ||
text | matrix_out, | ||
boolean | istemp | ||
) |
aggregate float8 [] __matrix_densify_agg | ( | integer | , |
integer | , | ||
float8 | |||
) |
float8 [] __matrix_densify_sfunc | ( | float8[] | state, |
integer | col_dim, | ||
integer | col_id, | ||
float8 | val | ||
) |
aggregate float8 [] __matrix_mem_sum | ( | float8 | [] | ) |
float8 [] __matrix_mem_sum_sfunc | ( | float[] | state, |
float[] | matrix | ||
) |
set<float8[]> __matrix_row_split | ( | float8[] | row_in, |
integer | size | ||
) |
aggregate float8 [] __matrix_unblockize_agg | ( | integer | , |
integer | , | ||
float8 | [] | ||
) |
float8 [] __matrix_unblockize_sfunc | ( | float8[] | state, |
integer | total_col_dim, | ||
integer | col_id, | ||
float8[] | row_vec | ||
) |
set<float8[]> __matrix_unnest_block | ( | float8[] | block | ) |
integer [] __rand_block | ( | integer | row_dim, |
integer | col_dim | ||
) |
integer [] __rand_block | ( | integer | dim | ) |
integer [] __rand_vector | ( | integer | dim | ) |
matrix_result matrix_add | ( | text | matrix_a, |
text | a_args, | ||
text | matrix_b, | ||
text | b_args, | ||
text | matrix_out, | ||
text | out_args | ||
) |
matrix_a | Name of the table containing the first matrix |
a_row | Name of the column containing the row index for the first matrix |
a_col | Name of the column containing the column index for the first matrix |
a_val | Name of the column containing the matrix values for the first matrix |
matrix_b | Name of the table containing the second matrix |
b_row | Name of the column containing the row index for the second matrix |
b_col | Name of the column containing the column index for the second matrix |
b_val | Name of the column containing the matrix values for the second matrix |
matrix_out | Name of the table where to output the result matrix |
matrix_result matrix_add | ( | text | matrix_a, |
text | a_args, | ||
text | matrix_b, | ||
text | b_args, | ||
text | matrix_out | ||
) |
text matrix_add | ( | text | message | ) |
text matrix_add | ( | ) |
matrix_result matrix_block_mult | ( | text | matrix_a, |
text | a_args, | ||
text | matrix_b, | ||
text | b_args, | ||
text | matrix_out, | ||
text | out_args | ||
) |
matrix_result matrix_block_square | ( | text | matrix_in, |
text | in_args, | ||
text | matrix_out, | ||
text | out_args | ||
) |
matrix_result matrix_block_trans | ( | text | matrix_in, |
text | in_args, | ||
text | matrix_out, | ||
text | out_args, | ||
boolean | use_temp_table | ||
) |
matrix_result matrix_block_trans | ( | text | matrix_in, |
text | in_args, | ||
text | matrix_out, | ||
text | out_args | ||
) |
matrix_result matrix_blockize | ( | text | matrix_in, |
text | in_args, | ||
integer | rsize, | ||
integer | csize, | ||
text | matrix_out, | ||
text | out_args | ||
) |
matrix_result matrix_blockize | ( | text | matrix_in, |
text | in_args, | ||
integer | rsize, | ||
integer | csize, | ||
text | matrix_out | ||
) |
matrix_result matrix_densify | ( | text | matrix_in, |
text | in_args, | ||
text | matrix_out, | ||
text | out_args, | ||
boolean | use_temp_table | ||
) |
matrix_in | Name of the table containing the input matrix |
in_row | Name of the column containing the row index for the input matrix |
in_col | Name of the column containing the column index for the input matrix |
in_val | Name of the column containing the matrix values for the input matrix |
matrix_out | Name of the table where to output the result matrix |
use_temp_table | Specify if use temp table for result |
matrix_result matrix_densify | ( | text | matrix_in, |
text | in_args, | ||
text | matrix_out, | ||
text | out_args | ||
) |
matrix_result matrix_densify | ( | text | matrix_in, |
text | in_args, | ||
text | matrix_out | ||
) |
text matrix_densify | ( | text | message | ) |
text matrix_densify | ( | ) |
matrix_result matrix_elem_mult | ( | text | matrix_a, |
text | a_args, | ||
text | matrix_b, | ||
text | b_args, | ||
text | matrix_out, | ||
text | out_args | ||
) |
matrix_a | Name of the table containing the first matrix |
a_row | Name of the column containing the row id for the first matrix |
a_col | Name of the column containing the column id for the first matrix |
a_val | Name of the column containing the matrix values for the first matrix |
matrix_b | Name of the table containing the second matrix |
b_row | Name of the column containing the row id for the second matrix |
b_col | Name of the column containing the column id for the second matrix |
b_val | Name of the column containing the matrix values for the second matrix |
matrix_out | Name of the table where to output the result matrix |
matrix_result matrix_elem_mult | ( | text | matrix_a, |
text | a_args, | ||
text | matrix_b, | ||
text | b_args, | ||
text | matrix_out | ||
) |
text matrix_elem_mult | ( | text | message | ) |
text matrix_elem_mult | ( | ) |
float8 [] matrix_extract_col | ( | text | matrix_in, |
text | in_args, | ||
integer | index | ||
) |
matrix_in | Name of the table containing the matrix |
in_args | A string containing multiple named arguments of the form "name=value". This argument is used as a container for multiple parameters related to a single matrix. |
index | Column index for wanted. |
text matrix_extract_col | ( | text | message | ) |
text matrix_extract_col | ( | ) |
float8 [] matrix_extract_row | ( | text | matrix_in, |
text | in_args, | ||
integer | index | ||
) |
matrix_in | Name of the table containing the matrix |
in_args | A string containing multiple named arguments of the form "name=value". This argument is used as a container for multiple parameters related to a single matrix. |
index | Row index for wanted. |
text matrix_extract_row | ( | text | message | ) |
text matrix_extract_row | ( | ) |
text matrix_info | ( | text | message | ) |
text matrix_info | ( | ) |
matrix_result matrix_max | ( | text | matrix_in, |
text | in_args, | ||
integer | dim, | ||
text | matrix_out, | ||
boolean | fetch_index | ||
) |
matrix_in | Name of the table containing the matrix |
in_args | A string containing multiple named arguments of the form "name=value". This argument is used as a container for multiple parameters related to a single matrix. |
dim | Which dimension to collapse. 1 means row wise, and 2 means column wise |
matrix_out | Result matrix which contains one column: max, and another column: index if fetch_index is set. The type of column is array |
fetch_index | True when want to get corresponding index of max value. Default is false |
text matrix_max | ( | text | message | ) |
text matrix_max | ( | ) |
float8 [] matrix_mean | ( | text | matrix_in, |
text | in_args, | ||
integer | dim | ||
) |
matrix_in | Name of the table containing the matrix |
in_args | Name-value pair string containing options for matrix_in |
dim | Which dimension to collapse. 1 means row wise, and 2 means column wise |
text matrix_mean | ( | text | message | ) |
text matrix_mean | ( | ) |
float8 [] matrix_mem_mult | ( | float[] | matrix_a, |
float[] | matrix_b, | ||
boolean | trans_b | ||
) |
float8 [] matrix_mem_mult | ( | float[] | matrix_a, |
float[] | matrix_b | ||
) |
float8 [] matrix_mem_trans | ( | float[] | matrix | ) |
matrix_result matrix_min | ( | text | matrix_in, |
text | in_args, | ||
integer | dim, | ||
text | matrix_out, | ||
boolean | fetch_index | ||
) |
matrix_in | Name of the table containing the matrix |
in_args | A string containing multiple named arguments of the form "name=value". This argument is used as a container for multiple parameters related to a single matrix. |
dim | Which dimension to collapse. 1 means row wise, and 2 means column wise |
matrix_out | Result matrix which contains one column: min, and another column: index if fetch_index is set. The type of column is array |
fetch_index | True when want to get corresponding index of min value. Default is false |
text matrix_min | ( | text | message | ) |
text matrix_min | ( | ) |
matrix_result matrix_mult | ( | text | matrix_a, |
text | a_args, | ||
text | matrix_b, | ||
text | b_args, | ||
text | matrix_out, | ||
text | out_args | ||
) |
matrix_a | Name of the table containing the first matrix |
a_row | Name of the column containing the row index for the first matrix |
a_col | Name of the column containing the column index for the first matrix |
a_val | Name of the column containing the matrix values for the first matrix |
a_trans | Boolean to indicate if first matrix should be transposed before multiplication |
matrix_b | Name of the table containing the second matrix |
b_row | Name of the column containing the row index for the second matrix |
b_col | Name of the column containing the column index for the second matrix |
b_val | Name of the column containing the matrix values for the second matrix |
b_trans | Boolean to indicate if second matrix should be transposed before multiplication |
matrix_out | Name of the table where to output the result matrix |
matrix_result matrix_mult | ( | text | matrix_a, |
text | a_args, | ||
text | matrix_b, | ||
text | b_args, | ||
text | matrix_out | ||
) |
text matrix_mult | ( | text | message | ) |
text matrix_mult | ( | ) |
float8 matrix_norm | ( | text | matrix_in, |
text | in_args, | ||
text | norm_type | ||
) |
matrix_a | Source matrix table (dense matrix format) |
norm_type | Type of norm used (default: fro) |
SELECT matrix_norm('matrix_table_name', 'fro');
float8 matrix_norm | ( | text | matrix_in, |
text | in_args | ||
) |
matrix_a | Source matrix table (dense matrix format) |
SELECT matrix_norm('matrix_table_name', 'fro');
matrix_result matrix_scalar_mult | ( | text | matrix_in, |
text | in_args, | ||
float8 | scalar, | ||
text | matrix_out, | ||
text | out_args | ||
) |
matrix_in | Name of the table containing the matrix |
in_args | Name-value pair string containing options for matrix_in |
scalar | Scalar value used to be multiplied with matrix_in |
matrix_out | Name of the table where to output the result matrix |
out_args | Name-value pair string containing options for matrix_in |
text matrix_scalar_mult | ( | text | message | ) |
text matrix_scalar_mult | ( | ) |
void matrix_scale_and_add | ( | text | matrix_a, |
text | a_args, | ||
text | matrix_b, | ||
text | b_args, | ||
float8 | scale, | ||
text | matrix_out, | ||
text | out_args | ||
) |
matrix_a | Source matrix table A (dense matrix format) |
matrix_b | Source matrix table B (dense matrix format) |
scale | Scale for matrix B |
matrix_out | Output table for matrix R <- A + sB |
SELECT matrix_scale_and_add('matrix_a', 'matrix_b', 1, 'matrix_out'); SELECT matrix_scale_and_add('matrix_a', 'matrix_b', -1, 'matrix_out');
matrix_result matrix_sparsify | ( | text | matrix_in, |
text | in_args, | ||
text | matrix_out, | ||
text | out_args, | ||
boolean | use_temp_table | ||
) |
matrix_in | Name of the table containing the input matrix |
matrix_out | Name of the table where to output the result matrix |
use_temp_table | Specify if use temp table for result |
matrix_result matrix_sparsify | ( | text | matrix_in, |
text | in_args, | ||
text | matrix_out, | ||
text | out_args | ||
) |
matrix_result matrix_sparsify | ( | text | matrix_in, |
text | in_args, | ||
text | matrix_out | ||
) |
text matrix_sparsify | ( | text | message | ) |
text matrix_sparsify | ( | ) |
matrix_result matrix_square | ( | text | matrix_in, |
text | in_args, | ||
text | matrix_out, | ||
text | out_args | ||
) |
matrix_in | Name of the table containing the input matrix |
matrix_out | Name of the table where to output the result matrix |
matrix_result matrix_square | ( | text | matrix_in, |
text | in_args, | ||
text | matrix_out | ||
) |
matrix_result matrix_sub | ( | text | matrix_a, |
text | a_args, | ||
text | matrix_b, | ||
text | b_args, | ||
text | matrix_out, | ||
text | out_args | ||
) |
matrix_a | Name of the table containing the first matrix |
a_row | Name of the column containing the row id for the first matrix |
a_col | Name of the column containing the column id for the first matrix |
a_val | Name of the column containing the matrix values for the first matrix |
matrix_b | Name of the table containing the second matrix |
b_row | Name of the column containing the row id for the second matrix |
b_col | Name of the column containing the column id for the second matrix |
b_val | Name of the column containing the matrix values for the second matrix |
matrix_out | Name of the table where to output the result matrix |
matrix_result matrix_sub | ( | text | matrix_a, |
text | a_args, | ||
text | matrix_b, | ||
text | b_args, | ||
text | matrix_out | ||
) |
text matrix_sub | ( | text | message | ) |
text matrix_sub | ( | ) |
float8 [] matrix_sum | ( | text | matrix_in, |
text | in_args, | ||
integer | dim | ||
) |
matrix_in | Name of the table containing the matrix |
in_args | Name-value pair string containing options for matrix_in |
dim | Which dimension to collapse. 1 means row wise, and 2 means column wise |
text matrix_sum | ( | text | message | ) |
text matrix_sum | ( | ) |
matrix_result matrix_trans | ( | text | matrix_in, |
text | in_args, | ||
text | matrix_out, | ||
text | out_args, | ||
boolean | use_temp_table | ||
) |
matrix_in | Name of the table containing the input matrix |
in_row | Name of the column containing the row index for the input matrix |
in_col | Name of the column containing the column index for the input matrix |
in_val | Name of the column containing the matrix values for the input matrix |
matrix_out | Name of the table where to output the result matrix |
use_temp_table | Specify if use temp table for result |
matrix_result matrix_trans | ( | text | matrix_in, |
text | in_args, | ||
text | matrix_out, | ||
text | out_args | ||
) |
matrix_result matrix_trans | ( | text | matrix_in, |
text | in_args, | ||
text | matrix_out | ||
) |
text matrix_trans | ( | text | message | ) |
text matrix_trans | ( | ) |
matrix_result matrix_unblockize | ( | text | matrix_in, |
text | in_args, | ||
text | matrix_out, | ||
text | out_args | ||
) |
float8 [] matrix_vec_mult | ( | text | matrix_in, |
text | in_args, | ||
float8[] | vector | ||
) |
matrix_in | Name of the table containing the matrix |
in_args | Name-value pair string containing options for matrix_in |
vector | Vector value used to be multiplied with matrix_in |
text matrix_vec_mult | ( | text | message | ) |
text matrix_vec_mult | ( | ) |