Re: [Numpy-discussion] Backout complex changes for next release?

2009-11-07 Thread David Cournapeau
On Sat, Nov 7, 2009 at 7:12 AM, Charles R Harris charlesr.har...@gmail.com wrote: There seems to be a rat's nest of problems showing up in scipy due to the recent changes in numpy complex support. The problems are of two basic sorts: 1) reserved name conflicts and 2) file conflicts. The first

Re: [Numpy-discussion] dtype 'groups'

2009-11-07 Thread Stéfan van der Walt
2009/11/7 David Warde-Farley d...@cs.toronto.edu: Just to confirm my suspicions, what's the preferred way to check if a dtype is... Not sure what the official way is, but this method works well: a) an integer type vs. a floating point type vs. a string type? I'm assuming dt.kind.

Re: [Numpy-discussion] Vector interpolation on a 2D grid

2009-11-07 Thread Christopher Barker
Pierre GM wrote: I have a vector of observations (latitude,longitude,value) that I need to interpolate over a given area. Some colleagues complained that the result looked a bit too choppy, meaning that too much weight was given to the actual observations. What are my other options ?

Re: [Numpy-discussion] ctypes and numpy

2009-11-07 Thread Zachary Pincus
Check out this thread: http://www.mail-archive.com/numpy-discuss...@lists.sourceforge.net/msg01154.html In shot, it can be done, but it can be tricky to make sure you don't leak memory. A better option if possible is to pre-allocate the array with numpy and pass that buffer into the C code --

Re: [Numpy-discussion] Deprecate np.max/np.min ?

2009-11-07 Thread Neil Crighton
Charles R Harris charlesr.harris at gmail.com writes: People import these functions -- yes, they shouldn't do that -- and the python builtin versions are overloaded, causing hard to locate errors. While I would love less duplication in the numpy namespace, I don't think the small gain here is

[Numpy-discussion] How to get rid of the loop?

2009-11-07 Thread Stas K
Can I get rid of the loop in this example? And what is the fastest way to get v in the example? ar = array([1,2,3]) for a in ar: for b in ar: v = a**2+b**2 ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] How to get rid of the loop?

2009-11-07 Thread josef . pktd
On Sat, Nov 7, 2009 at 1:51 PM, Stas K stanc...@gmail.com wrote: Can I get rid of the loop in this example? And what is the fastest way to get v in the example? ar = array([1,2,3]) for a in ar:    for b in ar:        v = a**2+b**2 ar[:,None]**2 + ar**2 array([[ 2, 5, 10], [ 5, 8,

Re: [Numpy-discussion] How to get rid of the loop?

2009-11-07 Thread Alan G Isaac
On 11/7/2009 1:51 PM, Stas K wrote: Can I get rid of the loop in this example? And what is the fastest way to get v in the example? ar = array([1,2,3]) for a in ar: for b in ar: v = a**2+b**2 a2 = a*a np.add.outer(a2,a2) array([[ 2, 5, 10], [ 5, 8, 13],

Re: [Numpy-discussion] How to get rid of the loop?

2009-11-07 Thread Stas K
Thank you, Josef It is exactly what I want: ar[:,None]**2 + ar**2 Do you know something about performance of this? In my real program ar have ~ 10k elements, and expression for v more complicated (it has some trigonometric functions) On 07.11.2009, at 21:57, josef.p...@gmail.com

[Numpy-discussion] PGI vs. Intel Compiler

2009-11-07 Thread Sebastian Żurek
Hi! I'm not sure, if it's the right group to ask, but it's a kind of a numeric question involving Python, so... My faculty is going to spend some money on commercial compiler. The two choices are: - PGI C++ compiler - Intel C++ compiler I wonder, if anyone as some experience with Python

Re: [Numpy-discussion] masked record arrays

2009-11-07 Thread Thomas Robitaille
Pierre GM-2 wrote: Mmh. With a recent (1.3) version of numpy, you should already be able to mask individual fields of a structured array without problems. If you need fields to be accessed as attributes the np.recarray way, you can give numpy.ma.mrecords.MaskedRecords a try. It's

Re: [Numpy-discussion] How to get rid of the loop?

2009-11-07 Thread Anne Archibald
2009/11/7 Stas K stanc...@gmail.com: Thank you, Josef It is exactly what I want: ar[:,None]**2 + ar**2 Do you know something about performance of this? In my real program ar  have ~ 10k elements, and expression for v more complicated (it has some trigonometric functions) The construction

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-07 Thread Sturla Molden
David Cournapeau wrote: On Fri, Nov 6, 2009 at 6:54 AM, David Goldsmith d.l.goldsm...@gmail.com wrote: Interesting thread, which leaves me wondering two things: is it documented somewhere (e.g., at the IEEE site) precisely how many *decimal* mantissae are representable using the 64-bit

[Numpy-discussion] Accessing LAPACK and BLAS from the numpy C API

2009-11-07 Thread Jake VanderPlas
Hello, I'm working on wrapping a set of C++ routines for manifold learning (LLE, Isomap, LTSA, etc) in python. In the LLE routine, it is necessary to loop through the input points and perform an svd of each local covariance matrix. Presently I have my own C-LAPACK wrapper that I call within a C

Re: [Numpy-discussion] Accessing LAPACK and BLAS from the numpy C API

2009-11-07 Thread Sturla Molden
Jake VanderPlas wrote: Does anybody know a way to directly access the numpy.linalg routines from a C extension, without the overhead of a python callback? Thanks for the help. You find a C function pointer wrapped in a CObject in the ._cpointer attribute.

[Numpy-discussion] Use-case for np.choose

2009-11-07 Thread David Goldsmith
Hi, all! I'm working to clarify the docstring for np.choose (Stefan pointed out to me that it is pretty unclear, and I agreed), and, now that (I'm pretty sure that) I've figured out what it does in its full generality (e.g., when the 'choices' array is greater than 2-D), I'm curious as to

Re: [Numpy-discussion] Use-case for np.choose

2009-11-07 Thread Anne Archibald
2009/11/7 David Goldsmith d.l.goldsm...@gmail.com: Hi, all!  I'm working to clarify the docstring for np.choose (Stefan pointed out to me that it is pretty unclear, and I agreed), and, now that (I'm pretty sure that) I've figured out what it does in its full generality (e.g., when the

Re: [Numpy-discussion] Deprecate np.max/np.min ?

2009-11-07 Thread Pauli Virtanen
la, 2009-11-07 kello 18:27 +, Neil Crighton kirjoitti: [clip] I think it would be better to fix this issue. np.min(3,2) should also give ValueError: axis(=2) out of bounds. Fixing this also removes any possibility of generating hard-to-find errors by overwriting the builtin min/max.

Re: [Numpy-discussion] ctypes and numpy

2009-11-07 Thread Trevor Clarke
this looks like what I need...I'm not concerned with leaking memory as it's a borrowed pointer which will be cleaned up in C code later. Thanks for the pointer. On Sat, Nov 7, 2009 at 12:36 PM, Zachary Pincus zachary.pin...@yale.eduwrote: Check out this thread:

Re: [Numpy-discussion] masked record arrays

2009-11-07 Thread Pierre GM
On Nov 7, 2009, at 2:26 PM, Thomas Robitaille wrote: Thanks for the advice! I'm somewhat confused by the difference between structured and record arrays. My understanding is that record arrays allow you to access fields by attribute (e.g. r.field_name), but I imagine that there are

Re: [Numpy-discussion] Vector interpolation on a 2D grid (with realistic results)

2009-11-07 Thread Pierre GM
On Nov 6, 2009, at 5:45 PM, Pauli Virtanen wrote: pe, 2009-11-06 kello 17:20 -0500, Pierre GM kirjoitti: All, I have a vector of observations (latitude,longitude,value) that I need to interpolate over a given area. You could try to use linear interpolation from the delaynay package

Re: [Numpy-discussion] Vector interpolation on a 2D grid (with realistic results)

2009-11-07 Thread Ryan May
On Sat, Nov 7, 2009 at 5:38 PM, Pierre GM pgmdevl...@gmail.com wrote: Linear interpolation with the delaunay package doesn't work great for my data. I played with the radial basis functions, but I'm afraid they're leading me down the dark, dark path of parameter fiddling. In particular, I'm

Re: [Numpy-discussion] Vector interpolation on a 2D grid (with realistic results)

2009-11-07 Thread Ryan May
On Sat, Nov 7, 2009 at 5:38 PM, Pierre GM pgmdevl...@gmail.com wrote: Linear interpolation with the delaunay package doesn't work great for my data. I played with the radial basis functions, but I'm afraid they're leading me down the dark, dark path of parameter fiddling. In particular, I'm

[Numpy-discussion] initializing an array of lists

2009-11-07 Thread alan
I want to build a 2D array of lists, and so I need to initialize the array with empty lists : myarray = array([[[],[],[]] ,[[],[],[]]]) Is there a clever way to do this? I could define the array myarray = zeros( (xdim,ydim), dtype=object) and then iterate through the elements initializing then

Re: [Numpy-discussion] initializing an array of lists

2009-11-07 Thread Alan G Isaac
On 11/7/2009 10:56 PM, a...@ajackson.org wrote: I want to build a 2D array of lists, and so I need to initialize the array with empty lists : myarray = array([[[],[],[]] ,[[],[],[]]]) [[[] for i in range(3)] for j in range(2) ] fwiw, Alan Isaac

Re: [Numpy-discussion] Use-case for np.choose

2009-11-07 Thread josef . pktd
On Sat, Nov 7, 2009 at 7:53 PM, David Goldsmith d.l.goldsm...@gmail.com wrote: Thanks, Anne. On Sat, Nov 7, 2009 at 1:32 PM, Anne Archibald peridot.face...@gmail.com wrote: 2009/11/7 David Goldsmith d.l.goldsm...@gmail.com: snip Also, my experimenting suggests that the index array

Re: [Numpy-discussion] Use-case for np.choose

2009-11-07 Thread Anne Archibald
2009/11/7 David Goldsmith d.l.goldsm...@gmail.com: Thanks, Anne. On Sat, Nov 7, 2009 at 1:32 PM, Anne Archibald peridot.face...@gmail.com wrote: 2009/11/7 David Goldsmith d.l.goldsm...@gmail.com: snip Also, my experimenting suggests that the index array ('a', the first argument in