Package ca.nengo.math.impl

Examples of ca.nengo.math.impl.SineFunction


   * @throws SimulationException
   */
  public void functionalTestSort() throws StructuralException, SimulationException {
    Network network = new NetworkImpl();
   
    FunctionInput input = new FunctionInput("input", new Function[]{new SineFunction(5)}, Units.UNK);
    network.addNode(input);
   
    NEFEnsembleFactory ef = new NEFEnsembleFactoryImpl();
    NEFEnsemble ensemble = ef.make("ensemble", 100, 1);
    ensemble.addDecodedTermination("input", MU.I(1), .005f, false);
View Full Code Here


            ensemble.addDecodedTermination("input", MU.I(1), .01f, false);
            Plotter.plot(ensemble);

            Network network = new NetworkImpl();
            network.addNode(ensemble);
            FunctionInput input = new FunctionInput("input", new Function[]{new SineFunction(3)}, Units.UNK);
            network.addNode(input);
            network.addProjection(input.getOrigin(FunctionInput.ORIGIN_NAME), ensemble.getTermination("input"));

            network.setMode(SimulationMode.RATE);
            Probe rates = network.getSimulator().addProbe("test", "rate", true);
View Full Code Here

    f = new PostfixFunction(l, "", 1);
    TestUtil.assertClose(1f, f.map(new float[]{1f}), .0001f);

    l.clear();
    l.add(Integer.valueOf(0));
    l.add(new SineFunction(1));
    f = new PostfixFunction(l, "", 1);
    TestUtil.assertClose(0f, f.map(new float[]{(float) Math.PI}), .0001f);
  }
View Full Code Here

  /*
   * Test method for 'ca.nengo.math.impl.SineFunction.getDimension()'
   */
  public void testGetDimension() {
    SineFunction f = new SineFunction(0.5f);
    assertEquals(1, f.getDimension());
  }
View Full Code Here

 
  /*
   * Test method for 'ca.nengo.math.impl.SineFunction.getOmega()'
   */
  public void testGetOmega() {
    SineFunction f = new SineFunction(0.5f);
    assertEquals(0.5f, f.getOmega());
  }
View Full Code Here

  /*
   * Test method for 'ca.nengo.math.impl.SineFunction.map(float[])'
   */
  public void testMap() {
    SineFunction f = new SineFunction(0.5f);
    TestUtil.assertClose(0f, f.map(new float[]{0f}), .00001f);
    TestUtil.assertClose(1f, f.map(new float[]{(float)Math.PI}), .00001f);
    TestUtil.assertClose(0.84147f, f.map(new float[]{2f}), .00001f);
  }
View Full Code Here

  /*
   * Test method for 'ca.nengo.math.impl.SineFunction.multiMap(float[][])'
   */
  public void testMultiMap() {
    SineFunction f = new SineFunction(0.5f);

    float[] values = f.multiMap(new float[][]{new float[]{3f}, new float[]{-2f}, new float[]{(float)-Math.PI}});
    TestUtil.assertClose(0.997495f, values[0], .00001f);
    TestUtil.assertClose(-0.84147f, values[1], .00001f);
    TestUtil.assertClose(-1f, values[2], .00001f);
  }
View Full Code Here

   
    func = new SigmoidFunction(-1f, 0.3f, -0.5f, 1f);
    root = nrf.findRoot(func, -5, 5, 0.0001f);
    TestUtil.assertClose(func.map(new float[]{root}), 0, 0.001f);
   
    func = new SineFunction(0.5f);
    root = nrf.findRoot(func, -5, 5, 0.0001f);
    TestUtil.assertClose(func.map(new float[]{root}), 0, 0.001f);
  }
View Full Code Here

TOP

Related Classes of ca.nengo.math.impl.SineFunction

Copyright © 2018 www.massapicom. 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.