Examples of map()


Examples of ca.nengo.math.Function.map()

    CurveFitter lcf = new LinearCurveFitter();
    float[][] values = new float[2][10];
   
    for (int i=0; i<values[0].length; i++) {
      values[0][i] = -9 + i * 2;
      values[1][i] = target.map(new float[]{values[0][i]});
    }
   
    Function fitted = lcf.fit(values[0], values[1]);
   
//    Plotter.plot(target, -10, 0.1f, 10, "target");
View Full Code Here

Examples of ca.nengo.math.PDF.map()

  /*
   * Test method for 'ca.nengo.math.impl.IndicatorPDF.map(float[])'
   */
  public void testMap() {
    PDF pdf = new IndicatorPDF(-1, 1);
    assertClose(0f, pdf.map(new float[]{-1.5f}));
    assertClose(.5f, pdf.map(new float[]{-0.5f}));
    assertClose(.5f, pdf.map(new float[]{0.5f}));
    assertClose(0f, pdf.map(new float[]{1.5f}));
   
    pdf = new IndicatorPDF(5, 5);
View Full Code Here

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

  public void testGetDerivative() {
    SigmoidFunction f = new SigmoidFunction(-1f,0.5f,1f,2f);
    AbstractFunction g = (AbstractFunction)f.getDerivative();
   
    assertEquals(1, g.getDimension());
    TestUtil.assertClose(0.209987f, g.map(new float[]{0f}), .00001f);
    TestUtil.assertClose(0.5f, g.map(new float[]{-1f}), .00001f);
    TestUtil.assertClose(0.000670475f, g.map(new float[]{3f}), .00001f);
  }

}
View Full Code Here

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

  /*
   * Test method for 'ca.nengo.math.impl.ConstantFunction.map(float[])'
   */
  public void testMap() {
    ConstantFunction f = new ConstantFunction(1, 1f);
    assertClose(1f, f.map(new float[]{0f}), .00001f);
    assertClose(1f, f.map(new float[]{1f}), .00001f);
  }

  /*
   * Test method for 'ca.nengo.math.impl.ConstantFunction.multiMap(float[][])'
View Full Code Here

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

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

   */
  public void testMap() {
    float tolerance = .0001f;

    GaussianPDF pdf = new GaussianPDF(0f, 1f);   
    TestUtil.assertClose(0.1109f, pdf.map(new float[]{-1.6f}), tolerance);
    TestUtil.assertClose(0.3989f, pdf.map(new float[]{0f}), tolerance);
    TestUtil.assertClose(0.3910f, pdf.map(new float[]{.2f}), tolerance);

    pdf = new GaussianPDF(1f, 2f);   
    TestUtil.assertClose(0.0521f, pdf.map(new float[]{-1.6f}), tolerance);
View Full Code Here

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

  /*
   * Test method for 'ca.nengo.math.impl.IdentityFunction.map(float[])'
   */
  public void testMap() {
    IdentityFunction f = new IdentityFunction(3, 0);
    TestUtil.assertClose(.1f, f.map(new float[]{.1f, .2f, .3f}), .00001f);

    f = new IdentityFunction(3, 1);
    TestUtil.assertClose(.2f, f.map(new float[]{.1f, .2f, .3f}), .00001f);
  }

View Full Code Here

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

  /*
   * Test method for 'ca.nengo.math.impl.IndicatorPDF.map(float[])'
   */
  public void testMap() {
    PDF pdf = new IndicatorPDF(-1, 1);
    assertClose(0f, pdf.map(new float[]{-1.5f}));
    assertClose(.5f, pdf.map(new float[]{-0.5f}));
    assertClose(.5f, pdf.map(new float[]{0.5f}));
    assertClose(0f, pdf.map(new float[]{1.5f}));
   
    pdf = new IndicatorPDF(5, 5);
View Full Code Here

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

   */
  public void testMap() {
    SigmoidFunction f = new SigmoidFunction();
    NumericallyDifferentiableFunction wrap = new NumericallyDifferentiableFunction(f, 0, 0.1f);
   
    assertEquals(wrap.map(new float[]{0}), f.map(new float[]{0}));
    assertEquals(wrap.map(new float[]{3}), f.map(new float[]{3}));
    assertEquals(wrap.map(new float[]{100}), f.map(new float[]{100}));
  }

  /*
 
View Full Code Here

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

  }
 
  private static void doTestMap(float rate, float observation, float probability) {
    float tolerance = .00001f;
    PoissonPDF pdf = new PoissonPDF(rate);
    float result = pdf.map(new float[]{observation});
    TestUtil.assertClose(probability, result, tolerance);
  }
 
  public void testSample() {
    doTestSample(1);
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.