MADlib
0.7 A newer version is available
User Documentation
|
\[ \boldsymbol Ax = \boldsymbol b \]
where \( \boldsymbol A \) is a symmetric, positive definite matrix and \(x\) and \( \boldsymbol b \) are vectors.{TABLE|VIEW} matrix_A ( row_number FLOAT, row_values FLOAT[], )The number of elements in each row should be the same.
\( \boldsymbol b \) is passed as a FLOAT[] to the function.
SELECT conjugate_gradient('table_name', 'name_of_row_values_col', 'name_of_row_number_col', 'aray_of_b_values', 'desired_precision');Function returns x as an array.
sql> SELECT * FROM data; row_num | row_val ---------+--------- 1 | {2,1} 2 | {1,4} (2 rows)
sql> SELECT conjugate_gradient('data','row_val','row_num','{2,1}',1E-6,1); INFO: COMPUTE RESIDUAL ERROR 14.5655661859659 INFO: ERROR 0.144934004246004 INFO: ERROR 3.12963615962926e-31 INFO: TEST FINAL ERROR 2.90029642185163e-29 conjugate_gradient --------------------------- {1,-1.31838984174237e-15} (1 row)