commons-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r961863 [25/34] - in /websites/production/commons/content/proper/commons-math: ./ apidocs/ apidocs/org/apache/commons/math3/analysis/class-use/ apidocs/org/apache/commons/math3/analysis/interpolation/ apidocs/org/apache/commons/math3/analys...
Date Fri, 14 Aug 2015 19:12:44 GMT
Modified: websites/production/commons/content/proper/commons-math/jacoco/org.apache.commons.math3.util/MathArrays.java.html
==============================================================================
--- websites/production/commons/content/proper/commons-math/jacoco/org.apache.commons.math3.util/MathArrays.java.html (original)
+++ websites/production/commons/content/proper/commons-math/jacoco/org.apache.commons.math3.util/MathArrays.java.html Fri Aug 14 19:12:42 2015
@@ -243,6 +243,17 @@ public class MathArrays {
     }
 
     /**
+     * Calculates the cosine of the angle between two vectors.
+     *
+     * @param v1 Cartesian coordinates of the first vector.
+     * @param v2 Cartesian coordinates of the second vector.
+     * @return the cosine of the angle between the vectors.
+     */
+    public static double cosAngle(double[] v1, double[] v2) {
+<span class="fc" id="L253">        return linearCombination(v1, v2) / (safeNorm(v1) * safeNorm(v2));</span>
+    }
+
+    /**
      * Calculates the L&lt;sub&gt;2&lt;/sub&gt; (Euclidean) distance between two points.
      *
      * @param p1 the first point
@@ -250,12 +261,12 @@ public class MathArrays {
      * @return the L&lt;sub&gt;2&lt;/sub&gt; distance between the two points
      */
     public static double distance(int[] p1, int[] p2) {
-<span class="fc" id="L253">      double sum = 0;</span>
-<span class="fc bfc" id="L254" title="All 2 branches covered.">      for (int i = 0; i &lt; p1.length; i++) {</span>
-<span class="fc" id="L255">          final double dp = p1[i] - p2[i];</span>
-<span class="fc" id="L256">          sum += dp * dp;</span>
+<span class="fc" id="L264">      double sum = 0;</span>
+<span class="fc bfc" id="L265" title="All 2 branches covered.">      for (int i = 0; i &lt; p1.length; i++) {</span>
+<span class="fc" id="L266">          final double dp = p1[i] - p2[i];</span>
+<span class="fc" id="L267">          sum += dp * dp;</span>
       }
-<span class="fc" id="L258">      return FastMath.sqrt(sum);</span>
+<span class="fc" id="L269">      return FastMath.sqrt(sum);</span>
     }
 
     /**
@@ -266,11 +277,11 @@ public class MathArrays {
      * @return the L&lt;sub&gt;&amp;infin;&lt;/sub&gt; distance between the two points
      */
     public static double distanceInf(double[] p1, double[] p2) {
-<span class="fc" id="L269">        double max = 0;</span>
-<span class="fc bfc" id="L270" title="All 2 branches covered.">        for (int i = 0; i &lt; p1.length; i++) {</span>
-<span class="fc" id="L271">            max = FastMath.max(max, FastMath.abs(p1[i] - p2[i]));</span>
+<span class="fc" id="L280">        double max = 0;</span>
+<span class="fc bfc" id="L281" title="All 2 branches covered.">        for (int i = 0; i &lt; p1.length; i++) {</span>
+<span class="fc" id="L282">            max = FastMath.max(max, FastMath.abs(p1[i] - p2[i]));</span>
         }
-<span class="fc" id="L273">        return max;</span>
+<span class="fc" id="L284">        return max;</span>
     }
 
     /**
@@ -281,21 +292,21 @@ public class MathArrays {
      * @return the L&lt;sub&gt;&amp;infin;&lt;/sub&gt; distance between the two points
      */
     public static int distanceInf(int[] p1, int[] p2) {
-<span class="fc" id="L284">        int max = 0;</span>
-<span class="fc bfc" id="L285" title="All 2 branches covered.">        for (int i = 0; i &lt; p1.length; i++) {</span>
-<span class="fc" id="L286">            max = FastMath.max(max, FastMath.abs(p1[i] - p2[i]));</span>
+<span class="fc" id="L295">        int max = 0;</span>
+<span class="fc bfc" id="L296" title="All 2 branches covered.">        for (int i = 0; i &lt; p1.length; i++) {</span>
+<span class="fc" id="L297">            max = FastMath.max(max, FastMath.abs(p1[i] - p2[i]));</span>
         }
-<span class="fc" id="L288">        return max;</span>
+<span class="fc" id="L299">        return max;</span>
     }
 
     /**
      * Specification of ordering direction.
      */
-<span class="pc" id="L294">    public static enum OrderDirection {</span>
+<span class="pc" id="L305">    public static enum OrderDirection {</span>
         /** Constant for increasing direction. */
-<span class="fc" id="L296">        INCREASING,</span>
+<span class="fc" id="L307">        INCREASING,</span>
         /** Constant for decreasing direction. */
-<span class="fc" id="L298">        DECREASING</span>
+<span class="fc" id="L309">        DECREASING</span>
     }
 
     /**
@@ -310,43 +321,43 @@ public class MathArrays {
     public static  &lt;T extends Comparable&lt;? super T&gt;&gt; boolean isMonotonic(T[] val,
                                       OrderDirection dir,
                                       boolean strict) {
-<span class="fc" id="L313">        T previous = val[0];</span>
-<span class="fc" id="L314">        final int max = val.length;</span>
-<span class="fc bfc" id="L315" title="All 2 branches covered.">        for (int i = 1; i &lt; max; i++) {</span>
+<span class="fc" id="L324">        T previous = val[0];</span>
+<span class="fc" id="L325">        final int max = val.length;</span>
+<span class="fc bfc" id="L326" title="All 2 branches covered.">        for (int i = 1; i &lt; max; i++) {</span>
             final int comp;
-<span class="pc bpc" id="L317" title="1 of 3 branches missed.">            switch (dir) {</span>
+<span class="pc bpc" id="L328" title="1 of 3 branches missed.">            switch (dir) {</span>
             case INCREASING:
-<span class="fc" id="L319">                comp = previous.compareTo(val[i]);</span>
-<span class="fc bfc" id="L320" title="All 2 branches covered.">                if (strict) {</span>
-<span class="fc bfc" id="L321" title="All 2 branches covered.">                    if (comp &gt;= 0) {</span>
-<span class="fc" id="L322">                        return false;</span>
+<span class="fc" id="L330">                comp = previous.compareTo(val[i]);</span>
+<span class="fc bfc" id="L331" title="All 2 branches covered.">                if (strict) {</span>
+<span class="fc bfc" id="L332" title="All 2 branches covered.">                    if (comp &gt;= 0) {</span>
+<span class="fc" id="L333">                        return false;</span>
                     }
                 } else {
-<span class="fc bfc" id="L325" title="All 2 branches covered.">                    if (comp &gt; 0) {</span>
-<span class="fc" id="L326">                        return false;</span>
+<span class="fc bfc" id="L336" title="All 2 branches covered.">                    if (comp &gt; 0) {</span>
+<span class="fc" id="L337">                        return false;</span>
                     }
                 }
                 break;
             case DECREASING:
-<span class="fc" id="L331">                comp = val[i].compareTo(previous);</span>
-<span class="fc bfc" id="L332" title="All 2 branches covered.">                if (strict) {</span>
-<span class="fc bfc" id="L333" title="All 2 branches covered.">                    if (comp &gt;= 0) {</span>
-<span class="fc" id="L334">                        return false;</span>
+<span class="fc" id="L342">                comp = val[i].compareTo(previous);</span>
+<span class="fc bfc" id="L343" title="All 2 branches covered.">                if (strict) {</span>
+<span class="fc bfc" id="L344" title="All 2 branches covered.">                    if (comp &gt;= 0) {</span>
+<span class="fc" id="L345">                        return false;</span>
                     }
                 } else {
-<span class="fc bfc" id="L337" title="All 2 branches covered.">                    if (comp &gt; 0) {</span>
-<span class="fc" id="L338">                       return false;</span>
+<span class="fc bfc" id="L348" title="All 2 branches covered.">                    if (comp &gt; 0) {</span>
+<span class="fc" id="L349">                       return false;</span>
                     }
                 }
                 break;
             default:
                 // Should never happen.
-<span class="nc" id="L344">                throw new MathInternalError();</span>
+<span class="nc" id="L355">                throw new MathInternalError();</span>
             }
 
-<span class="fc" id="L347">            previous = val[i];</span>
+<span class="fc" id="L358">            previous = val[i];</span>
         }
-<span class="fc" id="L349">        return true;</span>
+<span class="fc" id="L360">        return true;</span>
     }
 
     /**
@@ -358,7 +369,7 @@ public class MathArrays {
      * @return {@code true} if sorted, {@code false} otherwise.
      */
     public static boolean isMonotonic(double[] val, OrderDirection dir, boolean strict) {
-<span class="fc" id="L361">        return checkOrder(val, dir, strict, false);</span>
+<span class="fc" id="L372">        return checkOrder(val, dir, strict, false);</span>
     }
 
     /**
@@ -375,53 +386,53 @@ public class MathArrays {
     public static boolean checkOrder(double[] val, OrderDirection dir,
                                      boolean strict, boolean abort)
         throws NonMonotonicSequenceException {
-<span class="fc" id="L378">        double previous = val[0];</span>
-<span class="fc" id="L379">        final int max = val.length;</span>
+<span class="fc" id="L389">        double previous = val[0];</span>
+<span class="fc" id="L390">        final int max = val.length;</span>
 
         int index;
         ITEM:
-<span class="fc bfc" id="L383" title="All 2 branches covered.">        for (index = 1; index &lt; max; index++) {</span>
-<span class="pc bpc" id="L384" title="1 of 3 branches missed.">            switch (dir) {</span>
+<span class="fc bfc" id="L394" title="All 2 branches covered.">        for (index = 1; index &lt; max; index++) {</span>
+<span class="pc bpc" id="L395" title="1 of 3 branches missed.">            switch (dir) {</span>
             case INCREASING:
-<span class="fc bfc" id="L386" title="All 2 branches covered.">                if (strict) {</span>
-<span class="fc bfc" id="L387" title="All 2 branches covered.">                    if (val[index] &lt;= previous) {</span>
-<span class="fc" id="L388">                        break ITEM;</span>
+<span class="fc bfc" id="L397" title="All 2 branches covered.">                if (strict) {</span>
+<span class="fc bfc" id="L398" title="All 2 branches covered.">                    if (val[index] &lt;= previous) {</span>
+<span class="fc" id="L399">                        break ITEM;</span>
                     }
                 } else {
-<span class="fc bfc" id="L391" title="All 2 branches covered.">                    if (val[index] &lt; previous) {</span>
-<span class="fc" id="L392">                        break ITEM;</span>
+<span class="fc bfc" id="L402" title="All 2 branches covered.">                    if (val[index] &lt; previous) {</span>
+<span class="fc" id="L403">                        break ITEM;</span>
                     }
                 }
                 break;
             case DECREASING:
-<span class="fc bfc" id="L397" title="All 2 branches covered.">                if (strict) {</span>
-<span class="fc bfc" id="L398" title="All 2 branches covered.">                    if (val[index] &gt;= previous) {</span>
-<span class="fc" id="L399">                        break ITEM;</span>
+<span class="fc bfc" id="L408" title="All 2 branches covered.">                if (strict) {</span>
+<span class="fc bfc" id="L409" title="All 2 branches covered.">                    if (val[index] &gt;= previous) {</span>
+<span class="fc" id="L410">                        break ITEM;</span>
                     }
                 } else {
-<span class="fc bfc" id="L402" title="All 2 branches covered.">                    if (val[index] &gt; previous) {</span>
-<span class="fc" id="L403">                        break ITEM;</span>
+<span class="fc bfc" id="L413" title="All 2 branches covered.">                    if (val[index] &gt; previous) {</span>
+<span class="fc" id="L414">                        break ITEM;</span>
                     }
                 }
                 break;
             default:
                 // Should never happen.
-<span class="nc" id="L409">                throw new MathInternalError();</span>
+<span class="nc" id="L420">                throw new MathInternalError();</span>
             }
 
-<span class="fc" id="L412">            previous = val[index];</span>
+<span class="fc" id="L423">            previous = val[index];</span>
         }
 
-<span class="fc bfc" id="L415" title="All 2 branches covered.">        if (index == max) {</span>
+<span class="fc bfc" id="L426" title="All 2 branches covered.">        if (index == max) {</span>
             // Loop completed.
-<span class="fc" id="L417">            return true;</span>
+<span class="fc" id="L428">            return true;</span>
         }
 
         // Loop early exit means wrong ordering.
-<span class="fc bfc" id="L421" title="All 2 branches covered.">        if (abort) {</span>
-<span class="fc" id="L422">            throw new NonMonotonicSequenceException(val[index], previous, index, dir, strict);</span>
+<span class="fc bfc" id="L432" title="All 2 branches covered.">        if (abort) {</span>
+<span class="fc" id="L433">            throw new NonMonotonicSequenceException(val[index], previous, index, dir, strict);</span>
         } else {
-<span class="fc" id="L424">            return false;</span>
+<span class="fc" id="L435">            return false;</span>
         }
     }
 
@@ -436,8 +447,8 @@ public class MathArrays {
      */
     public static void checkOrder(double[] val, OrderDirection dir,
                                   boolean strict) throws NonMonotonicSequenceException {
-<span class="fc" id="L439">        checkOrder(val, dir, strict, true);</span>
-<span class="fc" id="L440">    }</span>
+<span class="fc" id="L450">        checkOrder(val, dir, strict, true);</span>
+<span class="fc" id="L451">    }</span>
 
     /**
      * Check that the given array is sorted in strictly increasing order.
@@ -447,8 +458,8 @@ public class MathArrays {
      * @since 2.2
      */
     public static void checkOrder(double[] val) throws NonMonotonicSequenceException {
-<span class="fc" id="L450">        checkOrder(val, OrderDirection.INCREASING, true);</span>
-<span class="fc" id="L451">    }</span>
+<span class="fc" id="L461">        checkOrder(val, OrderDirection.INCREASING, true);</span>
+<span class="fc" id="L462">    }</span>
 
     /**
      * Throws DimensionMismatchException if the input array is not rectangular.
@@ -460,15 +471,15 @@ public class MathArrays {
      */
     public static void checkRectangular(final long[][] in)
         throws NullArgumentException, DimensionMismatchException {
-<span class="fc" id="L463">        MathUtils.checkNotNull(in);</span>
-<span class="fc bfc" id="L464" title="All 2 branches covered.">        for (int i = 1; i &lt; in.length; i++) {</span>
-<span class="fc bfc" id="L465" title="All 2 branches covered.">            if (in[i].length != in[0].length) {</span>
-<span class="fc" id="L466">                throw new DimensionMismatchException(</span>
+<span class="fc" id="L474">        MathUtils.checkNotNull(in);</span>
+<span class="fc bfc" id="L475" title="All 2 branches covered.">        for (int i = 1; i &lt; in.length; i++) {</span>
+<span class="fc bfc" id="L476" title="All 2 branches covered.">            if (in[i].length != in[0].length) {</span>
+<span class="fc" id="L477">                throw new DimensionMismatchException(</span>
                         LocalizedFormats.DIFFERENT_ROWS_LENGTHS,
                         in[i].length, in[0].length);
             }
         }
-<span class="fc" id="L471">    }</span>
+<span class="fc" id="L482">    }</span>
 
     /**
      * Check that all entries of the input array are strictly positive.
@@ -480,12 +491,12 @@ public class MathArrays {
      */
     public static void checkPositive(final double[] in)
         throws NotStrictlyPositiveException {
-<span class="fc bfc" id="L483" title="All 2 branches covered.">        for (int i = 0; i &lt; in.length; i++) {</span>
-<span class="fc bfc" id="L484" title="All 2 branches covered.">            if (in[i] &lt;= 0) {</span>
-<span class="fc" id="L485">                throw new NotStrictlyPositiveException(in[i]);</span>
+<span class="fc bfc" id="L494" title="All 2 branches covered.">        for (int i = 0; i &lt; in.length; i++) {</span>
+<span class="fc bfc" id="L495" title="All 2 branches covered.">            if (in[i] &lt;= 0) {</span>
+<span class="fc" id="L496">                throw new NotStrictlyPositiveException(in[i]);</span>
             }
         }
-<span class="fc" id="L488">    }</span>
+<span class="fc" id="L499">    }</span>
 
     /**
      * Check that no entry of the input array is {@code NaN}.
@@ -496,12 +507,12 @@ public class MathArrays {
      */
     public static void checkNotNaN(final double[] in)
         throws NotANumberException {
-<span class="fc bfc" id="L499" title="All 2 branches covered.">        for(int i = 0; i &lt; in.length; i++) {</span>
-<span class="fc bfc" id="L500" title="All 2 branches covered.">            if (Double.isNaN(in[i])) {</span>
-<span class="fc" id="L501">                throw new NotANumberException();</span>
+<span class="fc bfc" id="L510" title="All 2 branches covered.">        for(int i = 0; i &lt; in.length; i++) {</span>
+<span class="fc bfc" id="L511" title="All 2 branches covered.">            if (Double.isNaN(in[i])) {</span>
+<span class="fc" id="L512">                throw new NotANumberException();</span>
             }
         }
-<span class="fc" id="L504">    }</span>
+<span class="fc" id="L515">    }</span>
 
     /**
      * Check that all entries of the input array are &gt;= 0.
@@ -512,12 +523,12 @@ public class MathArrays {
      */
     public static void checkNonNegative(final long[] in)
         throws NotPositiveException {
-<span class="fc bfc" id="L515" title="All 2 branches covered.">        for (int i = 0; i &lt; in.length; i++) {</span>
-<span class="fc bfc" id="L516" title="All 2 branches covered.">            if (in[i] &lt; 0) {</span>
-<span class="fc" id="L517">                throw new NotPositiveException(in[i]);</span>
+<span class="fc bfc" id="L526" title="All 2 branches covered.">        for (int i = 0; i &lt; in.length; i++) {</span>
+<span class="fc bfc" id="L527" title="All 2 branches covered.">            if (in[i] &lt; 0) {</span>
+<span class="fc" id="L528">                throw new NotPositiveException(in[i]);</span>
             }
         }
-<span class="fc" id="L520">    }</span>
+<span class="fc" id="L531">    }</span>
 
     /**
      * Check all entries of the input array are &gt;= 0.
@@ -528,14 +539,14 @@ public class MathArrays {
      */
     public static void checkNonNegative(final long[][] in)
         throws NotPositiveException {
-<span class="fc bfc" id="L531" title="All 2 branches covered.">        for (int i = 0; i &lt; in.length; i ++) {</span>
-<span class="fc bfc" id="L532" title="All 2 branches covered.">            for (int j = 0; j &lt; in[i].length; j++) {</span>
-<span class="fc bfc" id="L533" title="All 2 branches covered.">                if (in[i][j] &lt; 0) {</span>
-<span class="fc" id="L534">                    throw new NotPositiveException(in[i][j]);</span>
+<span class="fc bfc" id="L542" title="All 2 branches covered.">        for (int i = 0; i &lt; in.length; i ++) {</span>
+<span class="fc bfc" id="L543" title="All 2 branches covered.">            for (int j = 0; j &lt; in[i].length; j++) {</span>
+<span class="fc bfc" id="L544" title="All 2 branches covered.">                if (in[i][j] &lt; 0) {</span>
+<span class="fc" id="L545">                    throw new NotPositiveException(in[i][j]);</span>
                 }
             }
         }
-<span class="fc" id="L538">    }</span>
+<span class="fc" id="L549">    }</span>
 
     /**
      * Returns the Cartesian norm (2-norm), handling both overflow and underflow.
@@ -598,58 +609,58 @@ public class MathArrays {
      * @since 2.2
      */
     public static double safeNorm(double[] v) {
-<span class="nc" id="L601">        double rdwarf = 3.834e-20;</span>
-<span class="nc" id="L602">        double rgiant = 1.304e+19;</span>
-<span class="nc" id="L603">        double s1 = 0;</span>
-<span class="nc" id="L604">        double s2 = 0;</span>
-<span class="nc" id="L605">        double s3 = 0;</span>
-<span class="nc" id="L606">        double x1max = 0;</span>
-<span class="nc" id="L607">        double x3max = 0;</span>
-<span class="nc" id="L608">        double floatn = v.length;</span>
-<span class="nc" id="L609">        double agiant = rgiant / floatn;</span>
-<span class="nc bnc" id="L610" title="All 2 branches missed.">        for (int i = 0; i &lt; v.length; i++) {</span>
-<span class="nc" id="L611">            double xabs = FastMath.abs(v[i]);</span>
-<span class="nc bnc" id="L612" title="All 4 branches missed.">            if (xabs &lt; rdwarf || xabs &gt; agiant) {</span>
-<span class="nc bnc" id="L613" title="All 2 branches missed.">                if (xabs &gt; rdwarf) {</span>
-<span class="nc bnc" id="L614" title="All 2 branches missed.">                    if (xabs &gt; x1max) {</span>
-<span class="nc" id="L615">                        double r = x1max / xabs;</span>
-<span class="nc" id="L616">                        s1= 1 + s1 * r * r;</span>
-<span class="nc" id="L617">                        x1max = xabs;</span>
-<span class="nc" id="L618">                    } else {</span>
-<span class="nc" id="L619">                        double r = xabs / x1max;</span>
-<span class="nc" id="L620">                        s1 += r * r;</span>
-<span class="nc" id="L621">                    }</span>
+<span class="fc" id="L612">        double rdwarf = 3.834e-20;</span>
+<span class="fc" id="L613">        double rgiant = 1.304e+19;</span>
+<span class="fc" id="L614">        double s1 = 0;</span>
+<span class="fc" id="L615">        double s2 = 0;</span>
+<span class="fc" id="L616">        double s3 = 0;</span>
+<span class="fc" id="L617">        double x1max = 0;</span>
+<span class="fc" id="L618">        double x3max = 0;</span>
+<span class="fc" id="L619">        double floatn = v.length;</span>
+<span class="fc" id="L620">        double agiant = rgiant / floatn;</span>
+<span class="fc bfc" id="L621" title="All 2 branches covered.">        for (int i = 0; i &lt; v.length; i++) {</span>
+<span class="fc" id="L622">            double xabs = FastMath.abs(v[i]);</span>
+<span class="fc bfc" id="L623" title="All 4 branches covered.">            if (xabs &lt; rdwarf || xabs &gt; agiant) {</span>
+<span class="fc bfc" id="L624" title="All 2 branches covered.">                if (xabs &gt; rdwarf) {</span>
+<span class="fc bfc" id="L625" title="All 2 branches covered.">                    if (xabs &gt; x1max) {</span>
+<span class="fc" id="L626">                        double r = x1max / xabs;</span>
+<span class="fc" id="L627">                        s1= 1 + s1 * r * r;</span>
+<span class="fc" id="L628">                        x1max = xabs;</span>
+<span class="fc" id="L629">                    } else {</span>
+<span class="fc" id="L630">                        double r = xabs / x1max;</span>
+<span class="fc" id="L631">                        s1 += r * r;</span>
+<span class="fc" id="L632">                    }</span>
                 } else {
-<span class="nc bnc" id="L623" title="All 2 branches missed.">                    if (xabs &gt; x3max) {</span>
-<span class="nc" id="L624">                        double r = x3max / xabs;</span>
-<span class="nc" id="L625">                        s3= 1 + s3 * r * r;</span>
-<span class="nc" id="L626">                        x3max = xabs;</span>
-<span class="nc" id="L627">                    } else {</span>
-<span class="nc bnc" id="L628" title="All 2 branches missed.">                        if (xabs != 0) {</span>
-<span class="nc" id="L629">                            double r = xabs / x3max;</span>
-<span class="nc" id="L630">                            s3 += r * r;</span>
-<span class="nc" id="L631">                        }</span>
+<span class="fc bfc" id="L634" title="All 2 branches covered.">                    if (xabs &gt; x3max) {</span>
+<span class="fc" id="L635">                        double r = x3max / xabs;</span>
+<span class="fc" id="L636">                        s3= 1 + s3 * r * r;</span>
+<span class="fc" id="L637">                        x3max = xabs;</span>
+<span class="fc" id="L638">                    } else {</span>
+<span class="fc bfc" id="L639" title="All 2 branches covered.">                        if (xabs != 0) {</span>
+<span class="fc" id="L640">                            double r = xabs / x3max;</span>
+<span class="fc" id="L641">                            s3 += r * r;</span>
+<span class="fc" id="L642">                        }</span>
                     }
                 }
             } else {
-<span class="nc" id="L635">                s2 += xabs * xabs;</span>
+<span class="fc" id="L646">                s2 += xabs * xabs;</span>
             }
         }
         double norm;
-<span class="nc bnc" id="L639" title="All 2 branches missed.">        if (s1 != 0) {</span>
-<span class="nc" id="L640">            norm = x1max * Math.sqrt(s1 + (s2 / x1max) / x1max);</span>
+<span class="fc bfc" id="L650" title="All 2 branches covered.">        if (s1 != 0) {</span>
+<span class="fc" id="L651">            norm = x1max * Math.sqrt(s1 + (s2 / x1max) / x1max);</span>
         } else {
-<span class="nc bnc" id="L642" title="All 2 branches missed.">            if (s2 == 0) {</span>
-<span class="nc" id="L643">                norm = x3max * Math.sqrt(s3);</span>
+<span class="fc bfc" id="L653" title="All 2 branches covered.">            if (s2 == 0) {</span>
+<span class="fc" id="L654">                norm = x3max * Math.sqrt(s3);</span>
             } else {
-<span class="nc bnc" id="L645" title="All 2 branches missed.">                if (s2 &gt;= x3max) {</span>
-<span class="nc" id="L646">                    norm = Math.sqrt(s2 * (1 + (x3max / s2) * (x3max * s3)));</span>
+<span class="pc bpc" id="L656" title="1 of 2 branches missed.">                if (s2 &gt;= x3max) {</span>
+<span class="fc" id="L657">                    norm = Math.sqrt(s2 * (1 + (x3max / s2) * (x3max * s3)));</span>
                 } else {
-<span class="nc" id="L648">                    norm = Math.sqrt(x3max * ((s2 / x3max) + (x3max * s3)));</span>
+<span class="nc" id="L659">                    norm = Math.sqrt(x3max * ((s2 / x3max) + (x3max * s3)));</span>
                 }
             }
         }
-<span class="nc" id="L652">        return norm;</span>
+<span class="fc" id="L663">        return norm;</span>
     }
 
     /**
@@ -670,8 +681,8 @@ public class MathArrays {
      */
     public static void sortInPlace(double[] x, double[] ... yList)
         throws DimensionMismatchException, NullArgumentException {
-<span class="fc" id="L673">        sortInPlace(x, OrderDirection.INCREASING, yList);</span>
-<span class="fc" id="L674">    }</span>
+<span class="fc" id="L684">        sortInPlace(x, OrderDirection.INCREASING, yList);</span>
+<span class="fc" id="L685">    }</span>
 
     /**
      * Sort an array in place and perform the same reordering of entries on
@@ -697,70 +708,70 @@ public class MathArrays {
                DimensionMismatchException {
 
         // Consistency checks.
-<span class="pc bpc" id="L700" title="1 of 2 branches missed.">        if (x == null) {</span>
-<span class="nc" id="L701">            throw new NullArgumentException();</span>
+<span class="pc bpc" id="L711" title="1 of 2 branches missed.">        if (x == null) {</span>
+<span class="nc" id="L712">            throw new NullArgumentException();</span>
         }
 
-<span class="fc" id="L704">        final int yListLen = yList.length;</span>
-<span class="fc" id="L705">        final int len = x.length;</span>
+<span class="fc" id="L715">        final int yListLen = yList.length;</span>
+<span class="fc" id="L716">        final int len = x.length;</span>
 
-<span class="fc bfc" id="L707" title="All 2 branches covered.">        for (int j = 0; j &lt; yListLen; j++) {</span>
-<span class="fc" id="L708">            final double[] y = yList[j];</span>
-<span class="fc bfc" id="L709" title="All 2 branches covered.">            if (y == null) {</span>
-<span class="fc" id="L710">                throw new NullArgumentException();</span>
+<span class="fc bfc" id="L718" title="All 2 branches covered.">        for (int j = 0; j &lt; yListLen; j++) {</span>
+<span class="fc" id="L719">            final double[] y = yList[j];</span>
+<span class="fc bfc" id="L720" title="All 2 branches covered.">            if (y == null) {</span>
+<span class="fc" id="L721">                throw new NullArgumentException();</span>
             }
-<span class="fc bfc" id="L712" title="All 2 branches covered.">            if (y.length != len) {</span>
-<span class="fc" id="L713">                throw new DimensionMismatchException(y.length, len);</span>
+<span class="fc bfc" id="L723" title="All 2 branches covered.">            if (y.length != len) {</span>
+<span class="fc" id="L724">                throw new DimensionMismatchException(y.length, len);</span>
             }
         }
 
         // Associate each abscissa &quot;x[i]&quot; with its index &quot;i&quot;.
-<span class="fc" id="L718">        final List&lt;Pair&lt;Double, Integer&gt;&gt; list</span>
+<span class="fc" id="L729">        final List&lt;Pair&lt;Double, Integer&gt;&gt; list</span>
             = new ArrayList&lt;Pair&lt;Double, Integer&gt;&gt;(len);
-<span class="fc bfc" id="L720" title="All 2 branches covered.">        for (int i = 0; i &lt; len; i++) {</span>
-<span class="fc" id="L721">            list.add(new Pair&lt;Double, Integer&gt;(x[i], i));</span>
+<span class="fc bfc" id="L731" title="All 2 branches covered.">        for (int i = 0; i &lt; len; i++) {</span>
+<span class="fc" id="L732">            list.add(new Pair&lt;Double, Integer&gt;(x[i], i));</span>
         }
 
         // Create comparators for increasing and decreasing orders.
-<span class="fc bfc" id="L725" title="All 2 branches covered.">        final Comparator&lt;Pair&lt;Double, Integer&gt;&gt; comp</span>
+<span class="fc bfc" id="L736" title="All 2 branches covered.">        final Comparator&lt;Pair&lt;Double, Integer&gt;&gt; comp</span>
             = dir == MathArrays.OrderDirection.INCREASING ?
-<span class="fc" id="L727">            new Comparator&lt;Pair&lt;Double, Integer&gt;&gt;() {</span>
+<span class="fc" id="L738">            new Comparator&lt;Pair&lt;Double, Integer&gt;&gt;() {</span>
             public int compare(Pair&lt;Double, Integer&gt; o1,
                                Pair&lt;Double, Integer&gt; o2) {
-<span class="fc" id="L730">                return o1.getKey().compareTo(o2.getKey());</span>
+<span class="fc" id="L741">                return o1.getKey().compareTo(o2.getKey());</span>
             }
-<span class="fc" id="L732">        } : new Comparator&lt;Pair&lt;Double,Integer&gt;&gt;() {</span>
+<span class="fc" id="L743">        } : new Comparator&lt;Pair&lt;Double,Integer&gt;&gt;() {</span>
             public int compare(Pair&lt;Double, Integer&gt; o1,
                                Pair&lt;Double, Integer&gt; o2) {
-<span class="fc" id="L735">                return o2.getKey().compareTo(o1.getKey());</span>
+<span class="fc" id="L746">                return o2.getKey().compareTo(o1.getKey());</span>
             }
         };
 
         // Sort.
-<span class="fc" id="L740">        Collections.sort(list, comp);</span>
+<span class="fc" id="L751">        Collections.sort(list, comp);</span>
 
         // Modify the original array so that its elements are in
         // the prescribed order.
         // Retrieve indices of original locations.
-<span class="fc" id="L745">        final int[] indices = new int[len];</span>
-<span class="fc bfc" id="L746" title="All 2 branches covered.">        for (int i = 0; i &lt; len; i++) {</span>
-<span class="fc" id="L747">            final Pair&lt;Double, Integer&gt; e = list.get(i);</span>
-<span class="fc" id="L748">            x[i] = e.getKey();</span>
-<span class="fc" id="L749">            indices[i] = e.getValue();</span>
+<span class="fc" id="L756">        final int[] indices = new int[len];</span>
+<span class="fc bfc" id="L757" title="All 2 branches covered.">        for (int i = 0; i &lt; len; i++) {</span>
+<span class="fc" id="L758">            final Pair&lt;Double, Integer&gt; e = list.get(i);</span>
+<span class="fc" id="L759">            x[i] = e.getKey();</span>
+<span class="fc" id="L760">            indices[i] = e.getValue();</span>
         }
 
         // In each of the associated arrays, move the
         // elements to their new location.
-<span class="fc bfc" id="L754" title="All 2 branches covered.">        for (int j = 0; j &lt; yListLen; j++) {</span>
+<span class="fc bfc" id="L765" title="All 2 branches covered.">        for (int j = 0; j &lt; yListLen; j++) {</span>
             // Input array will be modified in place.
-<span class="fc" id="L756">            final double[] yInPlace = yList[j];</span>
-<span class="fc" id="L757">            final double[] yOrig = yInPlace.clone();</span>
+<span class="fc" id="L767">            final double[] yInPlace = yList[j];</span>
+<span class="fc" id="L768">            final double[] yOrig = yInPlace.clone();</span>
 
-<span class="fc bfc" id="L759" title="All 2 branches covered.">            for (int i = 0; i &lt; len; i++) {</span>
-<span class="fc" id="L760">                yInPlace[i] = yOrig[indices[i]];</span>
+<span class="fc bfc" id="L770" title="All 2 branches covered.">            for (int i = 0; i &lt; len; i++) {</span>
+<span class="fc" id="L771">                yInPlace[i] = yOrig[indices[i]];</span>
             }
         }
-<span class="fc" id="L763">    }</span>
+<span class="fc" id="L774">    }</span>
 
     /**
      * Creates a copy of the {@code source} array.
@@ -769,7 +780,7 @@ public class MathArrays {
      * @return the copied array.
      */
      public static int[] copyOf(int[] source) {
-<span class="fc" id="L772">         return copyOf(source, source.length);</span>
+<span class="fc" id="L783">         return copyOf(source, source.length);</span>
      }
 
     /**
@@ -779,7 +790,7 @@ public class MathArrays {
      * @return the copied array.
      */
      public static double[] copyOf(double[] source) {
-<span class="fc" id="L782">         return copyOf(source, source.length);</span>
+<span class="fc" id="L793">         return copyOf(source, source.length);</span>
      }
 
     /**
@@ -792,9 +803,9 @@ public class MathArrays {
      * @return the copied array.
      */
     public static int[] copyOf(int[] source, int len) {
-<span class="fc" id="L795">         final int[] output = new int[len];</span>
-<span class="fc" id="L796">         System.arraycopy(source, 0, output, 0, FastMath.min(len, source.length));</span>
-<span class="fc" id="L797">         return output;</span>
+<span class="fc" id="L806">         final int[] output = new int[len];</span>
+<span class="fc" id="L807">         System.arraycopy(source, 0, output, 0, FastMath.min(len, source.length));</span>
+<span class="fc" id="L808">         return output;</span>
      }
 
     /**
@@ -807,9 +818,9 @@ public class MathArrays {
      * @return the copied array.
      */
     public static double[] copyOf(double[] source, int len) {
-<span class="fc" id="L810">         final double[] output = new double[len];</span>
-<span class="fc" id="L811">         System.arraycopy(source, 0, output, 0, FastMath.min(len, source.length));</span>
-<span class="fc" id="L812">         return output;</span>
+<span class="fc" id="L821">         final double[] output = new double[len];</span>
+<span class="fc" id="L822">         System.arraycopy(source, 0, output, 0, FastMath.min(len, source.length));</span>
+<span class="fc" id="L823">         return output;</span>
      }
 
     /**
@@ -821,10 +832,10 @@ public class MathArrays {
      * @return the copied array.
      */
     public static double[] copyOfRange(double[] source, int from, int to) {
-<span class="fc" id="L824">        final int len = to - from;</span>
-<span class="fc" id="L825">        final double[] output = new double[len];</span>
-<span class="fc" id="L826">        System.arraycopy(source, from, output, 0, FastMath.min(len, source.length - from));</span>
-<span class="fc" id="L827">        return output;</span>
+<span class="fc" id="L835">        final int len = to - from;</span>
+<span class="fc" id="L836">        final double[] output = new double[len];</span>
+<span class="fc" id="L837">        System.arraycopy(source, from, output, 0, FastMath.min(len, source.length - from));</span>
+<span class="fc" id="L838">        return output;</span>
      }
 
     /**
@@ -846,63 +857,63 @@ public class MathArrays {
      */
     public static double linearCombination(final double[] a, final double[] b)
         throws DimensionMismatchException {
-<span class="fc" id="L849">        final int len = a.length;</span>
-<span class="pc bpc" id="L850" title="1 of 2 branches missed.">        if (len != b.length) {</span>
-<span class="nc" id="L851">            throw new DimensionMismatchException(len, b.length);</span>
+<span class="fc" id="L860">        final int len = a.length;</span>
+<span class="pc bpc" id="L861" title="1 of 2 branches missed.">        if (len != b.length) {</span>
+<span class="nc" id="L862">            throw new DimensionMismatchException(len, b.length);</span>
         }
 
-<span class="fc bfc" id="L854" title="All 2 branches covered.">        if (len == 1) {</span>
+<span class="fc bfc" id="L865" title="All 2 branches covered.">        if (len == 1) {</span>
             // Revert to scalar multiplication.
-<span class="fc" id="L856">            return a[0] * b[0];</span>
+<span class="fc" id="L867">            return a[0] * b[0];</span>
         }
 
-<span class="fc" id="L859">        final double[] prodHigh = new double[len];</span>
-<span class="fc" id="L860">        double prodLowSum = 0;</span>
+<span class="fc" id="L870">        final double[] prodHigh = new double[len];</span>
+<span class="fc" id="L871">        double prodLowSum = 0;</span>
 
-<span class="fc bfc" id="L862" title="All 2 branches covered.">        for (int i = 0; i &lt; len; i++) {</span>
-<span class="fc" id="L863">            final double ai    = a[i];</span>
-<span class="fc" id="L864">            final double aHigh = Double.longBitsToDouble(Double.doubleToRawLongBits(ai) &amp; ((-1L) &lt;&lt; 27));</span>
-<span class="fc" id="L865">            final double aLow  = ai - aHigh;</span>
-
-<span class="fc" id="L867">            final double bi    = b[i];</span>
-<span class="fc" id="L868">            final double bHigh = Double.longBitsToDouble(Double.doubleToRawLongBits(bi) &amp; ((-1L) &lt;&lt; 27));</span>
-<span class="fc" id="L869">            final double bLow  = bi - bHigh;</span>
-<span class="fc" id="L870">            prodHigh[i] = ai * bi;</span>
-<span class="fc" id="L871">            final double prodLow = aLow * bLow - (((prodHigh[i] -</span>
+<span class="fc bfc" id="L873" title="All 2 branches covered.">        for (int i = 0; i &lt; len; i++) {</span>
+<span class="fc" id="L874">            final double ai    = a[i];</span>
+<span class="fc" id="L875">            final double aHigh = Double.longBitsToDouble(Double.doubleToRawLongBits(ai) &amp; ((-1L) &lt;&lt; 27));</span>
+<span class="fc" id="L876">            final double aLow  = ai - aHigh;</span>
+
+<span class="fc" id="L878">            final double bi    = b[i];</span>
+<span class="fc" id="L879">            final double bHigh = Double.longBitsToDouble(Double.doubleToRawLongBits(bi) &amp; ((-1L) &lt;&lt; 27));</span>
+<span class="fc" id="L880">            final double bLow  = bi - bHigh;</span>
+<span class="fc" id="L881">            prodHigh[i] = ai * bi;</span>
+<span class="fc" id="L882">            final double prodLow = aLow * bLow - (((prodHigh[i] -</span>
                                                     aHigh * bHigh) -
                                                    aLow * bHigh) -
                                                   aHigh * bLow);
-<span class="fc" id="L875">            prodLowSum += prodLow;</span>
+<span class="fc" id="L886">            prodLowSum += prodLow;</span>
         }
 
 
-<span class="fc" id="L879">        final double prodHighCur = prodHigh[0];</span>
-<span class="fc" id="L880">        double prodHighNext = prodHigh[1];</span>
-<span class="fc" id="L881">        double sHighPrev = prodHighCur + prodHighNext;</span>
-<span class="fc" id="L882">        double sPrime = sHighPrev - prodHighNext;</span>
-<span class="fc" id="L883">        double sLowSum = (prodHighNext - (sHighPrev - sPrime)) + (prodHighCur - sPrime);</span>
+<span class="fc" id="L890">        final double prodHighCur = prodHigh[0];</span>
+<span class="fc" id="L891">        double prodHighNext = prodHigh[1];</span>
+<span class="fc" id="L892">        double sHighPrev = prodHighCur + prodHighNext;</span>
+<span class="fc" id="L893">        double sPrime = sHighPrev - prodHighNext;</span>
+<span class="fc" id="L894">        double sLowSum = (prodHighNext - (sHighPrev - sPrime)) + (prodHighCur - sPrime);</span>
 
-<span class="fc" id="L885">        final int lenMinusOne = len - 1;</span>
-<span class="fc bfc" id="L886" title="All 2 branches covered.">        for (int i = 1; i &lt; lenMinusOne; i++) {</span>
-<span class="fc" id="L887">            prodHighNext = prodHigh[i + 1];</span>
-<span class="fc" id="L888">            final double sHighCur = sHighPrev + prodHighNext;</span>
-<span class="fc" id="L889">            sPrime = sHighCur - prodHighNext;</span>
-<span class="fc" id="L890">            sLowSum += (prodHighNext - (sHighCur - sPrime)) + (sHighPrev - sPrime);</span>
-<span class="fc" id="L891">            sHighPrev = sHighCur;</span>
+<span class="fc" id="L896">        final int lenMinusOne = len - 1;</span>
+<span class="fc bfc" id="L897" title="All 2 branches covered.">        for (int i = 1; i &lt; lenMinusOne; i++) {</span>
+<span class="fc" id="L898">            prodHighNext = prodHigh[i + 1];</span>
+<span class="fc" id="L899">            final double sHighCur = sHighPrev + prodHighNext;</span>
+<span class="fc" id="L900">            sPrime = sHighCur - prodHighNext;</span>
+<span class="fc" id="L901">            sLowSum += (prodHighNext - (sHighCur - sPrime)) + (sHighPrev - sPrime);</span>
+<span class="fc" id="L902">            sHighPrev = sHighCur;</span>
         }
 
-<span class="fc" id="L894">        double result = sHighPrev + (prodLowSum + sLowSum);</span>
+<span class="fc" id="L905">        double result = sHighPrev + (prodLowSum + sLowSum);</span>
 
-<span class="fc bfc" id="L896" title="All 2 branches covered.">        if (Double.isNaN(result)) {</span>
+<span class="fc bfc" id="L907" title="All 2 branches covered.">        if (Double.isNaN(result)) {</span>
             // either we have split infinite numbers or some coefficients were NaNs,
             // just rely on the naive implementation and let IEEE754 handle this
-<span class="fc" id="L899">            result = 0;</span>
-<span class="fc bfc" id="L900" title="All 2 branches covered.">            for (int i = 0; i &lt; len; ++i) {</span>
-<span class="fc" id="L901">                result += a[i] * b[i];</span>
+<span class="fc" id="L910">            result = 0;</span>
+<span class="fc bfc" id="L911" title="All 2 branches covered.">            for (int i = 0; i &lt; len; ++i) {</span>
+<span class="fc" id="L912">                result += a[i] * b[i];</span>
             }
         }
 
-<span class="fc" id="L905">        return result;</span>
+<span class="fc" id="L916">        return result;</span>
     }
 
     /**
@@ -940,41 +951,41 @@ public class MathArrays {
         // only at the end, after cancellation may have occurred on high order bits
 
         // split a1 and b1 as one 26 bits number and one 27 bits number
-<span class="fc" id="L943">        final double a1High     = Double.longBitsToDouble(Double.doubleToRawLongBits(a1) &amp; ((-1L) &lt;&lt; 27));</span>
-<span class="fc" id="L944">        final double a1Low      = a1 - a1High;</span>
-<span class="fc" id="L945">        final double b1High     = Double.longBitsToDouble(Double.doubleToRawLongBits(b1) &amp; ((-1L) &lt;&lt; 27));</span>
-<span class="fc" id="L946">        final double b1Low      = b1 - b1High;</span>
+<span class="fc" id="L954">        final double a1High     = Double.longBitsToDouble(Double.doubleToRawLongBits(a1) &amp; ((-1L) &lt;&lt; 27));</span>
+<span class="fc" id="L955">        final double a1Low      = a1 - a1High;</span>
+<span class="fc" id="L956">        final double b1High     = Double.longBitsToDouble(Double.doubleToRawLongBits(b1) &amp; ((-1L) &lt;&lt; 27));</span>
+<span class="fc" id="L957">        final double b1Low      = b1 - b1High;</span>
 
         // accurate multiplication a1 * b1
-<span class="fc" id="L949">        final double prod1High  = a1 * b1;</span>
-<span class="fc" id="L950">        final double prod1Low   = a1Low * b1Low - (((prod1High - a1High * b1High) - a1Low * b1High) - a1High * b1Low);</span>
+<span class="fc" id="L960">        final double prod1High  = a1 * b1;</span>
+<span class="fc" id="L961">        final double prod1Low   = a1Low * b1Low - (((prod1High - a1High * b1High) - a1Low * b1High) - a1High * b1Low);</span>
 
         // split a2 and b2 as one 26 bits number and one 27 bits number
-<span class="fc" id="L953">        final double a2High     = Double.longBitsToDouble(Double.doubleToRawLongBits(a2) &amp; ((-1L) &lt;&lt; 27));</span>
-<span class="fc" id="L954">        final double a2Low      = a2 - a2High;</span>
-<span class="fc" id="L955">        final double b2High     = Double.longBitsToDouble(Double.doubleToRawLongBits(b2) &amp; ((-1L) &lt;&lt; 27));</span>
-<span class="fc" id="L956">        final double b2Low      = b2 - b2High;</span>
+<span class="fc" id="L964">        final double a2High     = Double.longBitsToDouble(Double.doubleToRawLongBits(a2) &amp; ((-1L) &lt;&lt; 27));</span>
+<span class="fc" id="L965">        final double a2Low      = a2 - a2High;</span>
+<span class="fc" id="L966">        final double b2High     = Double.longBitsToDouble(Double.doubleToRawLongBits(b2) &amp; ((-1L) &lt;&lt; 27));</span>
+<span class="fc" id="L967">        final double b2Low      = b2 - b2High;</span>
 
         // accurate multiplication a2 * b2
-<span class="fc" id="L959">        final double prod2High  = a2 * b2;</span>
-<span class="fc" id="L960">        final double prod2Low   = a2Low * b2Low - (((prod2High - a2High * b2High) - a2Low * b2High) - a2High * b2Low);</span>
+<span class="fc" id="L970">        final double prod2High  = a2 * b2;</span>
+<span class="fc" id="L971">        final double prod2Low   = a2Low * b2Low - (((prod2High - a2High * b2High) - a2Low * b2High) - a2High * b2Low);</span>
 
         // accurate addition a1 * b1 + a2 * b2
-<span class="fc" id="L963">        final double s12High    = prod1High + prod2High;</span>
-<span class="fc" id="L964">        final double s12Prime   = s12High - prod2High;</span>
-<span class="fc" id="L965">        final double s12Low     = (prod2High - (s12High - s12Prime)) + (prod1High - s12Prime);</span>
+<span class="fc" id="L974">        final double s12High    = prod1High + prod2High;</span>
+<span class="fc" id="L975">        final double s12Prime   = s12High - prod2High;</span>
+<span class="fc" id="L976">        final double s12Low     = (prod2High - (s12High - s12Prime)) + (prod1High - s12Prime);</span>
 
         // final rounding, s12 may have suffered many cancellations, we try
         // to recover some bits from the extra words we have saved up to now
-<span class="fc" id="L969">        double result = s12High + (prod1Low + prod2Low + s12Low);</span>
+<span class="fc" id="L980">        double result = s12High + (prod1Low + prod2Low + s12Low);</span>
 
-<span class="fc bfc" id="L971" title="All 2 branches covered.">        if (Double.isNaN(result)) {</span>
+<span class="fc bfc" id="L982" title="All 2 branches covered.">        if (Double.isNaN(result)) {</span>
             // either we have split infinite numbers or some coefficients were NaNs,
             // just rely on the naive implementation and let IEEE754 handle this
-<span class="fc" id="L974">            result = a1 * b1 + a2 * b2;</span>
+<span class="fc" id="L985">            result = a1 * b1 + a2 * b2;</span>
         }
 
-<span class="fc" id="L977">        return result;</span>
+<span class="fc" id="L988">        return result;</span>
     }
 
     /**
@@ -1015,56 +1026,56 @@ public class MathArrays {
         // only at the end, after cancellation may have occurred on high order bits
 
         // split a1 and b1 as one 26 bits number and one 27 bits number
-<span class="fc" id="L1018">        final double a1High     = Double.longBitsToDouble(Double.doubleToRawLongBits(a1) &amp; ((-1L) &lt;&lt; 27));</span>
-<span class="fc" id="L1019">        final double a1Low      = a1 - a1High;</span>
-<span class="fc" id="L1020">        final double b1High     = Double.longBitsToDouble(Double.doubleToRawLongBits(b1) &amp; ((-1L) &lt;&lt; 27));</span>
-<span class="fc" id="L1021">        final double b1Low      = b1 - b1High;</span>
+<span class="fc" id="L1029">        final double a1High     = Double.longBitsToDouble(Double.doubleToRawLongBits(a1) &amp; ((-1L) &lt;&lt; 27));</span>
+<span class="fc" id="L1030">        final double a1Low      = a1 - a1High;</span>
+<span class="fc" id="L1031">        final double b1High     = Double.longBitsToDouble(Double.doubleToRawLongBits(b1) &amp; ((-1L) &lt;&lt; 27));</span>
+<span class="fc" id="L1032">        final double b1Low      = b1 - b1High;</span>
 
         // accurate multiplication a1 * b1
-<span class="fc" id="L1024">        final double prod1High  = a1 * b1;</span>
-<span class="fc" id="L1025">        final double prod1Low   = a1Low * b1Low - (((prod1High - a1High * b1High) - a1Low * b1High) - a1High * b1Low);</span>
+<span class="fc" id="L1035">        final double prod1High  = a1 * b1;</span>
+<span class="fc" id="L1036">        final double prod1Low   = a1Low * b1Low - (((prod1High - a1High * b1High) - a1Low * b1High) - a1High * b1Low);</span>
 
         // split a2 and b2 as one 26 bits number and one 27 bits number
-<span class="fc" id="L1028">        final double a2High     = Double.longBitsToDouble(Double.doubleToRawLongBits(a2) &amp; ((-1L) &lt;&lt; 27));</span>
-<span class="fc" id="L1029">        final double a2Low      = a2 - a2High;</span>
-<span class="fc" id="L1030">        final double b2High     = Double.longBitsToDouble(Double.doubleToRawLongBits(b2) &amp; ((-1L) &lt;&lt; 27));</span>
-<span class="fc" id="L1031">        final double b2Low      = b2 - b2High;</span>
+<span class="fc" id="L1039">        final double a2High     = Double.longBitsToDouble(Double.doubleToRawLongBits(a2) &amp; ((-1L) &lt;&lt; 27));</span>
+<span class="fc" id="L1040">        final double a2Low      = a2 - a2High;</span>
+<span class="fc" id="L1041">        final double b2High     = Double.longBitsToDouble(Double.doubleToRawLongBits(b2) &amp; ((-1L) &lt;&lt; 27));</span>
+<span class="fc" id="L1042">        final double b2Low      = b2 - b2High;</span>
 
         // accurate multiplication a2 * b2
-<span class="fc" id="L1034">        final double prod2High  = a2 * b2;</span>
-<span class="fc" id="L1035">        final double prod2Low   = a2Low * b2Low - (((prod2High - a2High * b2High) - a2Low * b2High) - a2High * b2Low);</span>
+<span class="fc" id="L1045">        final double prod2High  = a2 * b2;</span>
+<span class="fc" id="L1046">        final double prod2Low   = a2Low * b2Low - (((prod2High - a2High * b2High) - a2Low * b2High) - a2High * b2Low);</span>
 
         // split a3 and b3 as one 26 bits number and one 27 bits number
-<span class="fc" id="L1038">        final double a3High     = Double.longBitsToDouble(Double.doubleToRawLongBits(a3) &amp; ((-1L) &lt;&lt; 27));</span>
-<span class="fc" id="L1039">        final double a3Low      = a3 - a3High;</span>
-<span class="fc" id="L1040">        final double b3High     = Double.longBitsToDouble(Double.doubleToRawLongBits(b3) &amp; ((-1L) &lt;&lt; 27));</span>
-<span class="fc" id="L1041">        final double b3Low      = b3 - b3High;</span>
+<span class="fc" id="L1049">        final double a3High     = Double.longBitsToDouble(Double.doubleToRawLongBits(a3) &amp; ((-1L) &lt;&lt; 27));</span>
+<span class="fc" id="L1050">        final double a3Low      = a3 - a3High;</span>
+<span class="fc" id="L1051">        final double b3High     = Double.longBitsToDouble(Double.doubleToRawLongBits(b3) &amp; ((-1L) &lt;&lt; 27));</span>
+<span class="fc" id="L1052">        final double b3Low      = b3 - b3High;</span>
 
         // accurate multiplication a3 * b3
-<span class="fc" id="L1044">        final double prod3High  = a3 * b3;</span>
-<span class="fc" id="L1045">        final double prod3Low   = a3Low * b3Low - (((prod3High - a3High * b3High) - a3Low * b3High) - a3High * b3Low);</span>
+<span class="fc" id="L1055">        final double prod3High  = a3 * b3;</span>
+<span class="fc" id="L1056">        final double prod3Low   = a3Low * b3Low - (((prod3High - a3High * b3High) - a3Low * b3High) - a3High * b3Low);</span>
 
         // accurate addition a1 * b1 + a2 * b2
-<span class="fc" id="L1048">        final double s12High    = prod1High + prod2High;</span>
-<span class="fc" id="L1049">        final double s12Prime   = s12High - prod2High;</span>
-<span class="fc" id="L1050">        final double s12Low     = (prod2High - (s12High - s12Prime)) + (prod1High - s12Prime);</span>
+<span class="fc" id="L1059">        final double s12High    = prod1High + prod2High;</span>
+<span class="fc" id="L1060">        final double s12Prime   = s12High - prod2High;</span>
+<span class="fc" id="L1061">        final double s12Low     = (prod2High - (s12High - s12Prime)) + (prod1High - s12Prime);</span>
 
         // accurate addition a1 * b1 + a2 * b2 + a3 * b3
-<span class="fc" id="L1053">        final double s123High   = s12High + prod3High;</span>
-<span class="fc" id="L1054">        final double s123Prime  = s123High - prod3High;</span>
-<span class="fc" id="L1055">        final double s123Low    = (prod3High - (s123High - s123Prime)) + (s12High - s123Prime);</span>
+<span class="fc" id="L1064">        final double s123High   = s12High + prod3High;</span>
+<span class="fc" id="L1065">        final double s123Prime  = s123High - prod3High;</span>
+<span class="fc" id="L1066">        final double s123Low    = (prod3High - (s123High - s123Prime)) + (s12High - s123Prime);</span>
 
         // final rounding, s123 may have suffered many cancellations, we try
         // to recover some bits from the extra words we have saved up to now
-<span class="fc" id="L1059">        double result = s123High + (prod1Low + prod2Low + prod3Low + s12Low + s123Low);</span>
+<span class="fc" id="L1070">        double result = s123High + (prod1Low + prod2Low + prod3Low + s12Low + s123Low);</span>
 
-<span class="fc bfc" id="L1061" title="All 2 branches covered.">        if (Double.isNaN(result)) {</span>
+<span class="fc bfc" id="L1072" title="All 2 branches covered.">        if (Double.isNaN(result)) {</span>
             // either we have split infinite numbers or some coefficients were NaNs,
             // just rely on the naive implementation and let IEEE754 handle this
-<span class="fc" id="L1064">            result = a1 * b1 + a2 * b2 + a3 * b3;</span>
+<span class="fc" id="L1075">            result = a1 * b1 + a2 * b2 + a3 * b3;</span>
         }
 
-<span class="fc" id="L1067">        return result;</span>
+<span class="fc" id="L1078">        return result;</span>
     }
 
     /**
@@ -1110,71 +1121,71 @@ public class MathArrays {
         // only at the end, after cancellation may have occurred on high order bits
 
         // split a1 and b1 as one 26 bits number and one 27 bits number
-<span class="fc" id="L1113">        final double a1High     = Double.longBitsToDouble(Double.doubleToRawLongBits(a1) &amp; ((-1L) &lt;&lt; 27));</span>
-<span class="fc" id="L1114">        final double a1Low      = a1 - a1High;</span>
-<span class="fc" id="L1115">        final double b1High     = Double.longBitsToDouble(Double.doubleToRawLongBits(b1) &amp; ((-1L) &lt;&lt; 27));</span>
-<span class="fc" id="L1116">        final double b1Low      = b1 - b1High;</span>
+<span class="fc" id="L1124">        final double a1High     = Double.longBitsToDouble(Double.doubleToRawLongBits(a1) &amp; ((-1L) &lt;&lt; 27));</span>
+<span class="fc" id="L1125">        final double a1Low      = a1 - a1High;</span>
+<span class="fc" id="L1126">        final double b1High     = Double.longBitsToDouble(Double.doubleToRawLongBits(b1) &amp; ((-1L) &lt;&lt; 27));</span>
+<span class="fc" id="L1127">        final double b1Low      = b1 - b1High;</span>
 
         // accurate multiplication a1 * b1
-<span class="fc" id="L1119">        final double prod1High  = a1 * b1;</span>
-<span class="fc" id="L1120">        final double prod1Low   = a1Low * b1Low - (((prod1High - a1High * b1High) - a1Low * b1High) - a1High * b1Low);</span>
+<span class="fc" id="L1130">        final double prod1High  = a1 * b1;</span>
+<span class="fc" id="L1131">        final double prod1Low   = a1Low * b1Low - (((prod1High - a1High * b1High) - a1Low * b1High) - a1High * b1Low);</span>
 
         // split a2 and b2 as one 26 bits number and one 27 bits number
-<span class="fc" id="L1123">        final double a2High     = Double.longBitsToDouble(Double.doubleToRawLongBits(a2) &amp; ((-1L) &lt;&lt; 27));</span>
-<span class="fc" id="L1124">        final double a2Low      = a2 - a2High;</span>
-<span class="fc" id="L1125">        final double b2High     = Double.longBitsToDouble(Double.doubleToRawLongBits(b2) &amp; ((-1L) &lt;&lt; 27));</span>
-<span class="fc" id="L1126">        final double b2Low      = b2 - b2High;</span>
+<span class="fc" id="L1134">        final double a2High     = Double.longBitsToDouble(Double.doubleToRawLongBits(a2) &amp; ((-1L) &lt;&lt; 27));</span>
+<span class="fc" id="L1135">        final double a2Low      = a2 - a2High;</span>
+<span class="fc" id="L1136">        final double b2High     = Double.longBitsToDouble(Double.doubleToRawLongBits(b2) &amp; ((-1L) &lt;&lt; 27));</span>
+<span class="fc" id="L1137">        final double b2Low      = b2 - b2High;</span>
 
         // accurate multiplication a2 * b2
-<span class="fc" id="L1129">        final double prod2High  = a2 * b2;</span>
-<span class="fc" id="L1130">        final double prod2Low   = a2Low * b2Low - (((prod2High - a2High * b2High) - a2Low * b2High) - a2High * b2Low);</span>
+<span class="fc" id="L1140">        final double prod2High  = a2 * b2;</span>
+<span class="fc" id="L1141">        final double prod2Low   = a2Low * b2Low - (((prod2High - a2High * b2High) - a2Low * b2High) - a2High * b2Low);</span>
 
         // split a3 and b3 as one 26 bits number and one 27 bits number
-<span class="fc" id="L1133">        final double a3High     = Double.longBitsToDouble(Double.doubleToRawLongBits(a3) &amp; ((-1L) &lt;&lt; 27));</span>
-<span class="fc" id="L1134">        final double a3Low      = a3 - a3High;</span>
-<span class="fc" id="L1135">        final double b3High     = Double.longBitsToDouble(Double.doubleToRawLongBits(b3) &amp; ((-1L) &lt;&lt; 27));</span>
-<span class="fc" id="L1136">        final double b3Low      = b3 - b3High;</span>
+<span class="fc" id="L1144">        final double a3High     = Double.longBitsToDouble(Double.doubleToRawLongBits(a3) &amp; ((-1L) &lt;&lt; 27));</span>
+<span class="fc" id="L1145">        final double a3Low      = a3 - a3High;</span>
+<span class="fc" id="L1146">        final double b3High     = Double.longBitsToDouble(Double.doubleToRawLongBits(b3) &amp; ((-1L) &lt;&lt; 27));</span>
+<span class="fc" id="L1147">        final double b3Low      = b3 - b3High;</span>
 
         // accurate multiplication a3 * b3
-<span class="fc" id="L1139">        final double prod3High  = a3 * b3;</span>
-<span class="fc" id="L1140">        final double prod3Low   = a3Low * b3Low - (((prod3High - a3High * b3High) - a3Low * b3High) - a3High * b3Low);</span>
+<span class="fc" id="L1150">        final double prod3High  = a3 * b3;</span>
+<span class="fc" id="L1151">        final double prod3Low   = a3Low * b3Low - (((prod3High - a3High * b3High) - a3Low * b3High) - a3High * b3Low);</span>
 
         // split a4 and b4 as one 26 bits number and one 27 bits number
-<span class="fc" id="L1143">        final double a4High     = Double.longBitsToDouble(Double.doubleToRawLongBits(a4) &amp; ((-1L) &lt;&lt; 27));</span>
-<span class="fc" id="L1144">        final double a4Low      = a4 - a4High;</span>
-<span class="fc" id="L1145">        final double b4High     = Double.longBitsToDouble(Double.doubleToRawLongBits(b4) &amp; ((-1L) &lt;&lt; 27));</span>
-<span class="fc" id="L1146">        final double b4Low      = b4 - b4High;</span>
+<span class="fc" id="L1154">        final double a4High     = Double.longBitsToDouble(Double.doubleToRawLongBits(a4) &amp; ((-1L) &lt;&lt; 27));</span>
+<span class="fc" id="L1155">        final double a4Low      = a4 - a4High;</span>
+<span class="fc" id="L1156">        final double b4High     = Double.longBitsToDouble(Double.doubleToRawLongBits(b4) &amp; ((-1L) &lt;&lt; 27));</span>
+<span class="fc" id="L1157">        final double b4Low      = b4 - b4High;</span>
 
         // accurate multiplication a4 * b4
-<span class="fc" id="L1149">        final double prod4High  = a4 * b4;</span>
-<span class="fc" id="L1150">        final double prod4Low   = a4Low * b4Low - (((prod4High - a4High * b4High) - a4Low * b4High) - a4High * b4Low);</span>
+<span class="fc" id="L1160">        final double prod4High  = a4 * b4;</span>
+<span class="fc" id="L1161">        final double prod4Low   = a4Low * b4Low - (((prod4High - a4High * b4High) - a4Low * b4High) - a4High * b4Low);</span>
 
         // accurate addition a1 * b1 + a2 * b2
-<span class="fc" id="L1153">        final double s12High    = prod1High + prod2High;</span>
-<span class="fc" id="L1154">        final double s12Prime   = s12High - prod2High;</span>
-<span class="fc" id="L1155">        final double s12Low     = (prod2High - (s12High - s12Prime)) + (prod1High - s12Prime);</span>
+<span class="fc" id="L1164">        final double s12High    = prod1High + prod2High;</span>
+<span class="fc" id="L1165">        final double s12Prime   = s12High - prod2High;</span>
+<span class="fc" id="L1166">        final double s12Low     = (prod2High - (s12High - s12Prime)) + (prod1High - s12Prime);</span>
 
         // accurate addition a1 * b1 + a2 * b2 + a3 * b3
-<span class="fc" id="L1158">        final double s123High   = s12High + prod3High;</span>
-<span class="fc" id="L1159">        final double s123Prime  = s123High - prod3High;</span>
-<span class="fc" id="L1160">        final double s123Low    = (prod3High - (s123High - s123Prime)) + (s12High - s123Prime);</span>
+<span class="fc" id="L1169">        final double s123High   = s12High + prod3High;</span>
+<span class="fc" id="L1170">        final double s123Prime  = s123High - prod3High;</span>
+<span class="fc" id="L1171">        final double s123Low    = (prod3High - (s123High - s123Prime)) + (s12High - s123Prime);</span>
 
         // accurate addition a1 * b1 + a2 * b2 + a3 * b3 + a4 * b4
-<span class="fc" id="L1163">        final double s1234High  = s123High + prod4High;</span>
-<span class="fc" id="L1164">        final double s1234Prime = s1234High - prod4High;</span>
-<span class="fc" id="L1165">        final double s1234Low   = (prod4High - (s1234High - s1234Prime)) + (s123High - s1234Prime);</span>
+<span class="fc" id="L1174">        final double s1234High  = s123High + prod4High;</span>
+<span class="fc" id="L1175">        final double s1234Prime = s1234High - prod4High;</span>
+<span class="fc" id="L1176">        final double s1234Low   = (prod4High - (s1234High - s1234Prime)) + (s123High - s1234Prime);</span>
 
         // final rounding, s1234 may have suffered many cancellations, we try
         // to recover some bits from the extra words we have saved up to now
-<span class="fc" id="L1169">        double result = s1234High + (prod1Low + prod2Low + prod3Low + prod4Low + s12Low + s123Low + s1234Low);</span>
+<span class="fc" id="L1180">        double result = s1234High + (prod1Low + prod2Low + prod3Low + prod4Low + s12Low + s123Low + s1234Low);</span>
 
-<span class="fc bfc" id="L1171" title="All 2 branches covered.">        if (Double.isNaN(result)) {</span>
+<span class="fc bfc" id="L1182" title="All 2 branches covered.">        if (Double.isNaN(result)) {</span>
             // either we have split infinite numbers or some coefficients were NaNs,
             // just rely on the naive implementation and let IEEE754 handle this
-<span class="fc" id="L1174">            result = a1 * b1 + a2 * b2 + a3 * b3 + a4 * b4;</span>
+<span class="fc" id="L1185">            result = a1 * b1 + a2 * b2 + a3 * b3 + a4 * b4;</span>
         }
 
-<span class="fc" id="L1177">        return result;</span>
+<span class="fc" id="L1188">        return result;</span>
     }
 
     /**
@@ -1188,18 +1199,18 @@ public class MathArrays {
      * and equal elements.
      */
     public static boolean equals(float[] x, float[] y) {
-<span class="nc bnc" id="L1191" title="All 4 branches missed.">        if ((x == null) || (y == null)) {</span>
-<span class="nc bnc" id="L1192" title="All 6 branches missed.">            return !((x == null) ^ (y == null));</span>
+<span class="nc bnc" id="L1202" title="All 4 branches missed.">        if ((x == null) || (y == null)) {</span>
+<span class="nc bnc" id="L1203" title="All 6 branches missed.">            return !((x == null) ^ (y == null));</span>
         }
-<span class="nc bnc" id="L1194" title="All 2 branches missed.">        if (x.length != y.length) {</span>
-<span class="nc" id="L1195">            return false;</span>
+<span class="nc bnc" id="L1205" title="All 2 branches missed.">        if (x.length != y.length) {</span>
+<span class="nc" id="L1206">            return false;</span>
         }
-<span class="nc bnc" id="L1197" title="All 2 branches missed.">        for (int i = 0; i &lt; x.length; ++i) {</span>
-<span class="nc bnc" id="L1198" title="All 2 branches missed.">            if (!Precision.equals(x[i], y[i])) {</span>
-<span class="nc" id="L1199">                return false;</span>
+<span class="nc bnc" id="L1208" title="All 2 branches missed.">        for (int i = 0; i &lt; x.length; ++i) {</span>
+<span class="nc bnc" id="L1209" title="All 2 branches missed.">            if (!Precision.equals(x[i], y[i])) {</span>
+<span class="nc" id="L1210">                return false;</span>
             }
         }
-<span class="nc" id="L1202">        return true;</span>
+<span class="nc" id="L1213">        return true;</span>
     }
 
     /**
@@ -1214,18 +1225,18 @@ public class MathArrays {
      * @since 2.2
      */
     public static boolean equalsIncludingNaN(float[] x, float[] y) {
-<span class="nc bnc" id="L1217" title="All 4 branches missed.">        if ((x == null) || (y == null)) {</span>
-<span class="nc bnc" id="L1218" title="All 6 branches missed.">            return !((x == null) ^ (y == null));</span>
+<span class="nc bnc" id="L1228" title="All 4 branches missed.">        if ((x == null) || (y == null)) {</span>
+<span class="nc bnc" id="L1229" title="All 6 branches missed.">            return !((x == null) ^ (y == null));</span>
         }
-<span class="nc bnc" id="L1220" title="All 2 branches missed.">        if (x.length != y.length) {</span>
-<span class="nc" id="L1221">            return false;</span>
+<span class="nc bnc" id="L1231" title="All 2 branches missed.">        if (x.length != y.length) {</span>
+<span class="nc" id="L1232">            return false;</span>
         }
-<span class="nc bnc" id="L1223" title="All 2 branches missed.">        for (int i = 0; i &lt; x.length; ++i) {</span>
-<span class="nc bnc" id="L1224" title="All 2 branches missed.">            if (!Precision.equalsIncludingNaN(x[i], y[i])) {</span>
-<span class="nc" id="L1225">                return false;</span>
+<span class="nc bnc" id="L1234" title="All 2 branches missed.">        for (int i = 0; i &lt; x.length; ++i) {</span>
+<span class="nc bnc" id="L1235" title="All 2 branches missed.">            if (!Precision.equalsIncludingNaN(x[i], y[i])) {</span>
+<span class="nc" id="L1236">                return false;</span>
             }
         }
-<span class="nc" id="L1228">        return true;</span>
+<span class="nc" id="L1239">        return true;</span>
     }
 
     /**
@@ -1239,18 +1250,18 @@ public class MathArrays {
      * dimension and equal elements.
      */
     public static boolean equals(double[] x, double[] y) {
-<span class="fc bfc" id="L1242" title="All 4 branches covered.">        if ((x == null) || (y == null)) {</span>
-<span class="fc bfc" id="L1243" title="All 6 branches covered.">            return !((x == null) ^ (y == null));</span>
+<span class="fc bfc" id="L1253" title="All 4 branches covered.">        if ((x == null) || (y == null)) {</span>
+<span class="fc bfc" id="L1254" title="All 6 branches covered.">            return !((x == null) ^ (y == null));</span>
         }
-<span class="fc bfc" id="L1245" title="All 2 branches covered.">        if (x.length != y.length) {</span>
-<span class="fc" id="L1246">            return false;</span>
+<span class="fc bfc" id="L1256" title="All 2 branches covered.">        if (x.length != y.length) {</span>
+<span class="fc" id="L1257">            return false;</span>
         }
-<span class="fc bfc" id="L1248" title="All 2 branches covered.">        for (int i = 0; i &lt; x.length; ++i) {</span>
-<span class="fc bfc" id="L1249" title="All 2 branches covered.">            if (!Precision.equals(x[i], y[i])) {</span>
-<span class="fc" id="L1250">                return false;</span>
+<span class="fc bfc" id="L1259" title="All 2 branches covered.">        for (int i = 0; i &lt; x.length; ++i) {</span>
+<span class="fc bfc" id="L1260" title="All 2 branches covered.">            if (!Precision.equals(x[i], y[i])) {</span>
+<span class="fc" id="L1261">                return false;</span>
             }
         }
-<span class="fc" id="L1253">        return true;</span>
+<span class="fc" id="L1264">        return true;</span>
     }
 
     /**
@@ -1265,18 +1276,18 @@ public class MathArrays {
      * @since 2.2
      */
     public static boolean equalsIncludingNaN(double[] x, double[] y) {
-<span class="fc bfc" id="L1268" title="All 4 branches covered.">        if ((x == null) || (y == null)) {</span>
-<span class="fc bfc" id="L1269" title="All 6 branches covered.">            return !((x == null) ^ (y == null));</span>
+<span class="fc bfc" id="L1279" title="All 4 branches covered.">        if ((x == null) || (y == null)) {</span>
+<span class="fc bfc" id="L1280" title="All 6 branches covered.">            return !((x == null) ^ (y == null));</span>
         }
-<span class="fc bfc" id="L1271" title="All 2 branches covered.">        if (x.length != y.length) {</span>
-<span class="fc" id="L1272">            return false;</span>
+<span class="fc bfc" id="L1282" title="All 2 branches covered.">        if (x.length != y.length) {</span>
+<span class="fc" id="L1283">            return false;</span>
         }
-<span class="fc bfc" id="L1274" title="All 2 branches covered.">        for (int i = 0; i &lt; x.length; ++i) {</span>
-<span class="fc bfc" id="L1275" title="All 2 branches covered.">            if (!Precision.equalsIncludingNaN(x[i], y[i])) {</span>
-<span class="fc" id="L1276">                return false;</span>
+<span class="fc bfc" id="L1285" title="All 2 branches covered.">        for (int i = 0; i &lt; x.length; ++i) {</span>
+<span class="fc bfc" id="L1286" title="All 2 branches covered.">            if (!Precision.equalsIncludingNaN(x[i], y[i])) {</span>
+<span class="fc" id="L1287">                return false;</span>
             }
         }
-<span class="fc" id="L1279">        return true;</span>
+<span class="fc" id="L1290">        return true;</span>
     }
 
     /**
@@ -1304,34 +1315,34 @@ public class MathArrays {
      */
     public static double[] normalizeArray(double[] values, double normalizedSum)
         throws MathIllegalArgumentException, MathArithmeticException {
-<span class="fc bfc" id="L1307" title="All 2 branches covered.">        if (Double.isInfinite(normalizedSum)) {</span>
-<span class="fc" id="L1308">            throw new MathIllegalArgumentException(LocalizedFormats.NORMALIZE_INFINITE);</span>
+<span class="fc bfc" id="L1318" title="All 2 branches covered.">        if (Double.isInfinite(normalizedSum)) {</span>
+<span class="fc" id="L1319">            throw new MathIllegalArgumentException(LocalizedFormats.NORMALIZE_INFINITE);</span>
         }
-<span class="fc bfc" id="L1310" title="All 2 branches covered.">        if (Double.isNaN(normalizedSum)) {</span>
-<span class="fc" id="L1311">            throw new MathIllegalArgumentException(LocalizedFormats.NORMALIZE_NAN);</span>
+<span class="fc bfc" id="L1321" title="All 2 branches covered.">        if (Double.isNaN(normalizedSum)) {</span>
+<span class="fc" id="L1322">            throw new MathIllegalArgumentException(LocalizedFormats.NORMALIZE_NAN);</span>
         }
-<span class="fc" id="L1313">        double sum = 0d;</span>
-<span class="fc" id="L1314">        final int len = values.length;</span>
-<span class="fc" id="L1315">        double[] out = new double[len];</span>
-<span class="fc bfc" id="L1316" title="All 2 branches covered.">        for (int i = 0; i &lt; len; i++) {</span>
-<span class="fc bfc" id="L1317" title="All 2 branches covered.">            if (Double.isInfinite(values[i])) {</span>
-<span class="fc" id="L1318">                throw new MathIllegalArgumentException(LocalizedFormats.INFINITE_ARRAY_ELEMENT, values[i], i);</span>
+<span class="fc" id="L1324">        double sum = 0d;</span>
+<span class="fc" id="L1325">        final int len = values.length;</span>
+<span class="fc" id="L1326">        double[] out = new double[len];</span>
+<span class="fc bfc" id="L1327" title="All 2 branches covered.">        for (int i = 0; i &lt; len; i++) {</span>
+<span class="fc bfc" id="L1328" title="All 2 branches covered.">            if (Double.isInfinite(values[i])) {</span>
+<span class="fc" id="L1329">                throw new MathIllegalArgumentException(LocalizedFormats.INFINITE_ARRAY_ELEMENT, values[i], i);</span>
             }
-<span class="fc bfc" id="L1320" title="All 2 branches covered.">            if (!Double.isNaN(values[i])) {</span>
-<span class="fc" id="L1321">                sum += values[i];</span>
+<span class="fc bfc" id="L1331" title="All 2 branches covered.">            if (!Double.isNaN(values[i])) {</span>
+<span class="fc" id="L1332">                sum += values[i];</span>
             }
         }
-<span class="fc bfc" id="L1324" title="All 2 branches covered.">        if (sum == 0) {</span>
-<span class="fc" id="L1325">            throw new MathArithmeticException(LocalizedFormats.ARRAY_SUMS_TO_ZERO);</span>
+<span class="fc bfc" id="L1335" title="All 2 branches covered.">        if (sum == 0) {</span>
+<span class="fc" id="L1336">            throw new MathArithmeticException(LocalizedFormats.ARRAY_SUMS_TO_ZERO);</span>
         }
-<span class="fc bfc" id="L1327" title="All 2 branches covered.">        for (int i = 0; i &lt; len; i++) {</span>
-<span class="fc bfc" id="L1328" title="All 2 branches covered.">            if (Double.isNaN(values[i])) {</span>
-<span class="fc" id="L1329">                out[i] = Double.NaN;</span>
+<span class="fc bfc" id="L1338" title="All 2 branches covered.">        for (int i = 0; i &lt; len; i++) {</span>
+<span class="fc bfc" id="L1339" title="All 2 branches covered.">            if (Double.isNaN(values[i])) {</span>
+<span class="fc" id="L1340">                out[i] = Double.NaN;</span>
             } else {
-<span class="fc" id="L1331">                out[i] = values[i] * normalizedSum / sum;</span>
+<span class="fc" id="L1342">                out[i] = values[i] * normalizedSum / sum;</span>
             }
         }
-<span class="fc" id="L1334">        return out;</span>
+<span class="fc" id="L1345">        return out;</span>
     }
 
     /** Build an array of elements.
@@ -1346,9 +1357,9 @@ public class MathArrays {
      */
     public static &lt;T&gt; T[] buildArray(final Field&lt;T&gt; field, final int length) {
         @SuppressWarnings(&quot;unchecked&quot;) // OK because field must be correct class
-<span class="fc" id="L1349">        T[] array = (T[]) Array.newInstance(field.getRuntimeClass(), length);</span>
-<span class="fc" id="L1350">        Arrays.fill(array, field.getZero());</span>
-<span class="fc" id="L1351">        return array;</span>
+<span class="fc" id="L1360">        T[] array = (T[]) Array.newInstance(field.getRuntimeClass(), length);</span>
+<span class="fc" id="L1361">        Arrays.fill(array, field.getZero());</span>
+<span class="fc" id="L1362">        return array;</span>
     }
 
     /** Build a double dimension  array of elements.
@@ -1366,19 +1377,19 @@ public class MathArrays {
     @SuppressWarnings(&quot;unchecked&quot;)
     public static &lt;T&gt; T[][] buildArray(final Field&lt;T&gt; field, final int rows, final int columns) {
         final T[][] array;
-<span class="fc bfc" id="L1369" title="All 2 branches covered.">        if (columns &lt; 0) {</span>
-<span class="fc" id="L1370">            T[] dummyRow = buildArray(field, 0);</span>
-<span class="fc" id="L1371">            array = (T[][]) Array.newInstance(dummyRow.getClass(), rows);</span>
-<span class="fc" id="L1372">        } else {</span>
-<span class="fc" id="L1373">            array = (T[][]) Array.newInstance(field.getRuntimeClass(),</span>
+<span class="fc bfc" id="L1380" title="All 2 branches covered.">        if (columns &lt; 0) {</span>
+<span class="fc" id="L1381">            T[] dummyRow = buildArray(field, 0);</span>
+<span class="fc" id="L1382">            array = (T[][]) Array.newInstance(dummyRow.getClass(), rows);</span>
+<span class="fc" id="L1383">        } else {</span>
+<span class="fc" id="L1384">            array = (T[][]) Array.newInstance(field.getRuntimeClass(),</span>
                                               new int[] {
                                                   rows, columns
                                               });
-<span class="fc bfc" id="L1377" title="All 2 branches covered.">            for (int i = 0; i &lt; rows; ++i) {</span>
-<span class="fc" id="L1378">                Arrays.fill(array[i], field.getZero());</span>
+<span class="fc bfc" id="L1388" title="All 2 branches covered.">            for (int i = 0; i &lt; rows; ++i) {</span>
+<span class="fc" id="L1389">                Arrays.fill(array[i], field.getZero());</span>
             }
         }
-<span class="fc" id="L1381">        return array;</span>
+<span class="fc" id="L1392">        return array;</span>
     }
 
     /**
@@ -1404,43 +1415,43 @@ public class MathArrays {
     public static double[] convolve(double[] x, double[] h)
         throws NullArgumentException,
                NoDataException {
-<span class="fc" id="L1407">        MathUtils.checkNotNull(x);</span>
-<span class="fc" id="L1408">        MathUtils.checkNotNull(h);</span>
+<span class="fc" id="L1418">        MathUtils.checkNotNull(x);</span>
+<span class="fc" id="L1419">        MathUtils.checkNotNull(h);</span>
 
-<span class="fc" id="L1410">        final int xLen = x.length;</span>
-<span class="fc" id="L1411">        final int hLen = h.length;</span>
+<span class="fc" id="L1421">        final int xLen = x.length;</span>
+<span class="fc" id="L1422">        final int hLen = h.length;</span>
 
-<span class="fc bfc" id="L1413" title="All 4 branches covered.">        if (xLen == 0 || hLen == 0) {</span>
-<span class="fc" id="L1414">            throw new NoDataException();</span>
+<span class="fc bfc" id="L1424" title="All 4 branches covered.">        if (xLen == 0 || hLen == 0) {</span>
+<span class="fc" id="L1425">            throw new NoDataException();</span>
         }
 
         // initialize the output array
-<span class="fc" id="L1418">        final int totalLength = xLen + hLen - 1;</span>
-<span class="fc" id="L1419">        final double[] y = new double[totalLength];</span>
+<span class="fc" id="L1429">        final int totalLength = xLen + hLen - 1;</span>
+<span class="fc" id="L1430">        final double[] y = new double[totalLength];</span>
 
         // straightforward implementation of the convolution sum
-<span class="fc bfc" id="L1422" title="All 2 branches covered.">        for (int n = 0; n &lt; totalLength; n++) {</span>
-<span class="fc" id="L1423">            double yn = 0;</span>
-<span class="fc" id="L1424">            int k = FastMath.max(0, n + 1 - xLen);</span>
-<span class="fc" id="L1425">            int j = n - k;</span>
-<span class="fc bfc" id="L1426" title="All 4 branches covered.">            while (k &lt; hLen &amp;&amp; j &gt;= 0) {</span>
-<span class="fc" id="L1427">                yn += x[j--] * h[k++];</span>
+<span class="fc bfc" id="L1433" title="All 2 branches covered.">        for (int n = 0; n &lt; totalLength; n++) {</span>
+<span class="fc" id="L1434">            double yn = 0;</span>
+<span class="fc" id="L1435">            int k = FastMath.max(0, n + 1 - xLen);</span>
+<span class="fc" id="L1436">            int j = n - k;</span>
+<span class="fc bfc" id="L1437" title="All 4 branches covered.">            while (k &lt; hLen &amp;&amp; j &gt;= 0) {</span>
+<span class="fc" id="L1438">                yn += x[j--] * h[k++];</span>
             }
-<span class="fc" id="L1429">            y[n] = yn;</span>
+<span class="fc" id="L1440">            y[n] = yn;</span>
         }
 
-<span class="fc" id="L1432">        return y;</span>
+<span class="fc" id="L1443">        return y;</span>
     }
 
     /**
      * Specification for indicating that some operation applies
      * before or after a given index.
      */
-<span class="pc" id="L1439">    public static enum Position {</span>
+<span class="pc" id="L1450">    public static enum Position {</span>
         /** Designates the beginning of the array (near index 0). */
-<span class="fc" id="L1441">        HEAD,</span>
+<span class="fc" id="L1452">        HEAD,</span>
         /** Designates the end of the array. */
-<span class="fc" id="L1443">        TAIL</span>
+<span class="fc" id="L1454">        TAIL</span>
     }
 
     /**
@@ -1459,8 +1470,8 @@ public class MathArrays {
     public static void shuffle(int[] list,
                                int start,
                                Position pos) {
-<span class="nc" id="L1462">        shuffle(list, start, pos, new Well19937c());</span>
-<span class="nc" id="L1463">    }</span>
+<span class="nc" id="L1473">        shuffle(list, start, pos, new Well19937c());</span>
+<span class="nc" id="L1474">    }</span>
 
     /**
      * Shuffle the entries of the given array, using the
@@ -1480,41 +1491,41 @@ public class MathArrays {
                                int start,
                                Position pos,
                                RandomGenerator rng) {
-<span class="pc bpc" id="L1483" title="1 of 3 branches missed.">        switch (pos) {</span>
+<span class="pc bpc" id="L1494" title="1 of 3 branches missed.">        switch (pos) {</span>
         case TAIL: {
-<span class="fc bfc" id="L1485" title="All 2 branches covered.">            for (int i = list.length - 1; i &gt;= start; i--) {</span>
+<span class="fc bfc" id="L1496" title="All 2 branches covered.">            for (int i = list.length - 1; i &gt;= start; i--) {</span>
                 final int target;
-<span class="fc bfc" id="L1487" title="All 2 branches covered.">                if (i == start) {</span>
-<span class="fc" id="L1488">                    target = start;</span>
+<span class="fc bfc" id="L1498" title="All 2 branches covered.">                if (i == start) {</span>
+<span class="fc" id="L1499">                    target = start;</span>
                 } else {
                     // NumberIsTooLargeException cannot occur.
-<span class="fc" id="L1491">                    target = new UniformIntegerDistribution(rng, start, i).sample();</span>
+<span class="fc" id="L1502">                    target = new UniformIntegerDistribution(rng, start, i).sample();</span>
                 }
-<span class="fc" id="L1493">                final int temp = list[target];</span>
-<span class="fc" id="L1494">                list[target] = list[i];</span>
-<span class="fc" id="L1495">                list[i] = temp;</span>
+<span class="fc" id="L1504">                final int temp = list[target];</span>
+<span class="fc" id="L1505">                list[target] = list[i];</span>
+<span class="fc" id="L1506">                list[i] = temp;</span>
             }
         }
-<span class="fc" id="L1498">            break;</span>
+<span class="fc" id="L1509">            break;</span>
         case HEAD: {
-<span class="fc bfc" id="L1500" title="All 2 branches covered.">            for (int i = 0; i &lt;= start; i++) {</span>
+<span class="fc bfc" id="L1511" title="All 2 branches covered.">            for (int i = 0; i &lt;= start; i++) {</span>
                 final int target;
-<span class="fc bfc" id="L1502" title="All 2 branches covered.">                if (i == start) {</span>
-<span class="fc" id="L1503">                    target = start;</span>
+<span class="fc bfc" id="L1513" title="All 2 branches covered.">                if (i == start) {</span>
+<span class="fc" id="L1514">                    target = start;</span>
                 } else {
                     // NumberIsTooLargeException cannot occur.
-<span class="fc" id="L1506">                    target = new UniformIntegerDistribution(rng, i, start).sample();</span>
+<span class="fc" id="L1517">                    target = new UniformIntegerDistribution(rng, i, start).sample();</span>
                 }
-<span class="fc" id="L1508">                final int temp = list[target];</span>
-<span class="fc" id="L1509">                list[target] = list[i];</span>
-<span class="fc" id="L1510">                list[i] = temp;</span>
+<span class="fc" id="L1519">                final int temp = list[target];</span>
+<span class="fc" id="L1520">                list[target] = list[i];</span>
+<span class="fc" id="L1521">                list[i] = temp;</span>
             }
         }
-<span class="fc" id="L1513">            break;</span>
+<span class="fc" id="L1524">            break;</span>
         default:
-<span class="nc" id="L1515">            throw new MathInternalError(); // Should never happen.</span>
+<span class="nc" id="L1526">            throw new MathInternalError(); // Should never happen.</span>
         }
-<span class="fc" id="L1517">    }</span>
+<span class="fc" id="L1528">    }</span>
 
     /**
      * Shuffle the entries of the given array.
@@ -1526,8 +1537,8 @@ public class MathArrays {
      */
     public static void shuffle(int[] list,
                                RandomGenerator rng) {
-<span class="fc" id="L1529">        shuffle(list, 0, Position.TAIL, rng);</span>
-<span class="fc" id="L1530">    }</span>
+<span class="fc" id="L1540">        shuffle(list, 0, Position.TAIL, rng);</span>
+<span class="fc" id="L1541">    }</span>
 
     /**
      * Shuffle the entries of the given array.
@@ -1537,8 +1548,8 @@ public class MathArrays {
      * @param list Array whose entries will be shuffled (in-place).
      */
     public static void shuffle(int[] list) {
-<span class="nc" id="L1540">        shuffle(list, new Well19937c());</span>
-<span class="nc" id="L1541">    }</span>
+<span class="nc" id="L1551">        shuffle(list, new Well19937c());</span>
+<span class="nc" id="L1552">    }</span>
 
     /**
      * Returns an array representing the natural number {@code n}.
@@ -1548,7 +1559,7 @@ public class MathArrays {
      * If {@code n == 0}, the returned array is empty.
      */
     public static int[] natural(int n) {
-<span class="fc" id="L1551">        return sequence(n, 0, 1);</span>
+<span class="fc" id="L1562">        return sequence(n, 0, 1);</span>
     }
     /**
      * Returns an array of {@code size} integers starting at {@code start},
@@ -1566,11 +1577,11 @@ public class MathArrays {
     public static int[] sequence(int size,
                                  int start,
                                  int stride) {
-<span class="fc" id="L1569">        final int[] a = new int[size];</span>
-<span class="fc bfc" id="L1570" title="All 2 branches covered.">        for (int i = 0; i &lt; size; i++) {</span>
-<span class="fc" id="L1571">            a[i] = start + i * stride;</span>
+<span class="fc" id="L1580">        final int[] a = new int[size];</span>
+<span class="fc bfc" id="L1581" title="All 2 branches covered.">        for (int i = 0; i &lt; size; i++) {</span>
+<span class="fc" id="L1582">            a[i] = start + i * stride;</span>
         }
-<span class="fc" id="L1573">        return a;</span>

[... 119 lines stripped ...]


Mime
View raw message