Package ca.nengo.math.impl

Examples of ca.nengo.math.impl.ConstantFunction


        pDimension.setEditable(isEditable);
    }

    @Override
    protected Function createFunction(ConfigResult props) throws ConfigException {
        return new ConstantFunction((Integer) props.getValue(pDimension), (Float) props
                .getValue(pValue));
    }
View Full Code Here


  public static void main(String[] args) {

    final float rl = 0.2f; //resting length

    float tauEA = .05f;
    Function CEForceLength = new ConstantFunction(1, 1f);

    final float vmax = -2f;
    final float af = 1f; //shaping parameter between 0.1 and 1
    Function CEForceVelocity = new AbstractFunction(1) {
      private static final long serialVersionUID = 1L;
View Full Code Here

        }
       
        if (myFunctionsWr == null || myFunctionsWr.length != getOutputDimension()) {
            myFunctionsWr = new Function[getOutputDimension()];
            for (int i=0; i<getOutputDimension(); i++) {
                myFunctionsWr[i] = new ConstantFunction(inputDimension, 0.0f);
            }
            return true;
        }

        return false;
View Full Code Here

  /*
   * Test method for 'ca.nengo.model.impl.FunctionInput.getName()'
   */
  public void testGetName() throws StructuralException {
    String name = "test";
    FunctionInput input = new FunctionInput(name, new Function[]{new ConstantFunction(1, 1f)}, Units.UNK);
    assertEquals(name, input.getName());
  }
View Full Code Here

  /*
   * Test method for 'ca.nengo.model.impl.FunctionInput.getDimensions()'
   */
  public void testGetDimensions() throws StructuralException {
    FunctionInput input = new FunctionInput("test", new Function[]{new ConstantFunction(1, 1f)}, Units.UNK);
    assertEquals(1, input.getOrigin(FunctionInput.ORIGIN_NAME).getDimensions());

    input = new FunctionInput("test", new Function[]{new ConstantFunction(1, 1f), new ConstantFunction(1, 1f)}, Units.UNK);
    assertEquals(2, input.getOrigin(FunctionInput.ORIGIN_NAME).getDimensions());   
   
    try {
      input = new FunctionInput("test", new Function[]{new ConstantFunction(2, 1f)}, Units.UNK);
      fail("Should have thrown exception due to 2-D function");
    } catch (Exception e) {} //exception is expected
  }
View Full Code Here

  /*
   * Test method for 'ca.nengo.model.impl.FunctionInput.getValues()'
   */
  public void testGetValues() throws StructuralException, SimulationException {
    FunctionInput input = new FunctionInput("test", new Function[]{new ConstantFunction(1, 1f), new ConstantFunction(1, 2f)}, Units.UNK);
    Origin origin = input.getOrigin(FunctionInput.ORIGIN_NAME);
    assertEquals(2, origin.getValues().getDimension());
    assertEquals(2, ((RealOutput) origin.getValues()).getValues().length);
   
    input.run(0f, 1f);
View Full Code Here

  /*
   * Test method for 'ca.nengo.model.impl.FunctionInput.getMode()'
   */
  public void testGetMode() throws StructuralException {
    FunctionInput input = new FunctionInput("test", new Function[]{new ConstantFunction(1, 1f)}, Units.UNK);
    assertEquals(SimulationMode.DEFAULT, input.getMode());
  }
View Full Code Here

  /*
   * Test method for 'ca.nengo.model.impl.FunctionInput.getHistory(String)'
   */
  public void testGetHistory() throws StructuralException, SimulationException {
    FunctionInput input = new FunctionInput("test", new Function[]{new ConstantFunction(1, 1f), new ConstantFunction(1, 2f)}, Units.UNK);
    assertEquals(1, input.listStates().size());
    assertTrue(input.listStates().get(FunctionInput.STATE_NAME) != null);
   
    assertEquals(1, input.getHistory(FunctionInput.STATE_NAME).getValues().length);
    assertTrue(input.getHistory(FunctionInput.STATE_NAME).getValues()[0][0] > .5f);
View Full Code Here

  public static Network createNetwork() throws StructuralException {
   
    Network network = new NetworkImpl();
   
    Function f = new ConstantFunction(1, 1f);
//    Function f = new SineFunction();
    FunctionInput input = new FunctionInput("input", new Function[]{f}, Units.UNK);
    network.addNode(input);
   
    NEFEnsembleFactory ef = new NEFEnsembleFactoryImpl();
View Full Code Here

      NEFEnsembleFactory ef = new NEFEnsembleFactoryImpl();
      final NEFEnsemble ensemble = ef.make("ensemble", 200, 1);
      ensemble.collectSpikes(true);
      network.addNode(ensemble);
     
      FunctionInput input = new FunctionInput("input", new Function[]{new ConstantFunction(1, 1)}, Units.UNK);
      network.addNode(input);
     
      network.run(0, 1);
     
      Environment.setUserInterface(true);
View Full Code Here

TOP

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

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.