Package ca.nengo.math.impl

Examples of ca.nengo.math.impl.FourierFunction.map()


  /*
   * Test method for 'ca.nengo.math.impl.FourierFunction.FourierFunction(float[], float[], float[])'
   */
  public void testFourierFunctionFloatArrayFloatArrayFloatArray() {
    FourierFunction f = new FourierFunction(new float[]{1.5f}, new float[]{5f}, new float[]{.2f});
    assertClose(0.0000f, f.map(new float[]{.2f}));
    assertClose(1.5451f, f.map(new float[]{1.5f}));
    assertClose(2.9389f, f.map(new float[]{2.8f}));
  }

  /*
 
View Full Code Here


   * Test method for 'ca.nengo.math.impl.FourierFunction.FourierFunction(float[], float[], float[])'
   */
  public void testFourierFunctionFloatArrayFloatArrayFloatArray() {
    FourierFunction f = new FourierFunction(new float[]{1.5f}, new float[]{5f}, new float[]{.2f});
    assertClose(0.0000f, f.map(new float[]{.2f}));
    assertClose(1.5451f, f.map(new float[]{1.5f}));
    assertClose(2.9389f, f.map(new float[]{2.8f}));
  }

  /*
   * Test method for 'ca.nengo.math.impl.FourierFunction.FourierFunction(float, float, float)'
View Full Code Here

   */
  public void testFourierFunctionFloatArrayFloatArrayFloatArray() {
    FourierFunction f = new FourierFunction(new float[]{1.5f}, new float[]{5f}, new float[]{.2f});
    assertClose(0.0000f, f.map(new float[]{.2f}));
    assertClose(1.5451f, f.map(new float[]{1.5f}));
    assertClose(2.9389f, f.map(new float[]{2.8f}));
  }

  /*
   * Test method for 'ca.nengo.math.impl.FourierFunction.FourierFunction(float, float, float)'
   *
 
View Full Code Here

   */
  public void testMultiMap() {
    FourierFunction f = new FourierFunction(new float[]{1f}, new float[]{1f}, new float[]{0f});

    float[] from1 = new float[]{.5f};
    float val1 = f.map(from1);
    float[] from2 = new float[]{.6f};
    float val2 = f.map(from2);
   
    float[] vals = f.multiMap(new float[][]{from1, from2});
    assertClose(vals[0], val1);
View Full Code Here

    FourierFunction f = new FourierFunction(new float[]{1f}, new float[]{1f}, new float[]{0f});

    float[] from1 = new float[]{.5f};
    float val1 = f.map(from1);
    float[] from2 = new float[]{.6f};
    float val2 = f.map(from2);
   
    float[] vals = f.multiMap(new float[][]{from1, from2});
    assertClose(vals[0], val1);
    assertClose(vals[1], val2);
  }
View Full Code Here

        int steps = (int) Math.floor(T/dt);
        float[] spikeTimes = new float[steps];
        int spikes = 0;
        for (int i = 0; i < steps; i++) {
            float time = dt * i;
            float c1 = current.map(new float[]{time});
            float c2 = current.map(new float[]{time+dt});
            boolean spike = ((SpikeOutput) generator.run(new float[]{time, time+dt}, new float[]{c1, c2})).getValues()[0];

            if (spike) {
                spikeTimes[spikes] = time+dt;
View Full Code Here

        float[] spikeTimes = new float[steps];
        int spikes = 0;
        for (int i = 0; i < steps; i++) {
            float time = dt * i;
            float c1 = current.map(new float[]{time});
            float c2 = current.map(new float[]{time+dt});
            boolean spike = ((SpikeOutput) generator.run(new float[]{time, time+dt}, new float[]{c1, c2})).getValues()[0];

            if (spike) {
                spikeTimes[spikes] = time+dt;
                spikes++;
View Full Code Here

    float[][] values = new float[frequencies.length][];
    for (int i = 0; i < frequencies.length; i++) {
      Function component = new FourierFunction(new float[]{frequencies[i]}, new float[]{1}, new float[]{phases[i]});
      values[i] = new float[evalPoints.length];
      for (int j = 0; j < evalPoints.length; j++) {
        values[i][j] = component.map(evalPoints[j]);
      }
    }
   
    GradientDescentApproximator.Constraints constraints = new GradientDescentApproximator.Constraints() {
      private static final long serialVersionUID = 1L;
View Full Code Here

    float[][] values = new float[frequencies.length][];
    for (int i = 0; i < frequencies.length; i++) {
      Function component = new FourierFunction(new float[]{frequencies[i]}, new float[]{1}, new float[]{phases[i]});
      values[i] = new float[evalPoints.length];
      for (int j = 0; j < evalPoints.length; j++) {
        values[i][j] = component.map(evalPoints[j]);
      }
    }
   
    WeightedCostApproximator.Factory factory = new WeightedCostApproximator.Factory(0f);
    LinearApproximator approximator = factory.getApproximator(evalPoints, values);
View Full Code Here

    float[][][] valuesig = new float[frequencies.length][1][];
    for (int i = 0; i < frequencies.length; i++) {
      Function component = new FourierFunction(new float[]{frequencies[i]}, new float[]{1}, new float[]{phases[i]});
      valuesig[i][0] = new float[times.length];
      for (int j = 0; j < times.length; j++) {
        valuesig[i][0][j] = component.map(new float[]{times[j]});
      }
    }
    float[][][] evalsigs = new float[1][1][];
    evalsigs[0][0] = times;
    factory = new WeightedCostApproximator.Factory(0f);
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.