DeltaCovarianceMatrixStandardDeviationCalculator extends Function1D<Map<Integer, ParametricVaRDataBundle>, Double> { @Override public Double evaluate(final Map<Integer, ParametricVaRDataBundle> data) { Validate.notNull(data, "data"); final ParametricVaRDataBundle firstOrderData = data.get(1); Validate.notNull(firstOrderData, "first order data"); final Matrix<?> delta = firstOrderData.getSensitivities(); final int s1 = delta.getNumberOfElements(); Validate.isTrue(s1 > 0, "Value delta vector contained no data"); final DoubleMatrix2D covariance = firstOrderData.getCovarianceMatrix(); return Math.sqrt(_algebra.getInnerProduct(delta, _algebra.multiply(covariance, delta))); } DeltaCovarianceMatrixStandardDeviationCalculator(final MatrixAlgebra algebra); @Override Double evaluate(final Map<Integer, ParametricVaRDataBundle> data); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullData() { F.evaluate((Map<Integer, ParametricVaRDataBundle>) null); }
@Test public void test() { final ParametricVaRDataBundle data = new ParametricVaRDataBundle(VECTOR, MATRIX, 1); final Map<Integer, ParametricVaRDataBundle> m = Collections.<Integer, ParametricVaRDataBundle> singletonMap(1, data); assertEquals(F.evaluate(m), Math.sqrt(45), 1e-9); }