Package ca.nengo.math.impl

Examples of ca.nengo.math.impl.AbstractFunction


    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;
      public float map(float[] from) {
        return Math.min(1.3f, (1 - from[0]/vmax) / (1 + from[0]/(vmax*af)));
      }
    };

    Function SEForceLength = new AbstractFunction(1) {
      private static final long serialVersionUID = 1L;
      public float map(float[] from) {
        return 200f * ( (float) Math.exp(200f*from[0]) - 1f );
      }
    };
View Full Code Here


      ourLogger.info("force: " + force + " lm: " + lm + " vm: " + vm + " a: " + a + " dadt: " + dadt);

      //find velocity corresponding to this multiplier
      final Function fv = myCEForceVelocity;
      Function f = new AbstractFunction(1) {
        private static final long serialVersionUID = 1L;

        public float map(float[] from) {
          float result = fv.map(from) - vm;
          //System.out.println("from: " + from[0] + " result: " + result);
View Full Code Here

  /*
   *   Test method for 'ca.nengo.math.impl.SigmoidFunction.getDerivative()'
   */
  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

    boolean regenerate = false;
    NEFEnsemble source = ef.make("source", 300, 1, "nefeTest_source", regenerate);
    NEFEnsemble dest = ef.make("dest", 300, 1, "nefeTest_dest", regenerate);
   
    Function f = new AbstractFunction(1) {
      private static final long serialVersionUID = 1L;
      public float map(float[] from) {
        return from[0] - 1;
      }
    };
View Full Code Here

  public void functionalTestBiasOriginError() throws StructuralException, SimulationException {
    float tauPSC = .01f;
   
    Network network = new NetworkImpl();
   
    Function f = new AbstractFunction(1) {
      private static final long serialVersionUID = 1L;
      public float map(float[] from) {
        return from[0] - 1;
      }
    };
View Full Code Here

      }

//      String n = fns[0].getClass().getCanonicalName();
      if(fns.length > 0 && fns[0].getClass().getCanonicalName() == "org.python.proxies.nef.functions$PythonFunction$3")
      {
        AbstractFunction absFun = (AbstractFunction) fns[0];
        String code = absFun.getCode();
       
        StringBuilder indentedCode = new StringBuilder();
       
        String[] split = code.split("\n");
       
        int i = 0;
        while(split[0].startsWith(" ", i)){
          i++;
        }
       
        if(i > 0){
          for(String s: split){
            indentedCode.append(s.substring(i) + "\n");
          }
        }
       
        code = indentedCode.toString();
       
        if(code != ""){
          py.insert(0, code);
        }else{
          throw new ScriptGenException("Trying to generate script of non user-defined function on an origin which is not supported.");
        }
       
       
        return absFun.getName();
      }
     
      for(Function f: fns)
      {
        String exp;
View Full Code Here

   */
  public float getAdaptedRate(final float I) {
    if (I > 1) {
      RootFinder rf = new NewtonRootFinder(50, false);

      Function f = new AbstractFunction(1) {
        private static final long serialVersionUID = 1L;
        public float map(float[] from) {
          float r = from[0];
          return r - 1 / (myTauRef - myTauRC * (float) Math.log(1f - 1f/(I-G_N*myIncN*myTauN*r)));
        }
 
View Full Code Here

  private NEFEnsemble createInterneurons(String name, int num, boolean excitatoryProjection) throws StructuralException {
    final Function f;
    if (excitatoryProjection) {
      f = new IdentityFunction(1, 0);
    } else {
      f = new AbstractFunction(1) {
        private static final long serialVersionUID = 1L;
        public float map(float[] from) {
          return 1 + from[0];
        }
      };
View Full Code Here

TOP

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

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.