Examples of LinearFunction


Examples of ca.nengo.math.impl.LinearFunction

   * Test method for {@link ca.nengo.math.impl.AbstractFunction#clone()}.
   * @throws CloneNotSupportedException
   */
  public void testClone() throws CloneNotSupportedException {
    float[] map = new float[]{1, 1};
    LinearFunction f = new LinearFunction(map, 0, true);
    LinearFunction f1 = (LinearFunction) f.clone();
    f.getMap()[0] = 2;
    f.setBias(1);
    f.setRectified(false);
   
    assertTrue(f1.getMap()[0] < 1.5f);
    assertTrue(f1.getBias() < .5f);
    assertTrue(f1.getRectified());
  }
View Full Code Here

Examples of ca.nengo.math.impl.LinearFunction

    public SpikeGenerator make() {
      float maxRate = myMaxRate.sample()[0];
      float intercept = myIntercept.sample()[0];
      float slope = maxRate / (1-intercept);
      float bias = - slope * intercept;
      Function line = new LinearFunction(new float[]{slope}, bias, myRectified);
      return new PoissonSpikeGenerator(line);
    }
View Full Code Here

Examples of com.barrybecker4.common.math.function.LinearFunction

        double max = opts_.getTheoreticalMaximum();
        double xScale = Math.pow(10, Math.max(0, Math.log10(max) - opts_.xResolution));
        double xLogScale = 3 * opts_.xResolution * opts_.xResolution;

        InvertibleFunction xFunction =
                opts_.useLogScale ? new LogFunction(xLogScale, 10.0, true) : new LinearFunction(1/xScale);

        int maxX = (int)xFunction.getValue(max);
        data_ = new int[maxX + 1];

        histogram_ = new HistogramRenderer(data_, xFunction);
View Full Code Here

Examples of com.barrybecker4.common.math.function.LinearFunction

    }

    @Override
    protected void initHistogram() {
        data_ = new int[numDice_ * (numSides_-1) + 1];
        histogram_ = new HistogramRenderer(data_, new LinearFunction(1.0, -numDice_));
        histogram_.setXFormatter(new IntegerFormatter());
    }
View Full Code Here

Examples of com.barrybecker4.common.math.function.LinearFunction

    /**
     * Constructor that assumes no scaling ont he x axis.
     * @param data  the array to hold counts for each x axis position.
     */
    public HistogramRenderer(int[] data) {
        this(data, new LinearFunction(1.0));
    }
View Full Code Here

Examples of com.neuralnetwork.shared.functions.LinearFunction

   * Test method for {@link com.neuralnetwork
   * .shared.functions.LinearFunction#LinearFunction()}.
   */
  @Test
  public final void testLinearFunction() {
    LinearFunction f = new LinearFunction();
    assertNotNull(f);
    for (int i = 0; i < NUM_ITER; i++) {
      assertEquals(f.activate(i), i, ACCUR * Math.ulp(i));
      assertEquals(f.derivative(i), 1, ACCUR * Math.ulp(i));
    }

    f.changeFunction(FunctionType.NULL);
   
    for (int i = 0; i < NUM_ITER; i++) {
      assertEquals(f.activate(i), 0, ACCUR * Math.ulp(i));
      assertEquals(f.derivative(i), 0, ACCUR * Math.ulp(i));
    }
  }
 
View Full Code Here

Examples of net.sourceforge.gpstools.math.LinearFunction

                   if(minX == maxX){
                       throw new IllegalArgumentException("Identical x-values.");
                   }
                   double y0 = (maxX * minY - minX * maxY)/(maxX - minX);
                   double m = (maxY - minY)/(maxX - minX);
                   result = new TimeCalibration(minX, minY, maxX, maxY, new LinearFunction(y0, m));
                   break;
               default:
                   result = new TimeCalibration(minX, minY, maxX, maxY, super.interpolate(x, y));
           }
           return result;
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.