Files
pj2/doc/edu/rit/numeric/NonNegativeLeastSquares.html
2016-04-27 01:07:35 -04:00

478 lines
20 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_51) on Wed Apr 06 13:11:04 EDT 2016 -->
<title>NonNegativeLeastSquares (Parallel Java 2 Library Documentation)</title>
<meta name="date" content="2016-04-06">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="NonNegativeLeastSquares (Parallel Java 2 Library Documentation)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/NonNegativeLeastSquares.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../edu/rit/numeric/NonLinearLeastSquares.html" title="class in edu.rit.numeric"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../edu/rit/numeric/NormalFit.html" title="class in edu.rit.numeric"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?edu/rit/numeric/NonNegativeLeastSquares.html" target="_top">Frames</a></li>
<li><a href="NonNegativeLeastSquares.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field_summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field_detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">edu.rit.numeric</div>
<h2 title="Class NonNegativeLeastSquares" class="title">Class NonNegativeLeastSquares</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>edu.rit.numeric.NonNegativeLeastSquares</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="strong">NonNegativeLeastSquares</span>
extends <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
<div class="block">Class NonNegativeLeastSquares provides a method for solving a least squares
minimization problem with nonnegativity constraints. The <TT>solve()</TT>
method finds an approximate solution to the linear system of equations
<B>Ax</B> = <B>b</B>, such that
||<B>Ax</B>&nbsp;-&nbsp;<B>b</B>||<SUP>2</SUP> is minimized, and such that
<B>x</B> &gt;= <B>0</B>. The inputs to and outputs from the <TT>solve()</TT>
method are stored in the fields of an instance of class
NonNegativeLeastSquares.
<P>
The Java code is a translation of the Fortran subroutine <TT>NNLS</TT> from
Charles L. Lawson and Richard J. Hanson, <I>Solving Least Squares
Problems</I> (Society for Industrial and Applied Mathematics, 1995), page
161.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double[][]</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/numeric/NonNegativeLeastSquares.html#a">a</a></strong></code>
<div class="block">The <I>M</I>x<I>N</I>-element <B>A</B> matrix for the least squares
problem.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>double[]</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/numeric/NonNegativeLeastSquares.html#b">b</a></strong></code>
<div class="block">The <I>M</I>-element <B>b</B> vector for the least squares problem.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int[]</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/numeric/NonNegativeLeastSquares.html#index">index</a></strong></code>
<div class="block">The <I>N</I>-element index vector.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/numeric/NonNegativeLeastSquares.html#M">M</a></strong></code>
<div class="block">The number of rows, typically the number of input data points, in the
least squares problem.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/numeric/NonNegativeLeastSquares.html#N">N</a></strong></code>
<div class="block">The number of columns, typically the number of output parameters, in the
least squares problem.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/numeric/NonNegativeLeastSquares.html#normsqr">normsqr</a></strong></code>
<div class="block">The squared Euclidean norm of the residual vector, ||<B>Ax</B> -
<B>b</B>||<SUP>2</SUP>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/numeric/NonNegativeLeastSquares.html#nsetp">nsetp</a></strong></code>
<div class="block">The number of elements in the set <I>P;</I> that is, the number of
positive values (inactive constraints).</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>double[]</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/numeric/NonNegativeLeastSquares.html#x">x</a></strong></code>
<div class="block">The <I>N</I>-element <B>x</B> vector for the least squares problem.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../edu/rit/numeric/NonNegativeLeastSquares.html#NonNegativeLeastSquares(int, int)">NonNegativeLeastSquares</a></strong>(int&nbsp;M,
int&nbsp;N)</code>
<div class="block">Construct a new nonnegative least squares problem of the given size.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/numeric/NonNegativeLeastSquares.html#solve()">solve</a></strong>()</code>
<div class="block">Solve this least squares minimization problem with nonnegativity
constraints.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="M">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>M</h4>
<pre>public final&nbsp;int M</pre>
<div class="block">The number of rows, typically the number of input data points, in the
least squares problem.</div>
</li>
</ul>
<a name="N">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>N</h4>
<pre>public final&nbsp;int N</pre>
<div class="block">The number of columns, typically the number of output parameters, in the
least squares problem.</div>
</li>
</ul>
<a name="a">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>a</h4>
<pre>public final&nbsp;double[][] a</pre>
<div class="block">The <I>M</I>x<I>N</I>-element <B>A</B> matrix for the least squares
problem. On input to the <TT>solve()</TT> method, <TT>a</TT> contains the
matrix <B>A</B>. On output, <TT>a</TT> has been replaced with <B>QA</B>,
where <B>Q</B> is an <I>M</I>x<I>M</I>-element orthogonal matrix
generated during the <TT>solve()</TT> method's execution.</div>
</li>
</ul>
<a name="b">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>b</h4>
<pre>public final&nbsp;double[] b</pre>
<div class="block">The <I>M</I>-element <B>b</B> vector for the least squares problem. On
input to the <TT>solve()</TT> method, <TT>b</TT> contains the vector
<B>b</B>. On output, <TT>b</TT> has been replaced with <B>Qb</B>, where
<B>Q</B> is an <I>M</I>x<I>M</I>-element orthogonal matrix generated
during the <TT>solve()</TT> method's execution.</div>
</li>
</ul>
<a name="x">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>x</h4>
<pre>public final&nbsp;double[] x</pre>
<div class="block">The <I>N</I>-element <B>x</B> vector for the least squares problem. On
output from the <TT>solve()</TT> method, <TT>x</TT> contains the solution
vector <B>x</B>.</div>
</li>
</ul>
<a name="index">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>index</h4>
<pre>public final&nbsp;int[] index</pre>
<div class="block">The <I>N</I>-element index vector. On output from the <TT>solve()</TT>
method: <TT>index[0]</TT> through <TT>index[nsetp-1]</TT> contain the
indexes of the elements in <B>x</B> that are in set <I>P,</I> the set of
positive values; that is, the elements that are not forced to be zero
(inactive constraints). <TT>index[nsetp]</TT> through <TT>index[N-1]</TT>
contain the indexes of the elements in <B>x</B> that are in set <I>Z,</I>
the set of zero values; that is, the elements that are forced to be zero
(active constraints).</div>
</li>
</ul>
<a name="nsetp">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>nsetp</h4>
<pre>public&nbsp;int nsetp</pre>
<div class="block">The number of elements in the set <I>P;</I> that is, the number of
positive values (inactive constraints). An output of the <TT>solve()</TT>
method.</div>
</li>
</ul>
<a name="normsqr">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>normsqr</h4>
<pre>public&nbsp;double normsqr</pre>
<div class="block">The squared Euclidean norm of the residual vector, ||<B>Ax</B> -
<B>b</B>||<SUP>2</SUP>. An output of the <TT>solve()</TT> method.</div>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="NonNegativeLeastSquares(int, int)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>NonNegativeLeastSquares</h4>
<pre>public&nbsp;NonNegativeLeastSquares(int&nbsp;M,
int&nbsp;N)</pre>
<div class="block">Construct a new nonnegative least squares problem of the given size.
Fields <TT>M</TT> and <TT>N</TT> are set to the given values. The array
fields <TT>a</TT>, <TT>b</TT>, <TT>x</TT>, and <TT>index</TT> are
allocated with the proper sizes but are not filled in.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>M</code> - Number of rows (input data points) in the least squares
problem.</dd><dd><code>N</code> - Number of columns (output parameters) in the least squares
problem.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - (unchecked exception) Thrown if <TT>M</TT> &lt;= 0 or <TT>N</TT>
&lt;= 0.</dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="solve()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>solve</h4>
<pre>public&nbsp;void&nbsp;solve()</pre>
<div class="block">Solve this least squares minimization problem with nonnegativity
constraints. The <TT>solve()</TT> method finds an approximate solution to
the linear system of equations <B>Ax</B> = <B>b</B>, such that
||<B>Ax</B>&nbsp;-&nbsp;<B>b</B>||<SUP>2</SUP> is minimized, and such
that <B>x</B> &gt;= <B>0</B>. On input, the field <TT>a</TT> must be
filled in with the matrix <B>A</B> and the field <TT>b</TT> must be
filled in with the vector <B>b</B> for the problem to be solved. On
output, the other fields are filled in with the solution as explained in
the documentation for each field.</div>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../edu/rit/numeric/TooManyIterationsException.html" title="class in edu.rit.numeric">TooManyIterationsException</a></code> - (unchecked exception) Thrown if too many iterations occurred without
finding a minimum (more than 3<I>N</I> iterations).</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/NonNegativeLeastSquares.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../edu/rit/numeric/NonLinearLeastSquares.html" title="class in edu.rit.numeric"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../edu/rit/numeric/NormalFit.html" title="class in edu.rit.numeric"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?edu/rit/numeric/NonNegativeLeastSquares.html" target="_top">Frames</a></li>
<li><a href="NonNegativeLeastSquares.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field_summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field_detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small><FONT SIZE="-2">Copyright &copy; 2013&ndash;2016 by Alan Kaminsky. All rights reserved. Send comments to ark</FONT><FONT SIZE="1" COLOR="#FFFFFF">&shy;</FONT><FONT SIZE="-2">&#64;</FONT><FONT SIZE="1" COLOR="#FFFFFF">&shy;</FONT><FONT SIZE="-2">cs.rit.edu.</FONT></small></p>
</body>
</html>