Package ca.nengo.math.impl

Examples of ca.nengo.math.impl.Polynomial.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


//    Plotter.plot(fitted, -10, 0.5f, 10, "fitted");
   
    float targetVal = 0f;
    float fittedVal = 0f;
    for (int i=-8; i<9; i=i+2) {
      targetVal = target.map(new float[]{i});
      fittedVal = fitted.map(new float[]{i});
      TestUtil.assertClose(targetVal, fittedVal, 15f);
    }
 
  }
View Full Code Here

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

View Full Code Here

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

  /*
 
View Full Code Here

   */
  public void testMap() {
    Polynomial f = new Polynomial(new float[]{-1,0,2,1});
    TestUtil.assertClose(2, f.map(new float[]{1}), .00001f);
    TestUtil.assertClose(15, f.map(new float[]{2}), .00001f);
    TestUtil.assertClose(-1, f.map(new float[]{-2}), .00001f);
    TestUtil.assertClose(-1, f.map(new float[]{0}), .00001f);
  }

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

  public void testMap() {
    Polynomial f = new Polynomial(new float[]{-1,0,2,1});
    TestUtil.assertClose(2, f.map(new float[]{1}), .00001f);
    TestUtil.assertClose(15, f.map(new float[]{2}), .00001f);
    TestUtil.assertClose(-1, f.map(new float[]{-2}), .00001f);
    TestUtil.assertClose(-1, f.map(new float[]{0}), .00001f);
  }

  /*
   * Test method for 'ca.nengo.math.impl.Polynomial.multiMap(float[][])'
   */
 
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.