commons-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r951633 [25/49] - in /websites/production/commons/content/proper/commons-math: xref-test/ xref-test/org/apache/commons/math3/ xref-test/org/apache/commons/math3/analysis/ xref-test/org/apache/commons/math3/analysis/differentiation/ xref-tes...
Date Sun, 17 May 2015 17:05:54 GMT
Modified: websites/production/commons/content/proper/commons-math/xref-test/org/apache/commons/math3/util/MathArraysTest.html
==============================================================================
--- websites/production/commons/content/proper/commons-math/xref-test/org/apache/commons/math3/util/MathArraysTest.html (original)
+++ websites/production/commons/content/proper/commons-math/xref-test/org/apache/commons/math3/util/MathArraysTest.html Sun May 17 17:05:50 2015
@@ -717,446 +717,479 @@
 <a class="jxr_linenumber" name="L709" href="#L709">709</a>     }
 <a class="jxr_linenumber" name="L710" href="#L710">710</a> 
 <a class="jxr_linenumber" name="L711" href="#L711">711</a>     @Test
-<a class="jxr_linenumber" name="L712" href="#L712">712</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testLinearCombinationInfinite() {
-<a class="jxr_linenumber" name="L713" href="#L713">713</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[][] a = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[][] {
-<a class="jxr_linenumber" name="L714" href="#L714">714</a>             { 1, 2, 3, 4},
-<a class="jxr_linenumber" name="L715" href="#L715">715</a>             { 1, Double.POSITIVE_INFINITY, 3, 4},
-<a class="jxr_linenumber" name="L716" href="#L716">716</a>             { 1, 2, Double.POSITIVE_INFINITY, 4},
-<a class="jxr_linenumber" name="L717" href="#L717">717</a>             { 1, Double.POSITIVE_INFINITY, 3, Double.NEGATIVE_INFINITY},
-<a class="jxr_linenumber" name="L718" href="#L718">718</a>             { 1, 2, 3, 4},
-<a class="jxr_linenumber" name="L719" href="#L719">719</a>             { 1, 2, 3, 4},
-<a class="jxr_linenumber" name="L720" href="#L720">720</a>             { 1, 2, 3, 4},
-<a class="jxr_linenumber" name="L721" href="#L721">721</a>             { 1, 2, 3, 4}
-<a class="jxr_linenumber" name="L722" href="#L722">722</a>         };
-<a class="jxr_linenumber" name="L723" href="#L723">723</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[][] b = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[][] {
-<a class="jxr_linenumber" name="L724" href="#L724">724</a>             { 1, -2, 3, 4},
-<a class="jxr_linenumber" name="L725" href="#L725">725</a>             { 1, -2, 3, 4},
-<a class="jxr_linenumber" name="L726" href="#L726">726</a>             { 1, -2, 3, 4},
-<a class="jxr_linenumber" name="L727" href="#L727">727</a>             { 1, -2, 3, 4},
-<a class="jxr_linenumber" name="L728" href="#L728">728</a>             { 1, Double.POSITIVE_INFINITY, 3, 4},
-<a class="jxr_linenumber" name="L729" href="#L729">729</a>             { 1, -2, Double.POSITIVE_INFINITY, 4},
-<a class="jxr_linenumber" name="L730" href="#L730">730</a>             { 1, Double.POSITIVE_INFINITY, 3, Double.NEGATIVE_INFINITY},
-<a class="jxr_linenumber" name="L731" href="#L731">731</a>             { Double.NaN, -2, 3, 4}
-<a class="jxr_linenumber" name="L732" href="#L732">732</a>         };
-<a class="jxr_linenumber" name="L733" href="#L733">733</a> 
-<a class="jxr_linenumber" name="L734" href="#L734">734</a>         Assert.assertEquals(-3,
-<a class="jxr_linenumber" name="L735" href="#L735">735</a>                             MathArrays.linearCombination(a[0][0], b[0][0],
-<a class="jxr_linenumber" name="L736" href="#L736">736</a>                                                          a[0][1], b[0][1]),
-<a class="jxr_linenumber" name="L737" href="#L737">737</a>                             1.0e-10);
-<a class="jxr_linenumber" name="L738" href="#L738">738</a>         Assert.assertEquals(6,
-<a class="jxr_linenumber" name="L739" href="#L739">739</a>                             MathArrays.linearCombination(a[0][0], b[0][0],
-<a class="jxr_linenumber" name="L740" href="#L740">740</a>                                                          a[0][1], b[0][1],
-<a class="jxr_linenumber" name="L741" href="#L741">741</a>                                                          a[0][2], b[0][2]),
-<a class="jxr_linenumber" name="L742" href="#L742">742</a>                             1.0e-10);
-<a class="jxr_linenumber" name="L743" href="#L743">743</a>         Assert.assertEquals(22,
-<a class="jxr_linenumber" name="L744" href="#L744">744</a>                             MathArrays.linearCombination(a[0][0], b[0][0],
-<a class="jxr_linenumber" name="L745" href="#L745">745</a>                                                          a[0][1], b[0][1],
-<a class="jxr_linenumber" name="L746" href="#L746">746</a>                                                          a[0][2], b[0][2],
-<a class="jxr_linenumber" name="L747" href="#L747">747</a>                                                          a[0][3], b[0][3]),
-<a class="jxr_linenumber" name="L748" href="#L748">748</a>                             1.0e-10);
-<a class="jxr_linenumber" name="L749" href="#L749">749</a>         Assert.assertEquals(22, MathArrays.linearCombination(a[0], b[0]), 1.0e-10);
-<a class="jxr_linenumber" name="L750" href="#L750">750</a> 
-<a class="jxr_linenumber" name="L751" href="#L751">751</a>         Assert.assertEquals(Double.NEGATIVE_INFINITY,
-<a class="jxr_linenumber" name="L752" href="#L752">752</a>                             MathArrays.linearCombination(a[1][0], b[1][0],
-<a class="jxr_linenumber" name="L753" href="#L753">753</a>                                                          a[1][1], b[1][1]),
-<a class="jxr_linenumber" name="L754" href="#L754">754</a>                             1.0e-10);
-<a class="jxr_linenumber" name="L755" href="#L755">755</a>         Assert.assertEquals(Double.NEGATIVE_INFINITY,
-<a class="jxr_linenumber" name="L756" href="#L756">756</a>                             MathArrays.linearCombination(a[1][0], b[1][0],
-<a class="jxr_linenumber" name="L757" href="#L757">757</a>                                                          a[1][1], b[1][1],
-<a class="jxr_linenumber" name="L758" href="#L758">758</a>                                                          a[1][2], b[1][2]),
-<a class="jxr_linenumber" name="L759" href="#L759">759</a>                             1.0e-10);
-<a class="jxr_linenumber" name="L760" href="#L760">760</a>         Assert.assertEquals(Double.NEGATIVE_INFINITY,
-<a class="jxr_linenumber" name="L761" href="#L761">761</a>                             MathArrays.linearCombination(a[1][0], b[1][0],
-<a class="jxr_linenumber" name="L762" href="#L762">762</a>                                                          a[1][1], b[1][1],
-<a class="jxr_linenumber" name="L763" href="#L763">763</a>                                                          a[1][2], b[1][2],
-<a class="jxr_linenumber" name="L764" href="#L764">764</a>                                                          a[1][3], b[1][3]),
-<a class="jxr_linenumber" name="L765" href="#L765">765</a>                             1.0e-10);
-<a class="jxr_linenumber" name="L766" href="#L766">766</a>         Assert.assertEquals(Double.NEGATIVE_INFINITY, MathArrays.linearCombination(a[1], b[1]), 1.0e-10);
-<a class="jxr_linenumber" name="L767" href="#L767">767</a> 
-<a class="jxr_linenumber" name="L768" href="#L768">768</a>         Assert.assertEquals(-3,
-<a class="jxr_linenumber" name="L769" href="#L769">769</a>                             MathArrays.linearCombination(a[2][0], b[2][0],
-<a class="jxr_linenumber" name="L770" href="#L770">770</a>                                                          a[2][1], b[2][1]),
-<a class="jxr_linenumber" name="L771" href="#L771">771</a>                             1.0e-10);
-<a class="jxr_linenumber" name="L772" href="#L772">772</a>         Assert.assertEquals(Double.POSITIVE_INFINITY,
-<a class="jxr_linenumber" name="L773" href="#L773">773</a>                             MathArrays.linearCombination(a[2][0], b[2][0],
-<a class="jxr_linenumber" name="L774" href="#L774">774</a>                                                          a[2][1], b[2][1],
-<a class="jxr_linenumber" name="L775" href="#L775">775</a>                                                          a[2][2], b[2][2]),
-<a class="jxr_linenumber" name="L776" href="#L776">776</a>                             1.0e-10);
-<a class="jxr_linenumber" name="L777" href="#L777">777</a>         Assert.assertEquals(Double.POSITIVE_INFINITY,
-<a class="jxr_linenumber" name="L778" href="#L778">778</a>                             MathArrays.linearCombination(a[2][0], b[2][0],
-<a class="jxr_linenumber" name="L779" href="#L779">779</a>                                                          a[2][1], b[2][1],
-<a class="jxr_linenumber" name="L780" href="#L780">780</a>                                                          a[2][2], b[2][2],
-<a class="jxr_linenumber" name="L781" href="#L781">781</a>                                                          a[2][3], b[2][3]),
-<a class="jxr_linenumber" name="L782" href="#L782">782</a>                             1.0e-10);
-<a class="jxr_linenumber" name="L783" href="#L783">783</a>         Assert.assertEquals(Double.POSITIVE_INFINITY, MathArrays.linearCombination(a[2], b[2]), 1.0e-10);
-<a class="jxr_linenumber" name="L784" href="#L784">784</a> 
-<a class="jxr_linenumber" name="L785" href="#L785">785</a>         Assert.assertEquals(Double.NEGATIVE_INFINITY,
-<a class="jxr_linenumber" name="L786" href="#L786">786</a>                             MathArrays.linearCombination(a[3][0], b[3][0],
-<a class="jxr_linenumber" name="L787" href="#L787">787</a>                                                          a[3][1], b[3][1]),
-<a class="jxr_linenumber" name="L788" href="#L788">788</a>                             1.0e-10);
-<a class="jxr_linenumber" name="L789" href="#L789">789</a>         Assert.assertEquals(Double.NEGATIVE_INFINITY,
-<a class="jxr_linenumber" name="L790" href="#L790">790</a>                             MathArrays.linearCombination(a[3][0], b[3][0],
-<a class="jxr_linenumber" name="L791" href="#L791">791</a>                                                          a[3][1], b[3][1],
-<a class="jxr_linenumber" name="L792" href="#L792">792</a>                                                          a[3][2], b[3][2]),
-<a class="jxr_linenumber" name="L793" href="#L793">793</a>                             1.0e-10);
-<a class="jxr_linenumber" name="L794" href="#L794">794</a>         Assert.assertEquals(Double.NEGATIVE_INFINITY,
-<a class="jxr_linenumber" name="L795" href="#L795">795</a>                             MathArrays.linearCombination(a[3][0], b[3][0],
-<a class="jxr_linenumber" name="L796" href="#L796">796</a>                                                          a[3][1], b[3][1],
-<a class="jxr_linenumber" name="L797" href="#L797">797</a>                                                          a[3][2], b[3][2],
-<a class="jxr_linenumber" name="L798" href="#L798">798</a>                                                          a[3][3], b[3][3]),
-<a class="jxr_linenumber" name="L799" href="#L799">799</a>                             1.0e-10);
-<a class="jxr_linenumber" name="L800" href="#L800">800</a>         Assert.assertEquals(Double.NEGATIVE_INFINITY, MathArrays.linearCombination(a[3], b[3]), 1.0e-10);
-<a class="jxr_linenumber" name="L801" href="#L801">801</a> 
-<a class="jxr_linenumber" name="L802" href="#L802">802</a>         Assert.assertEquals(Double.POSITIVE_INFINITY,
-<a class="jxr_linenumber" name="L803" href="#L803">803</a>                             MathArrays.linearCombination(a[4][0], b[4][0],
-<a class="jxr_linenumber" name="L804" href="#L804">804</a>                                                          a[4][1], b[4][1]),
-<a class="jxr_linenumber" name="L805" href="#L805">805</a>                             1.0e-10);
-<a class="jxr_linenumber" name="L806" href="#L806">806</a>         Assert.assertEquals(Double.POSITIVE_INFINITY,
-<a class="jxr_linenumber" name="L807" href="#L807">807</a>                             MathArrays.linearCombination(a[4][0], b[4][0],
-<a class="jxr_linenumber" name="L808" href="#L808">808</a>                                                          a[4][1], b[4][1],
-<a class="jxr_linenumber" name="L809" href="#L809">809</a>                                                          a[4][2], b[4][2]),
-<a class="jxr_linenumber" name="L810" href="#L810">810</a>                             1.0e-10);
-<a class="jxr_linenumber" name="L811" href="#L811">811</a>         Assert.assertEquals(Double.POSITIVE_INFINITY,
-<a class="jxr_linenumber" name="L812" href="#L812">812</a>                             MathArrays.linearCombination(a[4][0], b[4][0],
-<a class="jxr_linenumber" name="L813" href="#L813">813</a>                                                          a[4][1], b[4][1],
-<a class="jxr_linenumber" name="L814" href="#L814">814</a>                                                          a[4][2], b[4][2],
-<a class="jxr_linenumber" name="L815" href="#L815">815</a>                                                          a[4][3], b[4][3]),
-<a class="jxr_linenumber" name="L816" href="#L816">816</a>                             1.0e-10);
-<a class="jxr_linenumber" name="L817" href="#L817">817</a>         Assert.assertEquals(Double.POSITIVE_INFINITY, MathArrays.linearCombination(a[4], b[4]), 1.0e-10);
-<a class="jxr_linenumber" name="L818" href="#L818">818</a> 
-<a class="jxr_linenumber" name="L819" href="#L819">819</a>         Assert.assertEquals(-3,
-<a class="jxr_linenumber" name="L820" href="#L820">820</a>                             MathArrays.linearCombination(a[5][0], b[5][0],
-<a class="jxr_linenumber" name="L821" href="#L821">821</a>                                                          a[5][1], b[5][1]),
-<a class="jxr_linenumber" name="L822" href="#L822">822</a>                             1.0e-10);
-<a class="jxr_linenumber" name="L823" href="#L823">823</a>         Assert.assertEquals(Double.POSITIVE_INFINITY,
-<a class="jxr_linenumber" name="L824" href="#L824">824</a>                             MathArrays.linearCombination(a[5][0], b[5][0],
-<a class="jxr_linenumber" name="L825" href="#L825">825</a>                                                          a[5][1], b[5][1],
-<a class="jxr_linenumber" name="L826" href="#L826">826</a>                                                          a[5][2], b[5][2]),
-<a class="jxr_linenumber" name="L827" href="#L827">827</a>                             1.0e-10);
-<a class="jxr_linenumber" name="L828" href="#L828">828</a>         Assert.assertEquals(Double.POSITIVE_INFINITY,
-<a class="jxr_linenumber" name="L829" href="#L829">829</a>                             MathArrays.linearCombination(a[5][0], b[5][0],
-<a class="jxr_linenumber" name="L830" href="#L830">830</a>                                                          a[5][1], b[5][1],
-<a class="jxr_linenumber" name="L831" href="#L831">831</a>                                                          a[5][2], b[5][2],
-<a class="jxr_linenumber" name="L832" href="#L832">832</a>                                                          a[5][3], b[5][3]),
-<a class="jxr_linenumber" name="L833" href="#L833">833</a>                             1.0e-10);
-<a class="jxr_linenumber" name="L834" href="#L834">834</a>         Assert.assertEquals(Double.POSITIVE_INFINITY, MathArrays.linearCombination(a[5], b[5]), 1.0e-10);
-<a class="jxr_linenumber" name="L835" href="#L835">835</a> 
-<a class="jxr_linenumber" name="L836" href="#L836">836</a>         Assert.assertEquals(Double.POSITIVE_INFINITY,
-<a class="jxr_linenumber" name="L837" href="#L837">837</a>                             MathArrays.linearCombination(a[6][0], b[6][0],
-<a class="jxr_linenumber" name="L838" href="#L838">838</a>                                                          a[6][1], b[6][1]),
-<a class="jxr_linenumber" name="L839" href="#L839">839</a>                             1.0e-10);
-<a class="jxr_linenumber" name="L840" href="#L840">840</a>         Assert.assertEquals(Double.POSITIVE_INFINITY,
-<a class="jxr_linenumber" name="L841" href="#L841">841</a>                             MathArrays.linearCombination(a[6][0], b[6][0],
-<a class="jxr_linenumber" name="L842" href="#L842">842</a>                                                          a[6][1], b[6][1],
-<a class="jxr_linenumber" name="L843" href="#L843">843</a>                                                          a[6][2], b[6][2]),
-<a class="jxr_linenumber" name="L844" href="#L844">844</a>                             1.0e-10);
-<a class="jxr_linenumber" name="L845" href="#L845">845</a>         Assert.assertTrue(Double.isNaN(MathArrays.linearCombination(a[6][0], b[6][0],
-<a class="jxr_linenumber" name="L846" href="#L846">846</a>                                                                     a[6][1], b[6][1],
-<a class="jxr_linenumber" name="L847" href="#L847">847</a>                                                                     a[6][2], b[6][2],
-<a class="jxr_linenumber" name="L848" href="#L848">848</a>                                                                     a[6][3], b[6][3])));
-<a class="jxr_linenumber" name="L849" href="#L849">849</a>         Assert.assertTrue(Double.isNaN(MathArrays.linearCombination(a[6], b[6])));
-<a class="jxr_linenumber" name="L850" href="#L850">850</a> 
-<a class="jxr_linenumber" name="L851" href="#L851">851</a>         Assert.assertTrue(Double.isNaN(MathArrays.linearCombination(a[7][0], b[7][0],
-<a class="jxr_linenumber" name="L852" href="#L852">852</a>                                                                     a[7][1], b[7][1])));
-<a class="jxr_linenumber" name="L853" href="#L853">853</a>         Assert.assertTrue(Double.isNaN(MathArrays.linearCombination(a[7][0], b[7][0],
-<a class="jxr_linenumber" name="L854" href="#L854">854</a>                                                                     a[7][1], b[7][1],
-<a class="jxr_linenumber" name="L855" href="#L855">855</a>                                                                     a[7][2], b[7][2])));
-<a class="jxr_linenumber" name="L856" href="#L856">856</a>         Assert.assertTrue(Double.isNaN(MathArrays.linearCombination(a[7][0], b[7][0],
-<a class="jxr_linenumber" name="L857" href="#L857">857</a>                                                                     a[7][1], b[7][1],
-<a class="jxr_linenumber" name="L858" href="#L858">858</a>                                                                     a[7][2], b[7][2],
-<a class="jxr_linenumber" name="L859" href="#L859">859</a>                                                                     a[7][3], b[7][3])));
-<a class="jxr_linenumber" name="L860" href="#L860">860</a>         Assert.assertTrue(Double.isNaN(MathArrays.linearCombination(a[7], b[7])));
-<a class="jxr_linenumber" name="L861" href="#L861">861</a>     }
-<a class="jxr_linenumber" name="L862" href="#L862">862</a> 
-<a class="jxr_linenumber" name="L863" href="#L863">863</a>     @Test
-<a class="jxr_linenumber" name="L864" href="#L864">864</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testArrayEquals() {
-<a class="jxr_linenumber" name="L865" href="#L865">865</a>         Assert.assertFalse(MathArrays.equals(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d }, <strong class="jxr_keyword">null</strong>));
-<a class="jxr_linenumber" name="L866" href="#L866">866</a>         Assert.assertFalse(MathArrays.equals(<strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d }));
-<a class="jxr_linenumber" name="L867" href="#L867">867</a>         Assert.assertTrue(MathArrays.equals((<strong class="jxr_keyword">double</strong>[]) <strong class="jxr_keyword">null</strong>, (<strong class="jxr_keyword">double</strong>[]) <strong class="jxr_keyword">null</strong>));
+<a class="jxr_linenumber" name="L712" href="#L712">712</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testLinearCombinationHuge() {
+<a class="jxr_linenumber" name="L713" href="#L713">713</a>         <strong class="jxr_keyword">int</strong> scale = 971;
+<a class="jxr_linenumber" name="L714" href="#L714">714</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] a = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] {
+<a class="jxr_linenumber" name="L715" href="#L715">715</a>                                          -1321008684645961.0 / 268435456.0,
+<a class="jxr_linenumber" name="L716" href="#L716">716</a>                                          -5774608829631843.0 / 268435456.0,
+<a class="jxr_linenumber" name="L717" href="#L717">717</a>                                          -7645843051051357.0 / 8589934592.0
+<a class="jxr_linenumber" name="L718" href="#L718">718</a>                                      };
+<a class="jxr_linenumber" name="L719" href="#L719">719</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] b = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] {
+<a class="jxr_linenumber" name="L720" href="#L720">720</a>                                          -5712344449280879.0 / 2097152.0,
+<a class="jxr_linenumber" name="L721" href="#L721">721</a>                                          -4550117129121957.0 / 2097152.0,
+<a class="jxr_linenumber" name="L722" href="#L722">722</a>                                           8846951984510141.0 / 131072.0
+<a class="jxr_linenumber" name="L723" href="#L723">723</a>                                      };
+<a class="jxr_linenumber" name="L724" href="#L724">724</a> 
+<a class="jxr_linenumber" name="L725" href="#L725">725</a>         <strong class="jxr_keyword">double</strong>[] scaledA = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[a.length];
+<a class="jxr_linenumber" name="L726" href="#L726">726</a>         <strong class="jxr_keyword">double</strong>[] scaledB = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[b.length];
+<a class="jxr_linenumber" name="L727" href="#L727">727</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; scaledA.length; ++i) {
+<a class="jxr_linenumber" name="L728" href="#L728">728</a>             scaledA[i] = FastMath.scalb(a[i], -scale);
+<a class="jxr_linenumber" name="L729" href="#L729">729</a>             scaledB[i] = FastMath.scalb(b[i], +scale);
+<a class="jxr_linenumber" name="L730" href="#L730">730</a>         }
+<a class="jxr_linenumber" name="L731" href="#L731">731</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> abSumInline = MathArrays.linearCombination(scaledA[0], scaledB[0],
+<a class="jxr_linenumber" name="L732" href="#L732">732</a>                                                                 scaledA[1], scaledB[1],
+<a class="jxr_linenumber" name="L733" href="#L733">733</a>                                                                 scaledA[2], scaledB[2]);
+<a class="jxr_linenumber" name="L734" href="#L734">734</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> abSumArray = MathArrays.linearCombination(scaledA, scaledB);
+<a class="jxr_linenumber" name="L735" href="#L735">735</a> 
+<a class="jxr_linenumber" name="L736" href="#L736">736</a>         Assert.assertEquals(abSumInline, abSumArray, 0);
+<a class="jxr_linenumber" name="L737" href="#L737">737</a>         Assert.assertEquals(-1.8551294182586248737720779899, abSumInline, 1.0e-15);
+<a class="jxr_linenumber" name="L738" href="#L738">738</a> 
+<a class="jxr_linenumber" name="L739" href="#L739">739</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> naive = scaledA[0] * scaledB[0] + scaledA[1] * scaledB[1] + scaledA[2] * scaledB[2];
+<a class="jxr_linenumber" name="L740" href="#L740">740</a>         Assert.assertTrue(FastMath.abs(naive - abSumInline) &gt; 1.5);
+<a class="jxr_linenumber" name="L741" href="#L741">741</a> 
+<a class="jxr_linenumber" name="L742" href="#L742">742</a>     }
+<a class="jxr_linenumber" name="L743" href="#L743">743</a> 
+<a class="jxr_linenumber" name="L744" href="#L744">744</a>     @Test
+<a class="jxr_linenumber" name="L745" href="#L745">745</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testLinearCombinationInfinite() {
+<a class="jxr_linenumber" name="L746" href="#L746">746</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[][] a = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[][] {
+<a class="jxr_linenumber" name="L747" href="#L747">747</a>             { 1, 2, 3, 4},
+<a class="jxr_linenumber" name="L748" href="#L748">748</a>             { 1, Double.POSITIVE_INFINITY, 3, 4},
+<a class="jxr_linenumber" name="L749" href="#L749">749</a>             { 1, 2, Double.POSITIVE_INFINITY, 4},
+<a class="jxr_linenumber" name="L750" href="#L750">750</a>             { 1, Double.POSITIVE_INFINITY, 3, Double.NEGATIVE_INFINITY},
+<a class="jxr_linenumber" name="L751" href="#L751">751</a>             { 1, 2, 3, 4},
+<a class="jxr_linenumber" name="L752" href="#L752">752</a>             { 1, 2, 3, 4},
+<a class="jxr_linenumber" name="L753" href="#L753">753</a>             { 1, 2, 3, 4},
+<a class="jxr_linenumber" name="L754" href="#L754">754</a>             { 1, 2, 3, 4}
+<a class="jxr_linenumber" name="L755" href="#L755">755</a>         };
+<a class="jxr_linenumber" name="L756" href="#L756">756</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[][] b = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[][] {
+<a class="jxr_linenumber" name="L757" href="#L757">757</a>             { 1, -2, 3, 4},
+<a class="jxr_linenumber" name="L758" href="#L758">758</a>             { 1, -2, 3, 4},
+<a class="jxr_linenumber" name="L759" href="#L759">759</a>             { 1, -2, 3, 4},
+<a class="jxr_linenumber" name="L760" href="#L760">760</a>             { 1, -2, 3, 4},
+<a class="jxr_linenumber" name="L761" href="#L761">761</a>             { 1, Double.POSITIVE_INFINITY, 3, 4},
+<a class="jxr_linenumber" name="L762" href="#L762">762</a>             { 1, -2, Double.POSITIVE_INFINITY, 4},
+<a class="jxr_linenumber" name="L763" href="#L763">763</a>             { 1, Double.POSITIVE_INFINITY, 3, Double.NEGATIVE_INFINITY},
+<a class="jxr_linenumber" name="L764" href="#L764">764</a>             { Double.NaN, -2, 3, 4}
+<a class="jxr_linenumber" name="L765" href="#L765">765</a>         };
+<a class="jxr_linenumber" name="L766" href="#L766">766</a> 
+<a class="jxr_linenumber" name="L767" href="#L767">767</a>         Assert.assertEquals(-3,
+<a class="jxr_linenumber" name="L768" href="#L768">768</a>                             MathArrays.linearCombination(a[0][0], b[0][0],
+<a class="jxr_linenumber" name="L769" href="#L769">769</a>                                                          a[0][1], b[0][1]),
+<a class="jxr_linenumber" name="L770" href="#L770">770</a>                             1.0e-10);
+<a class="jxr_linenumber" name="L771" href="#L771">771</a>         Assert.assertEquals(6,
+<a class="jxr_linenumber" name="L772" href="#L772">772</a>                             MathArrays.linearCombination(a[0][0], b[0][0],
+<a class="jxr_linenumber" name="L773" href="#L773">773</a>                                                          a[0][1], b[0][1],
+<a class="jxr_linenumber" name="L774" href="#L774">774</a>                                                          a[0][2], b[0][2]),
+<a class="jxr_linenumber" name="L775" href="#L775">775</a>                             1.0e-10);
+<a class="jxr_linenumber" name="L776" href="#L776">776</a>         Assert.assertEquals(22,
+<a class="jxr_linenumber" name="L777" href="#L777">777</a>                             MathArrays.linearCombination(a[0][0], b[0][0],
+<a class="jxr_linenumber" name="L778" href="#L778">778</a>                                                          a[0][1], b[0][1],
+<a class="jxr_linenumber" name="L779" href="#L779">779</a>                                                          a[0][2], b[0][2],
+<a class="jxr_linenumber" name="L780" href="#L780">780</a>                                                          a[0][3], b[0][3]),
+<a class="jxr_linenumber" name="L781" href="#L781">781</a>                             1.0e-10);
+<a class="jxr_linenumber" name="L782" href="#L782">782</a>         Assert.assertEquals(22, MathArrays.linearCombination(a[0], b[0]), 1.0e-10);
+<a class="jxr_linenumber" name="L783" href="#L783">783</a> 
+<a class="jxr_linenumber" name="L784" href="#L784">784</a>         Assert.assertEquals(Double.NEGATIVE_INFINITY,
+<a class="jxr_linenumber" name="L785" href="#L785">785</a>                             MathArrays.linearCombination(a[1][0], b[1][0],
+<a class="jxr_linenumber" name="L786" href="#L786">786</a>                                                          a[1][1], b[1][1]),
+<a class="jxr_linenumber" name="L787" href="#L787">787</a>                             1.0e-10);
+<a class="jxr_linenumber" name="L788" href="#L788">788</a>         Assert.assertEquals(Double.NEGATIVE_INFINITY,
+<a class="jxr_linenumber" name="L789" href="#L789">789</a>                             MathArrays.linearCombination(a[1][0], b[1][0],
+<a class="jxr_linenumber" name="L790" href="#L790">790</a>                                                          a[1][1], b[1][1],
+<a class="jxr_linenumber" name="L791" href="#L791">791</a>                                                          a[1][2], b[1][2]),
+<a class="jxr_linenumber" name="L792" href="#L792">792</a>                             1.0e-10);
+<a class="jxr_linenumber" name="L793" href="#L793">793</a>         Assert.assertEquals(Double.NEGATIVE_INFINITY,
+<a class="jxr_linenumber" name="L794" href="#L794">794</a>                             MathArrays.linearCombination(a[1][0], b[1][0],
+<a class="jxr_linenumber" name="L795" href="#L795">795</a>                                                          a[1][1], b[1][1],
+<a class="jxr_linenumber" name="L796" href="#L796">796</a>                                                          a[1][2], b[1][2],
+<a class="jxr_linenumber" name="L797" href="#L797">797</a>                                                          a[1][3], b[1][3]),
+<a class="jxr_linenumber" name="L798" href="#L798">798</a>                             1.0e-10);
+<a class="jxr_linenumber" name="L799" href="#L799">799</a>         Assert.assertEquals(Double.NEGATIVE_INFINITY, MathArrays.linearCombination(a[1], b[1]), 1.0e-10);
+<a class="jxr_linenumber" name="L800" href="#L800">800</a> 
+<a class="jxr_linenumber" name="L801" href="#L801">801</a>         Assert.assertEquals(-3,
+<a class="jxr_linenumber" name="L802" href="#L802">802</a>                             MathArrays.linearCombination(a[2][0], b[2][0],
+<a class="jxr_linenumber" name="L803" href="#L803">803</a>                                                          a[2][1], b[2][1]),
+<a class="jxr_linenumber" name="L804" href="#L804">804</a>                             1.0e-10);
+<a class="jxr_linenumber" name="L805" href="#L805">805</a>         Assert.assertEquals(Double.POSITIVE_INFINITY,
+<a class="jxr_linenumber" name="L806" href="#L806">806</a>                             MathArrays.linearCombination(a[2][0], b[2][0],
+<a class="jxr_linenumber" name="L807" href="#L807">807</a>                                                          a[2][1], b[2][1],
+<a class="jxr_linenumber" name="L808" href="#L808">808</a>                                                          a[2][2], b[2][2]),
+<a class="jxr_linenumber" name="L809" href="#L809">809</a>                             1.0e-10);
+<a class="jxr_linenumber" name="L810" href="#L810">810</a>         Assert.assertEquals(Double.POSITIVE_INFINITY,
+<a class="jxr_linenumber" name="L811" href="#L811">811</a>                             MathArrays.linearCombination(a[2][0], b[2][0],
+<a class="jxr_linenumber" name="L812" href="#L812">812</a>                                                          a[2][1], b[2][1],
+<a class="jxr_linenumber" name="L813" href="#L813">813</a>                                                          a[2][2], b[2][2],
+<a class="jxr_linenumber" name="L814" href="#L814">814</a>                                                          a[2][3], b[2][3]),
+<a class="jxr_linenumber" name="L815" href="#L815">815</a>                             1.0e-10);
+<a class="jxr_linenumber" name="L816" href="#L816">816</a>         Assert.assertEquals(Double.POSITIVE_INFINITY, MathArrays.linearCombination(a[2], b[2]), 1.0e-10);
+<a class="jxr_linenumber" name="L817" href="#L817">817</a> 
+<a class="jxr_linenumber" name="L818" href="#L818">818</a>         Assert.assertEquals(Double.NEGATIVE_INFINITY,
+<a class="jxr_linenumber" name="L819" href="#L819">819</a>                             MathArrays.linearCombination(a[3][0], b[3][0],
+<a class="jxr_linenumber" name="L820" href="#L820">820</a>                                                          a[3][1], b[3][1]),
+<a class="jxr_linenumber" name="L821" href="#L821">821</a>                             1.0e-10);
+<a class="jxr_linenumber" name="L822" href="#L822">822</a>         Assert.assertEquals(Double.NEGATIVE_INFINITY,
+<a class="jxr_linenumber" name="L823" href="#L823">823</a>                             MathArrays.linearCombination(a[3][0], b[3][0],
+<a class="jxr_linenumber" name="L824" href="#L824">824</a>                                                          a[3][1], b[3][1],
+<a class="jxr_linenumber" name="L825" href="#L825">825</a>                                                          a[3][2], b[3][2]),
+<a class="jxr_linenumber" name="L826" href="#L826">826</a>                             1.0e-10);
+<a class="jxr_linenumber" name="L827" href="#L827">827</a>         Assert.assertEquals(Double.NEGATIVE_INFINITY,
+<a class="jxr_linenumber" name="L828" href="#L828">828</a>                             MathArrays.linearCombination(a[3][0], b[3][0],
+<a class="jxr_linenumber" name="L829" href="#L829">829</a>                                                          a[3][1], b[3][1],
+<a class="jxr_linenumber" name="L830" href="#L830">830</a>                                                          a[3][2], b[3][2],
+<a class="jxr_linenumber" name="L831" href="#L831">831</a>                                                          a[3][3], b[3][3]),
+<a class="jxr_linenumber" name="L832" href="#L832">832</a>                             1.0e-10);
+<a class="jxr_linenumber" name="L833" href="#L833">833</a>         Assert.assertEquals(Double.NEGATIVE_INFINITY, MathArrays.linearCombination(a[3], b[3]), 1.0e-10);
+<a class="jxr_linenumber" name="L834" href="#L834">834</a> 
+<a class="jxr_linenumber" name="L835" href="#L835">835</a>         Assert.assertEquals(Double.POSITIVE_INFINITY,
+<a class="jxr_linenumber" name="L836" href="#L836">836</a>                             MathArrays.linearCombination(a[4][0], b[4][0],
+<a class="jxr_linenumber" name="L837" href="#L837">837</a>                                                          a[4][1], b[4][1]),
+<a class="jxr_linenumber" name="L838" href="#L838">838</a>                             1.0e-10);
+<a class="jxr_linenumber" name="L839" href="#L839">839</a>         Assert.assertEquals(Double.POSITIVE_INFINITY,
+<a class="jxr_linenumber" name="L840" href="#L840">840</a>                             MathArrays.linearCombination(a[4][0], b[4][0],
+<a class="jxr_linenumber" name="L841" href="#L841">841</a>                                                          a[4][1], b[4][1],
+<a class="jxr_linenumber" name="L842" href="#L842">842</a>                                                          a[4][2], b[4][2]),
+<a class="jxr_linenumber" name="L843" href="#L843">843</a>                             1.0e-10);
+<a class="jxr_linenumber" name="L844" href="#L844">844</a>         Assert.assertEquals(Double.POSITIVE_INFINITY,
+<a class="jxr_linenumber" name="L845" href="#L845">845</a>                             MathArrays.linearCombination(a[4][0], b[4][0],
+<a class="jxr_linenumber" name="L846" href="#L846">846</a>                                                          a[4][1], b[4][1],
+<a class="jxr_linenumber" name="L847" href="#L847">847</a>                                                          a[4][2], b[4][2],
+<a class="jxr_linenumber" name="L848" href="#L848">848</a>                                                          a[4][3], b[4][3]),
+<a class="jxr_linenumber" name="L849" href="#L849">849</a>                             1.0e-10);
+<a class="jxr_linenumber" name="L850" href="#L850">850</a>         Assert.assertEquals(Double.POSITIVE_INFINITY, MathArrays.linearCombination(a[4], b[4]), 1.0e-10);
+<a class="jxr_linenumber" name="L851" href="#L851">851</a> 
+<a class="jxr_linenumber" name="L852" href="#L852">852</a>         Assert.assertEquals(-3,
+<a class="jxr_linenumber" name="L853" href="#L853">853</a>                             MathArrays.linearCombination(a[5][0], b[5][0],
+<a class="jxr_linenumber" name="L854" href="#L854">854</a>                                                          a[5][1], b[5][1]),
+<a class="jxr_linenumber" name="L855" href="#L855">855</a>                             1.0e-10);
+<a class="jxr_linenumber" name="L856" href="#L856">856</a>         Assert.assertEquals(Double.POSITIVE_INFINITY,
+<a class="jxr_linenumber" name="L857" href="#L857">857</a>                             MathArrays.linearCombination(a[5][0], b[5][0],
+<a class="jxr_linenumber" name="L858" href="#L858">858</a>                                                          a[5][1], b[5][1],
+<a class="jxr_linenumber" name="L859" href="#L859">859</a>                                                          a[5][2], b[5][2]),
+<a class="jxr_linenumber" name="L860" href="#L860">860</a>                             1.0e-10);
+<a class="jxr_linenumber" name="L861" href="#L861">861</a>         Assert.assertEquals(Double.POSITIVE_INFINITY,
+<a class="jxr_linenumber" name="L862" href="#L862">862</a>                             MathArrays.linearCombination(a[5][0], b[5][0],
+<a class="jxr_linenumber" name="L863" href="#L863">863</a>                                                          a[5][1], b[5][1],
+<a class="jxr_linenumber" name="L864" href="#L864">864</a>                                                          a[5][2], b[5][2],
+<a class="jxr_linenumber" name="L865" href="#L865">865</a>                                                          a[5][3], b[5][3]),
+<a class="jxr_linenumber" name="L866" href="#L866">866</a>                             1.0e-10);
+<a class="jxr_linenumber" name="L867" href="#L867">867</a>         Assert.assertEquals(Double.POSITIVE_INFINITY, MathArrays.linearCombination(a[5], b[5]), 1.0e-10);
 <a class="jxr_linenumber" name="L868" href="#L868">868</a> 
-<a class="jxr_linenumber" name="L869" href="#L869">869</a>         Assert.assertFalse(MathArrays.equals(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d }, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[0]));
-<a class="jxr_linenumber" name="L870" href="#L870">870</a>         Assert.assertTrue(MathArrays.equals(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d }, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d }));
-<a class="jxr_linenumber" name="L871" href="#L871">871</a>         Assert.assertTrue(MathArrays.equals(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { Double.POSITIVE_INFINITY,
-<a class="jxr_linenumber" name="L872" href="#L872">872</a>                                                            Double.NEGATIVE_INFINITY, 1d, 0d },
-<a class="jxr_linenumber" name="L873" href="#L873">873</a>                                             <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { Double.POSITIVE_INFINITY,
-<a class="jxr_linenumber" name="L874" href="#L874">874</a>                                                            Double.NEGATIVE_INFINITY, 1d, 0d }));
-<a class="jxr_linenumber" name="L875" href="#L875">875</a>         Assert.assertFalse(MathArrays.equals(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { Double.NaN },
-<a class="jxr_linenumber" name="L876" href="#L876">876</a>                                              <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { Double.NaN }));
-<a class="jxr_linenumber" name="L877" href="#L877">877</a>         Assert.assertFalse(MathArrays.equals(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { Double.POSITIVE_INFINITY },
-<a class="jxr_linenumber" name="L878" href="#L878">878</a>                                              <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { Double.NEGATIVE_INFINITY }));
-<a class="jxr_linenumber" name="L879" href="#L879">879</a>         Assert.assertFalse(MathArrays.equals(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d },
-<a class="jxr_linenumber" name="L880" href="#L880">880</a>                                              <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { FastMath.nextAfter(FastMath.nextAfter(1d, 2d), 2d) }));
-<a class="jxr_linenumber" name="L881" href="#L881">881</a> 
-<a class="jxr_linenumber" name="L882" href="#L882">882</a>     }
+<a class="jxr_linenumber" name="L869" href="#L869">869</a>         Assert.assertEquals(Double.POSITIVE_INFINITY,
+<a class="jxr_linenumber" name="L870" href="#L870">870</a>                             MathArrays.linearCombination(a[6][0], b[6][0],
+<a class="jxr_linenumber" name="L871" href="#L871">871</a>                                                          a[6][1], b[6][1]),
+<a class="jxr_linenumber" name="L872" href="#L872">872</a>                             1.0e-10);
+<a class="jxr_linenumber" name="L873" href="#L873">873</a>         Assert.assertEquals(Double.POSITIVE_INFINITY,
+<a class="jxr_linenumber" name="L874" href="#L874">874</a>                             MathArrays.linearCombination(a[6][0], b[6][0],
+<a class="jxr_linenumber" name="L875" href="#L875">875</a>                                                          a[6][1], b[6][1],
+<a class="jxr_linenumber" name="L876" href="#L876">876</a>                                                          a[6][2], b[6][2]),
+<a class="jxr_linenumber" name="L877" href="#L877">877</a>                             1.0e-10);
+<a class="jxr_linenumber" name="L878" href="#L878">878</a>         Assert.assertTrue(Double.isNaN(MathArrays.linearCombination(a[6][0], b[6][0],
+<a class="jxr_linenumber" name="L879" href="#L879">879</a>                                                                     a[6][1], b[6][1],
+<a class="jxr_linenumber" name="L880" href="#L880">880</a>                                                                     a[6][2], b[6][2],
+<a class="jxr_linenumber" name="L881" href="#L881">881</a>                                                                     a[6][3], b[6][3])));
+<a class="jxr_linenumber" name="L882" href="#L882">882</a>         Assert.assertTrue(Double.isNaN(MathArrays.linearCombination(a[6], b[6])));
 <a class="jxr_linenumber" name="L883" href="#L883">883</a> 
-<a class="jxr_linenumber" name="L884" href="#L884">884</a>     @Test
-<a class="jxr_linenumber" name="L885" href="#L885">885</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testArrayEqualsIncludingNaN() {
-<a class="jxr_linenumber" name="L886" href="#L886">886</a>         Assert.assertFalse(MathArrays.equalsIncludingNaN(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d }, <strong class="jxr_keyword">null</strong>));
-<a class="jxr_linenumber" name="L887" href="#L887">887</a>         Assert.assertFalse(MathArrays.equalsIncludingNaN(<strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d }));
-<a class="jxr_linenumber" name="L888" href="#L888">888</a>         Assert.assertTrue(MathArrays.equalsIncludingNaN((<strong class="jxr_keyword">double</strong>[]) <strong class="jxr_keyword">null</strong>, (<strong class="jxr_keyword">double</strong>[]) <strong class="jxr_keyword">null</strong>));
-<a class="jxr_linenumber" name="L889" href="#L889">889</a> 
-<a class="jxr_linenumber" name="L890" href="#L890">890</a>         Assert.assertFalse(MathArrays.equalsIncludingNaN(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d }, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[0]));
-<a class="jxr_linenumber" name="L891" href="#L891">891</a>         Assert.assertTrue(MathArrays.equalsIncludingNaN(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d }, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d }));
-<a class="jxr_linenumber" name="L892" href="#L892">892</a>         Assert.assertTrue(MathArrays.equalsIncludingNaN(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { Double.NaN, Double.POSITIVE_INFINITY,
-<a class="jxr_linenumber" name="L893" href="#L893">893</a>                                                                        Double.NEGATIVE_INFINITY, 1d, 0d },
-<a class="jxr_linenumber" name="L894" href="#L894">894</a>                                                         <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { Double.NaN, Double.POSITIVE_INFINITY,
-<a class="jxr_linenumber" name="L895" href="#L895">895</a>                                                                        Double.NEGATIVE_INFINITY, 1d, 0d }));
-<a class="jxr_linenumber" name="L896" href="#L896">896</a>         Assert.assertFalse(MathArrays.equalsIncludingNaN(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { Double.POSITIVE_INFINITY },
-<a class="jxr_linenumber" name="L897" href="#L897">897</a>                                                          <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { Double.NEGATIVE_INFINITY }));
-<a class="jxr_linenumber" name="L898" href="#L898">898</a>         Assert.assertFalse(MathArrays.equalsIncludingNaN(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d },
-<a class="jxr_linenumber" name="L899" href="#L899">899</a>                                                          <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { FastMath.nextAfter(FastMath.nextAfter(1d, 2d), 2d) }));
-<a class="jxr_linenumber" name="L900" href="#L900">900</a>     }
+<a class="jxr_linenumber" name="L884" href="#L884">884</a>         Assert.assertTrue(Double.isNaN(MathArrays.linearCombination(a[7][0], b[7][0],
+<a class="jxr_linenumber" name="L885" href="#L885">885</a>                                                                     a[7][1], b[7][1])));
+<a class="jxr_linenumber" name="L886" href="#L886">886</a>         Assert.assertTrue(Double.isNaN(MathArrays.linearCombination(a[7][0], b[7][0],
+<a class="jxr_linenumber" name="L887" href="#L887">887</a>                                                                     a[7][1], b[7][1],
+<a class="jxr_linenumber" name="L888" href="#L888">888</a>                                                                     a[7][2], b[7][2])));
+<a class="jxr_linenumber" name="L889" href="#L889">889</a>         Assert.assertTrue(Double.isNaN(MathArrays.linearCombination(a[7][0], b[7][0],
+<a class="jxr_linenumber" name="L890" href="#L890">890</a>                                                                     a[7][1], b[7][1],
+<a class="jxr_linenumber" name="L891" href="#L891">891</a>                                                                     a[7][2], b[7][2],
+<a class="jxr_linenumber" name="L892" href="#L892">892</a>                                                                     a[7][3], b[7][3])));
+<a class="jxr_linenumber" name="L893" href="#L893">893</a>         Assert.assertTrue(Double.isNaN(MathArrays.linearCombination(a[7], b[7])));
+<a class="jxr_linenumber" name="L894" href="#L894">894</a>     }
+<a class="jxr_linenumber" name="L895" href="#L895">895</a> 
+<a class="jxr_linenumber" name="L896" href="#L896">896</a>     @Test
+<a class="jxr_linenumber" name="L897" href="#L897">897</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testArrayEquals() {
+<a class="jxr_linenumber" name="L898" href="#L898">898</a>         Assert.assertFalse(MathArrays.equals(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d }, <strong class="jxr_keyword">null</strong>));
+<a class="jxr_linenumber" name="L899" href="#L899">899</a>         Assert.assertFalse(MathArrays.equals(<strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d }));
+<a class="jxr_linenumber" name="L900" href="#L900">900</a>         Assert.assertTrue(MathArrays.equals((<strong class="jxr_keyword">double</strong>[]) <strong class="jxr_keyword">null</strong>, (<strong class="jxr_keyword">double</strong>[]) <strong class="jxr_keyword">null</strong>));
 <a class="jxr_linenumber" name="L901" href="#L901">901</a> 
-<a class="jxr_linenumber" name="L902" href="#L902">902</a>     @Test
-<a class="jxr_linenumber" name="L903" href="#L903">903</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testNormalizeArray() {
-<a class="jxr_linenumber" name="L904" href="#L904">904</a>         <strong class="jxr_keyword">double</strong>[] testValues1 = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] {1, 1, 2};
-<a class="jxr_linenumber" name="L905" href="#L905">905</a>         TestUtils.assertEquals( <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] {.25, .25, .5},
-<a class="jxr_linenumber" name="L906" href="#L906">906</a>                                 MathArrays.normalizeArray(testValues1, 1),
-<a class="jxr_linenumber" name="L907" href="#L907">907</a>                                 Double.MIN_VALUE);
-<a class="jxr_linenumber" name="L908" href="#L908">908</a> 
-<a class="jxr_linenumber" name="L909" href="#L909">909</a>         <strong class="jxr_keyword">double</strong>[] testValues2 = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] {-1, -1, 1};
-<a class="jxr_linenumber" name="L910" href="#L910">910</a>         TestUtils.assertEquals( <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] {1, 1, -1},
-<a class="jxr_linenumber" name="L911" href="#L911">911</a>                                 MathArrays.normalizeArray(testValues2, 1),
-<a class="jxr_linenumber" name="L912" href="#L912">912</a>                                 Double.MIN_VALUE);
-<a class="jxr_linenumber" name="L913" href="#L913">913</a> 
-<a class="jxr_linenumber" name="L914" href="#L914">914</a>         <em class="jxr_comment">// Ignore NaNs</em>
-<a class="jxr_linenumber" name="L915" href="#L915">915</a>         <strong class="jxr_keyword">double</strong>[] testValues3 = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] {-1, -1, Double.NaN, 1, Double.NaN};
-<a class="jxr_linenumber" name="L916" href="#L916">916</a>         TestUtils.assertEquals( <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] {1, 1,Double.NaN, -1, Double.NaN},
-<a class="jxr_linenumber" name="L917" href="#L917">917</a>                                 MathArrays.normalizeArray(testValues3, 1),
-<a class="jxr_linenumber" name="L918" href="#L918">918</a>                                 Double.MIN_VALUE);
-<a class="jxr_linenumber" name="L919" href="#L919">919</a> 
-<a class="jxr_linenumber" name="L920" href="#L920">920</a>         <em class="jxr_comment">// Zero sum -&gt; MathArithmeticException</em>
-<a class="jxr_linenumber" name="L921" href="#L921">921</a>         <strong class="jxr_keyword">double</strong>[] zeroSum = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] {-1, 1};
-<a class="jxr_linenumber" name="L922" href="#L922">922</a>         <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="L923" href="#L923">923</a>             MathArrays.normalizeArray(zeroSum, 1);
-<a class="jxr_linenumber" name="L924" href="#L924">924</a>             Assert.fail(<span class="jxr_string">"expecting MathArithmeticException"</span>);
-<a class="jxr_linenumber" name="L925" href="#L925">925</a>         } <strong class="jxr_keyword">catch</strong> (MathArithmeticException ex) {}
-<a class="jxr_linenumber" name="L926" href="#L926">926</a> 
-<a class="jxr_linenumber" name="L927" href="#L927">927</a>         <em class="jxr_comment">// Infinite elements -&gt; MathArithmeticException</em>
-<a class="jxr_linenumber" name="L928" href="#L928">928</a>         <strong class="jxr_keyword">double</strong>[] hasInf = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] {1, 2, 1, Double.NEGATIVE_INFINITY};
-<a class="jxr_linenumber" name="L929" href="#L929">929</a>         <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="L930" href="#L930">930</a>             MathArrays.normalizeArray(hasInf, 1);
-<a class="jxr_linenumber" name="L931" href="#L931">931</a>             Assert.fail(<span class="jxr_string">"expecting MathIllegalArgumentException"</span>);
-<a class="jxr_linenumber" name="L932" href="#L932">932</a>         } <strong class="jxr_keyword">catch</strong> (MathIllegalArgumentException ex) {}
-<a class="jxr_linenumber" name="L933" href="#L933">933</a> 
-<a class="jxr_linenumber" name="L934" href="#L934">934</a>         <em class="jxr_comment">// Infinite target -&gt; MathIllegalArgumentException</em>
-<a class="jxr_linenumber" name="L935" href="#L935">935</a>         <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="L936" href="#L936">936</a>             MathArrays.normalizeArray(testValues1, Double.POSITIVE_INFINITY);
-<a class="jxr_linenumber" name="L937" href="#L937">937</a>             Assert.fail(<span class="jxr_string">"expecting MathIllegalArgumentException"</span>);
-<a class="jxr_linenumber" name="L938" href="#L938">938</a>         } <strong class="jxr_keyword">catch</strong> (MathIllegalArgumentException ex) {}
-<a class="jxr_linenumber" name="L939" href="#L939">939</a> 
-<a class="jxr_linenumber" name="L940" href="#L940">940</a>         <em class="jxr_comment">// NaN target -&gt; MathIllegalArgumentException</em>
-<a class="jxr_linenumber" name="L941" href="#L941">941</a>         <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="L942" href="#L942">942</a>             MathArrays.normalizeArray(testValues1, Double.NaN);
-<a class="jxr_linenumber" name="L943" href="#L943">943</a>             Assert.fail(<span class="jxr_string">"expecting MathIllegalArgumentException"</span>);
-<a class="jxr_linenumber" name="L944" href="#L944">944</a>         } <strong class="jxr_keyword">catch</strong> (MathIllegalArgumentException ex) {}
-<a class="jxr_linenumber" name="L945" href="#L945">945</a>     }
-<a class="jxr_linenumber" name="L946" href="#L946">946</a>     
-<a class="jxr_linenumber" name="L947" href="#L947">947</a>     @Test
-<a class="jxr_linenumber" name="L948" href="#L948">948</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testConvolve() {
-<a class="jxr_linenumber" name="L949" href="#L949">949</a>         <em class="jxr_comment">/* Test Case (obtained via SciPy)</em>
-<a class="jxr_linenumber" name="L950" href="#L950">950</a> <em class="jxr_comment">         * x=[1.2,-1.8,1.4]</em>
-<a class="jxr_linenumber" name="L951" href="#L951">951</a> <em class="jxr_comment">         * h=[1,0.8,0.5,0.3]</em>
-<a class="jxr_linenumber" name="L952" href="#L952">952</a> <em class="jxr_comment">         * convolve(x,h) -&gt; array([ 1.2 , -0.84,  0.56,  0.58,  0.16,  0.42])</em>
-<a class="jxr_linenumber" name="L953" href="#L953">953</a> <em class="jxr_comment">         */</em>
-<a class="jxr_linenumber" name="L954" href="#L954">954</a>         <strong class="jxr_keyword">double</strong>[] x1 = { 1.2, -1.8, 1.4 };
-<a class="jxr_linenumber" name="L955" href="#L955">955</a>         <strong class="jxr_keyword">double</strong>[] h1 = { 1, 0.8, 0.5, 0.3 };
-<a class="jxr_linenumber" name="L956" href="#L956">956</a>         <strong class="jxr_keyword">double</strong>[] y1 = { 1.2, -0.84, 0.56, 0.58, 0.16, 0.42 };
-<a class="jxr_linenumber" name="L957" href="#L957">957</a>         <strong class="jxr_keyword">double</strong> tolerance = 1e-13;
-<a class="jxr_linenumber" name="L958" href="#L958">958</a> 
-<a class="jxr_linenumber" name="L959" href="#L959">959</a>         <strong class="jxr_keyword">double</strong>[] yActual = MathArrays.convolve(x1, h1);
-<a class="jxr_linenumber" name="L960" href="#L960">960</a>         Assert.assertArrayEquals(y1, yActual, tolerance);
-<a class="jxr_linenumber" name="L961" href="#L961">961</a> 
-<a class="jxr_linenumber" name="L962" href="#L962">962</a>         <strong class="jxr_keyword">double</strong>[] x2 = { 1, 2, 3 };
-<a class="jxr_linenumber" name="L963" href="#L963">963</a>         <strong class="jxr_keyword">double</strong>[] h2 = { 0, 1, 0.5 };
-<a class="jxr_linenumber" name="L964" href="#L964">964</a>         <strong class="jxr_keyword">double</strong>[] y2 = { 0, 1, 2.5, 4, 1.5 };
-<a class="jxr_linenumber" name="L965" href="#L965">965</a>         
-<a class="jxr_linenumber" name="L966" href="#L966">966</a>         yActual = MathArrays.convolve(x2, h2);
-<a class="jxr_linenumber" name="L967" href="#L967">967</a>         Assert.assertArrayEquals(y2, yActual, tolerance);
-<a class="jxr_linenumber" name="L968" href="#L968">968</a>                 
-<a class="jxr_linenumber" name="L969" href="#L969">969</a>         <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="L970" href="#L970">970</a>             MathArrays.convolve(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{1, 2}, <strong class="jxr_keyword">null</strong>);
-<a class="jxr_linenumber" name="L971" href="#L971">971</a>             Assert.fail(<span class="jxr_string">"an exception should have been thrown"</span>);
-<a class="jxr_linenumber" name="L972" href="#L972">972</a>         } <strong class="jxr_keyword">catch</strong> (NullArgumentException e) {
-<a class="jxr_linenumber" name="L973" href="#L973">973</a>             <em class="jxr_comment">// expected behavior</em>
-<a class="jxr_linenumber" name="L974" href="#L974">974</a>         }
-<a class="jxr_linenumber" name="L975" href="#L975">975</a> 
-<a class="jxr_linenumber" name="L976" href="#L976">976</a>         <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="L977" href="#L977">977</a>             MathArrays.convolve(<strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{1, 2});
-<a class="jxr_linenumber" name="L978" href="#L978">978</a>             Assert.fail(<span class="jxr_string">"an exception should have been thrown"</span>);
-<a class="jxr_linenumber" name="L979" href="#L979">979</a>         } <strong class="jxr_keyword">catch</strong> (NullArgumentException e) {
-<a class="jxr_linenumber" name="L980" href="#L980">980</a>             <em class="jxr_comment">// expected behavior</em>
-<a class="jxr_linenumber" name="L981" href="#L981">981</a>         }
-<a class="jxr_linenumber" name="L982" href="#L982">982</a> 
-<a class="jxr_linenumber" name="L983" href="#L983">983</a>         <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="L984" href="#L984">984</a>             MathArrays.convolve(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{1, 2}, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{});
-<a class="jxr_linenumber" name="L985" href="#L985">985</a>             Assert.fail(<span class="jxr_string">"an exception should have been thrown"</span>);
-<a class="jxr_linenumber" name="L986" href="#L986">986</a>         } <strong class="jxr_keyword">catch</strong> (NoDataException e) {
-<a class="jxr_linenumber" name="L987" href="#L987">987</a>             <em class="jxr_comment">// expected behavior</em>
-<a class="jxr_linenumber" name="L988" href="#L988">988</a>         }
-<a class="jxr_linenumber" name="L989" href="#L989">989</a> 
-<a class="jxr_linenumber" name="L990" href="#L990">990</a>         <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="L991" href="#L991">991</a>             MathArrays.convolve(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{}, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{1, 2});
-<a class="jxr_linenumber" name="L992" href="#L992">992</a>             Assert.fail(<span class="jxr_string">"an exception should have been thrown"</span>);
-<a class="jxr_linenumber" name="L993" href="#L993">993</a>         } <strong class="jxr_keyword">catch</strong> (NoDataException e) {
-<a class="jxr_linenumber" name="L994" href="#L994">994</a>             <em class="jxr_comment">// expected behavior</em>
-<a class="jxr_linenumber" name="L995" href="#L995">995</a>         }
-<a class="jxr_linenumber" name="L996" href="#L996">996</a> 
-<a class="jxr_linenumber" name="L997" href="#L997">997</a>         <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="L998" href="#L998">998</a>             MathArrays.convolve(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{}, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{});
-<a class="jxr_linenumber" name="L999" href="#L999">999</a>             Assert.fail(<span class="jxr_string">"an exception should have been thrown"</span>);
-<a class="jxr_linenumber" name="L1000" href="#L1000">1000</a>         } <strong class="jxr_keyword">catch</strong> (NoDataException e) {
-<a class="jxr_linenumber" name="L1001" href="#L1001">1001</a>             <em class="jxr_comment">// expected behavior</em>
-<a class="jxr_linenumber" name="L1002" href="#L1002">1002</a>         }
-<a class="jxr_linenumber" name="L1003" href="#L1003">1003</a>     }
-<a class="jxr_linenumber" name="L1004" href="#L1004">1004</a> 
-<a class="jxr_linenumber" name="L1005" href="#L1005">1005</a>     @Test
-<a class="jxr_linenumber" name="L1006" href="#L1006">1006</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testShuffleTail() {
-<a class="jxr_linenumber" name="L1007" href="#L1007">1007</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong>[] orig = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">int</strong>[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
-<a class="jxr_linenumber" name="L1008" href="#L1008">1008</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong>[] list = orig.clone();
-<a class="jxr_linenumber" name="L1009" href="#L1009">1009</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> start = 4;
-<a class="jxr_linenumber" name="L1010" href="#L1010">1010</a>         MathArrays.shuffle(list, start, MathArrays.Position.TAIL, <strong class="jxr_keyword">new</strong> Well1024a(7654321L));
-<a class="jxr_linenumber" name="L1011" href="#L1011">1011</a> 
-<a class="jxr_linenumber" name="L1012" href="#L1012">1012</a>         <em class="jxr_comment">// Ensure that all entries below index "start" did not move.</em>
-<a class="jxr_linenumber" name="L1013" href="#L1013">1013</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; start; i++) {
-<a class="jxr_linenumber" name="L1014" href="#L1014">1014</a>             Assert.assertEquals(orig[i], list[i]);
-<a class="jxr_linenumber" name="L1015" href="#L1015">1015</a>         }
-<a class="jxr_linenumber" name="L1016" href="#L1016">1016</a> 
-<a class="jxr_linenumber" name="L1017" href="#L1017">1017</a>         <em class="jxr_comment">// Ensure that at least one entry has moved.</em>
-<a class="jxr_linenumber" name="L1018" href="#L1018">1018</a>         <strong class="jxr_keyword">boolean</strong> ok = false;
-<a class="jxr_linenumber" name="L1019" href="#L1019">1019</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = start; i &lt; orig.length - 1; i++) {
-<a class="jxr_linenumber" name="L1020" href="#L1020">1020</a>             <strong class="jxr_keyword">if</strong> (orig[i] != list[i]) {
-<a class="jxr_linenumber" name="L1021" href="#L1021">1021</a>                 ok = <strong class="jxr_keyword">true</strong>;
-<a class="jxr_linenumber" name="L1022" href="#L1022">1022</a>                 <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="L1023" href="#L1023">1023</a>             }
-<a class="jxr_linenumber" name="L1024" href="#L1024">1024</a>         }
-<a class="jxr_linenumber" name="L1025" href="#L1025">1025</a>         Assert.assertTrue(ok);
-<a class="jxr_linenumber" name="L1026" href="#L1026">1026</a>     }
-<a class="jxr_linenumber" name="L1027" href="#L1027">1027</a> 
-<a class="jxr_linenumber" name="L1028" href="#L1028">1028</a>     @Test
-<a class="jxr_linenumber" name="L1029" href="#L1029">1029</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testShuffleHead() {
-<a class="jxr_linenumber" name="L1030" href="#L1030">1030</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong>[] orig = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">int</strong>[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
-<a class="jxr_linenumber" name="L1031" href="#L1031">1031</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong>[] list = orig.clone();
-<a class="jxr_linenumber" name="L1032" href="#L1032">1032</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> start = 4;
-<a class="jxr_linenumber" name="L1033" href="#L1033">1033</a>         MathArrays.shuffle(list, start, MathArrays.Position.HEAD, <strong class="jxr_keyword">new</strong> Well1024a(1234567L));
-<a class="jxr_linenumber" name="L1034" href="#L1034">1034</a> 
-<a class="jxr_linenumber" name="L1035" href="#L1035">1035</a>         <em class="jxr_comment">// Ensure that all entries above index "start" did not move.</em>
-<a class="jxr_linenumber" name="L1036" href="#L1036">1036</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = start + 1; i &lt; orig.length; i++) {
-<a class="jxr_linenumber" name="L1037" href="#L1037">1037</a>             Assert.assertEquals(orig[i], list[i]);
-<a class="jxr_linenumber" name="L1038" href="#L1038">1038</a>         }
-<a class="jxr_linenumber" name="L1039" href="#L1039">1039</a> 
-<a class="jxr_linenumber" name="L1040" href="#L1040">1040</a>         <em class="jxr_comment">// Ensure that at least one entry has moved.</em>
-<a class="jxr_linenumber" name="L1041" href="#L1041">1041</a>         <strong class="jxr_keyword">boolean</strong> ok = false;
-<a class="jxr_linenumber" name="L1042" href="#L1042">1042</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt;= start; i++) {
-<a class="jxr_linenumber" name="L1043" href="#L1043">1043</a>             <strong class="jxr_keyword">if</strong> (orig[i] != list[i]) {
-<a class="jxr_linenumber" name="L1044" href="#L1044">1044</a>                 ok = <strong class="jxr_keyword">true</strong>;
-<a class="jxr_linenumber" name="L1045" href="#L1045">1045</a>                 <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="L1046" href="#L1046">1046</a>             }
-<a class="jxr_linenumber" name="L1047" href="#L1047">1047</a>         }
-<a class="jxr_linenumber" name="L1048" href="#L1048">1048</a>         Assert.assertTrue(ok);
-<a class="jxr_linenumber" name="L1049" href="#L1049">1049</a>     }
-<a class="jxr_linenumber" name="L1050" href="#L1050">1050</a> 
-<a class="jxr_linenumber" name="L1051" href="#L1051">1051</a>     @Test
-<a class="jxr_linenumber" name="L1052" href="#L1052">1052</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testNatural() {
-<a class="jxr_linenumber" name="L1053" href="#L1053">1053</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> n = 4;
-<a class="jxr_linenumber" name="L1054" href="#L1054">1054</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong>[] expected = {0, 1, 2, 3};
-<a class="jxr_linenumber" name="L1055" href="#L1055">1055</a> 
-<a class="jxr_linenumber" name="L1056" href="#L1056">1056</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong>[] natural = MathArrays.natural(n);
-<a class="jxr_linenumber" name="L1057" href="#L1057">1057</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; n; i++) {
-<a class="jxr_linenumber" name="L1058" href="#L1058">1058</a>             Assert.assertEquals(expected[i], natural[i]);
-<a class="jxr_linenumber" name="L1059" href="#L1059">1059</a>         }
-<a class="jxr_linenumber" name="L1060" href="#L1060">1060</a>     }
-<a class="jxr_linenumber" name="L1061" href="#L1061">1061</a> 
-<a class="jxr_linenumber" name="L1062" href="#L1062">1062</a>     @Test
-<a class="jxr_linenumber" name="L1063" href="#L1063">1063</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testNaturalZero() {
-<a class="jxr_linenumber" name="L1064" href="#L1064">1064</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong>[] natural = MathArrays.natural(0);
-<a class="jxr_linenumber" name="L1065" href="#L1065">1065</a>         Assert.assertEquals(0, natural.length);
-<a class="jxr_linenumber" name="L1066" href="#L1066">1066</a>     }
+<a class="jxr_linenumber" name="L902" href="#L902">902</a>         Assert.assertFalse(MathArrays.equals(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d }, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[0]));
+<a class="jxr_linenumber" name="L903" href="#L903">903</a>         Assert.assertTrue(MathArrays.equals(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d }, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d }));
+<a class="jxr_linenumber" name="L904" href="#L904">904</a>         Assert.assertTrue(MathArrays.equals(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { Double.POSITIVE_INFINITY,
+<a class="jxr_linenumber" name="L905" href="#L905">905</a>                                                            Double.NEGATIVE_INFINITY, 1d, 0d },
+<a class="jxr_linenumber" name="L906" href="#L906">906</a>                                             <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { Double.POSITIVE_INFINITY,
+<a class="jxr_linenumber" name="L907" href="#L907">907</a>                                                            Double.NEGATIVE_INFINITY, 1d, 0d }));
+<a class="jxr_linenumber" name="L908" href="#L908">908</a>         Assert.assertFalse(MathArrays.equals(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { Double.NaN },
+<a class="jxr_linenumber" name="L909" href="#L909">909</a>                                              <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { Double.NaN }));
+<a class="jxr_linenumber" name="L910" href="#L910">910</a>         Assert.assertFalse(MathArrays.equals(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { Double.POSITIVE_INFINITY },
+<a class="jxr_linenumber" name="L911" href="#L911">911</a>                                              <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { Double.NEGATIVE_INFINITY }));
+<a class="jxr_linenumber" name="L912" href="#L912">912</a>         Assert.assertFalse(MathArrays.equals(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d },
+<a class="jxr_linenumber" name="L913" href="#L913">913</a>                                              <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { FastMath.nextAfter(FastMath.nextAfter(1d, 2d), 2d) }));
+<a class="jxr_linenumber" name="L914" href="#L914">914</a> 
+<a class="jxr_linenumber" name="L915" href="#L915">915</a>     }
+<a class="jxr_linenumber" name="L916" href="#L916">916</a> 
+<a class="jxr_linenumber" name="L917" href="#L917">917</a>     @Test
+<a class="jxr_linenumber" name="L918" href="#L918">918</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testArrayEqualsIncludingNaN() {
+<a class="jxr_linenumber" name="L919" href="#L919">919</a>         Assert.assertFalse(MathArrays.equalsIncludingNaN(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d }, <strong class="jxr_keyword">null</strong>));
+<a class="jxr_linenumber" name="L920" href="#L920">920</a>         Assert.assertFalse(MathArrays.equalsIncludingNaN(<strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d }));
+<a class="jxr_linenumber" name="L921" href="#L921">921</a>         Assert.assertTrue(MathArrays.equalsIncludingNaN((<strong class="jxr_keyword">double</strong>[]) <strong class="jxr_keyword">null</strong>, (<strong class="jxr_keyword">double</strong>[]) <strong class="jxr_keyword">null</strong>));
+<a class="jxr_linenumber" name="L922" href="#L922">922</a> 
+<a class="jxr_linenumber" name="L923" href="#L923">923</a>         Assert.assertFalse(MathArrays.equalsIncludingNaN(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d }, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[0]));
+<a class="jxr_linenumber" name="L924" href="#L924">924</a>         Assert.assertTrue(MathArrays.equalsIncludingNaN(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d }, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d }));
+<a class="jxr_linenumber" name="L925" href="#L925">925</a>         Assert.assertTrue(MathArrays.equalsIncludingNaN(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { Double.NaN, Double.POSITIVE_INFINITY,
+<a class="jxr_linenumber" name="L926" href="#L926">926</a>                                                                        Double.NEGATIVE_INFINITY, 1d, 0d },
+<a class="jxr_linenumber" name="L927" href="#L927">927</a>                                                         <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { Double.NaN, Double.POSITIVE_INFINITY,
+<a class="jxr_linenumber" name="L928" href="#L928">928</a>                                                                        Double.NEGATIVE_INFINITY, 1d, 0d }));
+<a class="jxr_linenumber" name="L929" href="#L929">929</a>         Assert.assertFalse(MathArrays.equalsIncludingNaN(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { Double.POSITIVE_INFINITY },
+<a class="jxr_linenumber" name="L930" href="#L930">930</a>                                                          <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { Double.NEGATIVE_INFINITY }));
+<a class="jxr_linenumber" name="L931" href="#L931">931</a>         Assert.assertFalse(MathArrays.equalsIncludingNaN(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { 1d },
+<a class="jxr_linenumber" name="L932" href="#L932">932</a>                                                          <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] { FastMath.nextAfter(FastMath.nextAfter(1d, 2d), 2d) }));
+<a class="jxr_linenumber" name="L933" href="#L933">933</a>     }
+<a class="jxr_linenumber" name="L934" href="#L934">934</a> 
+<a class="jxr_linenumber" name="L935" href="#L935">935</a>     @Test
+<a class="jxr_linenumber" name="L936" href="#L936">936</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testNormalizeArray() {
+<a class="jxr_linenumber" name="L937" href="#L937">937</a>         <strong class="jxr_keyword">double</strong>[] testValues1 = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] {1, 1, 2};
+<a class="jxr_linenumber" name="L938" href="#L938">938</a>         TestUtils.assertEquals( <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] {.25, .25, .5},
+<a class="jxr_linenumber" name="L939" href="#L939">939</a>                                 MathArrays.normalizeArray(testValues1, 1),
+<a class="jxr_linenumber" name="L940" href="#L940">940</a>                                 Double.MIN_VALUE);
+<a class="jxr_linenumber" name="L941" href="#L941">941</a> 
+<a class="jxr_linenumber" name="L942" href="#L942">942</a>         <strong class="jxr_keyword">double</strong>[] testValues2 = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] {-1, -1, 1};
+<a class="jxr_linenumber" name="L943" href="#L943">943</a>         TestUtils.assertEquals( <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] {1, 1, -1},
+<a class="jxr_linenumber" name="L944" href="#L944">944</a>                                 MathArrays.normalizeArray(testValues2, 1),
+<a class="jxr_linenumber" name="L945" href="#L945">945</a>                                 Double.MIN_VALUE);
+<a class="jxr_linenumber" name="L946" href="#L946">946</a> 
+<a class="jxr_linenumber" name="L947" href="#L947">947</a>         <em class="jxr_comment">// Ignore NaNs</em>
+<a class="jxr_linenumber" name="L948" href="#L948">948</a>         <strong class="jxr_keyword">double</strong>[] testValues3 = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] {-1, -1, Double.NaN, 1, Double.NaN};
+<a class="jxr_linenumber" name="L949" href="#L949">949</a>         TestUtils.assertEquals( <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] {1, 1,Double.NaN, -1, Double.NaN},
+<a class="jxr_linenumber" name="L950" href="#L950">950</a>                                 MathArrays.normalizeArray(testValues3, 1),
+<a class="jxr_linenumber" name="L951" href="#L951">951</a>                                 Double.MIN_VALUE);
+<a class="jxr_linenumber" name="L952" href="#L952">952</a> 
+<a class="jxr_linenumber" name="L953" href="#L953">953</a>         <em class="jxr_comment">// Zero sum -&gt; MathArithmeticException</em>
+<a class="jxr_linenumber" name="L954" href="#L954">954</a>         <strong class="jxr_keyword">double</strong>[] zeroSum = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] {-1, 1};
+<a class="jxr_linenumber" name="L955" href="#L955">955</a>         <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="L956" href="#L956">956</a>             MathArrays.normalizeArray(zeroSum, 1);
+<a class="jxr_linenumber" name="L957" href="#L957">957</a>             Assert.fail(<span class="jxr_string">"expecting MathArithmeticException"</span>);
+<a class="jxr_linenumber" name="L958" href="#L958">958</a>         } <strong class="jxr_keyword">catch</strong> (MathArithmeticException ex) {}
+<a class="jxr_linenumber" name="L959" href="#L959">959</a> 
+<a class="jxr_linenumber" name="L960" href="#L960">960</a>         <em class="jxr_comment">// Infinite elements -&gt; MathArithmeticException</em>
+<a class="jxr_linenumber" name="L961" href="#L961">961</a>         <strong class="jxr_keyword">double</strong>[] hasInf = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[] {1, 2, 1, Double.NEGATIVE_INFINITY};
+<a class="jxr_linenumber" name="L962" href="#L962">962</a>         <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="L963" href="#L963">963</a>             MathArrays.normalizeArray(hasInf, 1);
+<a class="jxr_linenumber" name="L964" href="#L964">964</a>             Assert.fail(<span class="jxr_string">"expecting MathIllegalArgumentException"</span>);
+<a class="jxr_linenumber" name="L965" href="#L965">965</a>         } <strong class="jxr_keyword">catch</strong> (MathIllegalArgumentException ex) {}
+<a class="jxr_linenumber" name="L966" href="#L966">966</a> 
+<a class="jxr_linenumber" name="L967" href="#L967">967</a>         <em class="jxr_comment">// Infinite target -&gt; MathIllegalArgumentException</em>
+<a class="jxr_linenumber" name="L968" href="#L968">968</a>         <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="L969" href="#L969">969</a>             MathArrays.normalizeArray(testValues1, Double.POSITIVE_INFINITY);
+<a class="jxr_linenumber" name="L970" href="#L970">970</a>             Assert.fail(<span class="jxr_string">"expecting MathIllegalArgumentException"</span>);
+<a class="jxr_linenumber" name="L971" href="#L971">971</a>         } <strong class="jxr_keyword">catch</strong> (MathIllegalArgumentException ex) {}
+<a class="jxr_linenumber" name="L972" href="#L972">972</a> 
+<a class="jxr_linenumber" name="L973" href="#L973">973</a>         <em class="jxr_comment">// NaN target -&gt; MathIllegalArgumentException</em>
+<a class="jxr_linenumber" name="L974" href="#L974">974</a>         <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="L975" href="#L975">975</a>             MathArrays.normalizeArray(testValues1, Double.NaN);
+<a class="jxr_linenumber" name="L976" href="#L976">976</a>             Assert.fail(<span class="jxr_string">"expecting MathIllegalArgumentException"</span>);
+<a class="jxr_linenumber" name="L977" href="#L977">977</a>         } <strong class="jxr_keyword">catch</strong> (MathIllegalArgumentException ex) {}
+<a class="jxr_linenumber" name="L978" href="#L978">978</a>     }
+<a class="jxr_linenumber" name="L979" href="#L979">979</a>     
+<a class="jxr_linenumber" name="L980" href="#L980">980</a>     @Test
+<a class="jxr_linenumber" name="L981" href="#L981">981</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testConvolve() {
+<a class="jxr_linenumber" name="L982" href="#L982">982</a>         <em class="jxr_comment">/* Test Case (obtained via SciPy)</em>
+<a class="jxr_linenumber" name="L983" href="#L983">983</a> <em class="jxr_comment">         * x=[1.2,-1.8,1.4]</em>
+<a class="jxr_linenumber" name="L984" href="#L984">984</a> <em class="jxr_comment">         * h=[1,0.8,0.5,0.3]</em>
+<a class="jxr_linenumber" name="L985" href="#L985">985</a> <em class="jxr_comment">         * convolve(x,h) -&gt; array([ 1.2 , -0.84,  0.56,  0.58,  0.16,  0.42])</em>
+<a class="jxr_linenumber" name="L986" href="#L986">986</a> <em class="jxr_comment">         */</em>
+<a class="jxr_linenumber" name="L987" href="#L987">987</a>         <strong class="jxr_keyword">double</strong>[] x1 = { 1.2, -1.8, 1.4 };
+<a class="jxr_linenumber" name="L988" href="#L988">988</a>         <strong class="jxr_keyword">double</strong>[] h1 = { 1, 0.8, 0.5, 0.3 };
+<a class="jxr_linenumber" name="L989" href="#L989">989</a>         <strong class="jxr_keyword">double</strong>[] y1 = { 1.2, -0.84, 0.56, 0.58, 0.16, 0.42 };
+<a class="jxr_linenumber" name="L990" href="#L990">990</a>         <strong class="jxr_keyword">double</strong> tolerance = 1e-13;
+<a class="jxr_linenumber" name="L991" href="#L991">991</a> 
+<a class="jxr_linenumber" name="L992" href="#L992">992</a>         <strong class="jxr_keyword">double</strong>[] yActual = MathArrays.convolve(x1, h1);
+<a class="jxr_linenumber" name="L993" href="#L993">993</a>         Assert.assertArrayEquals(y1, yActual, tolerance);
+<a class="jxr_linenumber" name="L994" href="#L994">994</a> 
+<a class="jxr_linenumber" name="L995" href="#L995">995</a>         <strong class="jxr_keyword">double</strong>[] x2 = { 1, 2, 3 };
+<a class="jxr_linenumber" name="L996" href="#L996">996</a>         <strong class="jxr_keyword">double</strong>[] h2 = { 0, 1, 0.5 };
+<a class="jxr_linenumber" name="L997" href="#L997">997</a>         <strong class="jxr_keyword">double</strong>[] y2 = { 0, 1, 2.5, 4, 1.5 };
+<a class="jxr_linenumber" name="L998" href="#L998">998</a>         
+<a class="jxr_linenumber" name="L999" href="#L999">999</a>         yActual = MathArrays.convolve(x2, h2);
+<a class="jxr_linenumber" name="L1000" href="#L1000">1000</a>         Assert.assertArrayEquals(y2, yActual, tolerance);
+<a class="jxr_linenumber" name="L1001" href="#L1001">1001</a>                 
+<a class="jxr_linenumber" name="L1002" href="#L1002">1002</a>         <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="L1003" href="#L1003">1003</a>             MathArrays.convolve(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{1, 2}, <strong class="jxr_keyword">null</strong>);
+<a class="jxr_linenumber" name="L1004" href="#L1004">1004</a>             Assert.fail(<span class="jxr_string">"an exception should have been thrown"</span>);
+<a class="jxr_linenumber" name="L1005" href="#L1005">1005</a>         } <strong class="jxr_keyword">catch</strong> (NullArgumentException e) {
+<a class="jxr_linenumber" name="L1006" href="#L1006">1006</a>             <em class="jxr_comment">// expected behavior</em>
+<a class="jxr_linenumber" name="L1007" href="#L1007">1007</a>         }
+<a class="jxr_linenumber" name="L1008" href="#L1008">1008</a> 
+<a class="jxr_linenumber" name="L1009" href="#L1009">1009</a>         <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="L1010" href="#L1010">1010</a>             MathArrays.convolve(<strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{1, 2});
+<a class="jxr_linenumber" name="L1011" href="#L1011">1011</a>             Assert.fail(<span class="jxr_string">"an exception should have been thrown"</span>);
+<a class="jxr_linenumber" name="L1012" href="#L1012">1012</a>         } <strong class="jxr_keyword">catch</strong> (NullArgumentException e) {
+<a class="jxr_linenumber" name="L1013" href="#L1013">1013</a>             <em class="jxr_comment">// expected behavior</em>
+<a class="jxr_linenumber" name="L1014" href="#L1014">1014</a>         }
+<a class="jxr_linenumber" name="L1015" href="#L1015">1015</a> 
+<a class="jxr_linenumber" name="L1016" href="#L1016">1016</a>         <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="L1017" href="#L1017">1017</a>             MathArrays.convolve(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{1, 2}, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{});
+<a class="jxr_linenumber" name="L1018" href="#L1018">1018</a>             Assert.fail(<span class="jxr_string">"an exception should have been thrown"</span>);
+<a class="jxr_linenumber" name="L1019" href="#L1019">1019</a>         } <strong class="jxr_keyword">catch</strong> (NoDataException e) {
+<a class="jxr_linenumber" name="L1020" href="#L1020">1020</a>             <em class="jxr_comment">// expected behavior</em>
+<a class="jxr_linenumber" name="L1021" href="#L1021">1021</a>         }
+<a class="jxr_linenumber" name="L1022" href="#L1022">1022</a> 
+<a class="jxr_linenumber" name="L1023" href="#L1023">1023</a>         <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="L1024" href="#L1024">1024</a>             MathArrays.convolve(<strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{}, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{1, 2});

[... 248 lines stripped ...]


Mime
View raw message