[Numpy-discussion] float16/32: wrong number of digits?

2017-03-09 Thread Nico Schlömer
Hi everyone, I wondered how to express a numpy float exactly in terms of format, and found `%r` quite useful: `float(repr(a)) == a` is guaranteed for Python `float`s. When trying the same thing with lower-precision Python floats, I found this identity not quite fulfilled: ``` import numpy b = nump

Re: [Numpy-discussion] vectorization vs. numpy.linalg (shape (3, 3, 777) vs shape (777, 3, 3))

2017-03-05 Thread Nico Schlömer
0][0] +a[1][1] - a[0][1] - a[1][0]`). :) Cheers, Nico On Sun, Mar 5, 2017 at 3:53 PM Sebastian Berg wrote: On Thu, 2017-03-02 at 10:27 +, Nico Schlömer wrote: > Hi everyone, > > When trying to speed up my code, I noticed that simply by reordering > my data I could get more tha

[Numpy-discussion] vectorization vs. numpy.linalg (shape (3, 3, 777) vs shape (777, 3, 3))

2017-03-02 Thread Nico Schlömer
Hi everyone, When trying to speed up my code, I noticed that simply by reordering my data I could get more than twice as fast for the simplest operations: ``` import numpy a = numpy.random.rand(50, 50, 50) %timeit a[0] + a[1] 100 loops, best of 3: 1.7 µs per loop %timeit a[:, 0] + a[:, 1] 10

[Numpy-discussion] array_equal too strict?

2015-12-17 Thread Nico Schlömer
Hi everyone, I noticed a funny behavior in numpy's array_equal. The two arrays ``` a1 = numpy.array( [3.14159265358979320], dtype=numpy.float64 ) a2 = numpy.array( [3.14159265358979329], dtype=numpy.float64 ) ``` (differing the in the 18th overall digit) are reported equal