コード例 #1
0
        //-------------------------------------------------------------------------
        public virtual void test_lookup()
        {
            InterpolatedNodalCurve test   = InterpolatedNodalCurve.of(METADATA, XVALUES, YVALUES, INTERPOLATOR);
            BoundCurveInterpolator interp = INTERPOLATOR.bind(XVALUES, YVALUES, FLAT_EXTRAPOLATOR, FLAT_EXTRAPOLATOR);

            assertThat(test.yValue(XVALUES.get(0))).isEqualTo(YVALUES.get(0));
            assertThat(test.yValue(XVALUES.get(1))).isEqualTo(YVALUES.get(1));
            assertThat(test.yValue(XVALUES.get(2))).isEqualTo(YVALUES.get(2));
            assertThat(test.yValue(10d)).isEqualTo(interp.interpolate(10d));

            assertThat(test.yValueParameterSensitivity(10d).MarketDataName).isEqualTo(CURVE_NAME);
            assertThat(test.yValueParameterSensitivity(10d).Sensitivity).isEqualTo(interp.parameterSensitivity(10d));
            assertThat(test.firstDerivative(10d)).isEqualTo(interp.firstDerivative(10d));
        }
コード例 #2
0
 //-------------------------------------------------------------------------
 public virtual void test_yValue()
 {
     for (int i = 0; i < NUM_SAMPLES; ++i)
     {
         double computed = COMBINED_CURVE.yValue(X_SAMPLES.get(i));
         double expected = BASE_CURVE.yValue(X_SAMPLES.get(i)) + SPREAD_CURVE.yValue(X_SAMPLES.get(i));
         assertEquals(computed, expected, TOL);
     }
 }
コード例 #3
0
 public virtual void yValue()
 {
     for (int i = 0; i < NB_X_SAMPLE; i++)
     {
         double yComputed = ADD_FIXED_CURVE.yValue(X_SAMPLE[i]);
         double yExpected = FIXED_CURVE.yValue(X_SAMPLE[i]) + SPREAD_CURVE.yValue(X_SAMPLE[i]);
         assertEquals(yComputed, yExpected, TOLERANCE_Y);
     }
 }