SemiStandardDeviationCalculator extends Function1D<double[], Double> { @Override public Double evaluate(final double[] x) { Validate.notNull(x, "x"); final double mean = MEAN.evaluate(x); final int n = x.length; return new PartialMomentCalculator(mean, _useDownSide).evaluate(x) * n / (n - 1); } SemiStandardDeviationCalculator();  SemiStandardDeviationCalculator(final boolean useDownSide); @Override Double evaluate(final double[] x);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullArray() { UPSIDE.evaluate((double[]) null); }
@Test public void test() { final double eps = 1e-3; PartialMomentCalculator pm = new PartialMomentCalculator(0, true); assertEquals(UPSIDE.evaluate(X), pm.evaluate(X), eps); pm = new PartialMomentCalculator(0, false); assertEquals(DOWNSIDE.evaluate(X), pm.evaluate(X), eps); }