Esempio n. 1
0
 def test_logaddexp2_values(self):
     x = [1, 2, 3, 4, 5]
     y = [5, 4, 3, 2, 1]
     z = [6, 6, 6, 6, 6]
     for ds, dec in zip(['float32', 'float64'], [6, 15, 15]):
         xf = blaze.log2(blaze.array(x, dshape=ds))
         yf = blaze.log2(blaze.array(y, dshape=ds))
         zf = blaze.log2(blaze.array(z, dshape=ds))
         result = blaze.logaddexp2(xf, yf)
         assert_almost_equal(result, zf, decimal=dec)
Esempio n. 2
0
 def test_log2_values(self):
     x = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]
     y = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
     for ds in ['float32', 'float64']:
         xf = blaze.array(x, dshape=ds)
         yf = blaze.array(y, dshape=ds)
         result = blaze.log2(xf)
         assert_almost_equal(result, yf)