commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ericbarnh...@apache.org
Subject [18/51] [partial] commons-complex git commit: First commit to commons-complex
Date Wed, 04 Jan 2017 10:05:28 GMT
http://git-wip-us.apache.org/repos/asf/commons-complex/blob/b0db8fca/site-content/.svn/pristine/04/0400f403db78a35ecc7c09ac8968ab156cf0bd43.svn-base
----------------------------------------------------------------------
diff --git a/site-content/.svn/pristine/04/0400f403db78a35ecc7c09ac8968ab156cf0bd43.svn-base b/site-content/.svn/pristine/04/0400f403db78a35ecc7c09ac8968ab156cf0bd43.svn-base
new file mode 100644
index 0000000..c90851c
--- /dev/null
+++ b/site-content/.svn/pristine/04/0400f403db78a35ecc7c09ac8968ab156cf0bd43.svn-base
@@ -0,0 +1,247 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!-- NewPage -->
+<html lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>ValueAndJacobianFunction (Apache Commons Math 3.6.1 API)</title>
+<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="ValueAndJacobianFunction (Apache Commons Math 3.6.1 API)";
+    }
+//-->
+</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/ValueAndJacobianFunction.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-all.html">Index</a></li>
+<li><a href="../../../../../../help-doc.html">Help</a></li>
+</ul>
+<div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div>
+</div>
+<div class="subNav">
+<ul class="navList">
+<li><a href="../../../../../../org/apache/commons/math3/fitting/leastsquares/ParameterValidator.html" title="interface in org.apache.commons.math3.fitting.leastsquares"><span class="strong">Prev Class</span></a></li>
+<li>Next Class</li>
+</ul>
+<ul class="navList">
+<li><a href="../../../../../../index.html?org/apache/commons/math3/fitting/leastsquares/ValueAndJacobianFunction.html" target="_top">Frames</a></li>
+<li><a href="ValueAndJacobianFunction.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>Field&nbsp;|&nbsp;</li>
+<li>Constr&nbsp;|&nbsp;</li>
+<li><a href="#method_summary">Method</a></li>
+</ul>
+<ul class="subNavList">
+<li>Detail:&nbsp;</li>
+<li>Field&nbsp;|&nbsp;</li>
+<li>Constr&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">org.apache.commons.math3.fitting.leastsquares</div>
+<h2 title="Interface ValueAndJacobianFunction" class="title">Interface ValueAndJacobianFunction</h2>
+</div>
+<div class="contentContainer">
+<div class="description">
+<ul class="blockList">
+<li class="blockList">
+<dl>
+<dt>All Superinterfaces:</dt>
+<dd><a href="../../../../../../org/apache/commons/math3/fitting/leastsquares/MultivariateJacobianFunction.html" title="interface in org.apache.commons.math3.fitting.leastsquares">MultivariateJacobianFunction</a></dd>
+</dl>
+<hr>
+<br>
+<pre>public interface <a href="../../../../../../src-html/org/apache/commons/math3/fitting/leastsquares/ValueAndJacobianFunction.html#line.28">ValueAndJacobianFunction</a>
+extends <a href="../../../../../../org/apache/commons/math3/fitting/leastsquares/MultivariateJacobianFunction.html" title="interface in org.apache.commons.math3.fitting.leastsquares">MultivariateJacobianFunction</a></pre>
+<div class="block">A interface for functions that compute a vector of values and can compute their
+ derivatives (Jacobian).</div>
+<dl><dt><span class="strong">Since:</span></dt>
+  <dd>3.4</dd></dl>
+</li>
+</ul>
+</div>
+<div class="summary">
+<ul class="blockList">
+<li class="blockList">
+<!-- ========== 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><a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a></code></td>
+<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/fitting/leastsquares/ValueAndJacobianFunction.html#computeJacobian(double[])">computeJacobian</a></strong>(double[]&nbsp;params)</code>
+<div class="block">Compute the Jacobian.</div>
+</td>
+</tr>
+<tr class="rowColor">
+<td class="colFirst"><code><a href="../../../../../../org/apache/commons/math3/linear/RealVector.html" title="class in org.apache.commons.math3.linear">RealVector</a></code></td>
+<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/fitting/leastsquares/ValueAndJacobianFunction.html#computeValue(double[])">computeValue</a></strong>(double[]&nbsp;params)</code>
+<div class="block">Compute the value.</div>
+</td>
+</tr>
+</table>
+<ul class="blockList">
+<li class="blockList"><a name="methods_inherited_from_class_org.apache.commons.math3.fitting.leastsquares.MultivariateJacobianFunction">
+<!--   -->
+</a>
+<h3>Methods inherited from interface&nbsp;org.apache.commons.math3.fitting.leastsquares.<a href="../../../../../../org/apache/commons/math3/fitting/leastsquares/MultivariateJacobianFunction.html" title="interface in org.apache.commons.math3.fitting.leastsquares">MultivariateJacobianFunction</a></h3>
+<code><a href="../../../../../../org/apache/commons/math3/fitting/leastsquares/MultivariateJacobianFunction.html#value(org.apache.commons.math3.linear.RealVector)">value</a></code></li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</div>
+<div class="details">
+<ul class="blockList">
+<li class="blockList">
+<!-- ============ METHOD DETAIL ========== -->
+<ul class="blockList">
+<li class="blockList"><a name="method_detail">
+<!--   -->
+</a>
+<h3>Method Detail</h3>
+<a name="computeValue(double[])">
+<!--   -->
+</a>
+<ul class="blockList">
+<li class="blockList">
+<h4>computeValue</h4>
+<pre><a href="../../../../../../org/apache/commons/math3/linear/RealVector.html" title="class in org.apache.commons.math3.linear">RealVector</a>&nbsp;<a href="../../../../../../src-html/org/apache/commons/math3/fitting/leastsquares/ValueAndJacobianFunction.html#line.35">computeValue</a>(double[]&nbsp;params)</pre>
+<div class="block">Compute the value.</div>
+<dl><dt><span class="strong">Parameters:</span></dt><dd><code>params</code> - Point.</dd>
+<dt><span class="strong">Returns:</span></dt><dd>the value at the given point.</dd></dl>
+</li>
+</ul>
+<a name="computeJacobian(double[])">
+<!--   -->
+</a>
+<ul class="blockListLast">
+<li class="blockList">
+<h4>computeJacobian</h4>
+<pre><a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a>&nbsp;<a href="../../../../../../src-html/org/apache/commons/math3/fitting/leastsquares/ValueAndJacobianFunction.html#line.43">computeJacobian</a>(double[]&nbsp;params)</pre>
+<div class="block">Compute the Jacobian.</div>
+<dl><dt><span class="strong">Parameters:</span></dt><dd><code>params</code> - Point.</dd>
+<dt><span class="strong">Returns:</span></dt><dd>the Jacobian at the given point.</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/ValueAndJacobianFunction.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-all.html">Index</a></li>
+<li><a href="../../../../../../help-doc.html">Help</a></li>
+</ul>
+<div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div>
+</div>
+<div class="subNav">
+<ul class="navList">
+<li><a href="../../../../../../org/apache/commons/math3/fitting/leastsquares/ParameterValidator.html" title="interface in org.apache.commons.math3.fitting.leastsquares"><span class="strong">Prev Class</span></a></li>
+<li>Next Class</li>
+</ul>
+<ul class="navList">
+<li><a href="../../../../../../index.html?org/apache/commons/math3/fitting/leastsquares/ValueAndJacobianFunction.html" target="_top">Frames</a></li>
+<li><a href="ValueAndJacobianFunction.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>Field&nbsp;|&nbsp;</li>
+<li>Constr&nbsp;|&nbsp;</li>
+<li><a href="#method_summary">Method</a></li>
+</ul>
+<ul class="subNavList">
+<li>Detail:&nbsp;</li>
+<li>Field&nbsp;|&nbsp;</li>
+<li>Constr&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>Copyright &#169; 2003&#x2013;2016 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/commons-complex/blob/b0db8fca/site-content/.svn/pristine/04/0408a9222bbb2ed0a2dc0d095371a6aec9f05114.svn-base
----------------------------------------------------------------------
diff --git a/site-content/.svn/pristine/04/0408a9222bbb2ed0a2dc0d095371a6aec9f05114.svn-base b/site-content/.svn/pristine/04/0408a9222bbb2ed0a2dc0d095371a6aec9f05114.svn-base
new file mode 100644
index 0000000..2685b76
--- /dev/null
+++ b/site-content/.svn/pristine/04/0408a9222bbb2ed0a2dc0d095371a6aec9f05114.svn-base
@@ -0,0 +1,219 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+<title>Source code</title>
+<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">
+</head>
+<body>
+<div class="sourceContainer">
+<pre><span class="sourceLineNo">001</span>/*<a name="line.1"></a>
+<span class="sourceLineNo">002</span> * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<span class="sourceLineNo">003</span> * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<span class="sourceLineNo">004</span> * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<span class="sourceLineNo">005</span> * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<span class="sourceLineNo">006</span> * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<span class="sourceLineNo">007</span> * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<span class="sourceLineNo">008</span> *<a name="line.8"></a>
+<span class="sourceLineNo">009</span> *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<span class="sourceLineNo">010</span> *<a name="line.10"></a>
+<span class="sourceLineNo">011</span> * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<span class="sourceLineNo">012</span> * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<span class="sourceLineNo">013</span> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<span class="sourceLineNo">014</span> * See the License for the specific language governing permissions and<a name="line.14"></a>
+<span class="sourceLineNo">015</span> * limitations under the License.<a name="line.15"></a>
+<span class="sourceLineNo">016</span> */<a name="line.16"></a>
+<span class="sourceLineNo">017</span>package org.apache.commons.math3.analysis.interpolation;<a name="line.17"></a>
+<span class="sourceLineNo">018</span><a name="line.18"></a>
+<span class="sourceLineNo">019</span>import org.apache.commons.math3.exception.NonMonotonicSequenceException;<a name="line.19"></a>
+<span class="sourceLineNo">020</span>import org.apache.commons.math3.exception.DimensionMismatchException;<a name="line.20"></a>
+<span class="sourceLineNo">021</span>import org.apache.commons.math3.exception.NumberIsTooSmallException;<a name="line.21"></a>
+<span class="sourceLineNo">022</span>import org.apache.commons.math3.TestUtils;<a name="line.22"></a>
+<span class="sourceLineNo">023</span>import org.apache.commons.math3.analysis.UnivariateFunction;<a name="line.23"></a>
+<span class="sourceLineNo">024</span>import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;<a name="line.24"></a>
+<span class="sourceLineNo">025</span>import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction;<a name="line.25"></a>
+<span class="sourceLineNo">026</span>import org.junit.Assert;<a name="line.26"></a>
+<span class="sourceLineNo">027</span>import org.junit.Test;<a name="line.27"></a>
+<span class="sourceLineNo">028</span><a name="line.28"></a>
+<span class="sourceLineNo">029</span>/**<a name="line.29"></a>
+<span class="sourceLineNo">030</span> * Test the LinearInterpolator.<a name="line.30"></a>
+<span class="sourceLineNo">031</span> */<a name="line.31"></a>
+<span class="sourceLineNo">032</span>public class LinearInterpolatorTest {<a name="line.32"></a>
+<span class="sourceLineNo">033</span><a name="line.33"></a>
+<span class="sourceLineNo">034</span>    /** error tolerance for spline interpolator value at knot points */<a name="line.34"></a>
+<span class="sourceLineNo">035</span>    protected double knotTolerance = 1E-12;<a name="line.35"></a>
+<span class="sourceLineNo">036</span><a name="line.36"></a>
+<span class="sourceLineNo">037</span>    /** error tolerance for interpolating polynomial coefficients */<a name="line.37"></a>
+<span class="sourceLineNo">038</span>    protected double coefficientTolerance = 1E-6;<a name="line.38"></a>
+<span class="sourceLineNo">039</span><a name="line.39"></a>
+<span class="sourceLineNo">040</span>    /** error tolerance for interpolated values */<a name="line.40"></a>
+<span class="sourceLineNo">041</span>    protected double interpolationTolerance = 1E-12;<a name="line.41"></a>
+<span class="sourceLineNo">042</span><a name="line.42"></a>
+<span class="sourceLineNo">043</span>    @Test<a name="line.43"></a>
+<span class="sourceLineNo">044</span>    public void testInterpolateLinearDegenerateTwoSegment()<a name="line.44"></a>
+<span class="sourceLineNo">045</span>        {<a name="line.45"></a>
+<span class="sourceLineNo">046</span>        double x[] = { 0.0, 0.5, 1.0 };<a name="line.46"></a>
+<span class="sourceLineNo">047</span>        double y[] = { 0.0, 0.5, 1.0 };<a name="line.47"></a>
+<span class="sourceLineNo">048</span>        UnivariateInterpolator i = new LinearInterpolator();<a name="line.48"></a>
+<span class="sourceLineNo">049</span>        UnivariateFunction f = i.interpolate(x, y);<a name="line.49"></a>
+<span class="sourceLineNo">050</span>        verifyInterpolation(f, x, y);<a name="line.50"></a>
+<span class="sourceLineNo">051</span><a name="line.51"></a>
+<span class="sourceLineNo">052</span>        // Verify coefficients using analytical values<a name="line.52"></a>
+<span class="sourceLineNo">053</span>        PolynomialFunction polynomials[] = ((PolynomialSplineFunction) f).getPolynomials();<a name="line.53"></a>
+<span class="sourceLineNo">054</span>        double target[] = {y[0], 1d};<a name="line.54"></a>
+<span class="sourceLineNo">055</span>        TestUtils.assertEquals(polynomials[0].getCoefficients(), target, coefficientTolerance);<a name="line.55"></a>
+<span class="sourceLineNo">056</span>        target = new double[]{y[1], 1d};<a name="line.56"></a>
+<span class="sourceLineNo">057</span>        TestUtils.assertEquals(polynomials[1].getCoefficients(), target, coefficientTolerance);<a name="line.57"></a>
+<span class="sourceLineNo">058</span><a name="line.58"></a>
+<span class="sourceLineNo">059</span>        // Check interpolation<a name="line.59"></a>
+<span class="sourceLineNo">060</span>        Assert.assertEquals(0.0,f.value(0.0), interpolationTolerance);<a name="line.60"></a>
+<span class="sourceLineNo">061</span>        Assert.assertEquals(0.4,f.value(0.4), interpolationTolerance);<a name="line.61"></a>
+<span class="sourceLineNo">062</span>        Assert.assertEquals(1.0,f.value(1.0), interpolationTolerance);<a name="line.62"></a>
+<span class="sourceLineNo">063</span>    }<a name="line.63"></a>
+<span class="sourceLineNo">064</span><a name="line.64"></a>
+<span class="sourceLineNo">065</span>    @Test<a name="line.65"></a>
+<span class="sourceLineNo">066</span>    public void testInterpolateLinearDegenerateThreeSegment()<a name="line.66"></a>
+<span class="sourceLineNo">067</span>        {<a name="line.67"></a>
+<span class="sourceLineNo">068</span>        double x[] = { 0.0, 0.5, 1.0, 1.5 };<a name="line.68"></a>
+<span class="sourceLineNo">069</span>        double y[] = { 0.0, 0.5, 1.0, 1.5 };<a name="line.69"></a>
+<span class="sourceLineNo">070</span>        UnivariateInterpolator i = new LinearInterpolator();<a name="line.70"></a>
+<span class="sourceLineNo">071</span>        UnivariateFunction f = i.interpolate(x, y);<a name="line.71"></a>
+<span class="sourceLineNo">072</span>        verifyInterpolation(f, x, y);<a name="line.72"></a>
+<span class="sourceLineNo">073</span><a name="line.73"></a>
+<span class="sourceLineNo">074</span>        // Verify coefficients using analytical values<a name="line.74"></a>
+<span class="sourceLineNo">075</span>        PolynomialFunction polynomials[] = ((PolynomialSplineFunction) f).getPolynomials();<a name="line.75"></a>
+<span class="sourceLineNo">076</span>        double target[] = {y[0], 1d};<a name="line.76"></a>
+<span class="sourceLineNo">077</span>        TestUtils.assertEquals(polynomials[0].getCoefficients(), target, coefficientTolerance);<a name="line.77"></a>
+<span class="sourceLineNo">078</span>        target = new double[]{y[1], 1d};<a name="line.78"></a>
+<span class="sourceLineNo">079</span>        TestUtils.assertEquals(polynomials[1].getCoefficients(), target, coefficientTolerance);<a name="line.79"></a>
+<span class="sourceLineNo">080</span>        target = new double[]{y[2], 1d};<a name="line.80"></a>
+<span class="sourceLineNo">081</span>        TestUtils.assertEquals(polynomials[2].getCoefficients(), target, coefficientTolerance);<a name="line.81"></a>
+<span class="sourceLineNo">082</span><a name="line.82"></a>
+<span class="sourceLineNo">083</span>        // Check interpolation<a name="line.83"></a>
+<span class="sourceLineNo">084</span>        Assert.assertEquals(0,f.value(0), interpolationTolerance);<a name="line.84"></a>
+<span class="sourceLineNo">085</span>        Assert.assertEquals(1.4,f.value(1.4), interpolationTolerance);<a name="line.85"></a>
+<span class="sourceLineNo">086</span>        Assert.assertEquals(1.5,f.value(1.5), interpolationTolerance);<a name="line.86"></a>
+<span class="sourceLineNo">087</span>    }<a name="line.87"></a>
+<span class="sourceLineNo">088</span><a name="line.88"></a>
+<span class="sourceLineNo">089</span>    @Test<a name="line.89"></a>
+<span class="sourceLineNo">090</span>    public void testInterpolateLinear() {<a name="line.90"></a>
+<span class="sourceLineNo">091</span>        double x[] = { 0.0, 0.5, 1.0 };<a name="line.91"></a>
+<span class="sourceLineNo">092</span>        double y[] = { 0.0, 0.5, 0.0 };<a name="line.92"></a>
+<span class="sourceLineNo">093</span>        UnivariateInterpolator i = new LinearInterpolator();<a name="line.93"></a>
+<span class="sourceLineNo">094</span>        UnivariateFunction f = i.interpolate(x, y);<a name="line.94"></a>
+<span class="sourceLineNo">095</span>        verifyInterpolation(f, x, y);<a name="line.95"></a>
+<span class="sourceLineNo">096</span><a name="line.96"></a>
+<span class="sourceLineNo">097</span>        // Verify coefficients using analytical values<a name="line.97"></a>
+<span class="sourceLineNo">098</span>        PolynomialFunction polynomials[] = ((PolynomialSplineFunction) f).getPolynomials();<a name="line.98"></a>
+<span class="sourceLineNo">099</span>        double target[] = {y[0], 1d};<a name="line.99"></a>
+<span class="sourceLineNo">100</span>        TestUtils.assertEquals(polynomials[0].getCoefficients(), target, coefficientTolerance);<a name="line.100"></a>
+<span class="sourceLineNo">101</span>        target = new double[]{y[1], -1d};<a name="line.101"></a>
+<span class="sourceLineNo">102</span>        TestUtils.assertEquals(polynomials[1].getCoefficients(), target, coefficientTolerance);<a name="line.102"></a>
+<span class="sourceLineNo">103</span>    }<a name="line.103"></a>
+<span class="sourceLineNo">104</span><a name="line.104"></a>
+<span class="sourceLineNo">105</span>    @Test<a name="line.105"></a>
+<span class="sourceLineNo">106</span>    public void testIllegalArguments() {<a name="line.106"></a>
+<span class="sourceLineNo">107</span>        // Data set arrays of different size.<a name="line.107"></a>
+<span class="sourceLineNo">108</span>        UnivariateInterpolator i = new LinearInterpolator();<a name="line.108"></a>
+<span class="sourceLineNo">109</span>        try {<a name="line.109"></a>
+<span class="sourceLineNo">110</span>            double xval[] = { 0.0, 1.0 };<a name="line.110"></a>
+<span class="sourceLineNo">111</span>            double yval[] = { 0.0, 1.0, 2.0 };<a name="line.111"></a>
+<span class="sourceLineNo">112</span>            i.interpolate(xval, yval);<a name="line.112"></a>
+<span class="sourceLineNo">113</span>            Assert.fail("Failed to detect data set array with different sizes.");<a name="line.113"></a>
+<span class="sourceLineNo">114</span>        } catch (DimensionMismatchException iae) {<a name="line.114"></a>
+<span class="sourceLineNo">115</span>            // Expected.<a name="line.115"></a>
+<span class="sourceLineNo">116</span>        }<a name="line.116"></a>
+<span class="sourceLineNo">117</span>        // X values not sorted.<a name="line.117"></a>
+<span class="sourceLineNo">118</span>        try {<a name="line.118"></a>
+<span class="sourceLineNo">119</span>            double xval[] = { 0.0, 1.0, 0.5 };<a name="line.119"></a>
+<span class="sourceLineNo">120</span>            double yval[] = { 0.0, 1.0, 2.0 };<a name="line.120"></a>
+<span class="sourceLineNo">121</span>            i.interpolate(xval, yval);<a name="line.121"></a>
+<span class="sourceLineNo">122</span>            Assert.fail("Failed to detect unsorted arguments.");<a name="line.122"></a>
+<span class="sourceLineNo">123</span>        } catch (NonMonotonicSequenceException iae) {<a name="line.123"></a>
+<span class="sourceLineNo">124</span>            // Expected.<a name="line.124"></a>
+<span class="sourceLineNo">125</span>        }<a name="line.125"></a>
+<span class="sourceLineNo">126</span>        // Not enough data to interpolate.<a name="line.126"></a>
+<span class="sourceLineNo">127</span>        try {<a name="line.127"></a>
+<span class="sourceLineNo">128</span>            double xval[] = { 0.0 };<a name="line.128"></a>
+<span class="sourceLineNo">129</span>            double yval[] = { 0.0 };<a name="line.129"></a>
+<span class="sourceLineNo">130</span>            i.interpolate(xval, yval);<a name="line.130"></a>
+<span class="sourceLineNo">131</span>            Assert.fail("Failed to detect unsorted arguments.");<a name="line.131"></a>
+<span class="sourceLineNo">132</span>        } catch (NumberIsTooSmallException iae) {<a name="line.132"></a>
+<span class="sourceLineNo">133</span>            // Expected.<a name="line.133"></a>
+<span class="sourceLineNo">134</span>        }<a name="line.134"></a>
+<span class="sourceLineNo">135</span>    }<a name="line.135"></a>
+<span class="sourceLineNo">136</span><a name="line.136"></a>
+<span class="sourceLineNo">137</span>    /**<a name="line.137"></a>
+<span class="sourceLineNo">138</span>     * verifies that f(x[i]) = y[i] for i = 0..n-1 where n is common length.<a name="line.138"></a>
+<span class="sourceLineNo">139</span>     */<a name="line.139"></a>
+<span class="sourceLineNo">140</span>    protected void verifyInterpolation(UnivariateFunction f, double x[], double y[])<a name="line.140"></a>
+<span class="sourceLineNo">141</span>       {<a name="line.141"></a>
+<span class="sourceLineNo">142</span>        for (int i = 0; i &lt; x.length; i++) {<a name="line.142"></a>
+<span class="sourceLineNo">143</span>            Assert.assertEquals(f.value(x[i]), y[i], knotTolerance);<a name="line.143"></a>
+<span class="sourceLineNo">144</span>        }<a name="line.144"></a>
+<span class="sourceLineNo">145</span>    }<a name="line.145"></a>
+<span class="sourceLineNo">146</span><a name="line.146"></a>
+<span class="sourceLineNo">147</span>}<a name="line.147"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</pre>
+</div>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/commons-complex/blob/b0db8fca/site-content/.svn/pristine/04/040d8672c2f4c64bcb6d584b7bf1580b30bfbf82.svn-base
----------------------------------------------------------------------
diff --git a/site-content/.svn/pristine/04/040d8672c2f4c64bcb6d584b7bf1580b30bfbf82.svn-base b/site-content/.svn/pristine/04/040d8672c2f4c64bcb6d584b7bf1580b30bfbf82.svn-base
new file mode 100644
index 0000000..bea8d6f
--- /dev/null
+++ b/site-content/.svn/pristine/04/040d8672c2f4c64bcb6d584b7bf1580b30bfbf82.svn-base
@@ -0,0 +1,117 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!-- NewPage -->
+<html lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
+<title>Uses of Class org.apache.commons.math3.geometry.euclidean.threed.PLYParser (Apache Commons Math 3.5 Test API)</title>
+<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="Uses of Class org.apache.commons.math3.geometry.euclidean.threed.PLYParser (Apache Commons Math 3.5 Test API)";
+    }
+//-->
+</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><a href="../../../../../../../../org/apache/commons/math3/geometry/euclidean/threed/PLYParser.html" title="class in org.apache.commons.math3.geometry.euclidean.threed">Class</a></li>
+<li class="navBarCell1Rev">Use</li>
+<li><a href="../package-tree.html">Tree</a></li>
+<li><a href="../../../../../../../../deprecated-list.html">Deprecated</a></li>
+<li><a href="../../../../../../../../index-all.html">Index</a></li>
+<li><a href="../../../../../../../../help-doc.html">Help</a></li>
+</ul>
+<div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div>
+</div>
+<div class="subNav">
+<ul class="navList">
+<li>PREV</li>
+<li>NEXT</li>
+</ul>
+<ul class="navList">
+<li><a href="../../../../../../../../index.html?org/apache/commons/math3/geometry/euclidean/threed//class-usePLYParser.html" target="_top">FRAMES</a></li>
+<li><a href="PLYParser.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>
+<a name="skip-navbar_top">
+<!--   -->
+</a></div>
+<!-- ========= END OF TOP NAVBAR ========= -->
+<div class="header">
+<h2 title="Uses of Class org.apache.commons.math3.geometry.euclidean.threed.PLYParser" class="title">Uses of Class<br>org.apache.commons.math3.geometry.euclidean.threed.PLYParser</h2>
+</div>
+<div class="classUseContainer">No usage of org.apache.commons.math3.geometry.euclidean.threed.PLYParser</div>
+<!-- ======= 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><a href="../../../../../../../../org/apache/commons/math3/geometry/euclidean/threed/PLYParser.html" title="class in org.apache.commons.math3.geometry.euclidean.threed">Class</a></li>
+<li class="navBarCell1Rev">Use</li>
+<li><a href="../package-tree.html">Tree</a></li>
+<li><a href="../../../../../../../../deprecated-list.html">Deprecated</a></li>
+<li><a href="../../../../../../../../index-all.html">Index</a></li>
+<li><a href="../../../../../../../../help-doc.html">Help</a></li>
+</ul>
+<div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div>
+</div>
+<div class="subNav">
+<ul class="navList">
+<li>PREV</li>
+<li>NEXT</li>
+</ul>
+<ul class="navList">
+<li><a href="../../../../../../../../index.html?org/apache/commons/math3/geometry/euclidean/threed//class-usePLYParser.html" target="_top">FRAMES</a></li>
+<li><a href="PLYParser.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>
+<a name="skip-navbar_bottom">
+<!--   -->
+</a></div>
+<!-- ======== END OF BOTTOM NAVBAR ======= -->
+<p class="legalCopy"><small>Copyright &#169; 2003&#x2013;2015 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/commons-complex/blob/b0db8fca/site-content/.svn/pristine/04/04143e6999813b2e28d1fed504f92a10d8ab1cfa.svn-base
----------------------------------------------------------------------
diff --git a/site-content/.svn/pristine/04/04143e6999813b2e28d1fed504f92a10d8ab1cfa.svn-base b/site-content/.svn/pristine/04/04143e6999813b2e28d1fed504f92a10d8ab1cfa.svn-base
new file mode 100644
index 0000000..163badb
--- /dev/null
+++ b/site-content/.svn/pristine/04/04143e6999813b2e28d1fed504f92a10d8ab1cfa.svn-base
@@ -0,0 +1,367 @@
+<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>LogNormalDistribution.java</title><link rel="stylesheet" href="../.resources/prettify.css" type="text/css"/><script type="text/javascript" src="../.resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons Math</a> &gt; <a href="index.source.html" class="el_package">org.apache.commons.math3.distribution</a> &gt; <span class="el_source">LogNormalDistr
 ibution.java</span></div><h1>LogNormalDistribution.java</h1><pre class="source lang-java linenums">/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the &quot;License&quot;); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math3.distribution;
+
+import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math3.exception.NumberIsTooLargeException;
+import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math3.random.RandomGenerator;
+import org.apache.commons.math3.random.Well19937c;
+import org.apache.commons.math3.special.Erf;
+import org.apache.commons.math3.util.FastMath;
+
+/**
+ * Implementation of the log-normal (gaussian) distribution.
+ *
+ * &lt;p&gt;
+ * &lt;strong&gt;Parameters:&lt;/strong&gt;
+ * {@code X} is log-normally distributed if its natural logarithm {@code log(X)}
+ * is normally distributed. The probability distribution function of {@code X}
+ * is given by (for {@code x &gt; 0})
+ * &lt;/p&gt;
+ * &lt;p&gt;
+ * {@code exp(-0.5 * ((ln(x) - m) / s)^2) / (s * sqrt(2 * pi) * x)}
+ * &lt;/p&gt;
+ * &lt;ul&gt;
+ * &lt;li&gt;{@code m} is the &lt;em&gt;scale&lt;/em&gt; parameter: this is the mean of the
+ * normally distributed natural logarithm of this distribution,&lt;/li&gt;
+ * &lt;li&gt;{@code s} is the &lt;em&gt;shape&lt;/em&gt; parameter: this is the standard
+ * deviation of the normally distributed natural logarithm of this
+ * distribution.
+ * &lt;/ul&gt;
+ *
+ * @see &lt;a href=&quot;http://en.wikipedia.org/wiki/Log-normal_distribution&quot;&gt;
+ * Log-normal distribution (Wikipedia)&lt;/a&gt;
+ * @see &lt;a href=&quot;http://mathworld.wolfram.com/LogNormalDistribution.html&quot;&gt;
+ * Log Normal distribution (MathWorld)&lt;/a&gt;
+ *
+ * @since 3.0
+ */
+public class LogNormalDistribution extends AbstractRealDistribution {
+    /** Default inverse cumulative probability accuracy. */
+    public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
+
+    /** Serializable version identifier. */
+    private static final long serialVersionUID = 20120112;
+
+    /** &amp;radic;(2 &amp;pi;) */
+<span class="fc" id="L63">    private static final double SQRT2PI = FastMath.sqrt(2 * FastMath.PI);</span>
+
+    /** &amp;radic;(2) */
+<span class="fc" id="L66">    private static final double SQRT2 = FastMath.sqrt(2.0);</span>
+
+    /** The scale parameter of this distribution. */
+    private final double scale;
+
+    /** The shape parameter of this distribution. */
+    private final double shape;
+    /** The value of {@code log(shape) + 0.5 * log(2*PI)} stored for faster computation. */
+    private final double logShapePlusHalfLog2Pi;
+
+    /** Inverse cumulative probability accuracy. */
+    private final double solverAbsoluteAccuracy;
+
+    /**
+     * Create a log-normal distribution, where the mean and standard deviation
+     * of the {@link NormalDistribution normally distributed} natural
+     * logarithm of the log-normal distribution are equal to zero and one
+     * respectively. In other words, the scale of the returned distribution is
+     * {@code 0}, while its shape is {@code 1}.
+     * &lt;p&gt;
+     * &lt;b&gt;Note:&lt;/b&gt; this constructor will implicitly create an instance of
+     * {@link Well19937c} as random generator to be used for sampling only (see
+     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
+     * needed for the created distribution, it is advised to pass {@code null}
+     * as random generator via the appropriate constructors to avoid the
+     * additional initialisation overhead.
+     */
+    public LogNormalDistribution() {
+<span class="nc" id="L94">        this(0, 1);</span>
+<span class="nc" id="L95">    }</span>
+
+    /**
+     * Create a log-normal distribution using the specified scale and shape.
+     * &lt;p&gt;
+     * &lt;b&gt;Note:&lt;/b&gt; this constructor will implicitly create an instance of
+     * {@link Well19937c} as random generator to be used for sampling only (see
+     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
+     * needed for the created distribution, it is advised to pass {@code null}
+     * as random generator via the appropriate constructors to avoid the
+     * additional initialisation overhead.
+     *
+     * @param scale the scale parameter of this distribution
+     * @param shape the shape parameter of this distribution
+     * @throws NotStrictlyPositiveException if {@code shape &lt;= 0}.
+     */
+    public LogNormalDistribution(double scale, double shape)
+        throws NotStrictlyPositiveException {
+<span class="fc" id="L113">        this(scale, shape, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);</span>
+<span class="fc" id="L114">    }</span>
+
+    /**
+     * Create a log-normal distribution using the specified scale, shape and
+     * inverse cumulative distribution accuracy.
+     * &lt;p&gt;
+     * &lt;b&gt;Note:&lt;/b&gt; this constructor will implicitly create an instance of
+     * {@link Well19937c} as random generator to be used for sampling only (see
+     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
+     * needed for the created distribution, it is advised to pass {@code null}
+     * as random generator via the appropriate constructors to avoid the
+     * additional initialisation overhead.
+     *
+     * @param scale the scale parameter of this distribution
+     * @param shape the shape parameter of this distribution
+     * @param inverseCumAccuracy Inverse cumulative probability accuracy.
+     * @throws NotStrictlyPositiveException if {@code shape &lt;= 0}.
+     */
+    public LogNormalDistribution(double scale, double shape, double inverseCumAccuracy)
+        throws NotStrictlyPositiveException {
+<span class="fc" id="L134">        this(new Well19937c(), scale, shape, inverseCumAccuracy);</span>
+<span class="fc" id="L135">    }</span>
+
+    /**
+     * Creates a log-normal distribution.
+     *
+     * @param rng Random number generator.
+     * @param scale Scale parameter of this distribution.
+     * @param shape Shape parameter of this distribution.
+     * @throws NotStrictlyPositiveException if {@code shape &lt;= 0}.
+     * @since 3.3
+     */
+    public LogNormalDistribution(RandomGenerator rng, double scale, double shape)
+        throws NotStrictlyPositiveException {
+<span class="fc" id="L148">        this(rng, scale, shape, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);</span>
+<span class="fc" id="L149">    }</span>
+
+    /**
+     * Creates a log-normal distribution.
+     *
+     * @param rng Random number generator.
+     * @param scale Scale parameter of this distribution.
+     * @param shape Shape parameter of this distribution.
+     * @param inverseCumAccuracy Inverse cumulative probability accuracy.
+     * @throws NotStrictlyPositiveException if {@code shape &lt;= 0}.
+     * @since 3.1
+     */
+    public LogNormalDistribution(RandomGenerator rng,
+                                 double scale,
+                                 double shape,
+                                 double inverseCumAccuracy)
+        throws NotStrictlyPositiveException {
+<span class="fc" id="L166">        super(rng);</span>
+
+<span class="fc bfc" id="L168" title="All 2 branches covered.">        if (shape &lt;= 0) {</span>
+<span class="fc" id="L169">            throw new NotStrictlyPositiveException(LocalizedFormats.SHAPE, shape);</span>
+        }
+
+<span class="fc" id="L172">        this.scale = scale;</span>
+<span class="fc" id="L173">        this.shape = shape;</span>
+<span class="fc" id="L174">        this.logShapePlusHalfLog2Pi = FastMath.log(shape) + 0.5 * FastMath.log(2 * FastMath.PI);</span>
+<span class="fc" id="L175">        this.solverAbsoluteAccuracy = inverseCumAccuracy;</span>
+<span class="fc" id="L176">    }</span>
+
+    /**
+     * Returns the scale parameter of this distribution.
+     *
+     * @return the scale parameter
+     */
+    public double getScale() {
+<span class="fc" id="L184">        return scale;</span>
+    }
+
+    /**
+     * Returns the shape parameter of this distribution.
+     *
+     * @return the shape parameter
+     */
+    public double getShape() {
+<span class="fc" id="L193">        return shape;</span>
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * For scale {@code m}, and shape {@code s} of this distribution, the PDF
+     * is given by
+     * &lt;ul&gt;
+     * &lt;li&gt;{@code 0} if {@code x &lt;= 0},&lt;/li&gt;
+     * &lt;li&gt;{@code exp(-0.5 * ((ln(x) - m) / s)^2) / (s * sqrt(2 * pi) * x)}
+     * otherwise.&lt;/li&gt;
+     * &lt;/ul&gt;
+     */
+    public double density(double x) {
+<span class="fc bfc" id="L208" title="All 2 branches covered.">        if (x &lt;= 0) {</span>
+<span class="fc" id="L209">            return 0;</span>
+        }
+<span class="fc" id="L211">        final double x0 = FastMath.log(x) - scale;</span>
+<span class="fc" id="L212">        final double x1 = x0 / shape;</span>
+<span class="fc" id="L213">        return FastMath.exp(-0.5 * x1 * x1) / (shape * SQRT2PI * x);</span>
+    }
+
+    /** {@inheritDoc}
+     *
+     * See documentation of {@link #density(double)} for computation details.
+     */
+    @Override
+    public double logDensity(double x) {
+<span class="fc bfc" id="L222" title="All 2 branches covered.">        if (x &lt;= 0) {</span>
+<span class="fc" id="L223">            return Double.NEGATIVE_INFINITY;</span>
+        }
+<span class="fc" id="L225">        final double logX = FastMath.log(x);</span>
+<span class="fc" id="L226">        final double x0 = logX - scale;</span>
+<span class="fc" id="L227">        final double x1 = x0 / shape;</span>
+<span class="fc" id="L228">        return -0.5 * x1 * x1 - (logShapePlusHalfLog2Pi + logX);</span>
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * For scale {@code m}, and shape {@code s} of this distribution, the CDF
+     * is given by
+     * &lt;ul&gt;
+     * &lt;li&gt;{@code 0} if {@code x &lt;= 0},&lt;/li&gt;
+     * &lt;li&gt;{@code 0} if {@code ln(x) - m &lt; 0} and {@code m - ln(x) &gt; 40 * s}, as
+     * in these cases the actual value is within {@code Double.MIN_VALUE} of 0,
+     * &lt;li&gt;{@code 1} if {@code ln(x) - m &gt;= 0} and {@code ln(x) - m &gt; 40 * s},
+     * as in these cases the actual value is within {@code Double.MIN_VALUE} of
+     * 1,&lt;/li&gt;
+     * &lt;li&gt;{@code 0.5 + 0.5 * erf((ln(x) - m) / (s * sqrt(2))} otherwise.&lt;/li&gt;
+     * &lt;/ul&gt;
+     */
+    public double cumulativeProbability(double x)  {
+<span class="fc bfc" id="L247" title="All 2 branches covered.">        if (x &lt;= 0) {</span>
+<span class="fc" id="L248">            return 0;</span>
+        }
+<span class="fc" id="L250">        final double dev = FastMath.log(x) - scale;</span>
+<span class="fc bfc" id="L251" title="All 2 branches covered.">        if (FastMath.abs(dev) &gt; 40 * shape) {</span>
+<span class="pc bpc" id="L252" title="1 of 2 branches missed.">            return dev &lt; 0 ? 0.0d : 1.0d;</span>
+        }
+<span class="fc" id="L254">        return 0.5 + 0.5 * Erf.erf(dev / (shape * SQRT2));</span>
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * @deprecated See {@link RealDistribution#cumulativeProbability(double,double)}
+     */
+    @Override@Deprecated
+    public double cumulativeProbability(double x0, double x1)
+        throws NumberIsTooLargeException {
+<span class="fc" id="L265">        return probability(x0, x1);</span>
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public double probability(double x0,
+                              double x1)
+        throws NumberIsTooLargeException {
+<span class="fc bfc" id="L273" title="All 2 branches covered.">        if (x0 &gt; x1) {</span>
+<span class="fc" id="L274">            throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,</span>
+                                                x0, x1, true);
+        }
+<span class="pc bpc" id="L277" title="1 of 4 branches missed.">        if (x0 &lt;= 0 || x1 &lt;= 0) {</span>
+<span class="fc" id="L278">            return super.probability(x0, x1);</span>
+        }
+<span class="fc" id="L280">        final double denom = shape * SQRT2;</span>
+<span class="fc" id="L281">        final double v0 = (FastMath.log(x0) - scale) / denom;</span>
+<span class="fc" id="L282">        final double v1 = (FastMath.log(x1) - scale) / denom;</span>
+<span class="fc" id="L283">        return 0.5 * Erf.erf(v0, v1);</span>
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected double getSolverAbsoluteAccuracy() {
+<span class="fc" id="L289">        return solverAbsoluteAccuracy;</span>
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * For scale {@code m} and shape {@code s}, the mean is
+     * {@code exp(m + s^2 / 2)}.
+     */
+    public double getNumericalMean() {
+<span class="fc" id="L299">        double s = shape;</span>
+<span class="fc" id="L300">        return FastMath.exp(scale + (s * s / 2));</span>
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * For scale {@code m} and shape {@code s}, the variance is
+     * {@code (exp(s^2) - 1) * exp(2 * m + s^2)}.
+     */
+    public double getNumericalVariance() {
+<span class="fc" id="L310">        final double s = shape;</span>
+<span class="fc" id="L311">        final double ss = s * s;</span>
+<span class="fc" id="L312">        return (FastMath.expm1(ss)) * FastMath.exp(2 * scale + ss);</span>
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * The lower bound of the support is always 0 no matter the parameters.
+     *
+     * @return lower bound of the support (always 0)
+     */
+    public double getSupportLowerBound() {
+<span class="fc" id="L323">        return 0;</span>
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * The upper bound of the support is always positive infinity
+     * no matter the parameters.
+     *
+     * @return upper bound of the support (always
+     * {@code Double.POSITIVE_INFINITY})
+     */
+    public double getSupportUpperBound() {
+<span class="fc" id="L336">        return Double.POSITIVE_INFINITY;</span>
+    }
+
+    /** {@inheritDoc} */
+    public boolean isSupportLowerBoundInclusive() {
+<span class="fc" id="L341">        return true;</span>
+    }
+
+    /** {@inheritDoc} */
+    public boolean isSupportUpperBoundInclusive() {
+<span class="fc" id="L346">        return false;</span>
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * The support of this distribution is connected.
+     *
+     * @return {@code true}
+     */
+    public boolean isSupportConnected() {
+<span class="fc" id="L357">        return true;</span>
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public double sample()  {
+<span class="fc" id="L363">        final double n = random.nextGaussian();</span>
+<span class="fc" id="L364">        return FastMath.exp(scale + shape * n);</span>
+    }
+}
+</pre><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.5.201505241946</span></div></body></html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/commons-complex/blob/b0db8fca/site-content/.svn/pristine/04/041ddc1c191707212f28b391f180201164050cf6.svn-base
----------------------------------------------------------------------
diff --git a/site-content/.svn/pristine/04/041ddc1c191707212f28b391f180201164050cf6.svn-base b/site-content/.svn/pristine/04/041ddc1c191707212f28b391f180201164050cf6.svn-base
new file mode 100644
index 0000000..733f6c3
--- /dev/null
+++ b/site-content/.svn/pristine/04/041ddc1c191707212f28b391f180201164050cf6.svn-base
@@ -0,0 +1,454 @@
+<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>SchurTransformer.java</title><link rel="stylesheet" href="../.resources/prettify.css" type="text/css"/><script type="text/javascript" src="../.resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons Math</a> &gt; <a href="index.source.html" class="el_package">org.apache.commons.math3.linear</a> &gt; <span class="el_source">SchurTransformer.java</sp
 an></div><h1>SchurTransformer.java</h1><pre class="source lang-java linenums">/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the &quot;License&quot;); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math3.linear;
+
+import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math3.util.Precision;
+
+/**
+ * Class transforming a general real matrix to Schur form.
+ * &lt;p&gt;A m &amp;times; m matrix A can be written as the product of three matrices: A = P
+ * &amp;times; T &amp;times; P&lt;sup&gt;T&lt;/sup&gt; with P an orthogonal matrix and T an quasi-triangular
+ * matrix. Both P and T are m &amp;times; m matrices.&lt;/p&gt;
+ * &lt;p&gt;Transformation to Schur form is often not a goal by itself, but it is an
+ * intermediate step in more general decomposition algorithms like
+ * {@link EigenDecomposition eigen decomposition}. This class is therefore
+ * intended for internal use by the library and is not public. As a consequence
+ * of this explicitly limited scope, many methods directly returns references to
+ * internal arrays, not copies.&lt;/p&gt;
+ * &lt;p&gt;This class is based on the method hqr2 in class EigenvalueDecomposition
+ * from the &lt;a href=&quot;http://math.nist.gov/javanumerics/jama/&quot;&gt;JAMA&lt;/a&gt; library.&lt;/p&gt;
+ *
+ * @see &lt;a href=&quot;http://mathworld.wolfram.com/SchurDecomposition.html&quot;&gt;Schur Decomposition - MathWorld&lt;/a&gt;
+ * @see &lt;a href=&quot;http://en.wikipedia.org/wiki/Schur_decomposition&quot;&gt;Schur Decomposition - Wikipedia&lt;/a&gt;
+ * @see &lt;a href=&quot;http://en.wikipedia.org/wiki/Householder_transformation&quot;&gt;Householder Transformations&lt;/a&gt;
+ * @since 3.1
+ */
+class SchurTransformer {
+    /** Maximum allowed iterations for convergence of the transformation. */
+    private static final int MAX_ITERATIONS = 100;
+
+    /** P matrix. */
+    private final double matrixP[][];
+    /** T matrix. */
+    private final double matrixT[][];
+    /** Cached value of P. */
+    private RealMatrix cachedP;
+    /** Cached value of T. */
+    private RealMatrix cachedT;
+    /** Cached value of PT. */
+    private RealMatrix cachedPt;
+
+    /** Epsilon criteria taken from JAMA code (originally was 2^-52). */
+<span class="fc" id="L60">    private final double epsilon = Precision.EPSILON;</span>
+
+    /**
+     * Build the transformation to Schur form of a general real matrix.
+     *
+     * @param matrix matrix to transform
+     * @throws NonSquareMatrixException if the matrix is not square
+     */
+<span class="fc" id="L68">    SchurTransformer(final RealMatrix matrix) {</span>
+<span class="fc bfc" id="L69" title="All 2 branches covered.">        if (!matrix.isSquare()) {</span>
+<span class="fc" id="L70">            throw new NonSquareMatrixException(matrix.getRowDimension(),</span>
+                                               matrix.getColumnDimension());
+        }
+
+<span class="fc" id="L74">        HessenbergTransformer transformer = new HessenbergTransformer(matrix);</span>
+<span class="fc" id="L75">        matrixT = transformer.getH().getData();</span>
+<span class="fc" id="L76">        matrixP = transformer.getP().getData();</span>
+<span class="fc" id="L77">        cachedT = null;</span>
+<span class="fc" id="L78">        cachedP = null;</span>
+<span class="fc" id="L79">        cachedPt = null;</span>
+
+        // transform matrix
+<span class="fc" id="L82">        transform();</span>
+<span class="fc" id="L83">    }</span>
+
+    /**
+     * Returns the matrix P of the transform.
+     * &lt;p&gt;P is an orthogonal matrix, i.e. its inverse is also its transpose.&lt;/p&gt;
+     *
+     * @return the P matrix
+     */
+    public RealMatrix getP() {
+<span class="fc bfc" id="L92" title="All 2 branches covered.">        if (cachedP == null) {</span>
+<span class="fc" id="L93">            cachedP = MatrixUtils.createRealMatrix(matrixP);</span>
+        }
+<span class="fc" id="L95">        return cachedP;</span>
+    }
+
+    /**
+     * Returns the transpose of the matrix P of the transform.
+     * &lt;p&gt;P is an orthogonal matrix, i.e. its inverse is also its transpose.&lt;/p&gt;
+     *
+     * @return the transpose of the P matrix
+     */
+    public RealMatrix getPT() {
+<span class="pc bpc" id="L105" title="1 of 2 branches missed.">        if (cachedPt == null) {</span>
+<span class="fc" id="L106">            cachedPt = getP().transpose();</span>
+        }
+
+        // return the cached matrix
+<span class="fc" id="L110">        return cachedPt;</span>
+    }
+
+    /**
+     * Returns the quasi-triangular Schur matrix T of the transform.
+     *
+     * @return the T matrix
+     */
+    public RealMatrix getT() {
+<span class="fc bfc" id="L119" title="All 2 branches covered.">        if (cachedT == null) {</span>
+<span class="fc" id="L120">            cachedT = MatrixUtils.createRealMatrix(matrixT);</span>
+        }
+
+        // return the cached matrix
+<span class="fc" id="L124">        return cachedT;</span>
+    }
+
+    /**
+     * Transform original matrix to Schur form.
+     * @throws MaxCountExceededException if the transformation does not converge
+     */
+    private void transform() {
+<span class="fc" id="L132">        final int n = matrixT.length;</span>
+
+        // compute matrix norm
+<span class="fc" id="L135">        final double norm = getNorm();</span>
+
+        // shift information
+<span class="fc" id="L138">        final ShiftInfo shift = new ShiftInfo();</span>
+
+        // Outer loop over eigenvalue index
+<span class="fc" id="L141">        int iteration = 0;</span>
+<span class="fc" id="L142">        int iu = n - 1;</span>
+<span class="fc bfc" id="L143" title="All 2 branches covered.">        while (iu &gt;= 0) {</span>
+
+            // Look for single small sub-diagonal element
+<span class="fc" id="L146">            final int il = findSmallSubDiagonalElement(iu, norm);</span>
+
+            // Check for convergence
+<span class="fc bfc" id="L149" title="All 2 branches covered.">            if (il == iu) {</span>
+                // One root found
+<span class="fc" id="L151">                matrixT[iu][iu] += shift.exShift;</span>
+<span class="fc" id="L152">                iu--;</span>
+<span class="fc" id="L153">                iteration = 0;</span>
+<span class="fc bfc" id="L154" title="All 2 branches covered.">            } else if (il == iu - 1) {</span>
+                // Two roots found
+<span class="fc" id="L156">                double p = (matrixT[iu - 1][iu - 1] - matrixT[iu][iu]) / 2.0;</span>
+<span class="fc" id="L157">                double q = p * p + matrixT[iu][iu - 1] * matrixT[iu - 1][iu];</span>
+<span class="fc" id="L158">                matrixT[iu][iu] += shift.exShift;</span>
+<span class="fc" id="L159">                matrixT[iu - 1][iu - 1] += shift.exShift;</span>
+
+<span class="fc bfc" id="L161" title="All 2 branches covered.">                if (q &gt;= 0) {</span>
+<span class="fc" id="L162">                    double z = FastMath.sqrt(FastMath.abs(q));</span>
+<span class="fc bfc" id="L163" title="All 2 branches covered.">                    if (p &gt;= 0) {</span>
+<span class="fc" id="L164">                        z = p + z;</span>
+                    } else {
+<span class="fc" id="L166">                        z = p - z;</span>
+                    }
+<span class="fc" id="L168">                    final double x = matrixT[iu][iu - 1];</span>
+<span class="fc" id="L169">                    final double s = FastMath.abs(x) + FastMath.abs(z);</span>
+<span class="fc" id="L170">                    p = x / s;</span>
+<span class="fc" id="L171">                    q = z / s;</span>
+<span class="fc" id="L172">                    final double r = FastMath.sqrt(p * p + q * q);</span>
+<span class="fc" id="L173">                    p /= r;</span>
+<span class="fc" id="L174">                    q /= r;</span>
+
+                    // Row modification
+<span class="fc bfc" id="L177" title="All 2 branches covered.">                    for (int j = iu - 1; j &lt; n; j++) {</span>
+<span class="fc" id="L178">                        z = matrixT[iu - 1][j];</span>
+<span class="fc" id="L179">                        matrixT[iu - 1][j] = q * z + p * matrixT[iu][j];</span>
+<span class="fc" id="L180">                        matrixT[iu][j] = q * matrixT[iu][j] - p * z;</span>
+                    }
+
+                    // Column modification
+<span class="fc bfc" id="L184" title="All 2 branches covered.">                    for (int i = 0; i &lt;= iu; i++) {</span>
+<span class="fc" id="L185">                        z = matrixT[i][iu - 1];</span>
+<span class="fc" id="L186">                        matrixT[i][iu - 1] = q * z + p * matrixT[i][iu];</span>
+<span class="fc" id="L187">                        matrixT[i][iu] = q * matrixT[i][iu] - p * z;</span>
+                    }
+
+                    // Accumulate transformations
+<span class="fc bfc" id="L191" title="All 2 branches covered.">                    for (int i = 0; i &lt;= n - 1; i++) {</span>
+<span class="fc" id="L192">                        z = matrixP[i][iu - 1];</span>
+<span class="fc" id="L193">                        matrixP[i][iu - 1] = q * z + p * matrixP[i][iu];</span>
+<span class="fc" id="L194">                        matrixP[i][iu] = q * matrixP[i][iu] - p * z;</span>
+                    }
+                }
+<span class="fc" id="L197">                iu -= 2;</span>
+<span class="fc" id="L198">                iteration = 0;</span>
+<span class="fc" id="L199">            } else {</span>
+                // No convergence yet
+<span class="fc" id="L201">                computeShift(il, iu, iteration, shift);</span>
+
+                // stop transformation after too many iterations
+<span class="pc bpc" id="L204" title="1 of 2 branches missed.">                if (++iteration &gt; MAX_ITERATIONS) {</span>
+<span class="nc" id="L205">                    throw new MaxCountExceededException(LocalizedFormats.CONVERGENCE_FAILED,</span>
+                                                        MAX_ITERATIONS);
+                }
+
+                // the initial houseHolder vector for the QR step
+<span class="fc" id="L210">                final double[] hVec = new double[3];</span>
+
+<span class="fc" id="L212">                final int im = initQRStep(il, iu, shift, hVec);</span>
+<span class="fc" id="L213">                performDoubleQRStep(il, im, iu, shift, hVec);</span>
+            }
+<span class="fc" id="L215">        }</span>
+<span class="fc" id="L216">    }</span>
+
+    /**
+     * Computes the L1 norm of the (quasi-)triangular matrix T.
+     *
+     * @return the L1 norm of matrix T
+     */
+    private double getNorm() {
+<span class="fc" id="L224">        double norm = 0.0;</span>
+<span class="fc bfc" id="L225" title="All 2 branches covered.">        for (int i = 0; i &lt; matrixT.length; i++) {</span>
+            // as matrix T is (quasi-)triangular, also take the sub-diagonal element into account
+<span class="fc bfc" id="L227" title="All 2 branches covered.">            for (int j = FastMath.max(i - 1, 0); j &lt; matrixT.length; j++) {</span>
+<span class="fc" id="L228">                norm += FastMath.abs(matrixT[i][j]);</span>
+            }
+        }
+<span class="fc" id="L231">        return norm;</span>
+    }
+
+    /**
+     * Find the first small sub-diagonal element and returns its index.
+     *
+     * @param startIdx the starting index for the search
+     * @param norm the L1 norm of the matrix
+     * @return the index of the first small sub-diagonal element
+     */
+    private int findSmallSubDiagonalElement(final int startIdx, final double norm) {
+<span class="fc" id="L242">        int l = startIdx;</span>
+<span class="fc bfc" id="L243" title="All 2 branches covered.">        while (l &gt; 0) {</span>
+<span class="fc" id="L244">            double s = FastMath.abs(matrixT[l - 1][l - 1]) + FastMath.abs(matrixT[l][l]);</span>
+<span class="fc bfc" id="L245" title="All 2 branches covered.">            if (s == 0.0) {</span>
+<span class="fc" id="L246">                s = norm;</span>
+            }
+<span class="fc bfc" id="L248" title="All 2 branches covered.">            if (FastMath.abs(matrixT[l][l - 1]) &lt; epsilon * s) {</span>
+<span class="fc" id="L249">                break;</span>
+            }
+<span class="fc" id="L251">            l--;</span>
+<span class="fc" id="L252">        }</span>
+<span class="fc" id="L253">        return l;</span>
+    }
+
+    /**
+     * Compute the shift for the current iteration.
+     *
+     * @param l the index of the small sub-diagonal element
+     * @param idx the current eigenvalue index
+     * @param iteration the current iteration
+     * @param shift holder for shift information
+     */
+    private void computeShift(final int l, final int idx, final int iteration, final ShiftInfo shift) {
+        // Form shift
+<span class="fc" id="L266">        shift.x = matrixT[idx][idx];</span>
+<span class="fc" id="L267">        shift.y = shift.w = 0.0;</span>
+<span class="pc bpc" id="L268" title="1 of 2 branches missed.">        if (l &lt; idx) {</span>
+<span class="fc" id="L269">            shift.y = matrixT[idx - 1][idx - 1];</span>
+<span class="fc" id="L270">            shift.w = matrixT[idx][idx - 1] * matrixT[idx - 1][idx];</span>
+        }
+
+        // Wilkinson's original ad hoc shift
+<span class="fc bfc" id="L274" title="All 2 branches covered.">        if (iteration == 10) {</span>
+<span class="fc" id="L275">            shift.exShift += shift.x;</span>
+<span class="fc bfc" id="L276" title="All 2 branches covered.">            for (int i = 0; i &lt;= idx; i++) {</span>
+<span class="fc" id="L277">                matrixT[i][i] -= shift.x;</span>
+            }
+<span class="fc" id="L279">            final double s = FastMath.abs(matrixT[idx][idx - 1]) + FastMath.abs(matrixT[idx - 1][idx - 2]);</span>
+<span class="fc" id="L280">            shift.x = 0.75 * s;</span>
+<span class="fc" id="L281">            shift.y = 0.75 * s;</span>
+<span class="fc" id="L282">            shift.w = -0.4375 * s * s;</span>
+        }
+
+        // MATLAB's new ad hoc shift
+<span class="fc bfc" id="L286" title="All 2 branches covered.">        if (iteration == 30) {</span>
+<span class="fc" id="L287">            double s = (shift.y - shift.x) / 2.0;</span>
+<span class="fc" id="L288">            s = s * s + shift.w;</span>
+<span class="pc bpc" id="L289" title="1 of 2 branches missed.">            if (s &gt; 0.0) {</span>
+<span class="fc" id="L290">                s = FastMath.sqrt(s);</span>
+<span class="pc bpc" id="L291" title="1 of 2 branches missed.">                if (shift.y &lt; shift.x) {</span>
+<span class="fc" id="L292">                    s = -s;</span>
+                }
+<span class="fc" id="L294">                s = shift.x - shift.w / ((shift.y - shift.x) / 2.0 + s);</span>
+<span class="fc bfc" id="L295" title="All 2 branches covered.">                for (int i = 0; i &lt;= idx; i++) {</span>
+<span class="fc" id="L296">                    matrixT[i][i] -= s;</span>
+                }
+<span class="fc" id="L298">                shift.exShift += s;</span>
+<span class="fc" id="L299">                shift.x = shift.y = shift.w = 0.964;</span>
+            }
+        }
+<span class="fc" id="L302">    }</span>
+
+    /**
+     * Initialize the householder vectors for the QR step.
+     *
+     * @param il the index of the small sub-diagonal element
+     * @param iu the current eigenvalue index
+     * @param shift shift information holder
+     * @param hVec the initial houseHolder vector
+     * @return the start index for the QR step
+     */
+    private int initQRStep(int il, final int iu, final ShiftInfo shift, double[] hVec) {
+        // Look for two consecutive small sub-diagonal elements
+<span class="fc" id="L315">        int im = iu - 2;</span>
+<span class="pc bpc" id="L316" title="1 of 2 branches missed.">        while (im &gt;= il) {</span>
+<span class="fc" id="L317">            final double z = matrixT[im][im];</span>
+<span class="fc" id="L318">            final double r = shift.x - z;</span>
+<span class="fc" id="L319">            double s = shift.y - z;</span>
+<span class="fc" id="L320">            hVec[0] = (r * s - shift.w) / matrixT[im + 1][im] + matrixT[im][im + 1];</span>
+<span class="fc" id="L321">            hVec[1] = matrixT[im + 1][im + 1] - z - r - s;</span>
+<span class="fc" id="L322">            hVec[2] = matrixT[im + 2][im + 1];</span>
+
+<span class="fc bfc" id="L324" title="All 2 branches covered.">            if (im == il) {</span>
+<span class="fc" id="L325">                break;</span>
+            }
+
+<span class="fc" id="L328">            final double lhs = FastMath.abs(matrixT[im][im - 1]) * (FastMath.abs(hVec[1]) + FastMath.abs(hVec[2]));</span>
+<span class="fc" id="L329">            final double rhs = FastMath.abs(hVec[0]) * (FastMath.abs(matrixT[im - 1][im - 1]) +</span>
+                                                        FastMath.abs(z) +
+                                                        FastMath.abs(matrixT[im + 1][im + 1]));
+
+<span class="fc bfc" id="L333" title="All 2 branches covered.">            if (lhs &lt; epsilon * rhs) {</span>
+<span class="fc" id="L334">                break;</span>
+            }
+<span class="fc" id="L336">            im--;</span>
+<span class="fc" id="L337">        }</span>
+
+<span class="fc" id="L339">        return im;</span>
+    }
+
+    /**
+     * Perform a double QR step involving rows l:idx and columns m:n
+     *
+     * @param il the index of the small sub-diagonal element
+     * @param im the start index for the QR step
+     * @param iu the current eigenvalue index
+     * @param shift shift information holder
+     * @param hVec the initial houseHolder vector
+     */
+    private void performDoubleQRStep(final int il, final int im, final int iu,
+                                     final ShiftInfo shift, final double[] hVec) {
+
+<span class="fc" id="L354">        final int n = matrixT.length;</span>
+<span class="fc" id="L355">        double p = hVec[0];</span>
+<span class="fc" id="L356">        double q = hVec[1];</span>
+<span class="fc" id="L357">        double r = hVec[2];</span>
+
+<span class="fc bfc" id="L359" title="All 2 branches covered.">        for (int k = im; k &lt;= iu - 1; k++) {</span>
+<span class="fc bfc" id="L360" title="All 2 branches covered.">            boolean notlast = k != (iu - 1);</span>
+<span class="fc bfc" id="L361" title="All 2 branches covered.">            if (k != im) {</span>
+<span class="fc" id="L362">                p = matrixT[k][k - 1];</span>
+<span class="fc" id="L363">                q = matrixT[k + 1][k - 1];</span>
+<span class="fc bfc" id="L364" title="All 2 branches covered.">                r = notlast ? matrixT[k + 2][k - 1] : 0.0;</span>
+<span class="fc" id="L365">                shift.x = FastMath.abs(p) + FastMath.abs(q) + FastMath.abs(r);</span>
+<span class="fc bfc" id="L366" title="All 2 branches covered.">                if (Precision.equals(shift.x, 0.0, epsilon)) {</span>
+<span class="fc" id="L367">                    continue;</span>
+                }
+<span class="fc" id="L369">                p /= shift.x;</span>
+<span class="fc" id="L370">                q /= shift.x;</span>
+<span class="fc" id="L371">                r /= shift.x;</span>
+            }
+<span class="fc" id="L373">            double s = FastMath.sqrt(p * p + q * q + r * r);</span>
+<span class="fc bfc" id="L374" title="All 2 branches covered.">            if (p &lt; 0.0) {</span>
+<span class="fc" id="L375">                s = -s;</span>
+            }
+<span class="pc bpc" id="L377" title="1 of 2 branches missed.">            if (s != 0.0) {</span>
+<span class="fc bfc" id="L378" title="All 2 branches covered.">                if (k != im) {</span>
+<span class="fc" id="L379">                    matrixT[k][k - 1] = -s * shift.x;</span>
+<span class="fc bfc" id="L380" title="All 2 branches covered.">                } else if (il != im) {</span>
+<span class="fc" id="L381">                    matrixT[k][k - 1] = -matrixT[k][k - 1];</span>
+                }
+<span class="fc" id="L383">                p += s;</span>
+<span class="fc" id="L384">                shift.x = p / s;</span>
+<span class="fc" id="L385">                shift.y = q / s;</span>
+<span class="fc" id="L386">                double z = r / s;</span>
+<span class="fc" id="L387">                q /= p;</span>
+<span class="fc" id="L388">                r /= p;</span>
+
+                // Row modification
+<span class="fc bfc" id="L391" title="All 2 branches covered.">                for (int j = k; j &lt; n; j++) {</span>
+<span class="fc" id="L392">                    p = matrixT[k][j] + q * matrixT[k + 1][j];</span>
+<span class="fc bfc" id="L393" title="All 2 branches covered.">                    if (notlast) {</span>
+<span class="fc" id="L394">                        p += r * matrixT[k + 2][j];</span>
+<span class="fc" id="L395">                        matrixT[k + 2][j] -= p * z;</span>
+                    }
+<span class="fc" id="L397">                    matrixT[k][j] -= p * shift.x;</span>
+<span class="fc" id="L398">                    matrixT[k + 1][j] -= p * shift.y;</span>
+                }
+
+                // Column modification
+<span class="fc bfc" id="L402" title="All 2 branches covered.">                for (int i = 0; i &lt;= FastMath.min(iu, k + 3); i++) {</span>
+<span class="fc" id="L403">                    p = shift.x * matrixT[i][k] + shift.y * matrixT[i][k + 1];</span>
+<span class="fc bfc" id="L404" title="All 2 branches covered.">                    if (notlast) {</span>
+<span class="fc" id="L405">                        p += z * matrixT[i][k + 2];</span>
+<span class="fc" id="L406">                        matrixT[i][k + 2] -= p * r;</span>
+                    }
+<span class="fc" id="L408">                    matrixT[i][k] -= p;</span>
+<span class="fc" id="L409">                    matrixT[i][k + 1] -= p * q;</span>
+                }
+
+                // Accumulate transformations
+<span class="fc" id="L413">                final int high = matrixT.length - 1;</span>
+<span class="fc bfc" id="L414" title="All 2 branches covered.">                for (int i = 0; i &lt;= high; i++) {</span>
+<span class="fc" id="L415">                    p = shift.x * matrixP[i][k] + shift.y * matrixP[i][k + 1];</span>
+<span class="fc bfc" id="L416" title="All 2 branches covered.">                    if (notlast) {</span>
+<span class="fc" id="L417">                        p += z * matrixP[i][k + 2];</span>
+<span class="fc" id="L418">                        matrixP[i][k + 2] -= p * r;</span>
+                    }
+<span class="fc" id="L420">                    matrixP[i][k] -= p;</span>
+<span class="fc" id="L421">                    matrixP[i][k + 1] -= p * q;</span>
+                }
+            }  // (s != 0)
+        }  // k loop
+
+        // clean up pollution due to round-off errors
+<span class="fc bfc" id="L427" title="All 2 branches covered.">        for (int i = im + 2; i &lt;= iu; i++) {</span>
+<span class="fc" id="L428">            matrixT[i][i-2] = 0.0;</span>
+<span class="fc bfc" id="L429" title="All 2 branches covered.">            if (i &gt; im + 2) {</span>
+<span class="fc" id="L430">                matrixT[i][i-3] = 0.0;</span>
+            }
+        }
+<span class="fc" id="L433">    }</span>
+
+    /**
+     * Internal data structure holding the current shift information.
+     * Contains variable names as present in the original JAMA code.
+     */
+<span class="fc" id="L439">    private static class ShiftInfo {</span>
+        // CHECKSTYLE: stop all
+
+        /** x shift info */
+        double x;
+        /** y shift info */
+        double y;
+        /** w shift info */
+        double w;
+        /** Indicates an exceptional shift. */
+        double exShift;
+
+        // CHECKSTYLE: resume all
+    }
+}
+</pre><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.5.201505241946</span></div></body></html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/commons-complex/blob/b0db8fca/site-content/.svn/pristine/04/0431958e36e50ca1c5bd5c3b4eb5c0318d671c3c.svn-base
----------------------------------------------------------------------
diff --git a/site-content/.svn/pristine/04/0431958e36e50ca1c5bd5c3b4eb5c0318d671c3c.svn-base b/site-content/.svn/pristine/04/0431958e36e50ca1c5bd5c3b4eb5c0318d671c3c.svn-base
new file mode 100644
index 0000000..d410722
--- /dev/null
+++ b/site-content/.svn/pristine/04/0431958e36e50ca1c5bd5c3b4eb5c0318d671c3c.svn-base
@@ -0,0 +1,160 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+<title>Source code</title>
+<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">
+</head>
+<body>
+<div class="sourceContainer">
+<pre><span class="sourceLineNo">001</span>/*<a name="line.1"></a>
+<span class="sourceLineNo">002</span> * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<span class="sourceLineNo">003</span> * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<span class="sourceLineNo">004</span> * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<span class="sourceLineNo">005</span> * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<span class="sourceLineNo">006</span> * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<span class="sourceLineNo">007</span> * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<span class="sourceLineNo">008</span> *<a name="line.8"></a>
+<span class="sourceLineNo">009</span> *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<span class="sourceLineNo">010</span> *<a name="line.10"></a>
+<span class="sourceLineNo">011</span> * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<span class="sourceLineNo">012</span> * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<span class="sourceLineNo">013</span> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<span class="sourceLineNo">014</span> * See the License for the specific language governing permissions and<a name="line.14"></a>
+<span class="sourceLineNo">015</span> * limitations under the License.<a name="line.15"></a>
+<span class="sourceLineNo">016</span> */<a name="line.16"></a>
+<span class="sourceLineNo">017</span><a name="line.17"></a>
+<span class="sourceLineNo">018</span>package org.apache.commons.math3.analysis.differentiation;<a name="line.18"></a>
+<span class="sourceLineNo">019</span><a name="line.19"></a>
+<span class="sourceLineNo">020</span>import org.apache.commons.math3.TestUtils;<a name="line.20"></a>
+<span class="sourceLineNo">021</span>import org.apache.commons.math3.exception.DimensionMismatchException;<a name="line.21"></a>
+<span class="sourceLineNo">022</span>import org.apache.commons.math3.exception.MathIllegalArgumentException;<a name="line.22"></a>
+<span class="sourceLineNo">023</span>import org.apache.commons.math3.util.FastMath;<a name="line.23"></a>
+<span class="sourceLineNo">024</span>import org.junit.Test;<a name="line.24"></a>
+<span class="sourceLineNo">025</span><a name="line.25"></a>
+<span class="sourceLineNo">026</span><a name="line.26"></a>
+<span class="sourceLineNo">027</span>/**<a name="line.27"></a>
+<span class="sourceLineNo">028</span> * Test for class {@link GradientFunction}.<a name="line.28"></a>
+<span class="sourceLineNo">029</span> */<a name="line.29"></a>
+<span class="sourceLineNo">030</span>public class GradientFunctionTest {<a name="line.30"></a>
+<span class="sourceLineNo">031</span><a name="line.31"></a>
+<span class="sourceLineNo">032</span>    @Test<a name="line.32"></a>
+<span class="sourceLineNo">033</span>    public void test2DDistance() {<a name="line.33"></a>
+<span class="sourceLineNo">034</span>        EuclideanDistance f = new EuclideanDistance();<a name="line.34"></a>
+<span class="sourceLineNo">035</span>        GradientFunction g = new GradientFunction(f);<a name="line.35"></a>
+<span class="sourceLineNo">036</span>        for (double x = -10; x &lt; 10; x += 0.5) {<a name="line.36"></a>
+<span class="sourceLineNo">037</span>            for (double y = -10; y &lt; 10; y += 0.5) {<a name="line.37"></a>
+<span class="sourceLineNo">038</span>                double[] point = new double[] { x, y };<a name="line.38"></a>
+<span class="sourceLineNo">039</span>                TestUtils.assertEquals(f.gradient(point), g.value(point), 1.0e-15);<a name="line.39"></a>
+<span class="sourceLineNo">040</span>            }<a name="line.40"></a>
+<span class="sourceLineNo">041</span>        }<a name="line.41"></a>
+<span class="sourceLineNo">042</span>    }<a name="line.42"></a>
+<span class="sourceLineNo">043</span><a name="line.43"></a>
+<span class="sourceLineNo">044</span>    @Test<a name="line.44"></a>
+<span class="sourceLineNo">045</span>    public void test3DDistance() {<a name="line.45"></a>
+<span class="sourceLineNo">046</span>        EuclideanDistance f = new EuclideanDistance();<a name="line.46"></a>
+<span class="sourceLineNo">047</span>        GradientFunction g = new GradientFunction(f);<a name="line.47"></a>
+<span class="sourceLineNo">048</span>        for (double x = -10; x &lt; 10; x += 0.5) {<a name="line.48"></a>
+<span class="sourceLineNo">049</span>            for (double y = -10; y &lt; 10; y += 0.5) {<a name="line.49"></a>
+<span class="sourceLineNo">050</span>                for (double z = -10; z &lt; 10; z += 0.5) {<a name="line.50"></a>
+<span class="sourceLineNo">051</span>                    double[] point = new double[] { x, y, z };<a name="line.51"></a>
+<span class="sourceLineNo">052</span>                    TestUtils.assertEquals(f.gradient(point), g.value(point), 1.0e-15);<a name="line.52"></a>
+<span class="sourceLineNo">053</span>                }<a name="line.53"></a>
+<span class="sourceLineNo">054</span>            }<a name="line.54"></a>
+<span class="sourceLineNo">055</span>        }<a name="line.55"></a>
+<span class="sourceLineNo">056</span>    }<a name="line.56"></a>
+<span class="sourceLineNo">057</span><a name="line.57"></a>
+<span class="sourceLineNo">058</span>    private static class EuclideanDistance implements MultivariateDifferentiableFunction {<a name="line.58"></a>
+<span class="sourceLineNo">059</span>        <a name="line.59"></a>
+<span class="sourceLineNo">060</span>        public double value(double[] point) {<a name="line.60"></a>
+<span class="sourceLineNo">061</span>            double d2 = 0;<a name="line.61"></a>
+<span class="sourceLineNo">062</span>            for (double x : point) {<a name="line.62"></a>
+<span class="sourceLineNo">063</span>                d2 += x * x;<a name="line.63"></a>
+<span class="sourceLineNo">064</span>            }<a name="line.64"></a>
+<span class="sourceLineNo">065</span>            return FastMath.sqrt(d2);<a name="line.65"></a>
+<span class="sourceLineNo">066</span>        }<a name="line.66"></a>
+<span class="sourceLineNo">067</span>        <a name="line.67"></a>
+<span class="sourceLineNo">068</span>        public DerivativeStructure value(DerivativeStructure[] point)<a name="line.68"></a>
+<span class="sourceLineNo">069</span>            throws DimensionMismatchException, MathIllegalArgumentException {<a name="line.69"></a>
+<span class="sourceLineNo">070</span>            DerivativeStructure d2 = point[0].getField().getZero();<a name="line.70"></a>
+<span class="sourceLineNo">071</span>            for (DerivativeStructure x : point) {<a name="line.71"></a>
+<span class="sourceLineNo">072</span>                d2 = d2.add(x.multiply(x));<a name="line.72"></a>
+<span class="sourceLineNo">073</span>            }<a name="line.73"></a>
+<span class="sourceLineNo">074</span>            return d2.sqrt();<a name="line.74"></a>
+<span class="sourceLineNo">075</span>        }<a name="line.75"></a>
+<span class="sourceLineNo">076</span><a name="line.76"></a>
+<span class="sourceLineNo">077</span>        public double[] gradient(double[] point) {<a name="line.77"></a>
+<span class="sourceLineNo">078</span>            double[] gradient = new double[point.length];<a name="line.78"></a>
+<span class="sourceLineNo">079</span>            double d = value(point);<a name="line.79"></a>
+<span class="sourceLineNo">080</span>            for (int i = 0; i &lt; point.length; ++i) {<a name="line.80"></a>
+<span class="sourceLineNo">081</span>                gradient[i] = point[i] / d;<a name="line.81"></a>
+<span class="sourceLineNo">082</span>            }<a name="line.82"></a>
+<span class="sourceLineNo">083</span>            return gradient;<a name="line.83"></a>
+<span class="sourceLineNo">084</span>        }<a name="line.84"></a>
+<span class="sourceLineNo">085</span><a name="line.85"></a>
+<span class="sourceLineNo">086</span>    }<a name="line.86"></a>
+<span class="sourceLineNo">087</span><a name="line.87"></a>
+<span class="sourceLineNo">088</span>}<a name="line.88"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</pre>
+</div>
+</body>
+</html>


Mime
View raw message