Java Code Examples for org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic#incrementAll()
The following examples show how to use
org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic#incrementAll() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PSquarePercentileTest.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Verifies that copied statistics remain equal to originals when * incremented the same way by making the copy after a majority of elements * are incremented */ @Test public void testCopyConsistencyWithInitialMostElements() { StorelessUnivariateStatistic master = (StorelessUnivariateStatistic) getUnivariateStatistic(); StorelessUnivariateStatistic replica = null; // select a portion of testArray till 75 % of the length to load first long index = FastMath.round(0.75 * testArray.length); // Put first half in master and copy master to replica master.incrementAll(testArray, 0, (int) index); replica = master.copy(); // Check same Assert.assertTrue(replica.equals(master)); Assert.assertTrue(master.equals(replica)); // Now add second part to both and check again master.incrementAll(testArray, (int) index, (int) (testArray.length - index)); replica.incrementAll(testArray, (int) index, (int) (testArray.length - index)); Assert.assertTrue(replica.equals(master)); Assert.assertTrue(master.equals(replica)); }
Example 2
Source File: PSquarePercentileTest.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Verifies that copied statistics remain equal to originals when * incremented the same way by way of copying original after just a few * elements are incremented */ @Test public void testCopyConsistencyWithInitialFirstFewElements() { StorelessUnivariateStatistic master = (StorelessUnivariateStatistic) getUnivariateStatistic(); StorelessUnivariateStatistic replica = null; // select a portion of testArray which is 10% of the length to load // first long index = FastMath.round(0.1 * testArray.length); // Put first half in master and copy master to replica master.incrementAll(testArray, 0, (int) index); replica = master.copy(); // Check same Assert.assertTrue(replica.equals(master)); Assert.assertTrue(master.equals(replica)); // Now add second part to both and check again master.incrementAll(testArray, (int) index, (int) (testArray.length - index)); replica.incrementAll(testArray, (int) index, (int) (testArray.length - index)); Assert.assertTrue(master.equals(master)); Assert.assertTrue(replica.equals(replica)); Assert.assertTrue(replica.equals(master)); Assert.assertTrue(master.equals(replica)); }
Example 3
Source File: PSquarePercentileTest.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Verifies that copied statistics remain equal to originals when * incremented the same way by making the copy after a majority of elements * are incremented */ @Test public void testCopyConsistencyWithInitialMostElements() { StorelessUnivariateStatistic master = (StorelessUnivariateStatistic) getUnivariateStatistic(); StorelessUnivariateStatistic replica = null; // select a portion of testArray till 75 % of the length to load first long index = FastMath.round(0.75 * testArray.length); // Put first half in master and copy master to replica master.incrementAll(testArray, 0, (int) index); replica = master.copy(); // Check same Assert.assertTrue(replica.equals(master)); Assert.assertTrue(master.equals(replica)); // Now add second part to both and check again master.incrementAll(testArray, (int) index, (int) (testArray.length - index)); replica.incrementAll(testArray, (int) index, (int) (testArray.length - index)); Assert.assertTrue(replica.equals(master)); Assert.assertTrue(master.equals(replica)); }
Example 4
Source File: PSquarePercentileTest.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Verifies that copied statistics remain equal to originals when * incremented the same way by way of copying original after just a few * elements are incremented */ @Test public void testCopyConsistencyWithInitialFirstFewElements() { StorelessUnivariateStatistic master = (StorelessUnivariateStatistic) getUnivariateStatistic(); StorelessUnivariateStatistic replica = null; // select a portion of testArray which is 10% of the length to load // first long index = FastMath.round(0.1 * testArray.length); // Put first half in master and copy master to replica master.incrementAll(testArray, 0, (int) index); replica = master.copy(); // Check same Assert.assertTrue(replica.equals(master)); Assert.assertTrue(master.equals(replica)); // Now add second part to both and check again master.incrementAll(testArray, (int) index, (int) (testArray.length - index)); replica.incrementAll(testArray, (int) index, (int) (testArray.length - index)); Assert.assertTrue(master.equals(master)); Assert.assertTrue(replica.equals(replica)); Assert.assertTrue(replica.equals(master)); Assert.assertTrue(master.equals(replica)); }