Propchange: websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/stat/descriptive/rank/Percentile.EstimationType.html ------------------------------------------------------------------------------ svn:eol-style = native
Propchange: websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/stat/descriptive/rank/Percentile.EstimationType.html ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/CentralPivotingStrategy.html ============================================================================== --- websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/CentralPivotingStrategy.html (added) +++ websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/CentralPivotingStrategy.html Sat Oct 18 20:10:38 2014 @@ -0,0 +1,118 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="fr"> +<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.util;<a name="line.17"></a> +<span class="sourceLineNo">018</span><a name="line.18"></a> +<span class="sourceLineNo">019</span>import java.io.Serializable;<a name="line.19"></a> +<span class="sourceLineNo">020</span><a name="line.20"></a> +<span class="sourceLineNo">021</span>import org.apache.commons.math3.exception.MathIllegalArgumentException;<a name="line.21"></a> +<span class="sourceLineNo">022</span><a name="line.22"></a> +<span class="sourceLineNo">023</span><a name="line.23"></a> +<span class="sourceLineNo">024</span>/**<a name="line.24"></a> +<span class="sourceLineNo">025</span> * A mid point strategy based on the average of begin and end indices.<a name="line.25"></a> +<span class="sourceLineNo">026</span> * @since 3.4<a name="line.26"></a> +<span class="sourceLineNo">027</span> */<a name="line.27"></a> +<span class="sourceLineNo">028</span>public class CentralPivotingStrategy implements PivotingStrategyInterface, Serializable {<a name="line.28"></a> +<span class="sourceLineNo">029</span><a name="line.29"></a> +<span class="sourceLineNo">030</span> /** Serializable UID. */<a name="line.30"></a> +<span class="sourceLineNo">031</span> private static final long serialVersionUID = 20140713L;<a name="line.31"></a> +<span class="sourceLineNo">032</span><a name="line.32"></a> +<span class="sourceLineNo">033</span> /**<a name="line.33"></a> +<span class="sourceLineNo">034</span> * {@inheritDoc}<a name="line.34"></a> +<span class="sourceLineNo">035</span> * This in particular picks a average of begin and end indices<a name="line.35"></a> +<span class="sourceLineNo">036</span> * @return The index corresponding to a simple average of<a name="line.36"></a> +<span class="sourceLineNo">037</span> * the first and the last element indices of the array slice<a name="line.37"></a> +<span class="sourceLineNo">038</span> * @throws MathIllegalArgumentException when indices exceeds range<a name="line.38"></a> +<span class="sourceLineNo">039</span> */<a name="line.39"></a> +<span class="sourceLineNo">040</span> public int pivotIndex(final double[] work, final int begin, final int end)<a name="line.40"></a> +<span class="sourceLineNo">041</span> throws MathIllegalArgumentException {<a name="line.41"></a> +<span class="sourceLineNo">042</span> MathArrays.verifyValues(work, begin, end-begin);<a name="line.42"></a> +<span class="sourceLineNo">043</span> return begin + (end - begin)/2;<a name="line.43"></a> +<span class="sourceLineNo">044</span> }<a name="line.44"></a> +<span class="sourceLineNo">045</span><a name="line.45"></a> +<span class="sourceLineNo">046</span>}<a name="line.46"></a> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</pre> +</div> +</body> +</html> Propchange: websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/CentralPivotingStrategy.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/CentralPivotingStrategy.html ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/KthSelector.html ============================================================================== --- websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/KthSelector.html (added) +++ websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/KthSelector.html Sat Oct 18 20:10:38 2014 @@ -0,0 +1,229 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="fr"> +<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.util;<a name="line.17"></a> +<span class="sourceLineNo">018</span><a name="line.18"></a> +<span class="sourceLineNo">019</span>import java.io.Serializable;<a name="line.19"></a> +<span class="sourceLineNo">020</span>import java.util.Arrays;<a name="line.20"></a> +<span class="sourceLineNo">021</span><a name="line.21"></a> +<span class="sourceLineNo">022</span>import org.apache.commons.math3.exception.NullArgumentException;<a name="line.22"></a> +<span class="sourceLineNo">023</span><a name="line.23"></a> +<span class="sourceLineNo">024</span><a name="line.24"></a> +<span class="sourceLineNo">025</span>/**<a name="line.25"></a> +<span class="sourceLineNo">026</span> * A Simple K<sup>th</sup> selector implementation to pick up the<a name="line.26"></a> +<span class="sourceLineNo">027</span> * K<sup>th</sup> ordered element from a work array containing the input<a name="line.27"></a> +<span class="sourceLineNo">028</span> * numbers.<a name="line.28"></a> +<span class="sourceLineNo">029</span> * @since 3.4<a name="line.29"></a> +<span class="sourceLineNo">030</span> */<a name="line.30"></a> +<span class="sourceLineNo">031</span>public class KthSelector implements Serializable {<a name="line.31"></a> +<span class="sourceLineNo">032</span><a name="line.32"></a> +<span class="sourceLineNo">033</span> /** Serializable UID. */<a name="line.33"></a> +<span class="sourceLineNo">034</span> private static final long serialVersionUID = 20140713L;<a name="line.34"></a> +<span class="sourceLineNo">035</span><a name="line.35"></a> +<span class="sourceLineNo">036</span> /** Minimum selection size for insertion sort rather than selection. */<a name="line.36"></a> +<span class="sourceLineNo">037</span> private static final int MIN_SELECT_SIZE = 15;<a name="line.37"></a> +<span class="sourceLineNo">038</span><a name="line.38"></a> +<span class="sourceLineNo">039</span> /** A {@link PivotingStrategyInterface} used for pivoting */<a name="line.39"></a> +<span class="sourceLineNo">040</span> private final PivotingStrategyInterface pivotingStrategy;<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> * Constructor with default {@link MedianOf3PivotingStrategy median of 3} pivoting strategy<a name="line.43"></a> +<span class="sourceLineNo">044</span> */<a name="line.44"></a> +<span class="sourceLineNo">045</span> public KthSelector() {<a name="line.45"></a> +<span class="sourceLineNo">046</span> this.pivotingStrategy = new MedianOf3PivotingStrategy();<a name="line.46"></a> +<span class="sourceLineNo">047</span> }<a name="line.47"></a> +<span class="sourceLineNo">048</span><a name="line.48"></a> +<span class="sourceLineNo">049</span> /**<a name="line.49"></a> +<span class="sourceLineNo">050</span> * Constructor with specified pivoting strategy<a name="line.50"></a> +<span class="sourceLineNo">051</span> *<a name="line.51"></a> +<span class="sourceLineNo">052</span> * @param pivotingStrategy pivoting strategy to use<a name="line.52"></a> +<span class="sourceLineNo">053</span> * @throws NullArgumentException when pivotingStrategy is null<a name="line.53"></a> +<span class="sourceLineNo">054</span> * @see MedianOf3PivotingStrategy<a name="line.54"></a> +<span class="sourceLineNo">055</span> * @see RandomPivotingStrategy<a name="line.55"></a> +<span class="sourceLineNo">056</span> * @see CentralPivotingStrategy<a name="line.56"></a> +<span class="sourceLineNo">057</span> */<a name="line.57"></a> +<span class="sourceLineNo">058</span> public KthSelector(final PivotingStrategyInterface pivotingStrategy)<a name="line.58"></a> +<span class="sourceLineNo">059</span> throws NullArgumentException {<a name="line.59"></a> +<span class="sourceLineNo">060</span> MathUtils.checkNotNull(pivotingStrategy);<a name="line.60"></a> +<span class="sourceLineNo">061</span> this.pivotingStrategy = pivotingStrategy;<a name="line.61"></a> +<span class="sourceLineNo">062</span> }<a name="line.62"></a> +<span class="sourceLineNo">063</span><a name="line.63"></a> +<span class="sourceLineNo">064</span> /** Get the pivotin strategy.<a name="line.64"></a> +<span class="sourceLineNo">065</span> * @return pivoting strategy<a name="line.65"></a> +<span class="sourceLineNo">066</span> */<a name="line.66"></a> +<span class="sourceLineNo">067</span> public PivotingStrategyInterface getPivotingStrategy() {<a name="line.67"></a> +<span class="sourceLineNo">068</span> return pivotingStrategy;<a name="line.68"></a> +<span class="sourceLineNo">069</span> }<a name="line.69"></a> +<span class="sourceLineNo">070</span><a name="line.70"></a> +<span class="sourceLineNo">071</span> /**<a name="line.71"></a> +<span class="sourceLineNo">072</span> * Select K<sup>th</sup> value in the array.<a name="line.72"></a> +<span class="sourceLineNo">073</span> *<a name="line.73"></a> +<span class="sourceLineNo">074</span> * @param work work array to use to find out the K<sup>th</sup> value<a name="line.74"></a> +<span class="sourceLineNo">075</span> * @param pivotsHeap cached pivots heap that can be used for efficient estimation<a name="line.75"></a> +<span class="sourceLineNo">076</span> * @param k the index whose value in the array is of interest<a name="line.76"></a> +<span class="sourceLineNo">077</span> * @return K<sup>th</sup> value<a name="line.77"></a> +<span class="sourceLineNo">078</span> */<a name="line.78"></a> +<span class="sourceLineNo">079</span> public double select(final double[] work, final int[] pivotsHeap, final int k) {<a name="line.79"></a> +<span class="sourceLineNo">080</span> int begin = 0;<a name="line.80"></a> +<span class="sourceLineNo">081</span> int end = work.length;<a name="line.81"></a> +<span class="sourceLineNo">082</span> int node = 0;<a name="line.82"></a> +<span class="sourceLineNo">083</span> final boolean usePivotsHeap = pivotsHeap != null;<a name="line.83"></a> +<span class="sourceLineNo">084</span> while (end - begin > MIN_SELECT_SIZE) {<a name="line.84"></a> +<span class="sourceLineNo">085</span> final int pivot;<a name="line.85"></a> +<span class="sourceLineNo">086</span><a name="line.86"></a> +<span class="sourceLineNo">087</span> if (usePivotsHeap && node < pivotsHeap.length &&<a name="line.87"></a> +<span class="sourceLineNo">088</span> pivotsHeap[node] >= 0) {<a name="line.88"></a> +<span class="sourceLineNo">089</span> // the pivot has already been found in a previous call<a name="line.89"></a> +<span class="sourceLineNo">090</span> // and the array has already been partitioned around it<a name="line.90"></a> +<span class="sourceLineNo">091</span> pivot = pivotsHeap[node];<a name="line.91"></a> +<span class="sourceLineNo">092</span> } else {<a name="line.92"></a> +<span class="sourceLineNo">093</span> // select a pivot and partition work array around it<a name="line.93"></a> +<span class="sourceLineNo">094</span> pivot = partition(work, begin, end, pivotingStrategy.pivotIndex(work, begin, end));<a name="line.94"></a> +<span class="sourceLineNo">095</span> if (usePivotsHeap && node < pivotsHeap.length) {<a name="line.95"></a> +<span class="sourceLineNo">096</span> pivotsHeap[node] = pivot;<a name="line.96"></a> +<span class="sourceLineNo">097</span> }<a name="line.97"></a> +<span class="sourceLineNo">098</span> }<a name="line.98"></a> +<span class="sourceLineNo">099</span><a name="line.99"></a> +<span class="sourceLineNo">100</span> if (k == pivot) {<a name="line.100"></a> +<span class="sourceLineNo">101</span> // the pivot was exactly the element we wanted<a name="line.101"></a> +<span class="sourceLineNo">102</span> return work[k];<a name="line.102"></a> +<span class="sourceLineNo">103</span> } else if (k < pivot) {<a name="line.103"></a> +<span class="sourceLineNo">104</span> // the element is in the left partition<a name="line.104"></a> +<span class="sourceLineNo">105</span> end = pivot;<a name="line.105"></a> +<span class="sourceLineNo">106</span> node = FastMath.min(2 * node + 1, usePivotsHeap ? pivotsHeap.length : end);<a name="line.106"></a> +<span class="sourceLineNo">107</span> } else {<a name="line.107"></a> +<span class="sourceLineNo">108</span> // the element is in the right partition<a name="line.108"></a> +<span class="sourceLineNo">109</span> begin = pivot + 1;<a name="line.109"></a> +<span class="sourceLineNo">110</span> node = FastMath.min(2 * node + 2, usePivotsHeap ? pivotsHeap.length : end);<a name="line.110"></a> +<span class="sourceLineNo">111</span> }<a name="line.111"></a> +<span class="sourceLineNo">112</span> }<a name="line.112"></a> +<span class="sourceLineNo">113</span> Arrays.sort(work, begin, end);<a name="line.113"></a> +<span class="sourceLineNo">114</span> return work[k];<a name="line.114"></a> +<span class="sourceLineNo">115</span> }<a name="line.115"></a> +<span class="sourceLineNo">116</span><a name="line.116"></a> +<span class="sourceLineNo">117</span> /**<a name="line.117"></a> +<span class="sourceLineNo">118</span> * Partition an array slice around a pivot.Partitioning exchanges array<a name="line.118"></a> +<span class="sourceLineNo">119</span> * elements such that all elements smaller than pivot are before it and<a name="line.119"></a> +<span class="sourceLineNo">120</span> * all elements larger than pivot are after it.<a name="line.120"></a> +<span class="sourceLineNo">121</span> *<a name="line.121"></a> +<span class="sourceLineNo">122</span> * @param work work array<a name="line.122"></a> +<span class="sourceLineNo">123</span> * @param begin index of the first element of the slice of work array<a name="line.123"></a> +<span class="sourceLineNo">124</span> * @param end index after the last element of the slice of work array<a name="line.124"></a> +<span class="sourceLineNo">125</span> * @param pivot initial index of the pivot<a name="line.125"></a> +<span class="sourceLineNo">126</span> * @return index of the pivot after partition<a name="line.126"></a> +<span class="sourceLineNo">127</span> */<a name="line.127"></a> +<span class="sourceLineNo">128</span> private int partition(final double[] work, final int begin, final int end, final int pivot) {<a name="line.128"></a> +<span class="sourceLineNo">129</span><a name="line.129"></a> +<span class="sourceLineNo">130</span> final double value = work[pivot];<a name="line.130"></a> +<span class="sourceLineNo">131</span> work[pivot] = work[begin];<a name="line.131"></a> +<span class="sourceLineNo">132</span><a name="line.132"></a> +<span class="sourceLineNo">133</span> int i = begin + 1;<a name="line.133"></a> +<span class="sourceLineNo">134</span> int j = end - 1;<a name="line.134"></a> +<span class="sourceLineNo">135</span> while (i < j) {<a name="line.135"></a> +<span class="sourceLineNo">136</span> while (i < j && work[j] > value) {<a name="line.136"></a> +<span class="sourceLineNo">137</span> --j;<a name="line.137"></a> +<span class="sourceLineNo">138</span> }<a name="line.138"></a> +<span class="sourceLineNo">139</span> while (i < j && work[i] < value) {<a name="line.139"></a> +<span class="sourceLineNo">140</span> ++i;<a name="line.140"></a> +<span class="sourceLineNo">141</span> }<a name="line.141"></a> +<span class="sourceLineNo">142</span><a name="line.142"></a> +<span class="sourceLineNo">143</span> if (i < j) {<a name="line.143"></a> +<span class="sourceLineNo">144</span> final double tmp = work[i];<a name="line.144"></a> +<span class="sourceLineNo">145</span> work[i++] = work[j];<a name="line.145"></a> +<span class="sourceLineNo">146</span> work[j--] = tmp;<a name="line.146"></a> +<span class="sourceLineNo">147</span> }<a name="line.147"></a> +<span class="sourceLineNo">148</span> }<a name="line.148"></a> +<span class="sourceLineNo">149</span><a name="line.149"></a> +<span class="sourceLineNo">150</span> if (i >= end || work[i] > value) {<a name="line.150"></a> +<span class="sourceLineNo">151</span> --i;<a name="line.151"></a> +<span class="sourceLineNo">152</span> }<a name="line.152"></a> +<span class="sourceLineNo">153</span> work[begin] = work[i];<a name="line.153"></a> +<span class="sourceLineNo">154</span> work[i] = value;<a name="line.154"></a> +<span class="sourceLineNo">155</span> return i;<a name="line.155"></a> +<span class="sourceLineNo">156</span> }<a name="line.156"></a> +<span class="sourceLineNo">157</span>}<a name="line.157"></a> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</pre> +</div> +</body> +</html> Propchange: websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/KthSelector.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/KthSelector.html ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/MedianOf3PivotingStrategy.html ============================================================================== --- websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/MedianOf3PivotingStrategy.html (added) +++ websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/MedianOf3PivotingStrategy.html Sat Oct 18 20:10:38 2014 @@ -0,0 +1,135 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="fr"> +<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.util;<a name="line.17"></a> +<span class="sourceLineNo">018</span><a name="line.18"></a> +<span class="sourceLineNo">019</span>import java.io.Serializable;<a name="line.19"></a> +<span class="sourceLineNo">020</span><a name="line.20"></a> +<span class="sourceLineNo">021</span>import org.apache.commons.math3.exception.MathIllegalArgumentException;<a name="line.21"></a> +<span class="sourceLineNo">022</span><a name="line.22"></a> +<span class="sourceLineNo">023</span><a name="line.23"></a> +<span class="sourceLineNo">024</span>/**<a name="line.24"></a> +<span class="sourceLineNo">025</span> * Classic median of 3 strategy given begin and end indices.<a name="line.25"></a> +<span class="sourceLineNo">026</span> * @since 3.4<a name="line.26"></a> +<span class="sourceLineNo">027</span> */<a name="line.27"></a> +<span class="sourceLineNo">028</span>public class MedianOf3PivotingStrategy implements PivotingStrategyInterface, Serializable {<a name="line.28"></a> +<span class="sourceLineNo">029</span><a name="line.29"></a> +<span class="sourceLineNo">030</span> /** Serializable UID. */<a name="line.30"></a> +<span class="sourceLineNo">031</span> private static final long serialVersionUID = 20140713L;<a name="line.31"></a> +<span class="sourceLineNo">032</span><a name="line.32"></a> +<span class="sourceLineNo">033</span> /**{@inheritDoc}<a name="line.33"></a> +<span class="sourceLineNo">034</span> * This in specific makes use of median of 3 pivoting.<a name="line.34"></a> +<span class="sourceLineNo">035</span> * @return The index corresponding to a pivot chosen between the<a name="line.35"></a> +<span class="sourceLineNo">036</span> * first, middle and the last indices of the array slice<a name="line.36"></a> +<span class="sourceLineNo">037</span> * @throws MathIllegalArgumentException when indices exceeds range<a name="line.37"></a> +<span class="sourceLineNo">038</span> */<a name="line.38"></a> +<span class="sourceLineNo">039</span> public int pivotIndex(final double[] work, final int begin, final int end)<a name="line.39"></a> +<span class="sourceLineNo">040</span> throws MathIllegalArgumentException {<a name="line.40"></a> +<span class="sourceLineNo">041</span> MathArrays.verifyValues(work, begin, end-begin);<a name="line.41"></a> +<span class="sourceLineNo">042</span> final int inclusiveEnd = end - 1;<a name="line.42"></a> +<span class="sourceLineNo">043</span> final int middle = begin + (inclusiveEnd - begin) / 2;<a name="line.43"></a> +<span class="sourceLineNo">044</span> final double wBegin = work[begin];<a name="line.44"></a> +<span class="sourceLineNo">045</span> final double wMiddle = work[middle];<a name="line.45"></a> +<span class="sourceLineNo">046</span> final double wEnd = work[inclusiveEnd];<a name="line.46"></a> +<span class="sourceLineNo">047</span><a name="line.47"></a> +<span class="sourceLineNo">048</span> if (wBegin < wMiddle) {<a name="line.48"></a> +<span class="sourceLineNo">049</span> if (wMiddle < wEnd) {<a name="line.49"></a> +<span class="sourceLineNo">050</span> return middle;<a name="line.50"></a> +<span class="sourceLineNo">051</span> } else {<a name="line.51"></a> +<span class="sourceLineNo">052</span> return wBegin < wEnd ? inclusiveEnd : begin;<a name="line.52"></a> +<span class="sourceLineNo">053</span> }<a name="line.53"></a> +<span class="sourceLineNo">054</span> } else {<a name="line.54"></a> +<span class="sourceLineNo">055</span> if (wBegin < wEnd) {<a name="line.55"></a> +<span class="sourceLineNo">056</span> return begin;<a name="line.56"></a> +<span class="sourceLineNo">057</span> } else {<a name="line.57"></a> +<span class="sourceLineNo">058</span> return wMiddle < wEnd ? inclusiveEnd : middle;<a name="line.58"></a> +<span class="sourceLineNo">059</span> }<a name="line.59"></a> +<span class="sourceLineNo">060</span> }<a name="line.60"></a> +<span class="sourceLineNo">061</span> }<a name="line.61"></a> +<span class="sourceLineNo">062</span><a name="line.62"></a> +<span class="sourceLineNo">063</span>}<a name="line.63"></a> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</pre> +</div> +</body> +</html> Propchange: websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/MedianOf3PivotingStrategy.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/MedianOf3PivotingStrategy.html ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/PivotingStrategyInterface.html ============================================================================== --- websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/PivotingStrategyInterface.html (added) +++ websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/PivotingStrategyInterface.html Sat Oct 18 20:10:38 2014 @@ -0,0 +1,116 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="fr"> +<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.util;<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.MathIllegalArgumentException;<a name="line.19"></a> +<span class="sourceLineNo">020</span><a name="line.20"></a> +<span class="sourceLineNo">021</span><a name="line.21"></a> +<span class="sourceLineNo">022</span>/**<a name="line.22"></a> +<span class="sourceLineNo">023</span> * A strategy to pick a pivoting index of an array for doing partitioning.<a name="line.23"></a> +<span class="sourceLineNo">024</span> * @see MedianOf3PivotingStrategy<a name="line.24"></a> +<span class="sourceLineNo">025</span> * @see RandomPivotingStrategy<a name="line.25"></a> +<span class="sourceLineNo">026</span> * @see CentralPivotingStrategy<a name="line.26"></a> +<span class="sourceLineNo">027</span> * @since 3.4<a name="line.27"></a> +<span class="sourceLineNo">028</span> */<a name="line.28"></a> +<span class="sourceLineNo">029</span>public interface PivotingStrategyInterface {<a name="line.29"></a> +<span class="sourceLineNo">030</span><a name="line.30"></a> +<span class="sourceLineNo">031</span> /**<a name="line.31"></a> +<span class="sourceLineNo">032</span> * Find pivot index of the array so that partition and K<sup>th</sup><a name="line.32"></a> +<span class="sourceLineNo">033</span> * element selection can be made<a name="line.33"></a> +<span class="sourceLineNo">034</span> * @param work data array<a name="line.34"></a> +<span class="sourceLineNo">035</span> * @param begin index of the first element of the slice<a name="line.35"></a> +<span class="sourceLineNo">036</span> * @param end index after the last element of the slice<a name="line.36"></a> +<span class="sourceLineNo">037</span> * @return the index of the pivot element chosen between the<a name="line.37"></a> +<span class="sourceLineNo">038</span> * first and the last element of the array slice<a name="line.38"></a> +<span class="sourceLineNo">039</span> * @throws MathIllegalArgumentException when indices exceeds range<a name="line.39"></a> +<span class="sourceLineNo">040</span> */<a name="line.40"></a> +<span class="sourceLineNo">041</span> int pivotIndex(double[] work, int begin, int end)<a name="line.41"></a> +<span class="sourceLineNo">042</span> throws MathIllegalArgumentException;<a name="line.42"></a> +<span class="sourceLineNo">043</span><a name="line.43"></a> +<span class="sourceLineNo">044</span>}<a name="line.44"></a> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</pre> +</div> +</body> +</html> Propchange: websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/PivotingStrategyInterface.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/PivotingStrategyInterface.html ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/RandomPivotingStrategy.html ============================================================================== --- websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/RandomPivotingStrategy.html (added) +++ websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/RandomPivotingStrategy.html Sat Oct 18 20:10:38 2014 @@ -0,0 +1,129 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="fr"> +<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.util;<a name="line.17"></a> +<span class="sourceLineNo">018</span><a name="line.18"></a> +<span class="sourceLineNo">019</span>import java.io.Serializable;<a name="line.19"></a> +<span class="sourceLineNo">020</span><a name="line.20"></a> +<span class="sourceLineNo">021</span>import org.apache.commons.math3.exception.MathIllegalArgumentException;<a name="line.21"></a> +<span class="sourceLineNo">022</span>import org.apache.commons.math3.random.RandomGenerator;<a name="line.22"></a> +<span class="sourceLineNo">023</span><a name="line.23"></a> +<span class="sourceLineNo">024</span><a name="line.24"></a> +<span class="sourceLineNo">025</span>/**<a name="line.25"></a> +<span class="sourceLineNo">026</span> * A strategy of selecting random index between begin and end indices.<a name="line.26"></a> +<span class="sourceLineNo">027</span> * @since 3.4<a name="line.27"></a> +<span class="sourceLineNo">028</span> */<a name="line.28"></a> +<span class="sourceLineNo">029</span>public class RandomPivotingStrategy implements PivotingStrategyInterface, Serializable {<a name="line.29"></a> +<span class="sourceLineNo">030</span><a name="line.30"></a> +<span class="sourceLineNo">031</span> /** Serializable UID. */<a name="line.31"></a> +<span class="sourceLineNo">032</span> private static final long serialVersionUID = 20140713L;<a name="line.32"></a> +<span class="sourceLineNo">033</span><a name="line.33"></a> +<span class="sourceLineNo">034</span> /** Random generator to use for selecting pivot. */<a name="line.34"></a> +<span class="sourceLineNo">035</span> private final RandomGenerator random;<a name="line.35"></a> +<span class="sourceLineNo">036</span><a name="line.36"></a> +<span class="sourceLineNo">037</span> /** Simple constructor.<a name="line.37"></a> +<span class="sourceLineNo">038</span> * @param random random generator to use for selecting pivot<a name="line.38"></a> +<span class="sourceLineNo">039</span> */<a name="line.39"></a> +<span class="sourceLineNo">040</span> public RandomPivotingStrategy(final RandomGenerator random) {<a name="line.40"></a> +<span class="sourceLineNo">041</span> this.random = random;<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> /**<a name="line.44"></a> +<span class="sourceLineNo">045</span> * {@inheritDoc}<a name="line.45"></a> +<span class="sourceLineNo">046</span> * A uniform random pivot selection between begin and end indices<a name="line.46"></a> +<span class="sourceLineNo">047</span> * @return The index corresponding to a random uniformly selected<a name="line.47"></a> +<span class="sourceLineNo">048</span> * value between first and the last indices of the array slice<a name="line.48"></a> +<span class="sourceLineNo">049</span> * @throws MathIllegalArgumentException when indices exceeds range<a name="line.49"></a> +<span class="sourceLineNo">050</span> */<a name="line.50"></a> +<span class="sourceLineNo">051</span> public int pivotIndex(final double[] work, final int begin, final int end)<a name="line.51"></a> +<span class="sourceLineNo">052</span> throws MathIllegalArgumentException {<a name="line.52"></a> +<span class="sourceLineNo">053</span> MathArrays.verifyValues(work, begin, end-begin);<a name="line.53"></a> +<span class="sourceLineNo">054</span> return begin + random.nextInt(end - begin - 1);<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> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</pre> +</div> +</body> +</html> Propchange: websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/RandomPivotingStrategy.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/commons/content/proper/commons-math/apidocs/src-html/org/apache/commons/math3/util/RandomPivotingStrategy.html ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: websites/production/commons/content/proper/commons-math/jacoco/org.apache.commons.math3.analysis.interpolation/AkimaSplineInterpolator.html ============================================================================== --- websites/production/commons/content/proper/commons-math/jacoco/org.apache.commons.math3.analysis.interpolation/AkimaSplineInterpolator.html (added) +++ websites/production/commons/content/proper/commons-math/jacoco/org.apache.commons.math3.analysis.interpolation/AkimaSplineInterpolator.html Sat Oct 18 20:10:38 2014 @@ -0,0 +1 @@ +<?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>AkimaSplineInterpolator</title><script type="text/javascript" src="../.resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><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> > <a href="index.html" class="el_package">org.apache.commons.math3.analysis.interpolation</a> > <span class="el_class">AkimaSplineInterpolator</span></div><h1>AkimaSplineInterpolator</h1><table class="coverage" cellspacing= "0" id="coveragetable"><thead><tr><td class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">27 of 529</td><td class="ctr2">95%</td><td class="bar">3 of 26</td><td class="ctr2">88%</td><td class="ctr1">3</t d><td class="ctr2">17</td><td class="ctr1">3</td><td class="ctr2">54</td><td class="ctr1">0</td><td class="ctr2">4</td></tr></tfoot><tbody><tr><td id="a3"><a href="AkimaSplineInterpolator.java.html#L187" class="el_method">interpolateHermiteSorted(double[], double[], double[])</a></td><td class="bar" id="b0"><img src="../.resources/redbar.gif" width="11" height="10" title="27" alt="27"/><img src="../.resources/greenbar.gif" width="54" height="10" title="132" alt="132"/></td><td class="ctr2" id="c3">83%</td><td class="bar" id="d0"><img src="../.resources/redbar.gif" width="20" height="10" title="3" alt="3"/><img src="../.resources/greenbar.gif" width="33" height="10" title="5" alt="5"/></td><td class="ctr2" id="e1">62%</td><td class="ctr1" id="f0">3</td><td class="ctr2" id="g1">5</td><td class="ctr1" id="h0">3</td><td class="ctr2" id="i1">19</td><td class="ctr1" id="j0">0</td><td class="ctr2" id="k0">1</td></tr><tr><td id="a2"><a href="AkimaSplineInterpolator.java.html#L81" class="el_ method">interpolate(double[], double[])</a></td><td class="bar" id="b1"><img src="../.resources/greenbar.gif" width="120" height="10" title="291" alt="291"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d1"><img src="../.resources/greenbar.gif" width="120" height="10" title="18" alt="18"/></td><td class="ctr2" id="e0">100%</td><td class="ctr1" id="f1">0</td><td class="ctr2" id="g0">10</td><td class="ctr1" id="h1">0</td><td class="ctr2" id="i0">24</td><td class="ctr1" id="j1">0</td><td class="ctr2" id="k1">1</td></tr><tr><td id="a1"><a href="AkimaSplineInterpolator.java.html#L161" class="el_method">differentiateThreePoint(double[], double[], int, int, int, int)</a></td><td class="bar" id="b2"><img src="../.resources/greenbar.gif" width="31" height="10" title="76" alt="76"/></td><td class="ctr2" id="c1">100%</td><td class="bar" id="d2"/><td class="ctr2" id="e2">n/a</td><td class="ctr1" id="f2">0</td><td class="ctr2" id="g2">1</td><td class="ctr1" id="h2">0</td><td class=" ctr2" id="i2">9</td><td class="ctr1" id="j2">0</td><td class="ctr2" id="k2">1</td></tr><tr><td id="a0"><a href="AkimaSplineInterpolator.java.html#L61" class="el_method">AkimaSplineInterpolator()</a></td><td class="bar" id="b3"><img src="../.resources/greenbar.gif" width="1" height="10" title="3" alt="3"/></td><td class="ctr2" id="c2">100%</td><td class="bar" id="d3"/><td class="ctr2" id="e3">n/a</td><td class="ctr1" id="f3">0</td><td class="ctr2" id="g3">1</td><td class="ctr1" id="h3">0</td><td class="ctr2" id="i3">2</td><td class="ctr1" id="j3">0</td><td class="ctr2" id="k3">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.0.201403182114</span></div></body></html> \ No newline at end of file Propchange: websites/production/commons/content/proper/commons-math/jacoco/org.apache.commons.math3.analysis.interpolation/AkimaSplineInterpolator.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/commons/content/proper/commons-math/jacoco/org.apache.commons.math3.analysis.interpolation/AkimaSplineInterpolator.html ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: websites/production/commons/content/proper/commons-math/jacoco/org.apache.commons.math3.analysis.interpolation/AkimaSplineInterpolator.java.html ============================================================================== --- websites/production/commons/content/proper/commons-math/jacoco/org.apache.commons.math3.analysis.interpolation/AkimaSplineInterpolator.java.html (added) +++ websites/production/commons/content/proper/commons-math/jacoco/org.apache.commons.math3.analysis.interpolation/AkimaSplineInterpolator.java.html Sat Oct 18 20:10:38 2014 @@ -0,0 +1,226 @@ +<?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>AkimaSplineInterpolator.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> > <a href="index.source.html" class="el_package">org.apache.commons.math3.analysis.interpolation</a> > <span class="el_source">Ak imaSplineInterpolator.java</span></div><h1>AkimaSplineInterpolator.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 "License"); 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 "AS IS" 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.analysis.interpolation; + +import org.apache.commons.math3.analysis.polynomials.PolynomialFunction; +import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction; +import org.apache.commons.math3.exception.DimensionMismatchException; +import org.apache.commons.math3.exception.NonMonotonicSequenceException; +import org.apache.commons.math3.exception.NullArgumentException; +import org.apache.commons.math3.exception.NumberIsTooSmallException; +import org.apache.commons.math3.exception.util.LocalizedFormats; +import org.apache.commons.math3.util.FastMath; +import org.apache.commons.math3.util.MathArrays; +import org.apache.commons.math3.util.Precision; + +/** + * Computes a cubic spline interpolation for the data set using the Akima + * algorithm, as originally formulated by Hiroshi Akima in his 1970 paper + * "A New Method of Interpolation and Smooth Curve Fitting Based on Local Procedures." + * J. ACM 17, 4 (October 1970), 589-602. DOI=10.1145/321607.321609 + * http://doi.acm.org/10.1145/321607.321609 + * <p> + * This implementation is based on the Akima implementation in the CubicSpline + * class in the Math.NET Numerics library. The method referenced is + * CubicSpline.InterpolateAkimaSorted + * <p> + * The {@link #interpolate(double[], double[])} method returns a + * {@link PolynomialSplineFunction} consisting of n cubic polynomials, defined + * over the subintervals determined by the x values, x[0] < x[i] ... < x[n]. The + * Akima algorithm requires that n >= 5. + * </p> + * <p> + */ + +public class AkimaSplineInterpolator + implements UnivariateInterpolator { + + + /** + * The minimum number of points that are needed to compute the function + */ + public static final int MINIMUM_NUMBER_POINTS = 5; + + /** + * Default constructor. Builds an AkimaSplineInterpolator object + */ +<span class="fc" id="L61"> public AkimaSplineInterpolator() {</span> + +<span class="fc" id="L63"> }</span> + + /** + * Computes an interpolating function for the data set. + * + * @param xvals the arguments for the interpolation points + * @param yvals the values for the interpolation points + * @return a function which interpolates the data set + * @throws DimensionMismatchException if {@code x} and {@code y} have + * different sizes. + * @throws NonMonotonicSequenceException if {@code x} is not sorted in + * strict increasing order. + * @throws NumberIsTooSmallException if the size of {@code x} is smaller + * than 5. + */ + public PolynomialSplineFunction interpolate(double[] xvals, double[] yvals) + throws DimensionMismatchException, NumberIsTooSmallException, + NonMonotonicSequenceException { +<span class="fc bfc" id="L81" title="All 4 branches covered."> if (xvals == null || yvals == null) {</span> +<span class="fc" id="L82"> throw new NullArgumentException();</span> + } + +<span class="fc bfc" id="L85" title="All 2 branches covered."> if (xvals.length != yvals.length) {</span> +<span class="fc" id="L86"> throw new DimensionMismatchException(xvals.length, yvals.length);</span> + } + +<span class="fc bfc" id="L89" title="All 2 branches covered."> if (xvals.length < MINIMUM_NUMBER_POINTS) {</span> +<span class="fc" id="L90"> throw new NumberIsTooSmallException(</span> + LocalizedFormats.NUMBER_OF_POINTS, + xvals.length, + MINIMUM_NUMBER_POINTS, true); + } + +<span class="fc" id="L96"> MathArrays.checkOrder(xvals);</span> + +<span class="fc" id="L98"> final int numberOfDiffAndWeightElements = xvals.length - 1;</span> + +<span class="fc" id="L100"> double differences[] = new double[numberOfDiffAndWeightElements];</span> +<span class="fc" id="L101"> double weights[] = new double[numberOfDiffAndWeightElements];</span> + +<span class="fc bfc" id="L103" title="All 2 branches covered."> for (int i = 0; i < differences.length; i++) {</span> +<span class="fc" id="L104"> differences[i] = (yvals[i + 1] - yvals[i]) /</span> + (xvals[i + 1] - xvals[i]); + } + +<span class="fc bfc" id="L108" title="All 2 branches covered."> for (int i = 1; i < weights.length; i++) {</span> +<span class="fc" id="L109"> weights[i] = FastMath.abs(differences[i] - differences[i - 1]);</span> + } + + /* Prepare Hermite interpolation scheme */ + +<span class="fc" id="L114"> double firstDerivatives[] = new double[xvals.length];</span> + +<span class="fc bfc" id="L116" title="All 2 branches covered."> for (int i = 2; i < firstDerivatives.length - 2; i++) {</span> +<span class="fc bfc" id="L117" title="All 4 branches covered."> if (Precision.equals(weights[i - 1], 0.0) &&</span> + Precision.equals(weights[i + 1], 0.0)) { +<span class="fc" id="L119"> firstDerivatives[i] = (((xvals[i + 1] - xvals[i]) * differences[i - 1]) + ((xvals[i] - xvals[i - 1]) * differences[i])) /</span> + (xvals[i + 1] - xvals[i - 1]); + } else { +<span class="fc" id="L122"> firstDerivatives[i] = ((weights[i + 1] * differences[i - 1]) + (weights[i - 1] * differences[i])) /</span> + (weights[i + 1] + weights[i - 1]); + } + } + +<span class="fc" id="L127"> firstDerivatives[0] = this.differentiateThreePoint(xvals, yvals, 0, 0,</span> + 1, 2); +<span class="fc" id="L129"> firstDerivatives[1] = this.differentiateThreePoint(xvals, yvals, 1, 0,</span> + 1, 2); +<span class="fc" id="L131"> firstDerivatives[xvals.length - 2] = this</span> + .differentiateThreePoint(xvals, yvals, xvals.length - 2, + xvals.length - 3, xvals.length - 2, + xvals.length - 1); +<span class="fc" id="L135"> firstDerivatives[xvals.length - 1] = this</span> + .differentiateThreePoint(xvals, yvals, xvals.length - 1, + xvals.length - 3, xvals.length - 2, + xvals.length - 1); + +<span class="fc" id="L140"> return this.interpolateHermiteSorted(xvals, yvals, firstDerivatives);</span> + } + + /** + * Three point differentiation helper, modeled off of the same method in the + * Math.NET CubicSpline class. This is used by both the Apache Math and the + * Math.NET Akima Cubic Spline algorithms + * + * @param xvals x values to calculate the numerical derivative with + * @param yvals y values to calculate the numerical derivative with + * @param indexOfDifferentiation index of the elemnt we are calculating the derivative around + * @param indexOfFirstSample index of the first element to sample for the three point method + * @param indexOfSecondsample index of the second element to sample for the three point method + * @param indexOfThirdSample index of the third element to sample for the three point method + * @return the derivative + */ + private double differentiateThreePoint(double[] xvals, double[] yvals, + int indexOfDifferentiation, + int indexOfFirstSample, + int indexOfSecondsample, + int indexOfThirdSample) { +<span class="fc" id="L161"> double x0 = yvals[indexOfFirstSample];</span> +<span class="fc" id="L162"> double x1 = yvals[indexOfSecondsample];</span> +<span class="fc" id="L163"> double x2 = yvals[indexOfThirdSample];</span> + +<span class="fc" id="L165"> double t = xvals[indexOfDifferentiation] - xvals[indexOfFirstSample];</span> +<span class="fc" id="L166"> double t1 = xvals[indexOfSecondsample] - xvals[indexOfFirstSample];</span> +<span class="fc" id="L167"> double t2 = xvals[indexOfThirdSample] - xvals[indexOfFirstSample];</span> + +<span class="fc" id="L169"> double a = (x2 - x0 - (t2 / t1 * (x1 - x0))) / (t2 * t2 - t1 * t2);</span> +<span class="fc" id="L170"> double b = (x1 - x0 - a * t1 * t1) / t1;</span> +<span class="fc" id="L171"> return (2 * a * t) + b;</span> + } + + /** + * Creates a Hermite cubic spline interpolation from the set of (x,y) value + * pairs and their derivatives. This is modeled off of the + * InterpolateHermiteSorted method in the Math.NET CubicSpline class. + * + * @param xvals x values for interpolation + * @param yvals y values for interpolation + * @param firstDerivatives first derivative values of the function + * @return polynomial that fits the function + */ + private PolynomialSplineFunction interpolateHermiteSorted(double[] xvals, + double[] yvals, + double[] firstDerivatives) { +<span class="pc bpc" id="L187" title="1 of 2 branches missed."> if (xvals.length != yvals.length) {</span> +<span class="nc" id="L188"> throw new DimensionMismatchException(xvals.length, yvals.length);</span> + } + +<span class="pc bpc" id="L191" title="1 of 2 branches missed."> if (xvals.length != firstDerivatives.length) {</span> +<span class="nc" id="L192"> throw new DimensionMismatchException(xvals.length,</span> + firstDerivatives.length); + } + +<span class="fc" id="L196"> final int minimumLength = 2;</span> +<span class="pc bpc" id="L197" title="1 of 2 branches missed."> if (xvals.length < minimumLength) {</span> +<span class="nc" id="L198"> throw new NumberIsTooSmallException(</span> + LocalizedFormats.NUMBER_OF_POINTS, + xvals.length, minimumLength, + true); + } + +<span class="fc" id="L204"> int size = xvals.length - 1;</span> +<span class="fc" id="L205"> final PolynomialFunction polynomials[] = new PolynomialFunction[size];</span> +<span class="fc" id="L206"> final double coefficients[] = new double[4];</span> + +<span class="fc bfc" id="L208" title="All 2 branches covered."> for (int i = 0; i < polynomials.length; i++) {</span> +<span class="fc" id="L209"> double w = xvals[i + 1] - xvals[i];</span> +<span class="fc" id="L210"> double w2 = w * w;</span> +<span class="fc" id="L211"> coefficients[0] = yvals[i];</span> +<span class="fc" id="L212"> coefficients[1] = firstDerivatives[i];</span> +<span class="fc" id="L213"> coefficients[2] = (3 * (yvals[i + 1] - yvals[i]) / w - 2 *</span> + firstDerivatives[i] - firstDerivatives[i + 1]) / + w; +<span class="fc" id="L216"> coefficients[3] = (2 * (yvals[i] - yvals[i + 1]) / w +</span> + firstDerivatives[i] + firstDerivatives[i + 1]) / + w2; +<span class="fc" id="L219"> polynomials[i] = new PolynomialFunction(coefficients);</span> + } + +<span class="fc" id="L222"> return new PolynomialSplineFunction(xvals, polynomials);</span> + + } +} +</pre><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.0.201403182114</span></div></body></html> \ No newline at end of file Propchange: websites/production/commons/content/proper/commons-math/jacoco/org.apache.commons.math3.analysis.interpolation/AkimaSplineInterpolator.java.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/commons/content/proper/commons-math/jacoco/org.apache.commons.math3.analysis.interpolation/AkimaSplineInterpolator.java.html ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: websites/production/commons/content/proper/commons-math/jacoco/org.apache.commons.math3.distribution/ConstantRealDistribution.html ============================================================================== --- websites/production/commons/content/proper/commons-math/jacoco/org.apache.commons.math3.distribution/ConstantRealDistribution.html (added) +++ websites/production/commons/content/proper/commons-math/jacoco/org.apache.commons.math3.distribution/ConstantRealDistribution.html Sat Oct 18 20:10:38 2014 @@ -0,0 +1 @@ +<?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>ConstantRealDistribution</title><script type="text/javascript" src="../.resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><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> > <a href="index.html" class="el_package">org.apache.commons.math3.distribution</a> > <span class="el_class">ConstantRealDistribution</span></div><h1>ConstantRealDistribution</h1><table class="coverage" cellspacing="0" id= "coveragetable"><thead><tr><td class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">2 of 67</td><td class="ctr2">97%</td><td class="bar">0 of 8</td><td class="ctr2">100%</td><td class="ctr1">1</td><td cla ss="ctr2">17</td><td class="ctr1">1</td><td class="ctr2">17</td><td class="ctr1">1</td><td class="ctr2">13</td></tr></tfoot><tbody><tr><td id="a8"><a href="ConstantRealDistribution.java.html#L106" class="el_method">isSupportConnected()</a></td><td class="bar" id="b0"><img src="../.resources/redbar.gif" width="11" height="10" title="2" alt="2"/></td><td class="ctr2" id="c12">0%</td><td class="bar" id="d3"/><td class="ctr2" id="e3">n/a</td><td class="ctr1" id="f0">1</td><td class="ctr2" id="g3">1</td><td class="ctr1" id="h0">1</td><td class="ctr2" id="i2">1</td><td class="ctr1" id="j0">1</td><td class="ctr2" id="k0">1</td></tr><tr><td id="a7"><a href="ConstantRealDistribution.java.html#L58" class="el_method">inverseCumulativeProbability(double)</a></td><td class="bar" id="b1"><img src="../.resources/greenbar.gif" width="120" height="10" title="21" alt="21"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d0"><img src="../.resources/greenbar.gif" width="120" height="10" titl e="4" alt="4"/></td><td class="ctr2" id="e0">100%</td><td class="ctr1" id="f1">0</td><td class="ctr2" id="g0">3</td><td class="ctr1" id="h1">0</td><td class="ctr2" id="i0">3</td><td class="ctr1" id="j1">0</td><td class="ctr2" id="k1">1</td></tr><tr><td id="a2"><a href="ConstantRealDistribution.java.html#L47" class="el_method">density(double)</a></td><td class="bar" id="b2"><img src="../.resources/greenbar.gif" width="51" height="10" title="9" alt="9"/></td><td class="ctr2" id="c1">100%</td><td class="bar" id="d1"><img src="../.resources/greenbar.gif" width="60" height="10" title="2" alt="2"/></td><td class="ctr2" id="e1">100%</td><td class="ctr1" id="f2">0</td><td class="ctr2" id="g1">2</td><td class="ctr1" id="h2">0</td><td class="ctr2" id="i3">1</td><td class="ctr1" id="j2">0</td><td class="ctr2" id="k2">1</td></tr><tr><td id="a1"><a href="ConstantRealDistribution.java.html#L52" class="el_method">cumulativeProbability(double)</a></td><td class="bar" id="b3"><img src="../.resources /greenbar.gif" width="51" height="10" title="9" alt="9"/></td><td class="ctr2" id="c2">100%</td><td class="bar" id="d2"><img src="../.resources/greenbar.gif" width="60" height="10" title="2" alt="2"/></td><td class="ctr2" id="e2">100%</td><td class="ctr1" id="f3">0</td><td class="ctr2" id="g2">2</td><td class="ctr1" id="h3">0</td><td class="ctr2" id="i4">1</td><td class="ctr1" id="j3">0</td><td class="ctr2" id="k3">1</td></tr><tr><td id="a0"><a href="ConstantRealDistribution.java.html#L41" class="el_method">ConstantRealDistribution(double)</a></td><td class="bar" id="b4"><img src="../.resources/greenbar.gif" width="40" height="10" title="7" alt="7"/></td><td class="ctr2" id="c3">100%</td><td class="bar" id="d4"/><td class="ctr2" id="e4">n/a</td><td class="ctr1" id="f4">0</td><td class="ctr2" id="g4">1</td><td class="ctr1" id="h4">0</td><td class="ctr2" id="i1">3</td><td class="ctr1" id="j4">0</td><td class="ctr2" id="k4">1</td></tr><tr><td id="a3"><a href="ConstantRealDistribution.j ava.html#L68" class="el_method">getNumericalMean()</a></td><td class="bar" id="b5"><img src="../.resources/greenbar.gif" width="17" height="10" title="3" alt="3"/></td><td class="ctr2" id="c4">100%</td><td class="bar" id="d5"/><td class="ctr2" id="e5">n/a</td><td class="ctr1" id="f5">0</td><td class="ctr2" id="g5">1</td><td class="ctr1" id="h5">0</td><td class="ctr2" id="i5">1</td><td class="ctr1" id="j5">0</td><td class="ctr2" id="k5">1</td></tr><tr><td id="a5"><a href="ConstantRealDistribution.java.html#L82" class="el_method">getSupportLowerBound()</a></td><td class="bar" id="b6"><img src="../.resources/greenbar.gif" width="17" height="10" title="3" alt="3"/></td><td class="ctr2" id="c5">100%</td><td class="bar" id="d6"/><td class="ctr2" id="e6">n/a</td><td class="ctr1" id="f6">0</td><td class="ctr2" id="g6">1</td><td class="ctr1" id="h6">0</td><td class="ctr2" id="i6">1</td><td class="ctr1" id="j6">0</td><td class="ctr2" id="k6">1</td></tr><tr><td id="a6"><a href="ConstantRealDis tribution.java.html#L89" class="el_method">getSupportUpperBound()</a></td><td class="bar" id="b7"><img src="../.resources/greenbar.gif" width="17" height="10" title="3" alt="3"/></td><td class="ctr2" id="c6">100%</td><td class="bar" id="d7"/><td class="ctr2" id="e7">n/a</td><td class="ctr1" id="f7">0</td><td class="ctr2" id="g7">1</td><td class="ctr1" id="h7">0</td><td class="ctr2" id="i7">1</td><td class="ctr1" id="j7">0</td><td class="ctr2" id="k7">1</td></tr><tr><td id="a12"><a href="ConstantRealDistribution.java.html#L112" class="el_method">sample()</a></td><td class="bar" id="b8"><img src="../.resources/greenbar.gif" width="17" height="10" title="3" alt="3"/></td><td class="ctr2" id="c7">100%</td><td class="bar" id="d8"/><td class="ctr2" id="e8">n/a</td><td class="ctr1" id="f8">0</td><td class="ctr2" id="g8">1</td><td class="ctr1" id="h8">0</td><td class="ctr2" id="i8">1</td><td class="ctr1" id="j8">0</td><td class="ctr2" id="k8">1</td></tr><tr><td id="a4"><a href="ConstantReal Distribution.java.html#L75" class="el_method">getNumericalVariance()</a></td><td class="bar" id="b9"><img src="../.resources/greenbar.gif" width="11" height="10" title="2" alt="2"/></td><td class="ctr2" id="c8">100%</td><td class="bar" id="d9"/><td class="ctr2" id="e9">n/a</td><td class="ctr1" id="f9">0</td><td class="ctr2" id="g9">1</td><td class="ctr1" id="h9">0</td><td class="ctr2" id="i9">1</td><td class="ctr1" id="j9">0</td><td class="ctr2" id="k9">1</td></tr><tr><td id="a9"><a href="ConstantRealDistribution.java.html#L94" class="el_method">isSupportLowerBoundInclusive()</a></td><td class="bar" id="b10"><img src="../.resources/greenbar.gif" width="11" height="10" title="2" alt="2"/></td><td class="ctr2" id="c9">100%</td><td class="bar" id="d10"/><td class="ctr2" id="e10">n/a</td><td class="ctr1" id="f10">0</td><td class="ctr2" id="g10">1</td><td class="ctr1" id="h10">0</td><td class="ctr2" id="i10">1</td><td class="ctr1" id="j10">0</td><td class="ctr2" id="k10">1</td></tr><tr>< td id="a10"><a href="ConstantRealDistribution.java.html#L99" class="el_method">isSupportUpperBoundInclusive()</a></td><td class="bar" id="b11"><img src="../.resources/greenbar.gif" width="11" height="10" title="2" alt="2"/></td><td class="ctr2" id="c10">100%</td><td class="bar" id="d11"/><td class="ctr2" id="e11">n/a</td><td class="ctr1" id="f11">0</td><td class="ctr2" id="g11">1</td><td class="ctr1" id="h11">0</td><td class="ctr2" id="i11">1</td><td class="ctr1" id="j11">0</td><td class="ctr2" id="k11">1</td></tr><tr><td id="a11"><a href="ConstantRealDistribution.java.html#L120" class="el_method">reseedRandomGenerator(long)</a></td><td class="bar" id="b12"><img src="../.resources/greenbar.gif" width="5" height="10" title="1" alt="1"/></td><td class="ctr2" id="c11">100%</td><td class="bar" id="d12"/><td class="ctr2" id="e12">n/a</td><td class="ctr1" id="f12">0</td><td class="ctr2" id="g12">1</td><td class="ctr1" id="h12">0</td><td class="ctr2" id="i12">1</td><td class="ctr1" id="j12 ">0</td><td class="ctr2" id="k12">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.0.201403182114</span></div></body></html> \ No newline at end of file Propchange: websites/production/commons/content/proper/commons-math/jacoco/org.apache.commons.math3.distribution/ConstantRealDistribution.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/commons/content/proper/commons-math/jacoco/org.apache.commons.math3.distribution/ConstantRealDistribution.html ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: websites/production/commons/content/proper/commons-math/jacoco/org.apache.commons.math3.distribution/ConstantRealDistribution.java.html ============================================================================== --- websites/production/commons/content/proper/commons-math/jacoco/org.apache.commons.math3.distribution/ConstantRealDistribution.java.html (added) +++ websites/production/commons/content/proper/commons-math/jacoco/org.apache.commons.math3.distribution/ConstantRealDistribution.java.html Sat Oct 18 20:10:38 2014 @@ -0,0 +1,122 @@ +<?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>ConstantRealDistribution.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> > <a href="index.source.html" class="el_package">org.apache.commons.math3.distribution</a> > <span class="el_source">ConstantRea lDistribution.java</span></div><h1>ConstantRealDistribution.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 "License"); 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 "AS IS" 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.OutOfRangeException; + +/** + * Implementation of the constant real distribution. + * + * @since 3.4 + */ +public class ConstantRealDistribution extends AbstractRealDistribution { + + /** Serialization ID */ + private static final long serialVersionUID = -4157745166772046273L; + + /** Constant value of the distribution */ + private final double value; + + /** + * Create a constant real distribution with the given value. + * + * @param value the constant value of this distribution + */ + public ConstantRealDistribution(double value) { +<span class="fc" id="L41"> super(null); // Avoid creating RandomGenerator</span> +<span class="fc" id="L42"> this.value = value;</span> +<span class="fc" id="L43"> }</span> + + /** {@inheritDoc} */ + public double density(double x) { +<span class="fc bfc" id="L47" title="All 2 branches covered."> return x == value ? 1 : 0;</span> + } + + /** {@inheritDoc} */ + public double cumulativeProbability(double x) { +<span class="fc bfc" id="L52" title="All 2 branches covered."> return x < value ? 0 : 1;</span> + } + + @Override + public double inverseCumulativeProbability(final double p) + throws OutOfRangeException { +<span class="fc bfc" id="L58" title="All 4 branches covered."> if (p < 0.0 || p > 1.0) {</span> +<span class="fc" id="L59"> throw new OutOfRangeException(p, 0, 1);</span> + } +<span class="fc" id="L61"> return value;</span> + } + + /** + * {@inheritDoc} + */ + public double getNumericalMean() { +<span class="fc" id="L68"> return value;</span> + } + + /** + * {@inheritDoc} + */ + public double getNumericalVariance() { +<span class="fc" id="L75"> return 0;</span> + } + + /** + * {@inheritDoc} + */ + public double getSupportLowerBound() { +<span class="fc" id="L82"> return value;</span> + } + + /** + * {@inheritDoc} + */ + public double getSupportUpperBound() { +<span class="fc" id="L89"> return value;</span> + } + + /** {@inheritDoc} */ + public boolean isSupportLowerBoundInclusive() { +<span class="fc" id="L94"> return true;</span> + } + + /** {@inheritDoc} */ + public boolean isSupportUpperBoundInclusive() { +<span class="fc" id="L99"> return true;</span> + } + + /** + * {@inheritDoc} + */ + public boolean isSupportConnected() { +<span class="nc" id="L106"> return true;</span> + } + + /** {@inheritDoc} */ + @Override + public double sample() { +<span class="fc" id="L112"> return value;</span> + } + + /** + * Override with no-op (there is no generator). + * @param seed (ignored) + */ + @Override +<span class="fc" id="L120"> public void reseedRandomGenerator(long seed) {}</span> +} +</pre><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.0.201403182114</span></div></body></html> \ No newline at end of file Propchange: websites/production/commons/content/proper/commons-math/jacoco/org.apache.commons.math3.distribution/ConstantRealDistribution.java.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/commons/content/proper/commons-math/jacoco/org.apache.commons.math3.distribution/ConstantRealDistribution.java.html ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision