Examples of interpolate()


Examples of ca.nengo.util.InterpolatorND.interpolate()

    assertTrue(result.getTimes().length < 60);
   
    //check results against selected hard-coded values from matlab solution ...
    InterpolatorND interpolator = new LinearInterpolatorND(result);
    float tolerance = 0.005f;
    float[] time2 = interpolator.interpolate(2);
    TestUtil.assertClose(time2[0], 0.053f, tolerance);
    TestUtil.assertClose(time2[1], -0.157f, tolerance);
    float[] time5 = interpolator.interpolate(5);
    TestUtil.assertClose(time5[0], -0.128f, tolerance);
    TestUtil.assertClose(time5[1], 0.223f, tolerance);
View Full Code Here

Examples of ca.nengo.util.impl.LinearInterpolatorND.interpolate()

    for (int i = 1; i <= steps; i++) {
      float dt = (i < steps) ? h : (inTimes[inTimes.length-1] - t);
      t = t + dt;
      times[i] = t;

      float[] u = interpolator.interpolate(t);
      float[] dxdt = system.f(t, u);
      system.setState(MU.sum(system.getState(), MU.prod(dxdt, dt)));
      values[i] = system.g(t, u);
    }
View Full Code Here

Examples of com.ardor3d.spline.Spline.interpolate()

        final ReadOnlyVector3 p0 = getControlPointStart();
        final ReadOnlyVector3 p3 = getCotnrolPointEnd();

        final Spline spline = getCurve().getSpline();

        return spline.interpolate(p0, from, to, p3, delta, target);
    }

    /**
     * @return The initial control point, will not be <code>null</code>.
     */
 
View Full Code Here

Examples of com.jme.renderer.ColorRGBA.interpolate()

        if (i == color.length - 1) {
            setSolidColor(color[i]);
        } else {
            float percentColor = (1 / step) * (this.percent - (i * step));
            ColorRGBA c = new ColorRGBA();
            c.interpolate(color[i], color[i + 1], percentColor);
            setSolidColor(c);
        }
    }

    private void initTriMesh() {
View Full Code Here

Examples of com.jme3.math.ColorRGBA.interpolate()

   * @param amount  The amount of c2 to blend into c1
   * @return r  The resulting ColorRGBA
     */
  private ColorRGBA mix(ColorRGBA c1, ColorRGBA c2, float amount) {
    ColorRGBA r = new ColorRGBA();
    r.interpolate(c1, c2, amount);
    return  r;
  }
 
  // Day to night/night to day cycles
  /**
 
View Full Code Here

Examples of com.opengamma.analytics.math.interpolation.CombinedInterpolatorExtrapolator.interpolate()

      System.out.println("weights:\t" + results.getFitParameters());

      for (int i = 0; i < 101; i++) {
        final double logX = -5 + 8 * i / 100.;
        final double x = Math.exp(logX);
        System.out.println(x + "\t" + +logX + "\t" + spline.evaluate(x) + "\t" + interpolator.interpolate(db, x) + "\t"
            + splineLog.evaluate(logX) + "\t" + interpolator.interpolate(dbLog, logX) + "\t" + splineVar.evaluate(x) + "\t"
            + interpolator.interpolate(dbVar, x) + "\t" + splineVarLog.evaluate(logX) + "\t" + interpolator.interpolate(dbVarLog, logX));
      }
      for (int i = 0; i < n; i++) {
        System.out.println(lnX[i] + "\t" + yData[i]);
View Full Code Here

Examples of com.opengamma.analytics.math.interpolation.DoubleQuadraticInterpolator1D.interpolate()

      final EuropeanVanillaOption option = new EuropeanVanillaOption(k, t, isCall);
      double[] senseFourier = modelGreekFourier.getGreeks(data, option, heston, alpha, 1e-12);

  //    System.out.print(k);
      for(int j=0;j<size;j++) {
        double senseFFT = interpolator.interpolate(db[j], k);
    //    System.out.print("\t"+senseFourier[j]+"\t"+senseFFT);
        assertEquals(senseFourier[j],senseFFT,1e-5);
      }
    //  System.out.print("\n");
         
View Full Code Here

Examples of com.opengamma.analytics.math.interpolation.Interpolator1D.interpolate()

      final double[][] sensitivityDD = new double[sensitivityList.size()][];
      // Implementation note: Sensitivity of the interpolated discount factor to the node discount factor
      final double[] df = new double[sensitivityList.size()];
      int k = 0;
      for (final DoublesPair timeAndS : sensitivityList) {
        df[k] = interpolator.interpolate(data, timeAndS.first);
        sensitivityDD[k++] = interpolator.getNodeSensitivitiesForValue(data, timeAndS.getFirst());
      }
      for (int j = 0; j < sensitivityDD[0].length; j++) {
        double temp = 0.0;
        k = 0;
View Full Code Here

Examples of com.opengamma.analytics.math.interpolation.LinearInterpolator1D.interpolate()

    final double strike = 1.50;
    final double[] strikes = SMILE_TERM.getVolatilityTerm()[2].getStrike(forward);
    final double[] vol = SMILE_TERM.getVolatilityTerm()[2].getVolatility();
    final ArrayInterpolator1DDataBundle volatilityInterpolation = new ArrayInterpolator1DDataBundle(strikes, vol);
    final LinearInterpolator1D interpolator = new LinearInterpolator1D();
    final double volExpected = interpolator.interpolate(volatilityInterpolation, strike);
    final double volComputed = SMILE_TERM.getVolatility(timeToExpiration, strike, forward);
    assertEquals("Smile by delta term structure: volatility interpolation on strike", volExpected, volComputed, TOLERANCE_VOL);
  }

  @Test
View Full Code Here

Examples of com.opengamma.analytics.math.interpolation.StepInterpolator1D.interpolate()

  @Override
  public Double evaluate(Double x) {
    StepInterpolator1D interpolator = new StepInterpolator1D();
    Interpolator1DDataBundle dataBundle = interpolator.getDataBundleFromSortedArrays(_steps, _monthlyCumulativeFactors);
    return interpolator.interpolate(dataBundle, x);
  }
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.