Package ca.nengo.util.impl

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


    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

    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);
    float[] time8 = interpolator.interpolate(8);
    TestUtil.assertClose(time8[0], 0.257f, tolerance);
    TestUtil.assertClose(time8[1], -0.297f, tolerance);
View Full Code Here

    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);
    float[] time8 = interpolator.interpolate(8);
    TestUtil.assertClose(time8[0], 0.257f, tolerance);
    TestUtil.assertClose(time8[1], -0.297f, tolerance);
   
//    Plotter.plot(result, "Van der Pol Oscillator");
  }
View Full Code Here

      k[i] = new float[x.length];
    }

    //Compute the first stage prior to the main loop (subsequently the first stage is assigned from the previous
    //step's last stage).
    float[] u = interpolator.interpolate(t);
    k[0] = system.f(t, u);
   
    while (t < tfinal && h >= hmin) {
      if (t + h > tfinal) h = tfinal - t;
View Full Code Here

    while (t < tfinal && h >= hmin) {
      if (t + h > tfinal) h = tfinal - t;

      for (int j = 0; j < 6; j++) {
        float stageTime = t + c[j+1]*h;
        u = interpolator.interpolate(stageTime);
               
        float[] ka = new float[x.length];
        for (int q = 0; q < x.length; q++) {
          for (int r = 0; r <= j; r++) {
            ka[q] += k[r][q] * a[j+1][r]; //note: this doesn't look like a matrix-vector product because our k is transposed
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.