//------------------------------------------------------------------------- public virtual void coverage() { coverImmutableBean(DATA); SsviFormulaData another = SsviFormulaData.of(1.2, 0.4, 0.2); coverBeanEquals(DATA, another); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void derivatives() public virtual void derivatives() { // AD v Finite Difference ScalarFieldFirstOrderDifferentiator differentiator = new ScalarFieldFirstOrderDifferentiator(FiniteDifferenceType.CENTRAL, 1.0E-5); for (int i = 0; i < N; i++) { System.Func <DoubleArray, double> function = (DoubleArray x) => { SsviFormulaData data = SsviFormulaData.of(x.get(3), x.get(4), x.get(5)); return(SSVI_FUNCTION.volatility(x.get(0), x.get(1), x.get(2), data)); }; System.Func <DoubleArray, DoubleArray> d = differentiator.differentiate(function); DoubleArray fd = d(DoubleArray.of(FORWARD, STRIKES[i], TIME_EXP, VOL_ATM, RHO, ETA)); ValueDerivatives ad = SSVI_FUNCTION.volatilityAdjoint(FORWARD, STRIKES[i], TIME_EXP, DATA); for (int j = 0; j < 6; j++) { assertEquals(fd.get(j), ad.Derivatives.get(j), TOLERANCE_AD); } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void test() public virtual void test() { assertEquals(DATA.Sigma, SIGMA, 0); assertEquals(DATA.Rho, RHO, 0); assertEquals(DATA.Eta, ETA, 0); assertEquals(DATA.getParameter(0), SIGMA, 0); assertEquals(DATA.getParameter(1), RHO, 0); assertEquals(DATA.getParameter(2), ETA, 0); assertEquals(DATA.NumberOfParameters, 3); SsviFormulaData other = SsviFormulaData.of(new double[] { SIGMA, RHO, ETA }); assertEquals(other, DATA); assertEquals(other.GetHashCode(), DATA.GetHashCode()); other = other.with(0, SIGMA - 0.01); assertFalse(other.Equals(DATA)); other = SsviFormulaData.of(SIGMA * 0.5, RHO, ETA); assertFalse(other.Equals(DATA)); other = SsviFormulaData.of(SIGMA, RHO * 0.5, ETA); assertFalse(other.Equals(DATA)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testWrongParameterLength() public virtual void testWrongParameterLength() { assertThrowsIllegalArg(() => SsviFormulaData.of(new double[] { ETA, RHO, SIGMA, 0.1 })); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testHighRho() public virtual void testHighRho() { assertThrowsIllegalArg(() => SsviFormulaData.of(SIGMA, RHO + 10, ETA)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testNegativeSigma() public virtual void testNegativeSigma() { assertThrowsIllegalArg(() => SsviFormulaData.of(-SIGMA, RHO, ETA)); }