blob: 2b054059089c80e8041c8c33e9ad69c12753c06d [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: Dense Linear Systems</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.1</span> <span style="font-size:10pt; font-style:italic"><a href="../latest/./group__grp__dense__linear__solver.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><a href="files.html"><span>Files</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__dense__linear__solver.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">Dense Linear Systems<div class="ingroups"><a class="el" href="group__grp__linear__solver.html">Linear Systems</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 Dense Linear Systems:</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__dense__linear__solver.svg" width="344" 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>
<div class="toc"><b>Contents</b> </p>
<ul>
<li class="level1">
<a href="#dls_about">About</a> </li>
<li class="level1">
<a href="#dls_online_help">Online Help</a> </li>
<li class="level1">
<a href="#dls_function">Function Syntax</a> </li>
<li class="level1">
<a href="#dls_args">Arguments</a> </li>
<li class="level1">
<a href="#dls_opt_params">Optimizer Parameters</a> </li>
<li class="level1">
<a href="#dls_output">Output Tables</a> </li>
<li class="level1">
<a href="#dls_examples">Examples</a> </li>
</ul>
</div><p><a class="anchor" id="dls_about"></a></p>
<dl class="section user"><dt>About:</dt><dd></dd></dl>
<p>The linear systems module implements solution methods for systems of consistent linear equations. Systems of linear equations take the form: </p>
<p class="formulaDsp">
\[ Ax = b \]
</p>
<p>where \(x \in \mathbb{R}^{n}\), \(A \in \mathbb{R}^{m \times n} \) and \(b \in \mathbb{R}^{m}\). We assume that there are no rows of \(A\) where all elements are zero. The algorithms implemented in this module can handle large dense linear systems. Currently, the algorithms implemented in this module solve the linear system by a direct decomposition. Hence, these methods are known as <em>direct method</em>.</p>
<p><a class="anchor" id="dls_online_help"></a></p>
<dl class="section user"><dt>Online Help</dt><dd></dd></dl>
<p>View short help messages using the following statements: </p>
<pre class="fragment">-- Summary of dense linear systems
SELECT madlib.linear_solver_dense();
-- Function syntax and output table format
SELECT madlib.linear_solver_dense('usage');
-- Syntax for direct methods
SELECT madlib.linear_solver_dense('direct');
</pre><p><a class="anchor" id="dls_function"></a></p>
<dl class="section user"><dt>Function Syntax</dt><dd></dd></dl>
<pre>
SELECT linear_solver_dense(tbl_source, tbl_result, row_id, LHS,
RHS, grouping_col := NULL, optimizer := 'direct',
optimizer_params := 'algorithm = householderqr');
</pre><p><a class="anchor" id="dls_args"></a></p>
<dl class="section user"><dt>Arguments</dt><dd></dd></dl>
<dl class="arglist">
<dt>tbl_source </dt>
<dd><p class="startdd">Text value. The name of the table containing the training data. The input data is expected to be of the following form: </p>
<pre>{TABLE|VIEW} <em>sourceName</em> (
...
<em>row_id</em> FLOAT8,
<em>left_hand_side</em> FLOAT8[],
<em>right_hand_side</em> FLOAT8,
...
)</pre><p>Here, each row represents a single equation using. The <em> right_hand_side </em> refers to the right hand side of the equations while the <em> left_hand_side </em> refers to the multipliers on the variables on the left hand side of the same equations. </p>
<p class="enddd"></p>
</dd>
<dt>tbl_result </dt>
<dd><p class="startdd">Text value. The name of the table where the output is saved.</p>
<p class="enddd"></p>
</dd>
<dt>row_id </dt>
<dd><p class="startdd">Text value. The name of the column storing the 'row id' of the equations.</p>
<dl class="section note"><dt>Note</dt><dd>For a system with N equations, the row_id's must be a continuous range of integers from \( 0 \ldots n-1 \).</dd></dl>
</dd>
<dt>LHS </dt>
<dd><p class="startdd">Text value. The name of the column storing the 'left hand side' of the equations stored as an array.</p>
<p class="enddd"></p>
</dd>
<dt>RHS </dt>
<dd><p class="startdd">Text value. The name of the column storing the 'right hand side' of the equations.</p>
<p class="enddd"></p>
</dd>
<dt>grouping_col (optional) </dt>
<dd>Text value. Group by columns. Default: NULL. <dl class="section note"><dt>Note</dt><dd>The grouing columns is a placeholder in MADlib V1.1</dd></dl>
</dd>
<dt>optimizer (optional) </dt>
<dd><p class="startdd">Text value. Type of optimizer. Default: 'direct'.</p>
<p class="enddd"></p>
</dd>
<dt>optimizer_params (optional) </dt>
<dd>Text value. Optimizer specific parameters. Default: NULL. </dd>
</dl>
<p><a class="anchor" id="dls_opt_params"></a></p>
<dl class="section user"><dt>Optimizer Parameters</dt><dd></dd></dl>
<p>For each optimizer, there are specific parameters that can be tuned for better performance. </p>
<dl class="section user"><dt></dt><dd><dl class="arglist">
<dt>algorithm (default: householderqr) </dt>
<dd><p class="startdd"></p>
<p>There are several algorithms that can be classified as 'direct' methods of solving linear systems. MADlib dense linear system solvers provide various algorithmic options for users.</p>
<p>The following table provides a guideline on the choice of algorithm based on conditions on the A matrix, speed of the algorithms and numerical stability. </p>
<pre class="fragment"> Algorithm | Contitions on A | Speed | Accuracy
----------------------------------------------------------
householderqr | None | ++ | +
partialpivlu | Invertable | ++ | +
fullpivlu | None | - | +++
colpivhouseholderqr | None | + | ++
fullpivhouseholderqr | None | - | +++
llt | Pos. Definite | +++ | +
ldlt | Pos. or Neg Def | +++ | ++
</pre><p>For speed '++' is faster than '+', which is faster than '-'. For accuracy '+++' is better than '++'.</p>
<p>More details about the individual algorithms can be found on the <a href="http://eigen.tuxfamily.org/dox-devel/group__TutorialLinearAlgebra.html">Eigen documentation</a>. Eigen is an open source library for linear algebra.</p>
<p class="enddd"></p>
</dd>
</dl>
</dd></dl>
<p><a class="anchor" id="dls_output"></a></p>
<dl class="section user"><dt>Output statistics </dt><dd>Output is stored in the <em>tbl_result</em> table. <dl class="arglist">
<dt>solution </dt>
<dd><p class="startdd">The solution is an array (of double precision) with the variables in the same order as that provided as input in the 'left_hand_side' column name of the 'source_table' </p>
<p class="enddd"></p>
</dd>
<dt>residual_norm </dt>
<dd><p class="startdd">Computes the scaled residual norm, defined as \( \frac{|Ax - b|}{|b|} \). This value is an indication of the accuracy of the solution. </p>
<p class="enddd"></p>
</dd>
<dt>iters </dt>
<dd><p class="startdd">The number of iterations required by the algorithm (only applicable for iterative algorithms). The output is NULL for direct' methods. </p>
<p class="enddd"></p>
</dd>
</dl>
</dd></dl>
<p><a class="anchor" id="dls_examples"></a></p>
<dl class="section user"><dt>Examples:</dt><dd><ol type="1">
<li>Create the sample data set: <pre class="fragment">sql&gt; CREATE TABLE linear_systems_test_data (id INTEGER NOT NULL,
lhs DOUBLE PRECISION[],
rhs DOUBLE PRECISION);
sql&gt; INSERT INTO linear_systems_test_data(id, lhs, rhs) VaLUES
(0, ARRAY[1,0,0], 20),
(1, ARRAY[0,1,0], 15),
(2, ARRAY[0,0,1], 20);
</pre></li>
<li>Solve the linear systems with default parameters <pre class="fragment">sql&gt; SELECT madlib.linear_solver_dense('linear_systems_test_data',
'output_table',
'id',
'lhs',
'rhs');
</pre></li>
<li>Obtain the output from the output table <pre class="fragment">sql&gt; SELECT * FROM output_table;
--------------------+-------------------------------------
solution | {20,15,20}
residual_norm | 0
iters | NULL
</pre></li>
<li>Chose a different algorithm than the default algorithm <pre class="fragment">drop table if exists result_table;
select madlib.linear_solver_dense(
'linear_systems_test_data',
'result_table',
'id',
'lhs',
'rhs',
NULL,
'direct',
'algorithm=llt'
);
</pre></li>
</ol>
</dd></dl>
<dl class="section see"><dt>See Also</dt><dd>File dense_linear_sytems.sql_in documenting the SQL functions. </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 Wed Aug 21 2013 16:09:52 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>