当前位置: 首页>>代码示例>>Java>>正文


Java StorelessUnivariateStatistic.copy方法代码示例

本文整理汇总了Java中org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic.copy方法的典型用法代码示例。如果您正苦于以下问题:Java StorelessUnivariateStatistic.copy方法的具体用法?Java StorelessUnivariateStatistic.copy怎么用?Java StorelessUnivariateStatistic.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic的用法示例。


在下文中一共展示了StorelessUnivariateStatistic.copy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCopyConsistencyWithInitialMostElements

import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic; //导入方法依赖的package包/类
/**
 * 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));
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:33,代码来源:PSquarePercentileTest.java

示例2: testCopyConsistencyWithInitialFirstFewElements

import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic; //导入方法依赖的package包/类
/**
 * 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));
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:35,代码来源:PSquarePercentileTest.java


注:本文中的org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic.copy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。