2223242526272829303132
Plotter.plot(pdf, 0, .001f, .5f, "aagg"); float binSize = .05f; float[] bins = new float[8]; for (int i = 0; i < 10000; i++) { float foo = pdf.sample()[0]; int bin = (int) Math.floor(foo / binSize); if (bin <= 7) { bins[bin] += 1; } }
1920212223242526272829
*/ public void testSample() { PDF pdf = new IndicatorPDF(-1, 1); for (int i = 0; i < 10; i++) { float[] s = pdf.sample(); assertEquals(1, s.length); assertTrue(s[0] > -1 && s[0] < 1); } pdf = new IndicatorPDF(0, 0);
2526272829303132333435
assertEquals(1, s.length); assertTrue(s[0] > -1 && s[0] < 1); } pdf = new IndicatorPDF(0, 0); assertEquals(0f, pdf.sample()[0]); } /* * Test method for 'ca.nengo.math.impl.IndicatorPDF.getDimension()' */