blob: ab98a1bfdd53bae49884c22ebbde0f1f13dfdb6b [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.4"/>
<title>MADlib: Conjugate Gradient</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script><script src="../mathjax/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">MADlib
&#160;<span id="projectnumber">1.0</span> <span style="font-size:10pt; font-style:italic"><a href="../latest/./group__grp__cg.html"> A newer version is available</a></span>
</div>
<div id="projectbrief">User Documentation</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.4 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__grp__cg.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Groups</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">Conjugate Gradient<div class="ingroups"><a class="el" href="group__grp__early__stage.html">Early Stage Development</a></div></div> </div>
</div><!--header-->
<div class="contents">
<div id="dynsection-0" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
<img id="dynsection-0-trigger" src="closed.png" alt="+"/> Collaboration diagram for Conjugate Gradient:</div>
<div id="dynsection-0-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-0-content" class="dyncontent" style="display:none;">
<center><table><tr><td><div class="center"><iframe scrolling="no" frameborder="0" src="group__grp__cg.svg" width="390" height="40"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</td></tr></table></center>
</div>
<dl class="section warning"><dt>Warning</dt><dd><em> This MADlib method is still in early stage development. There may be some issues that will be addressed in a future version. Interface and implementation is subject to change. </em></dd></dl>
<dl class="section user"><dt>About:</dt><dd>This function uses the iterative conjugate gradient method [1] to find a solution to the function: <p class="formulaDsp">
\[ \boldsymbol Ax = \boldsymbol b \]
</p>
where \( \boldsymbol A \) is a symmetric, positive definite matrix and \(x\) and \( \boldsymbol b \) are vectors.</dd></dl>
<dl class="section user"><dt>Input:</dt><dd>Matrix \( \boldsymbol A \) is assumed to be stored in a table where each row consists of at least two columns: array containing values of a given row, row number: <pre>{TABLE|VIEW} <em>matrix_A</em> (
<em>row_number</em> FLOAT,
<em>row_values</em> FLOAT[],
)</pre> The number of elements in each row should be the same.</dd></dl>
<p>\( \boldsymbol b \) is passed as a FLOAT[] to the function.</p>
<dl class="section user"><dt>Usage:</dt><dd>Conjugate gradient can be called as follows: <pre>SELECT <a class="el" href="conjugate__gradient_8sql__in.html#ab94e8a12cc9c2d0dac35168721ec8585">conjugate_gradient</a>('<em>table_name</em>',
'<em>name_of_row_values_col</em>', '<em>name_of_row_number_col</em>', '<em>aray_of_b_values</em>',
'<em>desired_precision</em>');</pre> Function returns x as an array.</dd></dl>
<dl class="section user"><dt>Examples:</dt><dd><ol type="1">
<li>Construct matrix A according to structure: <div class="fragment"><div class="line">sql&gt; SELECT * FROM data;</div>
<div class="line"> row_num | row_val </div>
<div class="line">---------+---------</div>
<div class="line"> 1 | {2,1}</div>
<div class="line"> 2 | {1,4}</div>
<div class="line">(2 rows)</div>
</div><!-- fragment --></li>
<li>Call conjugate gradient function: <div class="fragment"><div class="line">sql&gt; SELECT <a class="code" href="conjugate__gradient_8sql__in.html#ab94e8a12cc9c2d0dac35168721ec8585" title="Compute conjugate gradient. ">conjugate_gradient</a>(<span class="stringliteral">&#39;data&#39;</span>,<span class="stringliteral">&#39;row_val&#39;</span>,<span class="stringliteral">&#39;row_num&#39;</span>,<span class="stringliteral">&#39;{2,1}&#39;</span>,1E-6,1);</div>
<div class="line">INFO: COMPUTE RESIDUAL ERROR 14.5655661859659</div>
<div class="line">INFO: ERROR 0.144934004246004</div>
<div class="line">INFO: ERROR 3.12963615962926e-31</div>
<div class="line">INFO: TEST FINAL ERROR 2.90029642185163e-29</div>
<div class="line"> <a class="code" href="conjugate__gradient_8sql__in.html#ab94e8a12cc9c2d0dac35168721ec8585" title="Compute conjugate gradient. ">conjugate_gradient</a> </div>
<div class="line">---------------------------</div>
<div class="line"> {1,-1.31838984174237e-15}</div>
<div class="line">(1 row)</div>
</div><!-- fragment --></li>
</ol>
</dd></dl>
<dl class="section user"><dt>Literature:</dt><dd>[1] "Conjugate gradient method" Wikipedia - <a href="http://en.wikipedia.org/wiki/Conjugate_gradient_method">http://en.wikipedia.org/wiki/Conjugate_gradient_method</a></dd></dl>
<dl class="section see"><dt>See Also</dt><dd>File <a class="el" href="conjugate__gradient_8sql__in.html" title="SQL function computing Conjugate Gradient. ">conjugate_gradient.sql_in</a> documenting the SQL function. </dd></dl>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated on Tue Sep 10 2013 15:48:04 for MADlib by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.4 </li>
</ul>
</div>
</body>
</html>