Re: [Numpy-discussion] How to remove fortran-like loops with numpy?

2009-06-09 Thread Sebastian Haase
2009/6/9 Stéfan van der Walt ste...@sun.ac.za: Hi Juan ---cut --- As you can see, it is very simple, but it takes several seconds running just to create a 200x200 plot. Fortran takes same time to create a 2000x2000 plot, around 100 times faster... So the question is, do you know how to

[Numpy-discussion] How to remove fortran-like loops with numpy?

2009-06-08 Thread Juanjo Gomez Navarro
Hi all, I'm new in numpy. Actually, I'm new in Python. In order to learn a bit, I want to create a program to plot the Mandelbrot set. This program is quite simple, and I have already programmed it. The problem is that I come from fortran, so I use to think in for loops. I know that it is not the

Re: [Numpy-discussion] How to remove fortran-like loops with numpy?

2009-06-08 Thread David Goldsmith
-discussion] How to remove fortran-like loops with numpy? To: numpy-discussion@scipy.org Date: Monday, June 8, 2009, 2:52 PM Hi all, I'm new in numpy. Actually, I'm new in Python. In order to learn a bit, I want to create a program to plot the Mandelbrot set. This program is quite simple, and I

Re: [Numpy-discussion] How to remove fortran-like loops with numpy?

2009-06-08 Thread Robert Kern
On Mon, Jun 8, 2009 at 17:04, David Goldsmithd_l_goldsm...@yahoo.com wrote: I look forward to an instructive reply: the Pythonic way to do it would be to take advantage of the facts that Numpy is pre-vectorized and uses broadcasting, but so far I haven't been able to figure out (though I

Re: [Numpy-discussion] How to remove fortran-like loops with numpy?

2009-06-08 Thread Anne Archibald
2009/6/8 Robert Kern robert.k...@gmail.com: On Mon, Jun 8, 2009 at 17:04, David Goldsmithd_l_goldsm...@yahoo.com wrote: I look forward to an instructive reply: the Pythonic way to do it would be to take advantage of the facts that Numpy is pre-vectorized and uses broadcasting, but so far I

Re: [Numpy-discussion] How to remove fortran-like loops with numpy?

2009-06-08 Thread David Goldsmith
Thanks, Robert! DG --- On Mon, 6/8/09, Robert Kern robert.k...@gmail.com wrote: I haven't been able to figure out (though I haven't yet really buckled down and tried real hard) how to broadcast a conditionally-terminated iteration where the number of iterations will vary among the array

Re: [Numpy-discussion] How to remove fortran-like loops with numpy?

2009-06-08 Thread David Goldsmith
--- On Mon, 6/8/09, Anne Archibald peridot.face...@gmail.com wrote: You can't, really. What you can do is just keep iterating with the whole data set and ignore the parts that have already converged. Here is an example: Well, yes and no. This is only worth doing if the number of

Re: [Numpy-discussion] How to remove fortran-like loops with numpy?

2009-06-08 Thread Robert Kern
On Mon, Jun 8, 2009 at 18:01, David Goldsmithd_l_goldsm...@yahoo.com wrote: --- On Mon, 6/8/09, Anne Archibald peridot.face...@gmail.com wrote: You can't, really. What you can do is just keep iterating with the whole data set and ignore the parts that have already converged. Here is an

Re: [Numpy-discussion] How to remove fortran-like loops with numpy?

2009-06-08 Thread Stéfan van der Walt
Hi Juan 2009/6/8 Juanjo Gomez Navarro juanjo.gomeznava...@gmail.com: I'm new in numpy. Actually, I'm new in Python. In order to learn a bit, I want to create a program to plot the Mandelbrot set. This program is quite simple, and I have already programmed it. The problem is that I come from

Re: [Numpy-discussion] How to remove fortran-like loops with numpy?

2009-06-08 Thread David Goldsmith
--- On Mon, 6/8/09, Robert Kern robert.k...@gmail.com wrote: Goldsmithd_l_goldsm...@yahoo.com wrote: The advantage of my implementation is that I didn't have to think too hard about it. -- Robert Kern Agreed. :-) DG ___