Re: [Numpy-discussion] caching large allocations on gnu/linux

2017-03-13 Thread Anne Archibald
On Mon, Mar 13, 2017 at 12:21 PM Julian Taylor < jtaylor.deb...@googlemail.com> wrote: Should it be agreed that caching is worthwhile I would propose a very > simple implementation. We only really need to cache a small handful of > array data pointers for the fast allocate deallocate cycle that

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

2017-03-13 Thread Anne Archibald
On Mon, Mar 13, 2017 at 12:57 PM Eric Wieser wrote: > > `float(repr(a)) == a` is guaranteed for Python `float` > > And `np.float16(repr(a)) == a` is guaranteed for `np.float16`(and the same > is true up to `float128`, which can be platform-dependent). Your code >

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

2017-03-09 Thread Anne Archibald
On Thu, Mar 9, 2017, 11:27 Nico Schlömer wrote: > 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

Re: [Numpy-discussion] Question about numpy.random.choice with probabilties

2017-01-23 Thread Anne Archibald
On Mon, Jan 23, 2017 at 3:34 PM Robert Kern wrote: > I don't object to some Notes, but I would probably phrase it more like we > are providing the standard definition of the jargon term "sampling without > replacement" in the case of non-uniform probabilities. To my mind

Re: [Numpy-discussion] Question about numpy.random.choice with probabilties

2017-01-23 Thread Anne Archibald
On Wed, Jan 18, 2017 at 4:13 PM Nadav Har'El wrote: > On Wed, Jan 18, 2017 at 4:30 PM, wrote: > > > > Having more sampling schemes would be useful, but it's not possible to > implement sampling schemes with impossible properties. > > > > BTW: sampling 3

Re: [Numpy-discussion] Fast vectorized arithmetic with ~32 significant digits under Numpy

2015-12-12 Thread Anne Archibald
On Fri, Dec 11, 2015, 18:04 David Cournapeau <courn...@gmail.com> wrote: On Fri, Dec 11, 2015 at 4:22 PM, Anne Archibald <archib...@astron.nl> wrote: Actually, GCC implements 128-bit floats in software and provides them as __float128; there are also quad-precision versions of the usu

Re: [Numpy-discussion] Fast vectorized arithmetic with ~32 significant digits under Numpy

2015-12-11 Thread Anne Archibald
Actually, GCC implements 128-bit floats in software and provides them as __float128; there are also quad-precision versions of the usual functions. The Intel compiler provides this as well, I think, but I don't think Microsoft compilers do. A portable quad-precision library might be less painful.

Re: [Numpy-discussion] Sign of NaN

2015-09-29 Thread Anne Archibald
IEEE 754 has signum(NaN)->NaN. So does np.sign on floating-point arrays. Why should it be different for object arrays? Anne P.S. If you want exceptions when NaNs appear, that's what np.seterr is for. -A On Tue, Sep 29, 2015 at 5:18 PM Freddy Rietdijk wrote: > I

Re: [Numpy-discussion] Python needs goto

2015-09-25 Thread Anne Archibald
goto! and comefrom! Together with exceptions, threads, lambda, super, generators, and coroutines, all we're lacking is call-with-current-continuation for the full list of impenetrable control-flow constructs. Oh, and lisp-style resumable exception handling. (Suggested syntax: drop(exception,

Re: [Numpy-discussion] feature request - increment counter on write check

2015-09-11 Thread Anne Archibald
On Fri, Sep 11, 2015 at 3:20 PM Sebastian Berg wrote: > On Fr, 2015-09-11 at 13:10 +, Daniel Manson wrote: > > Originally posted as issue 6301 on github. > > > > > > Presumably any block of code that modifies an ndarray's buffer is > > wrapped in a (thread safe?)

Re: [Numpy-discussion] Defining a white noise process using numpy

2015-08-27 Thread Anne Archibald
On Thu, Aug 27, 2015 at 12:51 AM Daniel Bliss daniel.p.bl...@gmail.com wrote: Can anyone give me some advice for translating this equation into code using numpy? eta(t) = lim(dt - 0) N(0, 1/sqrt(dt)), where N(a, b) is a Gaussian random variable of mean a and variance b**2. This is a

[Numpy-discussion] Development workflow (not git tutorial)

2015-08-13 Thread Anne Archibald
Hi, What is a sensible way to work on (modify, compile, and test) numpy? There is documentation about contributing to numpy at: http://docs.scipy.org/doc/numpy-dev/dev/index.html and: http://docs.scipy.org/doc/numpy-dev/dev/gitwash/development_workflow.html but these are entirely focused on

Re: [Numpy-discussion] DEP: Deprecate boolean array indices with non-matching shape #4353

2015-06-05 Thread Anne Archibald
On Fri, Jun 5, 2015 at 5:45 PM Sebastian Berg sebast...@sipsolutions.net wrote: On Fr, 2015-06-05 at 08:36 -0400, josef.p...@gmail.com wrote: snip What is actually being deprecated? It looks like there are different examples. wrong length: Nathaniels first example above, where the

Re: [Numpy-discussion] Backwards-incompatible improvements to numpy.random.RandomState

2015-05-24 Thread Anne Archibald
Do we want a deprecation-like approach, so that eventually people who want replicability will specify versions, and everyone else gets bug fixes and improvements? This would presumably take several major versions, but it might avoid people getting unintentionally trapped on this version.

Re: [Numpy-discussion] supporting quad precision

2013-06-08 Thread Anne Archibald
, 2013 at 10:07 AM, Anne Archibald archib...@astron.nl wrote: Hi folks, I recently came across an application I needed quad precision for (high-accuracy solution of a differential equation). I found a C++ library (odeint) that worked for the integration itself, but unfortunately

[Numpy-discussion] supporting quad precision

2013-06-05 Thread Anne Archibald
Hi folks, I recently came across an application I needed quad precision for (high-accuracy solution of a differential equation). I found a C++ library (odeint) that worked for the integration itself, but unfortunately it appears numpy is not able to work with quad precision arrays. For my

Re: [Numpy-discussion] Efficient way to load a 1Gb file?

2011-08-10 Thread Anne Archibald
There was also some work on a semi-mutable array type that allowed appending along one axis, then 'freezing' to yield a normal numpy array (unfortunately I'm not sure how to find it in the mailing list archives). One could write such a setup by hand, using mmap() or realloc(), but I'd be inclined

Re: [Numpy-discussion] [SciPy-User] recommendation for saving data

2011-08-01 Thread Anne Archibald
In astronomy we tend to use FITS, which is well-supported by pyfits, but a little limited. Some new instruments are beginning to use HDF5. All these generic formats allow very general data storage, so you will need to come up with a standrdized way to represent your own data. Used well, these

Re: [Numpy-discussion] Can I index array starting with 1?

2011-07-28 Thread Anne Archibald
Don't forget the everything-looks-like-a-nail approach: make all your arrays one bigger than you need and ignore element zero. Anne On 7/28/11, Stéfan van der Walt ste...@sun.ac.za wrote: Hi Jeremy On Thu, Jul 28, 2011 at 3:19 PM, Jeremy Conlin jlcon...@gmail.com wrote: I have a need to

Re: [Numpy-discussion] Can I index array starting with 1?

2011-07-28 Thread Anne Archibald
, implementation would be pretty easy - just make a subclass of ndarray that replaces the indexing function. Anne On 28 July 2011 19:26, Derek Homeier de...@astro.physik.uni-goettingen.de wrote: On 29.07.2011, at 1:19AM, Stéfan van der Walt wrote: On Thu, Jul 28, 2011 at 4:10 PM, Anne Archibald

Re: [Numpy-discussion] Quaternion dtype for NumPy - initial implementation available

2011-07-16 Thread Anne Archibald
What a useful package! Apart from helping all the people who know they need quaternions, this package removes one major family of use cases for vectorized small-matrix operations, namely, 3D rotations. Quaternions are the canonical way to represent orientation and rotation in three dimensions, and

Re: [Numpy-discussion] Numeric integration of higher order integrals

2011-06-01 Thread Anne Archibald
When the dimensionality gets high, grid methods like you're describing start to be a problem (the curse of dimensionality). The standard approaches are simple Monte Carlo integration or its refinements (Metropolis-Hasings, for example). These converge somewhat slowly, but are not much affected by

Re: [Numpy-discussion] RFC: Detecting array changes (NumPy 2.0?)

2011-03-11 Thread Anne Archibald
On 11 March 2011 15:34, Charles R Harris charlesr.har...@gmail.com wrote: On Fri, Mar 11, 2011 at 1:06 PM, Dag Sverre Seljebotn d.s.seljeb...@astro.uio.no wrote: On Fri, 11 Mar 2011 19:37:42 + (UTC), Pauli Virtanen p...@iki.fi wrote: On Fri, 11 Mar 2011 11:47:58 -0700, Charles R

Re: [Numpy-discussion] ragged array implimentation

2011-03-07 Thread Anne Archibald
On 7 March 2011 15:29, Christopher Barker chris.bar...@noaa.gov wrote: On 3/7/11 11:18 AM, Francesc Alted wrote: but, instead of returning a numpy array of 'object' elements, plain python lists are returned instead. which gives you the append option -- I can see how that would be usefull.

Re: [Numpy-discussion] sample without replacement

2010-12-21 Thread Anne Archibald
I know this question came up on the mailing list some time ago (19/09/2008), and the conclusion was that yes, you can do it more or less efficiently in pure python; the trick is to use two different methods. If your sample is more than, say, a quarter the size of the set you're drawing from, you

Re: [Numpy-discussion] Solving Ax = b: inverse vs cholesky factorization

2010-11-08 Thread Anne Archibald
On 8 November 2010 14:38, Joon groups.and.li...@gmail.com wrote: Oh I see. So I guess in invA = solve(Ax, I) and then x = dot(invA, b) case, there are more places where numerical errors occur, than just x = solve(Ax, b) case. That's the heart of the matter, but one can be more specific. You

Re: [Numpy-discussion] Stacking a 2d array onto a 3d array

2010-10-28 Thread Anne Archibald
On 26 October 2010 21:02, Dewald Pieterse dewald.piete...@gmail.com wrote: I see my slicing was the problem, np.vstack((test[:1], test)) works perfectly. Yes and no. np.newaxis (or None for short) is a very useful tool; you just stick it in an index expression and it adds an axis of length one

Re: [Numpy-discussion] Assigning complex value to real array

2010-10-07 Thread Anne Archibald
On 7 October 2010 13:01, Pauli Virtanen p...@iki.fi wrote: to, 2010-10-07 kello 12:08 -0400, Andrew P. Mullhaupt kirjoitti: [clip] No. You can define the arrays as backed by mapped files with real and imaginary parts separated. Then the imaginary part, being initially zero, is a sparse part

Re: [Numpy-discussion] Assigning complex value to real array

2010-10-07 Thread Anne Archibald
On 7 October 2010 19:46, Andrew P. Mullhaupt d...@zen-pharaohs.com wrote: It wouldn't be the first time I suggested rewriting the select and choose operations. I spent months trying to get Guido to let anything more than slice indexing in arrays. And now, in the technologically advanced

Re: [Numpy-discussion] A proposed change to rollaxis() behavior for negative 'start' values

2010-09-23 Thread Anne Archibald
On 23 September 2010 02:20, Ralf Gommers ralf.gomm...@googlemail.com wrote: On Wed, Sep 22, 2010 at 4:14 AM, Anne Archibald aarch...@physics.mcgill.ca wrote: Hi Ken, This is a tricky one. The current behaviour of rollaxis is to remove the requested axis from the list of axes

Re: [Numpy-discussion] slicing / indexing question

2010-09-22 Thread Anne Archibald
On 21 September 2010 19:20, Timothy W. Hilton hil...@meteo.psu.edu wrote: I have an 80x1200x1200 nd.array of floats this_par.  I have a 1200x1200 boolean array idx, and an 80-element float array pars.  For each element of idx that is True, I wish to replace the corresponding 80x1x1 slice of

Re: [Numpy-discussion] Indexing and lookup issues

2010-09-22 Thread Anne Archibald
On 22 September 2010 16:38, Ross Williamson rosswilliamson@gmail.com wrote: Hi everyone I suspect this is easy but I'm stuck say I have a 1D array: t = [10,11,12] and a 2D array: id = [[0,1,0] [0,2,0] [2,0,2]] In could in IDL do y = t[id] which would produce: y = [[10,11,10]

Re: [Numpy-discussion] A proposed change to rollaxis() behavior for negative 'start' values

2010-09-21 Thread Anne Archibald
Hi Ken, This is a tricky one. The current behaviour of rollaxis is to remove the requested axis from the list of axes and then insert it before the axis specified. This is exactly how python's list insertion works: In [1]: a = range(10) In [3]: a.insert(-1,'a') In [4]: a Out[4]: [0, 1, 2, 3,

Re: [Numpy-discussion] restrictions on fancy indexing

2010-09-17 Thread Anne Archibald
On 17 September 2010 13:47, Neal Becker ndbeck...@gmail.com wrote: It's nice I can do: f = np.linspace (0, 1, 100) u[f.1] = 0 cool, this seems to work also: u[np.abs(f).1] = 0 cool!  But exactly what kind of expressions are possible here?  Certainly not arbitrary code. The short answer

Re: [Numpy-discussion] indexing with booleans without making a copy?

2010-09-08 Thread Anne Archibald
2010/9/8 Ernest Adrogué eadro...@gmx.net: I have a sorted, flat array: In [139]: a =np.array([0,1,2,2,2,3]) Basically, I want views of the areas where there are repeated numbers (since the array is sorted, they will be contiguous). But, of course, to find the numbers that are repeated I

Re: [Numpy-discussion] IEEE 754-2008 decimal floating point support

2010-09-08 Thread Anne Archibald
On 8 September 2010 16:33, Robert Kern robert.k...@gmail.com wrote: On Wed, Sep 8, 2010 at 15:10, Michael Gilbert michael.s.gilb...@gmail.com wrote: On Wed, 8 Sep 2010 15:04:17 -0500, Robert Kern wrote: On Wed, Sep 8, 2010 at 14:44, Michael Gilbert michael.s.gilb...@gmail.com wrote: Just

Re: [Numpy-discussion] test if two arrays share the same data

2010-09-05 Thread Anne Archibald
2010/9/5 Ernest Adrogué eadro...@gmx.net:  5/09/10 @ 15:59 (-0500), thus spake Robert Kern: 2010/9/5 Ernest Adrogué eadro...@gmx.net:  5/09/10 @ 21:25 (+0200), thus spake Gael Varoquaux: On Sun, Sep 05, 2010 at 09:12:34PM +0200, Ernest Adrogué wrote: Hi, How can it be done?

Re: [Numpy-discussion] Array slices and number of dimensions

2010-09-01 Thread Anne Archibald
On 1 September 2010 17:54, Thomas Robitaille thomas.robitai...@gmail.com wrote: Hi, I'm trying to extract sub-sections of a multidimensional array while keeping the number of dimensions the same. If I just select a specific element along a given direction, then the number of dimensions goes

Re: [Numpy-discussion] inversion of large matrices

2010-08-31 Thread Anne Archibald
Hi Melissa, On 30 August 2010 17:42, Melissa Mendonça meliss...@gmail.com wrote: I've been lurking for a while here but never really introduced myself. I'm a mathematician in Brazil working with optimization and numerical analysis and I'm looking into scipy/numpy basically because I want to

Re: [Numpy-discussion] Boolean arrays

2010-08-27 Thread Anne Archibald
On 27 August 2010 16:17, Robert Kern robert.k...@gmail.com wrote: On Fri, Aug 27, 2010 at 15:10, Ken Watford kwatford+sc...@gmail.com wrote: On Fri, Aug 27, 2010 at 3:58 PM, Brett Olsen brett.ol...@gmail.com wrote: Hello, I have an array of non-numeric data, and I want to create a boolean

Re: [Numpy-discussion] np.asfortranarray: unnecessary copying?

2010-07-30 Thread Anne Archibald
This seems to me to be a bug, or rather, two bugs. 1D arrays are automatically Fortran-ordered, so isfortran should return True for them (incidentally, the documentation should be edited to indicate that the data must also be contiguous in memory). Whether or not this change is made, there's no

Re: [Numpy-discussion] 3 dim array unpacking

2010-07-12 Thread Anne Archibald
On 12 July 2010 13:24, K.-Michael Aye kmichael@gmail.com wrote: Dear numpy hackers, I can't find the syntax for unpacking the 3 dimensions of a rgb array. so i have a MxNx3 image array 'img' and would like to do: red, green, blue = img[magical_slicing] Which slicing magic do I need to

Re: [Numpy-discussion] numpy.load raising IOError but EOFError expected

2010-06-28 Thread Anne Archibald
On 28 June 2010 10:52, Ruben Salvador rsalvador...@gmail.com wrote: Sorry I had no access during these days. Thanks for the answer Friedrich, I had already checked numpy.savez, but unfortunately I cannot make use of it. I don't have all the data needed to be saved at the same time...it is

Re: [Numpy-discussion] Solving a NLLSQ Problem by Pieces?

2010-06-26 Thread Anne Archibald
The basic problem with nonlinear least squares fitting, as with other nonlinear minimization problems, is that the standard algorithms find only a local minimum. It's easy to miss the global minimum and instead settle on a local minimum that is in fact a horrible fit. To deal with this, there are

Re: [Numpy-discussion] Ufunc memory access optimization

2010-06-15 Thread Anne Archibald
Correct me if I'm wrong, but this code still doesn't seem to make the optimization of flattening arrays as much as possible. The array you get out of np.zeros((100,100)) can be iterated over as an array of shape (1,), which should yield very substantial speedups. Since most arrays one operates

Re: [Numpy-discussion] Ufunc memory access optimization

2010-06-15 Thread Anne Archibald
On 15 June 2010 11:16, Pauli Virtanen p...@iki.fi wrote: ti, 2010-06-15 kello 10:10 -0400, Anne Archibald kirjoitti: Correct me if I'm wrong, but this code still doesn't seem to make the optimization of flattening arrays as much as possible. The array you get out of np.zeros((100,100)) can

Re: [Numpy-discussion] NumPy re-factoring project

2010-06-11 Thread Anne Archibald
On 11 June 2010 11:12, Benjamin Root ben.r...@ou.edu wrote: On Fri, Jun 11, 2010 at 8:31 AM, Sturla Molden stu...@molden.no wrote: It would also make sence to evaluate expressions like y = b*x + a without a temporary array for b*x. I know roughly how to do it, but don't have time to look

Re: [Numpy-discussion] numpy.savez does /not/ compress!?

2010-06-08 Thread Anne Archibald
On 8 June 2010 06:11, Pauli Virtanen p...@iki.fi wrote: ti, 2010-06-08 kello 12:03 +0200, Hans Meine kirjoitti: On Tuesday 08 June 2010 11:40:59 Scott Sinclair wrote: The savez docstring should probably be clarified to provide this information. I would prefer to actually offer compression

Re: [Numpy-discussion] C vs. Fortran order -- misleading documentation?

2010-06-08 Thread Anne Archibald
On 8 June 2010 14:16, Eric Firing efir...@hawaii.edu wrote: On 06/08/2010 05:50 AM, Charles R Harris wrote: On Tue, Jun 8, 2010 at 9:39 AM, David Goldsmith d.l.goldsm...@gmail.com mailto:d.l.goldsm...@gmail.com wrote: On Tue, Jun 8, 2010 at 8:27 AM, Pavel Bazant maxpla...@seznam.cz

Re: [Numpy-discussion] C vs. Fortran order -- misleading documentation?

2010-06-08 Thread Anne Archibald
On 8 June 2010 17:17, David Goldsmith d.l.goldsm...@gmail.com wrote: On Tue, Jun 8, 2010 at 1:56 PM, Benjamin Root ben.r...@ou.edu wrote: On Tue, Jun 8, 2010 at 1:36 PM, Eric Firing efir...@hawaii.edu wrote: On 06/08/2010 08:16 AM, Eric Firing wrote: On 06/08/2010 05:50 AM, Charles R Harris

Re: [Numpy-discussion] Dynamic convolution in Numpy

2010-06-06 Thread Anne Archibald
On 6 June 2010 04:44, David Cournapeau courn...@gmail.com wrote: On Thu, Jun 3, 2010 at 7:49 PM, arthur de conihout arthurdeconih...@gmail.com wrote: I don't know if i made myself very clear. if anyone has suggestions or has already operated a dynamic filtering i would be well interested.

Re: [Numpy-discussion] Numerical Recipes (for Python)?

2010-06-04 Thread Anne Archibald
of python, scipy itself is pretty much a library providing what's in NR. Anne On 6/1/2010 9:04 PM, Anne Archibald wrote: On 2 June 2010 00:33, Wayne Watsonsierra_mtnv...@sbcglobal.net  wrote: Subject is a book title from some many years ago, I wonder if it ever got to Python? I know

Re: [Numpy-discussion] Numerical Recipes (for Python)?

2010-06-04 Thread Anne Archibald
need. Python of course. Read the scipy documentation. Anne On 6/3/2010 11:09 PM, Anne Archibald wrote: On 4 June 2010 00:24, Wayne Watsonsierra_mtnv...@sbcglobal.net wrote: The link below leads me to http://numpy.scipy.org/, with or without the whatever. IRAF is not mentioned on the home

Re: [Numpy-discussion] Numerical Recipes (for Python)?

2010-06-01 Thread Anne Archibald
On 2 June 2010 00:33, Wayne Watson sierra_mtnv...@sbcglobal.net wrote: Subject is a book title from some many years ago, I wonder if it ever got to Python? I know there were C and Fortran versions. There is no Numerical Recipes for python. The main reason there isn't a NR for python is that

Re: [Numpy-discussion] ix_ and copies

2010-05-30 Thread Anne Archibald
On 30 May 2010 11:25, Keith Goodman kwgood...@gmail.com wrote: On Sat, May 29, 2010 at 2:49 PM, Anne Archibald aarch...@physics.mcgill.ca wrote: On 29 May 2010 15:09, Robert Kern robert.k...@gmail.com wrote: On Sat, May 29, 2010 at 12:27, Keith Goodman kwgood...@gmail.com wrote: Will making

Re: [Numpy-discussion] ix_ and copies

2010-05-29 Thread Anne Archibald
On 29 May 2010 15:09, Robert Kern robert.k...@gmail.com wrote: On Sat, May 29, 2010 at 12:27, Keith Goodman kwgood...@gmail.com wrote: Will making changes to arr2 never change arr1 if arr2 = arr1[np.ix_(*lists)] where lists is a list of (index) lists? np.ix_ returns a tuple of arrays so I'm

Re: [Numpy-discussion] Finding Star Images on a Photo (Video chip) Plate?

2010-05-28 Thread Anne Archibald
On 28 May 2010 21:09, Charles R Harris charlesr.har...@gmail.com wrote: On Fri, May 28, 2010 at 5:45 PM, Wayne Watson sierra_mtnv...@sbcglobal.net wrote: Suppose I have a 640x480 pixel video chip and would like to find star images on it, possible planets and the moon. A possibility of noise

Re: [Numpy-discussion] curious about how people would feel about moving to github

2010-05-27 Thread Anne Archibald
On 27 May 2010 04:43, Charles R Harris charlesr.har...@gmail.com wrote: Maybe most importantly, distributed revision control places any possible contributor on equal footing with those with commit access; this is one important step in making contributors feel valued. Well, not quite. They

Re: [Numpy-discussion] curious about how people would feel about moving to github

2010-05-26 Thread Anne Archibald
Hi Jarrod, I'm in favour of the switch, though I don't use Windows. I find git far more convenient to use than SVN; I've been using git-svn, and in spite of the headaches it's caused me I still prefer it to raw SVN. It seems to me that git's flexibility in how people collaborate means we can do

Re: [Numpy-discussion] curious about how people would feel about moving to github

2010-05-26 Thread Anne Archibald
On 27 May 2010 01:22, Charles R Harris charlesr.har...@gmail.com wrote: On Wed, May 26, 2010 at 9:49 PM, Jarrod Millman mill...@berkeley.edu wrote: On Wed, May 26, 2010 at 8:08 PM, Matthew Brett matthew.br...@gmail.com wrote: That's the model we've gone for in nipy and ipython too.  We

Re: [Numpy-discussion] curious about how people would feel about moving to github

2010-05-26 Thread Anne Archibald
On 27 May 2010 01:55, Matthew Brett matthew.br...@gmail.com wrote: Hi, Linux has Linus, ipython has Fernando, nipy has... well, I'm sure it is somebody. Numpy and Scipy no longer have a central figure and I like it that way. There is no reason that DVCS has to inevitably lead to a central

Re: [Numpy-discussion] efficient way to manage a set of floats?

2010-05-12 Thread Anne Archibald
On 12 May 2010 20:09, Dr. Phillip M. Feldman pfeld...@verizon.net wrote: Warren Weckesser-3 wrote: A couple questions: How many floats will you be storing? When you test for membership, will you want to allow for a numerical tolerance, so that if the value 1 - 0.7 is added to the set, a

Re: [Numpy-discussion] efficient way to manage a set of floats?

2010-05-10 Thread Anne Archibald
On 10 May 2010 18:53, Dr. Phillip M. Feldman pfeld...@verizon.net wrote: I have an application that involves managing sets of floats.  I can use Python's built-in set type, but a data structure that is optimized for fixed-size objects that can be compared without hashing should be more

Re: [Numpy-discussion] efficient way to manage a set of floats?

2010-05-10 Thread Anne Archibald
On 10 May 2010 21:56, Dr. Phillip M. Feldman pfeld...@verizon.net wrote: Anne Archibald-2 wrote: on a 32-bit machine, the space overhead is roughly a 32-bit object pointer or two for each float, plus about twice the number of floats times 32-bit pointers for the table. Hello Anne, I'm

Re: [Numpy-discussion] Question about numpy.arange()

2010-05-02 Thread Anne Archibald
On 1 May 2010 16:36, Gökhan Sever gokhanse...@gmail.com wrote: Hello, Is b an expected value? I am suspecting another floating point arithmetic issue. I[1]: a = np.arange(1.6, 1.8, 0.1, dtype='float32') I[2]: a O[2]: array([ 1.6002,  1.7005], dtype=float32) I[3]: b =

Re: [Numpy-discussion] proposing a beware of [as]matrix() warning

2010-04-28 Thread Anne Archibald
On 28 April 2010 14:30, Alan G Isaac ais...@american.edu wrote: On 4/28/2010 12:08 PM, Dag Sverre Seljebotn wrote: it would be good to deprecate the matrix class from NumPy Please let us not have this discussion all over again. I think you may be too late on this, but it's worth a try. The

Re: [Numpy-discussion] Aggregate memmap

2010-04-25 Thread Anne Archibald
On 21 April 2010 15:41, Matthew Turk matthewt...@gmail.com wrote: Hi there, I've quite a bit of unformatted fortran data that I'd like to use as input to a memmap, as sort of a staging area for selection of subregions to be loaded into RAM. Unfortunately, what I'm running into is that the

Re: [Numpy-discussion] How to combine a pair of 1D arrays?

2010-04-14 Thread Anne Archibald
On 14 April 2010 11:34, Robert Kern robert.k...@gmail.com wrote: On Wed, Apr 14, 2010 at 10:25, Peter Shinners p...@shinners.org wrote: Is there a way to combine two 1D arrays with the same size into a 2D array? It seems like the internal pointers and strides could be combined. My primary goal

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Anne Archibald
On 14 April 2010 16:56, Keith Goodman kwgood...@gmail.com wrote: On Wed, Apr 14, 2010 at 12:39 PM, Nikolaus Rath nikol...@rath.org wrote: Keith Goodman kwgood...@gmail.com writes: On Wed, Apr 14, 2010 at 8:49 AM, Keith Goodman kwgood...@gmail.com wrote: On Wed, Apr 14, 2010 at 8:16 AM,

Re: [Numpy-discussion] binomial coefficient, factorial

2010-04-14 Thread Anne Archibald
On 14 April 2010 17:37, Christopher Barker chris.bar...@noaa.gov wrote: jah wrote: Is there any chance that a binomial coefficent and factorial function can make their way into NumPy? probably not -- numpy is over-populated already I know these exist in Scipy, but I don't want to have to

Re: [Numpy-discussion] Best dtype for Boolean values

2010-04-12 Thread Anne Archibald
On 12 April 2010 11:59, John Jack itsmilesda...@gmail.com wrote: Hello all. I am (relatively) new to python, and 100% new to numpy. I need a way to store arrays of booleans and compare the arrays for equality. I assume I want arrays of dtype Boolean, and I should compare the arrays with

Re: [Numpy-discussion] Proposal for new ufunc functionality

2010-04-12 Thread Anne Archibald
On 12 April 2010 18:26, Travis Oliphant oliph...@enthought.com wrote: We should collect all of these proposals into a NEP. Or several NEPs, since I think they are quasi-orthogonal.  To clarify what I mean by group-by behavior. Suppose I have an array of floats and an array of integers.  

Re: [Numpy-discussion] Proposal for new ufunc functionality

2010-04-11 Thread Anne Archibald
2010/4/10 Stéfan van der Walt ste...@sun.ac.za: On 10 April 2010 19:45, Pauli Virtanen p...@iki.fi wrote: Another addition to ufuncs that should be though about is specifying the Python-side interface to generalized ufuncs. This is an interesting idea; what do you have in mind? I can see two

Re: [Numpy-discussion] Do ufuncs returned by frompyfunc() have the out arg?

2010-04-06 Thread Anne Archibald
On 6 April 2010 15:42, Ken Basye kbas...@jhu.edu wrote: Folks, I hope this is a simple question. When I created a ufunc with np.frompyfunc(), I got an error when I called the result with an 'out' argument: In fact, ordinary ufuncs do not accept names for their arguments. This is annoying,

Re: [Numpy-discussion] Bug in logaddexp2.reduce

2010-04-01 Thread Anne Archibald
On 1 April 2010 01:59, Charles R Harris charlesr.har...@gmail.com wrote: On Wed, Mar 31, 2010 at 11:46 PM, Anne Archibald peridot.face...@gmail.com wrote: On 1 April 2010 01:40, Charles R Harris charlesr.har...@gmail.com wrote: On Wed, Mar 31, 2010 at 11:25 PM, josef.p...@gmail.com

Re: [Numpy-discussion] Bug in logaddexp2.reduce

2010-04-01 Thread Anne Archibald
On 1 April 2010 02:24, Charles R Harris charlesr.har...@gmail.com wrote: On Thu, Apr 1, 2010 at 12:04 AM, Anne Archibald peridot.face...@gmail.com wrote: On 1 April 2010 01:59, Charles R Harris charlesr.har...@gmail.com wrote: On Wed, Mar 31, 2010 at 11:46 PM, Anne Archibald

Re: [Numpy-discussion] Bug in logaddexp2.reduce

2010-04-01 Thread Anne Archibald
On 1 April 2010 02:49, David Cournapeau da...@silveregg.co.jp wrote: Charles R Harris wrote: On Thu, Apr 1, 2010 at 12:04 AM, Anne Archibald peridot.face...@gmail.comwrote: On 1 April 2010 01:59, Charles R Harris charlesr.har...@gmail.com wrote: On Wed, Mar 31, 2010 at 11:46 PM, Anne

Re: [Numpy-discussion] Bug in logaddexp2.reduce

2010-04-01 Thread Anne Archibald
On 1 April 2010 03:15, David Cournapeau da...@silveregg.co.jp wrote: Anne Archibald wrote: Particularly given the comments in the boost source code, I'm leery of this fix; who knows what an optimizing compiler will do with it? But the current code *is* wrong: it is not true that u == 1

Re: [Numpy-discussion] ufuncs on funny strides; also isnan, isfinite, etc on a variety of dtypes

2010-04-01 Thread Anne Archibald
On 1 April 2010 14:30, M Trumpis mtrum...@berkeley.edu wrote: Hi all, disclaimer: pardon my vast ignorance on the subject of ufuncs, that will explain the naivety of the following questions This morning I was looking at this line of code, which was running quite slow for me and making me

Re: [Numpy-discussion] Bug in logaddexp2.reduce

2010-04-01 Thread Anne Archibald
On 1 April 2010 13:38, Charles R Harris charlesr.har...@gmail.com wrote: On Thu, Apr 1, 2010 at 8:37 AM, Charles R Harris charlesr.har...@gmail.com wrote: On Thu, Apr 1, 2010 at 12:46 AM, Anne Archibald peridot.face...@gmail.com wrote: On 1 April 2010 02:24, Charles R Harris charlesr.har

Re: [Numpy-discussion] Bug in logaddexp2.reduce

2010-03-31 Thread Anne Archibald
On 31 March 2010 16:21, Charles R Harris charlesr.har...@gmail.com wrote: On Wed, Mar 31, 2010 at 11:38 AM, T J tjhn...@gmail.com wrote: On Wed, Mar 31, 2010 at 10:30 AM, T J tjhn...@gmail.com wrote: Hi, I'm getting some strange behavior with logaddexp2.reduce: from itertools import

Re: [Numpy-discussion] Bug in logaddexp2.reduce

2010-03-31 Thread Anne Archibald
On 1 April 2010 01:11, Charles R Harris charlesr.har...@gmail.com wrote: On Wed, Mar 31, 2010 at 11:03 PM, Anne Archibald peridot.face...@gmail.com wrote: On 31 March 2010 16:21, Charles R Harris charlesr.har...@gmail.com wrote: On Wed, Mar 31, 2010 at 11:38 AM, T J tjhn...@gmail.com

Re: [Numpy-discussion] Bug in logaddexp2.reduce

2010-03-31 Thread Anne Archibald
On 1 April 2010 01:40, Charles R Harris charlesr.har...@gmail.com wrote: On Wed, Mar 31, 2010 at 11:25 PM, josef.p...@gmail.com wrote: On Thu, Apr 1, 2010 at 1:22 AM,  josef.p...@gmail.com wrote: On Thu, Apr 1, 2010 at 1:17 AM, Charles R Harris charlesr.har...@gmail.com wrote: On

Re: [Numpy-discussion] Dealing with roundoff error

2010-03-28 Thread Anne Archibald
On 27 March 2010 19:38, Mike Sarahan msara...@gmail.com wrote: Hi all, I have run into some roundoff problems trying to line up some experimental spectra.  The x coordinates are given in intervals of 0.1 units.  I read the data in from a text file using np.loadtxt(). I think Robert's post

Re: [Numpy-discussion] Interpolation question

2010-03-28 Thread Anne Archibald
On 27 March 2010 20:24, Andrea Gavana andrea.gav...@gmail.com wrote: Hi All,    I have an interpolation problem and I am having some difficulties in tackling it. I hope I can explain myself clearly enough. Basically, I have a whole bunch of 3D fluid flow simulations (close to 1000), and

Re: [Numpy-discussion] [OT] Starving CPUs article featured in IEEE's ComputingNow portal

2010-03-22 Thread Anne Archibald
On 22 March 2010 14:42, Pauli Virtanen p...@iki.fi wrote: la, 2010-03-20 kello 17:36 -0400, Anne Archibald kirjoitti: I was in on that discussion. My recollection of the conclusion was that on the one hand they're useful, carefully applied, while on the other hand they're very difficult

Re: [Numpy-discussion] [OT] Starving CPUs article featured in IEEE's ComputingNow portal

2010-03-20 Thread Anne Archibald
On 20 March 2010 06:32, Francesc Alted fal...@pytables.org wrote: A Friday 19 March 2010 18:13:33 Anne Archibald escrigué: [clip] What I didn't go into in detail in the article was that there's a trade-off of processing versus memory access available: we could reduce the memory load

Re: [Numpy-discussion] [OT] Starving CPUs article featured in IEEE's ComputingNow portal

2010-03-20 Thread Anne Archibald
On 20 March 2010 14:56, Dag Sverre Seljebotn da...@student.matnat.uio.no wrote: Pauli Virtanen wrote: Anne Archibald wrote: I'm not knocking numpy; it does (almost) the best it can. (I'm not sure of the optimality of the order in which ufuncs are executed; I think some optimizations

Re: [Numpy-discussion] [OT] Starving CPUs article featured in IEEE's ComputingNow portal

2010-03-20 Thread Anne Archibald
On 20 March 2010 16:18, Sebastian Haase seb.ha...@gmail.com wrote: On Sat, Mar 20, 2010 at 8:22 PM, Anne Archibald peridot.face...@gmail.com wrote: On 20 March 2010 14:56, Dag Sverre Seljebotn da...@student.matnat.uio.no wrote: Pauli Virtanen wrote: Anne Archibald wrote: I'm not knocking

Re: [Numpy-discussion] [OT] Starving CPUs article featured in IEEE's ComputingNow portal

2010-03-19 Thread Anne Archibald
On 18 March 2010 13:53, Francesc Alted fal...@pytables.org wrote: A Thursday 18 March 2010 16:26:09 Anne Archibald escrigué: Speak for your own CPUs :). But seriously, congratulations on the wide publication of the article; it's an important issue we often don't think enough about. I'm just

Re: [Numpy-discussion] [OT] Starving CPUs article featured in IEEE's ComputingNow portal

2010-03-18 Thread Anne Archibald
On 18 March 2010 09:57, Francesc Alted fal...@pytables.org wrote: Hi, Konrad Hinsen has just told me that my article Why Modern CPUs Are Starving and What Can Be Done About It, which has just released on the March/April issue of Computing in Science and Engineering, also made into this

Re: [Numpy-discussion] matrix division without a loop

2010-03-12 Thread Anne Archibald
On 12 March 2010 13:54, gerardo.berbeglia gberbeg...@gmail.com wrote: Hello, I want to divide an n x n (2-dimension) numpy array matrix A by a n (1-dimension) array d as follows: Look up broadcasting in the numpy docs. The short version is this: operations like division act elementwise on

Re: [Numpy-discussion] arange including stop value?

2010-03-11 Thread Anne Archibald
On 11 March 2010 19:30, Tom K. t...@kraussfamily.org wrote: davefallest wrote: ... In [3]: np.arange(1.01, 1.1, 0.01) Out[3]: array([ 1.01,  1.02,  1.03,  1.04,  1.05,  1.06,  1.07,  1.08, 1.09,  1.1 ]) Why does the ... np.arange command end up including my stop value? Don't use arange

Re: [Numpy-discussion] fast duplicate of array

2010-01-23 Thread Anne Archibald
2010/1/23 Alan G Isaac ais...@american.edu: Suppose x and y are conformable 2d arrays. I now want x to become a duplicate of y. I could create a new array: x = y.copy() or I could assign the values of y to x: x[:,:] = y As expected the latter is faster (no array creation). Are there

Re: [Numpy-discussion] fast duplicate of array

2010-01-23 Thread Anne Archibald
2010/1/23 Alan G Isaac ais...@american.edu: On 1/23/2010 5:01 PM, Anne Archibald wrote: If both arrays are C contiguous, or more generally contiguous blocks of memory with the same strided structure, you might get faster copying by flattening them first, so that it can go in a single memcpy

Re: [Numpy-discussion] Efficient orthogonalisation with scipy/numpy

2010-01-19 Thread Anne Archibald
2010/1/19 Gael Varoquaux gael.varoqu...@normalesup.org: For the google-completness of this thread, to get a speed gain, one needs to use the 'econ=True' flag to qr. Be warned that in some installations (in particular some using ATLAS), supplying econ=True can cause a segfault under certain

Re: [Numpy-discussion] Efficient orthogonalisation with scipy/numpy

2010-01-19 Thread Anne Archibald
2010/1/19 Charles R Harris charlesr.har...@gmail.com: Note that if you apply the QR algorithm to a Vandermonde matrix with the columns properly ordered you can get a collection of graded orthogonal polynomials over a given set of points. Or, if you want the polynomials in some other

Re: [Numpy-discussion] LA improvements (was: dot function or dot notation, matrices, arrays?)

2009-12-23 Thread Anne Archibald
2009/12/23 David Goldsmith d.l.goldsm...@gmail.com: Starting a new thread for this. On Tue, Dec 22, 2009 at 7:13 PM, Anne Archibald peridot.face...@gmail.com wrote: I think we have one major lacuna: vectorized linear algebra. If I have to solve a whole whack of four-dimensional linear

Re: [Numpy-discussion] LA improvements (was: dot function or dot notation, matrices, arrays?)

2009-12-23 Thread Anne Archibald
2009/12/23 David Warde-Farley d...@cs.toronto.edu: On 23-Dec-09, at 10:34 AM, Anne Archibald wrote: The key idea would be that the linear algebra dimensions would always be the last one(s); this is fairly easy to arrange with rollaxis when it isn't already true, would tend to reduce copying

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-22 Thread Anne Archibald
2009/12/21 David Goldsmith d.l.goldsm...@gmail.com: On Mon, Dec 21, 2009 at 9:57 AM, Christopher Barker chris.bar...@noaa.gov wrote: Dag Sverre Seljebotn wrote: I recently got motivated to get better linear algebra for Python; wonderful! To me that seems like the ideal way to split up code

  1   2   3   4   5   >