Package ca.nengo.math

Examples of ca.nengo.math.Function.map()


    l = ((PostfixFunction) f).getExpressionList();
    assertEquals(Integer.valueOf(0), l.get(0));
    assertEquals(Integer.valueOf(1), l.get(1));
    assertEquals("|", l.get(2).toString());
    TestUtil.assertClose(0f, f.map(new float[]{0f, 0f}), tolerance);
    TestUtil.assertClose(1f, f.map(new float[]{0f, 1f}), tolerance);
   
    f = interpreter.parse("x0|x1", 2);
    l = ((PostfixFunction) f).getExpressionList();
    assertEquals(Integer.valueOf(0), l.get(0));
    assertEquals(Integer.valueOf(1), l.get(1));
View Full Code Here


    f = interpreter.parse("x0 % x1", 2);
    l = ((PostfixFunction) f).getExpressionList();
    assertEquals(Integer.valueOf(0), l.get(0));
    assertEquals(Integer.valueOf(1), l.get(1));
    assertEquals("%", l.get(2).toString());
    TestUtil.assertClose(0f, f.map(new float[]{10f, 2f}), tolerance);
    TestUtil.assertClose(1f, f.map(new float[]{10f, 3f}), tolerance);
   
    // basic unary cases ... 
    f = interpreter.parse("x0", 1);
    l = ((PostfixFunction) f).getExpressionList();
View Full Code Here

    l = ((PostfixFunction) f).getExpressionList();
    assertEquals(Integer.valueOf(0), l.get(0));
    assertEquals(Integer.valueOf(1), l.get(1));
    assertEquals("%", l.get(2).toString());
    TestUtil.assertClose(0f, f.map(new float[]{10f, 2f}), tolerance);
    TestUtil.assertClose(1f, f.map(new float[]{10f, 3f}), tolerance);
   
    // basic unary cases ... 
    f = interpreter.parse("x0", 1);
    l = ((PostfixFunction) f).getExpressionList();
    assertEquals(Integer.valueOf(0), l.get(0));
View Full Code Here

   
    // basic unary cases ... 
    f = interpreter.parse("x0", 1);
    l = ((PostfixFunction) f).getExpressionList();
    assertEquals(Integer.valueOf(0), l.get(0));
    TestUtil.assertClose(1f, f.map(new float[]{1f}), tolerance);
   
    f = interpreter.parse("-x0", 1);
    l = ((PostfixFunction) f).getExpressionList();
    assertEquals(Integer.valueOf(0), l.get(0));
    assertEquals("~", l.get(1).toString());
View Full Code Here

   
    f = interpreter.parse("-x0", 1);
    l = ((PostfixFunction) f).getExpressionList();
    assertEquals(Integer.valueOf(0), l.get(0));
    assertEquals("~", l.get(1).toString());
    TestUtil.assertClose(-1f, f.map(new float[]{1f}), tolerance);
   
    f = interpreter.parse("!x0", 1);
    l = ((PostfixFunction) f).getExpressionList();
    assertEquals(Integer.valueOf(0), l.get(0));
    assertEquals("!", l.get(1).toString());
View Full Code Here

   
    f = interpreter.parse("!x0", 1);
    l = ((PostfixFunction) f).getExpressionList();
    assertEquals(Integer.valueOf(0), l.get(0));
    assertEquals("!", l.get(1).toString());
    TestUtil.assertClose(0f, f.map(new float[]{1f}), tolerance);
    TestUtil.assertClose(1f, f.map(new float[]{0f}), tolerance);
   
    f = interpreter.parse("! x0", 1);
    l = ((PostfixFunction) f).getExpressionList();
    assertEquals(Integer.valueOf(0), l.get(0));
View Full Code Here

    f = interpreter.parse("!x0", 1);
    l = ((PostfixFunction) f).getExpressionList();
    assertEquals(Integer.valueOf(0), l.get(0));
    assertEquals("!", l.get(1).toString());
    TestUtil.assertClose(0f, f.map(new float[]{1f}), tolerance);
    TestUtil.assertClose(1f, f.map(new float[]{0f}), tolerance);
   
    f = interpreter.parse("! x0", 1);
    l = ((PostfixFunction) f).getExpressionList();
    assertEquals(Integer.valueOf(0), l.get(0));
    assertEquals("!", l.get(1).toString());
View Full Code Here

    assertEquals(Integer.valueOf(0), l.get(0));
    assertEquals(Integer.valueOf(1), l.get(1));
    assertEquals("+", l.get(2).toString());
    assertEquals(Integer.valueOf(2), l.get(3));
    assertEquals("+", l.get(4).toString());
    TestUtil.assertClose(6f, f.map(new float[]{1f, 2f, 3f}), tolerance);
   
    f = interpreter.parse("x0 * x1 + x2", 3);
    l = ((PostfixFunction) f).getExpressionList();
    assertEquals(Integer.valueOf(0), l.get(0));
    assertEquals(Integer.valueOf(1), l.get(1));
View Full Code Here

    assertEquals(Integer.valueOf(0), l.get(0));
    assertEquals(Integer.valueOf(1), l.get(1));
    assertEquals("*", l.get(2).toString());
    assertEquals(Integer.valueOf(2), l.get(3));
    assertEquals("+", l.get(4).toString());
    TestUtil.assertClose(5f, f.map(new float[]{1f, 2f, 3f}), tolerance);
   
    f = interpreter.parse("x0 / x1 - x2", 3);
    l = ((PostfixFunction) f).getExpressionList();
    assertEquals(Integer.valueOf(0), l.get(0));
    assertEquals(Integer.valueOf(1), l.get(1));
View Full Code Here

    assertEquals(Integer.valueOf(0), l.get(0));
    assertEquals(Integer.valueOf(1), l.get(1));
    assertEquals("/", l.get(2).toString());
    assertEquals(Integer.valueOf(2), l.get(3));
    assertEquals("-", l.get(4).toString());
    TestUtil.assertClose(-2.5f, f.map(new float[]{1f, 2f, 3f}), tolerance);
   
    f = interpreter.parse("x0 + x1 * x2", 3);
    l = ((PostfixFunction) f).getExpressionList();
    assertEquals(Integer.valueOf(0), l.get(0));
    assertEquals(Integer.valueOf(1), l.get(1));
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.