Beispiel #1
0
//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()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final com.opengamma.strata.collect.array.DoubleArray x = com.opengamma.strata.collect.array.DoubleArray.of(.2245, -1.2344);
            DoubleArray x = DoubleArray.of(.2245, -1.2344);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final com.opengamma.strata.collect.array.DoubleArray anGrad = G.apply(x);
            DoubleArray anGrad = G.apply(x);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final com.opengamma.strata.collect.array.DoubleArray fdFwdGrad = FORWARD.differentiate(F).apply(x);
            DoubleArray fdFwdGrad = FORWARD.differentiate(F).apply(x);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final com.opengamma.strata.collect.array.DoubleArray fdCentGrad = CENTRAL.differentiate(F).apply(x);
            DoubleArray fdCentGrad = CENTRAL.differentiate(F).apply(x);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final com.opengamma.strata.collect.array.DoubleArray fdBackGrad = BACKWARD.differentiate(F).apply(x);
            DoubleArray fdBackGrad = BACKWARD.differentiate(F).apply(x);

            for (int i = 0; i < 2; i++)
            {
                assertEquals(fdFwdGrad.get(i), anGrad.get(i), 10 * EPS);
                assertEquals(fdCentGrad.get(i), anGrad.get(i), EPS * EPS);
                assertEquals(fdBackGrad.get(i), anGrad.get(i), 10 * EPS);
            }
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void testNullFunction()
        public virtual void testNullFunction()
        {
            CENTRAL.differentiate((System.Func <DoubleArray, double>)null);
        }