[Numpy-discussion] Bug in einsum?

2013-03-13 Thread Jaakko Luttinen
Hi, I have encountered a very weird behaviour with einsum. I try to compute something like R*A*R', where * denotes a kind of matrix multiplication. However, for particular shapes of R and A, the results are extremely bad. I compare two einsum results: First, I compute in two einsum calls as

Re: [Numpy-discussion] Adopt Mersenne Twister 64bit?

2013-03-13 Thread Neal Becker
Neal Becker wrote: Neal Becker wrote: I guess I talked to you about 100 years ago about sharing state between numpy rng and code I have in c++ that wraps boost::random. So is there a C-api for this RandomState object I could use to call from c++? Maybe I could do something with that.

[Numpy-discussion] fast numpy.fromfile skipping data chunks

2013-03-13 Thread Andrea Cimatoribus
Hi everybody, I hope this has not been discussed before, I couldn't find a solution elsewhere. I need to read some binary data, and I am using numpy.fromfile to do this. Since the files are huge, and would make me run out of memory, I need to read data skipping some records (I am reading data

Re: [Numpy-discussion] fast numpy.fromfile skipping data chunks

2013-03-13 Thread Nathaniel Smith
On Wed, Mar 13, 2013 at 1:45 PM, Andrea Cimatoribus andrea.cimatori...@nioz.nl wrote: Hi everybody, I hope this has not been discussed before, I couldn't find a solution elsewhere. I need to read some binary data, and I am using numpy.fromfile to do this. Since the files are huge, and would

[Numpy-discussion] numpy reference array

2013-03-13 Thread Matt U
Is it possible to create a numpy array which points to the same data in a different numpy array (but in different order etc)? For example: Code: -- import numpy as np a = np.arange(10) ids = np.array([0,0,5,5,9,9,1,1])

[Numpy-discussion] R: fast numpy.fromfile skipping data chunks

2013-03-13 Thread Andrea Cimatoribus
This solution does not work for me since I have an offset before the data that is not a multiple of the datatype (it's a header containing various stuff). I'll at pytables. # Exploit the operating system's virtual memory manager to get a virtual copy of the entire file in memory # (This does not

[Numpy-discussion] Dot/inner products with broadcasting?

2013-03-13 Thread Jaakko Luttinen
Hi! How can I compute dot product (or similar multiplysum operations) efficiently so that broadcasting is utilized? For multi-dimensional arrays, NumPy's inner and dot functions do not match the leading axes and use broadcasting, but instead the result has first the leading axes of the first

[Numpy-discussion] R: fast numpy.fromfile skipping data chunks

2013-03-13 Thread Andrea Cimatoribus
I see that pytables deals with hdf5 data. It would be very nice if the data were in such a standard format, but that is not the case, and that can't be changed. Da: numpy-discussion-boun...@scipy.org [numpy-discussion-boun...@scipy.org] per conto di

Re: [Numpy-discussion] R: fast numpy.fromfile skipping data chunks

2013-03-13 Thread Nathaniel Smith
On Wed, Mar 13, 2013 at 2:18 PM, Andrea Cimatoribus andrea.cimatori...@nioz.nl wrote: This solution does not work for me since I have an offset before the data that is not a multiple of the datatype (it's a header containing various stuff). np.memmap takes an offset= argument. -n

[Numpy-discussion] R: R: fast numpy.fromfile skipping data chunks

2013-03-13 Thread Andrea Cimatoribus
Indeed, but that offset it should be a multiple of the byte-size of dtype as the help says. Indeed, this is silly. Da: numpy-discussion-boun...@scipy.org [numpy-discussion-boun...@scipy.org] per conto di Nathaniel Smith [n...@pobox.com] Inviato:

[Numpy-discussion] R: R: R: fast numpy.fromfile skipping data chunks

2013-03-13 Thread Andrea Cimatoribus
On top of that, there is another issue: it can be that the data available itself is not a multiple of dtype, since there can be write errors at the end of the file, and I don't know how to deal with that. Da: numpy-discussion-boun...@scipy.org

[Numpy-discussion] R: R: R: fast numpy.fromfile skipping data chunks

2013-03-13 Thread Andrea Cimatoribus
Indeed, but that offset it should be a multiple of the byte-size of dtype as the help says. My mistake, sorry, even if the help says so, it seems that this is not the case in the actual code. Still, the problem with the size of the available data (which is not necessarily a multiple of dtype

Re: [Numpy-discussion] R: R: R: fast numpy.fromfile skipping data chunks

2013-03-13 Thread Nathaniel Smith
On Wed, Mar 13, 2013 at 2:46 PM, Andrea Cimatoribus andrea.cimatori...@nioz.nl wrote: Indeed, but that offset it should be a multiple of the byte-size of dtype as the help says. My mistake, sorry, even if the help says so, it seems that this is not the case in the actual code. Still, the

Re: [Numpy-discussion] fast numpy.fromfile skipping data chunks

2013-03-13 Thread Francesc Alted
On 3/13/13 2:45 PM, Andrea Cimatoribus wrote: Hi everybody, I hope this has not been discussed before, I couldn't find a solution elsewhere. I need to read some binary data, and I am using numpy.fromfile to do this. Since the files are huge, and would make me run out of memory, I need to

Re: [Numpy-discussion] fast numpy.fromfile skipping data chunks

2013-03-13 Thread Francesc Alted
On 3/13/13 3:53 PM, Francesc Alted wrote: On 3/13/13 2:45 PM, Andrea Cimatoribus wrote: Hi everybody, I hope this has not been discussed before, I couldn't find a solution elsewhere. I need to read some binary data, and I am using numpy.fromfile to do this. Since the files are huge, and

[Numpy-discussion] R: R: R: R: fast numpy.fromfile skipping data chunks

2013-03-13 Thread Andrea Cimatoribus
Ok, this seems to be working (well, as soon as I get the right offset and things like that, but that's a different story). The problem is that it does not go any faster than my initial function compiled with cython, and it is still a lot slower than fromfile. Is there a reason why, even with

Re: [Numpy-discussion] R: R: R: R: fast numpy.fromfile skipping data chunks

2013-03-13 Thread Nathaniel Smith
On 13 Mar 2013 15:16, Andrea Cimatoribus andrea.cimatori...@nioz.nl wrote: Ok, this seems to be working (well, as soon as I get the right offset and things like that, but that's a different story). The problem is that it does not go any faster than my initial function compiled with cython, and

[Numpy-discussion] Performance of einsum?

2013-03-13 Thread Jaakko Luttinen
Hi, I was wondering if someone could provide some intuition on the performance of einsum? I have found that sometimes it is extremely efficient but sometimes it is several orders of magnitudes slower compared to some other approaches, for instance, using multiple dot-calls. My intuition is that

[Numpy-discussion] R: fast numpy.fromfile skipping data chunks

2013-03-13 Thread Andrea Cimatoribus
Thanks a lot for the feedback, I'll try to modify my function to overcome this issue. Since I'm in the process of buying new hardware too, a slight OT (but definitely related). Does an ssd provide substantial improvement in these cases? Da:

Re: [Numpy-discussion] (@Pat Marion) Re: Yes, this one again ImportError: No module named multiarray

2013-03-13 Thread Dinesh B Vadhia
Many thanks Pat - the numpy discussion list is brill. Go ahead and see if the CPython developers would be interested as it is a problem that appears all the time on boards/lists. Best ... Dinesh From: Pat Marion Sent: Tuesday, March 12, 2013 7:23 AM To: Aron Ahmadia Cc: Discussion of

Re: [Numpy-discussion] Yes, this one again ImportError: No module named multiarray

2013-03-13 Thread Dinesh B Vadhia
Hi Chris Darn! It worked this morning and I don't know why. Focused on PyInstaller because it creates a single executable. Testing on all major versions of Windows (32-bit and 64-bit), Linux and OSX. The problem OS is unsurprisingly, Windows XP (SP3). Numpy was upgraded to the mkl-version

Re: [Numpy-discussion] fast numpy.fromfile skipping data chunks

2013-03-13 Thread Richard Hattersley
Since the files are huge, and would make me run out of memory, I need to read data skipping some records Is it possible to describe what you're doing with the data once you have subsampled it? And if there were a way to work with the full resolution data, would that be desirable? I ask because

Re: [Numpy-discussion] R: fast numpy.fromfile skipping data chunks

2013-03-13 Thread Daπid
On 13 March 2013 16:54, Andrea Cimatoribus andrea.cimatori...@nioz.nlwrote: Since I'm in the process of buying new hardware too, a slight OT (but definitely related). Does an ssd provide substantial improvement in these cases? It should help. Nevertheless, when talking about performance, it

[Numpy-discussion] can't run cython on mtrand.pyx

2013-03-13 Thread Neal Becker
Grabbed numpy-1.7.0 source. Cython is 0.18 cython mtrand.pyx produces lots of errors. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] can't run cython on mtrand.pyx

2013-03-13 Thread Robert Kern
On Wed, Mar 13, 2013 at 6:40 PM, Neal Becker ndbeck...@gmail.com wrote: Grabbed numpy-1.7.0 source. Cython is 0.18 cython mtrand.pyx produces lots of errors. It helps to copy-and-paste the errors that you are seeing. In any case, Cython 0.18 works okay on master's mtrand.pyx sources. --

Re: [Numpy-discussion] can't run cython on mtrand.pyx

2013-03-13 Thread Neal Becker
Robert Kern wrote: On Wed, Mar 13, 2013 at 6:40 PM, Neal Becker ndbeck...@gmail.com wrote: Grabbed numpy-1.7.0 source. Cython is 0.18 cython mtrand.pyx produces lots of errors. It helps to copy-and-paste the errors that you are seeing. In any case, Cython 0.18 works okay on master's

Re: [Numpy-discussion] R: fast numpy.fromfile skipping data chunks

2013-03-13 Thread Charles R Harris
On Wed, Mar 13, 2013 at 9:54 AM, Andrea Cimatoribus andrea.cimatori...@nioz.nl wrote: Thanks a lot for the feedback, I'll try to modify my function to overcome this issue. Since I'm in the process of buying new hardware too, a slight OT (but definitely related). Does an ssd provide

Re: [Numpy-discussion] numpy reference array

2013-03-13 Thread Chris Barker - NOAA Federal
On Wed, Mar 13, 2013 at 6:56 AM, Matt U mpuec...@mit.edu wrote: Is it possible to create a numpy array which points to the same data in a different numpy array (but in different order etc)? You can do this (easily), but only if the different order can be defined in terms of strides. A simple

[Numpy-discussion] Any help from Numpy community?

2013-03-13 Thread Birdada Simret
* Any help from Numpy community [[ 0. 1.540. 0. 0.1.08 1.08 1.08 ] [ 1.540. 1.081.08 1.080. 0. 0. ] [0. 1.08 0. 0. 0.0. 0.

Re: [Numpy-discussion] Yes, this one again ImportError: No module named multiarray

2013-03-13 Thread Pat Marion
Glad you got it working! For those who might be interested, the distinction between the example I linked to and packaging tools like PyInstaller or py2exe, is that NumpyBuiltinExamplehttps://github.com/patmarion/NumpyBuiltinExampleuses static linking to embed numpy as a builtin module. At