Re: [Numpy-discussion] numpy.fft.irfftn fails apparently unexpectedly

2012-02-07 Thread Henry Gomersall
On Tue, 2012-02-07 at 01:04 +0100, Torgil Svensson wrote: irfftn is an optimization for real input and does not take complex input. You have to use numpy.fft.ifftn instead: hmmm, that doesn't sound right to me (though there could be some non obvious DFT magic that I'm missing). Indeed,

Re: [Numpy-discussion] numpy.fft.irfftn fails apparently unexpectedly

2012-02-07 Thread Henry Gomersall
On Tue, 2012-02-07 at 09:15 +, Henry Gomersall wrote: On Tue, 2012-02-07 at 01:04 +0100, Torgil Svensson wrote: irfftn is an optimization for real input and does not take complex input. You have to use numpy.fft.ifftn instead: hmmm, that doesn't sound right to me (though there could

Re: [Numpy-discussion] Download page still points to SVN

2012-02-07 Thread Pauli Virtanen
Hi, 06.02.2012 20:41, Ralf Gommers kirjoitti: [clip] I've created https://github.com/scipy/scipy.github.com and gave you permissions on that. So with that for the built html and https://github.com/scipy/scipy.org-new for the sources, that should do it. On the numpy org I don't have the

Re: [Numpy-discussion] Structure of polynomial module

2012-02-07 Thread Stéfan van der Walt
On Mon, Feb 6, 2012 at 2:34 PM, Charles R Harris charlesr.har...@gmail.com wrote: Use Polynomial.fit, it tracks the domain for you. Want to use Legendre functions? Use Legendre.fit. Want to plot the result? plot(*p.linspace()), want to plot the derivative? plot(*p.deriv().linspace()). Want to

Re: [Numpy-discussion] avoiding loops when downsampling arrays

2012-02-07 Thread Sturla Molden
On 06.02.2012 22:27, Sturla Molden wrote: # Make a 4D view of this data, such that b[i,j] # is a 2D block with shape (4,4) (e.g. b[0,0] is # the same as a[:4, :4]). b = as_strided(a, shape=(a.shape[0]/4, a.shape[1]/4, 4, 4), strides=(4*a.strides[0], 4*a.strides[1],

Re: [Numpy-discussion] Moving to gcc 4.* for win32 installers ?

2012-02-07 Thread Sturla Molden
On 04.02.2012 16:55, Ralf Gommers wrote: Although not ideal, I don't have a problem with that in principle. However, wouldn't it break installing without admin rights if Python is installed by the admin? Not on Windows. Sturla ___

Re: [Numpy-discussion] Moving to gcc 4.* for win32 installers ?

2012-02-07 Thread Sturla Molden
On 27.10.2011 15:02, David Cournapeau wrote: - we need to recompile atlas (but I can take care of it) - the biggest: it is difficult to combine gfortran with visual studio (more exactly you cannot link gfortran runtime to a visual studio executable). Why is that? I have used gfortran

Re: [Numpy-discussion] Moving to gcc 4.* for win32 installers ?

2012-02-07 Thread Sturla Molden
On 27.10.2011 15:02, David Cournapeau wrote: - we need to recompile atlas (but I can take care of it) May I suggest GotoBLAS2 instead of ATLAS? Is is faster (comparable to MKL), easier to build, and now released under BSD licence. http://www.tacc.utexas.edu/tacc-projects/gotoblas2

Re: [Numpy-discussion] Moving to gcc 4.* for win32 installers ?

2012-02-07 Thread Sturla Molden
On 07.02.2012 14:38, Sturla Molden wrote: May I suggest GotoBLAS2 instead of ATLAS? Or OpenBLAS, which is GotoBLAS2 except it is still maintained. https://github.com/xianyi/OpenBLAS ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] numpy.fft.irfftn fails apparently unexpectedly

2012-02-07 Thread Henry Gomersall
On Tue, 2012-02-07 at 09:15 +, Henry Gomersall wrote: numpy.fft.ifftn(a, axes=axes) Or do you mean if the error message is expected? Yeah, the question was regarding the error message. Specifically, the problem it seems to have with an axes argument like that. Sorry, the error

Re: [Numpy-discussion] avoiding loops when downsampling arrays

2012-02-07 Thread eat
Hi This is elegant and very fast as well! On Tue, Feb 7, 2012 at 2:57 PM, Sturla Molden stu...@molden.no wrote: On 06.02.2012 22:27, Sturla Molden wrote: # Make a 4D view of this data, such that b[i,j] # is a 2D block with shape (4,4) (e.g. b[0,0] is # the same as a[:4, :4]). b =

Re: [Numpy-discussion] Moving to gcc 4.* for win32 installers ?

2012-02-07 Thread David Cournapeau
On Tue, Feb 7, 2012 at 1:30 PM, Sturla Molden stu...@molden.no wrote: On 27.10.2011 15:02, David Cournapeau wrote:    - we need to recompile atlas (but I can take care of it)    - the biggest: it is difficult to combine gfortran with visual studio (more exactly you cannot link gfortran

Re: [Numpy-discussion] Moving to gcc 4.* for win32 installers ?

2012-02-07 Thread David Cournapeau
On Tue, Feb 7, 2012 at 1:55 PM, Sturla Molden stu...@molden.no wrote: On 07.02.2012 14:38, Sturla Molden wrote: May I suggest GotoBLAS2 instead of ATLAS? Or OpenBLAS, which is GotoBLAS2 except it is still maintained. I did not know GotoBLAS2 was open source (it wasn't last time I checked).

Re: [Numpy-discussion] avoiding loops when downsampling arrays

2012-02-07 Thread Sturla Molden
On 07.02.2012 15:27, eat wrote: This is elegant and very fast as well! Just be aware that it depends on C ordered input. So: m,n = data.shape cond = lamda x : (x = t1) (x = t2) x = cond(np.ascontiguousarray(data)).reshape((m//4, 4, n//4, 4)) found = np.any(np.any(x, axis=1),

[Numpy-discussion] Logical indexing and higher-dimensional arrays.

2012-02-07 Thread Jordi Gutiérrez Hermoso
Consider the following. Is this a bug? Thanks, - Jordi G. H. --- #!/usr/bin/python import numpy as np x = np.reshape(np.random.uniform(size=2*3*4), [2,3,4]) idx = np.array([False, True, False, True]) y = x[0,:,:]; ## Why is this transposed? print

Re: [Numpy-discussion] Moving to gcc 4.* for win32 installers ?

2012-02-07 Thread Sturla Molden
On 07.02.2012 17:14, David Cournapeau wrote: How did you link a library with mixed C and gfortran ? Use gfortran instead of gcc when you link. gfortran knows what to do (and don't put -lgfortran in there). Something like this I think: gfortran -o whatever.pyd -shared cobj.o fobj.o -lmsvcr90

Re: [Numpy-discussion] avoiding loops when downsampling arrays

2012-02-07 Thread Sturla Molden
for i in range(m): for j in range(n): found[i//4,j//4] = cond(x[i,j]) Blah, that should be found[i//4,j//4] |= cond(x[i,j]) Sturla ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] Moving to gcc 4.* for win32 installers ?

2012-02-07 Thread Sturla Molden
On 07.02.2012 17:15, David Cournapeau wrote: I did not know GotoBLAS2 was open source (it wasn't last time I checked). That's very useful information, I will look into it. One potential problem I just discovered is dependency on a DLL called libpthreadGC2.dll. First, it's a DLL that must be

Re: [Numpy-discussion] Logical indexing and higher-dimensional arrays.

2012-02-07 Thread Benjamin Root
On Tue, Feb 7, 2012 at 11:11 AM, Jordi Gutiérrez Hermoso jord...@octave.org wrote: Consider the following. Is this a bug? Thanks, - Jordi G. H. --- #!/usr/bin/python import numpy as np x = np.reshape(np.random.uniform(size=2*3*4), [2,3,4])

Re: [Numpy-discussion] Logical indexing and higher-dimensional arrays.

2012-02-07 Thread Sturla Molden
On 07.02.2012 19:17, Benjamin Root wrote: print x.shape (2, 3, 4) print x[0, :, :].shape (3, 4) print x[0, :, idx].shape (2, 3) That looks like a bug to me. The length of the first dimension should be the same. Sturla ___

Re: [Numpy-discussion] Logical indexing and higher-dimensional arrays.

2012-02-07 Thread Sturla Molden
On 07.02.2012 19:24, Sturla Molden wrote: On 07.02.2012 19:17, Benjamin Root wrote: print x.shape (2, 3, 4) print x[0, :, :].shape (3, 4) print x[0, :, idx].shape (2, 3) That looks like a bug to me. The length of the first dimension should be the same. I can reproduce this

Re: [Numpy-discussion] numpy.fft.irfftn fails apparently unexpectedly

2012-02-07 Thread Warren Focke
On Tue, 7 Feb 2012, Henry Gomersall wrote: On Tue, 2012-02-07 at 01:04 +0100, Torgil Svensson wrote: irfftn is an optimization for real input and does not take complex input. You have to use numpy.fft.ifftn instead: hmmm, that doesn't sound right to me (though there could be some non

Re: [Numpy-discussion] Logical indexing and higher-dimensional arrays.

2012-02-07 Thread Stéfan van der Walt
On Tue, Feb 7, 2012 at 10:41 AM, Sturla Molden stu...@molden.no wrote: It's the combination of a single index and fancy indexing that does this, not the slicing. There are some quirks in the broadcasting machinery that makes it almost impossible to guess what the outcome of mixed indexing is

Re: [Numpy-discussion] numpy.fft.irfftn fails apparently unexpectedly

2012-02-07 Thread Henry Gomersall
On Tue, 2012-02-07 at 11:53 -0800, Warren Focke wrote: You're not doing anything wrong. irfftn takes complex input and returns real output. The exception is a bug which is triggered because max(axes) = len(axes). Is this a bug I should register? Cheers, Henry

Re: [Numpy-discussion] numpy.fft.irfftn fails apparently unexpectedly

2012-02-07 Thread Warren Focke
On Tue, 7 Feb 2012, Henry Gomersall wrote: On Tue, 2012-02-07 at 11:53 -0800, Warren Focke wrote: You're not doing anything wrong. irfftn takes complex input and returns real output. The exception is a bug which is triggered because max(axes) = len(axes). Is this a bug I should register?

Re: [Numpy-discussion] Moving to gcc 4.* for win32 installers ?

2012-02-07 Thread Ralf Gommers
On Tue, Feb 7, 2012 at 2:23 PM, Sturla Molden stu...@molden.no wrote: On 04.02.2012 16:55, Ralf Gommers wrote: Although not ideal, I don't have a problem with that in principle. However, wouldn't it break installing without admin rights if Python is installed by the admin?

Re: [Numpy-discussion] Download page still points to SVN

2012-02-07 Thread Travis Oliphant
On Feb 7, 2012, at 4:02 AM, Pauli Virtanen wrote: Hi, 06.02.2012 20:41, Ralf Gommers kirjoitti: [clip] I've created https://github.com/scipy/scipy.github.com and gave you permissions on that. So with that for the built html and https://github.com/scipy/scipy.org-new for the sources, that

Re: [Numpy-discussion] Logical indexing and higher-dimensional arrays.

2012-02-07 Thread Travis Oliphant
This comes up from time to time.This is an example of what is described at the top of page 84 of Guide to NumPy. Also read Chapter 17 to get the explanation of how fancy indexing is implemented if you really want to understand the issues. When you mix fancy-indexing with simple indexing,

Re: [Numpy-discussion] numpy.fft.irfftn fails apparently unexpectedly

2012-02-07 Thread Henry Gomersall
On Tue, 2012-02-07 at 12:26 -0800, Warren Focke wrote: Is this a bug I should register? Yes. It should work right if you replace s[axes[-1]] = (s[axes[-1]] - 1) * 2 with s[-1] = (a.shape[axes[-1]] - 1) * 2 but I'm not really in a position to test it right now. I can confirm

Re: [Numpy-discussion] numpy.fft.irfftn fails apparently unexpectedly

2012-02-07 Thread Warren Focke
On Tue, 7 Feb 2012, Henry Gomersall wrote: On Tue, 2012-02-07 at 12:26 -0800, Warren Focke wrote: Is this a bug I should register? Yes. It should work right if you replace s[axes[-1]] = (s[axes[-1]] - 1) * 2 with s[-1] = (a.shape[axes[-1]] - 1) * 2 but I'm not really in a

Re: [Numpy-discussion] Download page still points to SVN

2012-02-07 Thread Stéfan van der Walt
On Tue, Feb 7, 2012 at 2:03 PM, Travis Oliphant tra...@continuum.io wrote: John Turner at ORNL has the numpy.org domain and perhaps we could get him to point it to numpy.github.com Remember to also put a CNAME file in the root of the repository: http://pages.github.com/ Stéfan

Re: [Numpy-discussion] matrix indexing

2012-02-07 Thread Aronne Merrelli
On Mon, Feb 6, 2012 at 11:44 AM, Naresh Pai n...@uark.edu wrote: I have two large matrices, say, ABC and DEF, each with a shape of 7000 by 4500. I have another list, say, elem, containing 850 values from ABC. I am interested in finding out the corresponding values in DEF where ABC has elem

Re: [Numpy-discussion] Logical indexing and higher-dimensional arrays.

2012-02-07 Thread Travis Oliphant
On Feb 7, 2012, at 12:24 PM, Sturla Molden wrote: On 07.02.2012 19:17, Benjamin Root wrote: print x.shape (2, 3, 4) print x[0, :, :].shape (3, 4) print x[0, :, idx].shape (2, 3) That looks like a bug to me. The length of the first dimension should be the same. What you are

Re: [Numpy-discussion] matrix indexing

2012-02-07 Thread Val Kalatsky
Aronne made good suggestions. Here is another weapon for your arsenal: 1) I assume that the shape of your array is irrelevant (reshape if needed) 2) Depending on the structure of your data np.unique can be handy: arr_unique, idx = np.unique(arr1d, return_inverse=True) then search arr_unique