Re: [Numpy-discussion] OpenOpt Suite release 0.45

2013-04-10 Thread Sebastian Berg
On Wed, 2013-04-10 at 11:45 +0200, Sebastian Berg wrote: > On Wed, 2013-04-10 at 11:54 +0300, Dmitrey wrote: > > On 04/10/2013 10:31 AM, Robert Kern wrote: > > > You think comparing tracked bug counts across different projects > > > means anything? That's ador

Re: [Numpy-discussion] OpenOpt Suite release 0.45

2013-04-10 Thread Sebastian Berg
On Wed, 2013-04-10 at 11:45 +0200, Sebastian Berg wrote: > On Wed, 2013-04-10 at 11:54 +0300, Dmitrey wrote: > > On 04/10/2013 10:31 AM, Robert Kern wrote: > > This is all good and nice, but Robert is still right. For dictionaries > to work predictable you need to ensure two

Re: [Numpy-discussion] OpenOpt Suite release 0.45

2013-04-10 Thread Sebastian Berg
On Wed, 2013-04-10 at 11:54 +0300, Dmitrey wrote: > On 04/10/2013 10:31 AM, Robert Kern wrote: > > You think comparing tracked bug counts across different projects > > means anything? That's adorable. I admire your diligence at > > addressing the bugs that you do acknowledge. That was never in > >

Re: [Numpy-discussion] einsum and broadcasting

2013-04-05 Thread Sebastian Berg
On Thu, 2013-04-04 at 16:56 +0300, Jaakko Luttinen wrote: > I don't quite understand how einsum handles broadcasting. I get the > following error, but I don't understand why: > > In [8]: import numpy as np > In [9]: A = np.arange(12).reshape((4,3)) > In [10]: B = np.arange(6).reshape((3,2)) > In [

Re: [Numpy-discussion] Raveling, reshape order keyword unnecessarily confuses index and memory ordering

2013-04-05 Thread Sebastian Berg
Hey On Thu, 2013-04-04 at 14:20 -0700, Matthew Brett wrote: > Hi, > > On Tue, Apr 2, 2013 at 4:32 AM, Nathaniel Smith wrote: > > > Maybe we should go through and rename "order" to something more descriptive > > in each case, so we'd have > > a.reshape(..., index_order="C") > > a.copy(memory

Re: [Numpy-discussion] Raveling, reshape order keyword unnecessarily confuses index and memory ordering

2013-04-04 Thread Sebastian Berg
On Thu, 2013-04-04 at 12:40 -0700, Matthew Brett wrote: > Hi, > > > So - to restate in other words - this : > > np.reshape(a, (3, 4), order='F') > > could reasonably mean one of two orthogonal things > > 1) Retrieve data from the array using first-to-last indexing, return > any memory layout

Re: [Numpy-discussion] try to solve issue #2649 and revisit #473

2013-04-03 Thread Sebastian Berg
On Wed, 2013-04-03 at 16:03 -0400, Alan G Isaac wrote: > On 4/3/2013 3:18 PM, huangkan...@gmail.com wrote: > > A 5*5 matrix multiplies another matrix, we expect answer to be error or a > > 5*? matrix, not a 1*5 matrix. > > > That is what happens. > But you are post"multiplying" a matrix by a one

Re: [Numpy-discussion] Raveling, reshape order keyword unnecessarily confuses index and memory ordering

2013-04-03 Thread Sebastian Berg
On Wed, 2013-04-03 at 08:52 -0700, Chris Barker - NOAA Federal wrote: > On Wed, Apr 3, 2013 at 6:24 AM, Sebastian Berg > wrote: > >> the context where it gets applied. So giving the same strategy two > >> different names is silly; if anything it's the contexts th

Re: [Numpy-discussion] Raveling, reshape order keyword unnecessarily confuses index and memory ordering

2013-04-03 Thread Sebastian Berg
On Tue, 2013-04-02 at 22:52 +0100, Nathaniel Smith wrote: > On Tue, Apr 2, 2013 at 10:21 PM, Matthew Brett > wrote: > >> This is like observing that if I say "go North" then it's ambiguous > >> about whether I want you to drive or walk, and concluding that we need > >> new words for the direction

Re: [Numpy-discussion] Raveling, reshape order keyword unnecessarily confuses index and memory ordering

2013-04-01 Thread Sebastian Berg
On Sun, 2013-03-31 at 14:04 -0700, Matthew Brett wrote: > Hi, > > On Sun, Mar 31, 2013 at 1:43 PM, wrote: > > On Sun, Mar 31, 2013 at 3:54 PM, Matthew Brett > > wrote: > >> Hi, > >> > >> On Sat, Mar 30, 2013 at 10:38 PM, wrote: > >>> On Sun, Mar 31, 2013 at 12:50 AM, Matthew Brett > >>> wr

Re: [Numpy-discussion] Raveling, reshape order keyword unnecessarily confuses index and memory ordering

2013-03-30 Thread Sebastian Berg
On Sat, 2013-03-30 at 12:45 -0700, Matthew Brett wrote: > Hi, > > On Sat, Mar 30, 2013 at 11:55 AM, Sebastian Berg > wrote: > > On Fri, 2013-03-29 at 19:08 -0700, Matthew Brett wrote: > >> Hi, > >> > >> We were teaching today, and found ourselves get

Re: [Numpy-discussion] Raveling, reshape order keyword unnecessarily confuses index and memory ordering

2013-03-30 Thread Sebastian Berg
On Fri, 2013-03-29 at 19:08 -0700, Matthew Brett wrote: > Hi, > > We were teaching today, and found ourselves getting very confused > about ravel and shape in numpy. > > Summary > -- > > There are two separate ideas needed to understand ordering in ravel and > reshape: > > Idea 1):

Re: [Numpy-discussion] NumPy/SciPy participation in GSoC 2013

2013-03-24 Thread Sebastian Berg
On Thu, 2013-03-21 at 22:20 +0100, Ralf Gommers wrote: > Hi all, > > > It is the time of the year for Google Summer of Code applications. If > we want to participate with Numpy and/or Scipy, we need two things: > enough mentors and ideas for projects. If we get those, we'll apply > under the PSF

Re: [Numpy-discussion] how to efficiently select multiple slices from an array?

2013-03-20 Thread Sebastian Berg
Hey, On Wed, 2013-03-20 at 16:31 +0100, Andreas Hilboll wrote: > Cross-posting a question I asked on SO > (http://stackoverflow.com/q/15527666/152439): > > > Given an array > > d = np.random.randn(100) > > and an index array > > i = np.random.random_integers(low=3, high=d.size - 5, si

Re: [Numpy-discussion] Compile time flag for numpy

2013-03-09 Thread Sebastian Berg
On Sat, 2013-03-09 at 17:17 +0100, Sebastian Berg wrote: > Hey, > > how would I go about making a compile time flag for numpy to use as a > macro? > To be clear I mean an environment variable. > The reason is: https://github.com/numpy/numpy/pull/2735 > > so that

[Numpy-discussion] Compile time flag for numpy

2013-03-09 Thread Sebastian Berg
Hey, how would I go about making a compile time flag for numpy to use as a macro? The reason is: https://github.com/numpy/numpy/pull/2735 so that it would be possible to compile numpy differently for debugging if software depending on numpy is broken by this change. Regards, Sebastian ___

Re: [Numpy-discussion] aligned / unaligned structured dtype behavior (was: GSOC 2013)

2013-03-06 Thread Sebastian Berg
On Wed, 2013-03-06 at 12:42 -0600, Kurt Smith wrote: > On Wed, Mar 6, 2013 at 12:12 PM, Kurt Smith wrote: > > On Wed, Mar 6, 2013 at 4:29 AM, Francesc Alted > > wrote: > >> > >> I would not run too much. The example above takes 9 bytes to host the > >> structure, while a `aligned=True` will tak

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Sebastian Berg
On Fri, 2013-03-01 at 10:49 -0500, Alan G Isaac wrote: > One motivation of this thread was that > adding a step parameter to linspace might make > things easier for beginners. > > I claim this thread has put the lie to that, > starting with the initial post. So what is the > persuasive case for t

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Sebastian Berg
On Fri, 2013-03-01 at 15:07 +, Henry Gomersall wrote: > On Fri, 2013-03-01 at 10:01 -0500, Alan G Isaac wrote: > > On 3/1/2013 9:32 AM, Henry Gomersall wrote: > > > there should be an equivalent for floats that > > > unambiguously returns a range for the half open interval > > > > > > If I've

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Sebastian Berg
On Fri, 2013-03-01 at 13:34 +, Nathaniel Smith wrote: > On Fri, Mar 1, 2013 at 12:33 PM, Henry Gomersall wrote: > > On Fri, 2013-03-01 at 13:25 +0100, Sebastian Berg wrote: > >> there has been a request on the issue tracker for a step parameter to > >> linspace. Th

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Sebastian Berg
On Fri, 2013-03-01 at 13:44 +0100, Sebastian Berg wrote: > On Fri, 2013-03-01 at 12:33 +, Henry Gomersall wrote: > > On Fri, 2013-03-01 at 13:25 +0100, Sebastian Berg wrote: > > > there has been a request on the issue tracker for a step parameter to > > > linspac

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Sebastian Berg
On Fri, 2013-03-01 at 12:33 +, Henry Gomersall wrote: > On Fri, 2013-03-01 at 13:25 +0100, Sebastian Berg wrote: > > there has been a request on the issue tracker for a step parameter to > > linspace. This is of course tricky with the imprecision of floating > > point numb

[Numpy-discussion] step paramter for linspace

2013-03-01 Thread Sebastian Berg
Hi, there has been a request on the issue tracker for a step parameter to linspace. This is of course tricky with the imprecision of floating point numbers. As a trade off, I was thinking of a step parameter that is used to calculate the integer number of steps. However to be certain that it neve

Re: [Numpy-discussion] Array indexing and repeated indices

2013-03-01 Thread Sebastian Berg
On Fri, 2013-03-01 at 08:30 +0100, Nicolas Rougier wrote: > Hi, > > I'm trying to increment an array using indexing and a second array for > increment values (since it might be a little tedious to explain, see below > for a short example). > > Using "direct" indexing, the values in the example

Re: [Numpy-discussion] Adding .abs() method to the array object

2013-02-26 Thread Sebastian Berg
On Tue, 2013-02-26 at 11:16 +0100, Todd wrote: > On Tue, Feb 26, 2013 at 10:58 AM, Sebastian Berg > wrote: > On Mon, 2013-02-25 at 22:04 -0500, josef.p...@gmail.com wrote: > > On Mon, Feb 25, 2013 at 9:58 PM, > wrote: > > > On M

Re: [Numpy-discussion] What should np.ndarray.__contains__ do

2013-02-26 Thread Sebastian Berg
On Mon, 2013-02-25 at 16:33 +, Nathaniel Smith wrote: > On Mon, Feb 25, 2013 at 3:10 PM, Sebastian Berg > wrote: > > Hello all, > > > > currently the `__contains__` method or the `in` operator on arrays, does > > not return what the user would expect when in the

Re: [Numpy-discussion] Adding .abs() method to the array object

2013-02-26 Thread Sebastian Berg
On Mon, 2013-02-25 at 22:04 -0500, josef.p...@gmail.com wrote: > On Mon, Feb 25, 2013 at 9:58 PM, wrote: > > On Mon, Feb 25, 2013 at 9:20 PM, Sebastian Berg > > wrote: > >> On Mon, 2013-02-25 at 10:50 -0500, Skipper Seabold wrote: > >>> On Mon, Feb 2

Re: [Numpy-discussion] Adding .abs() method to the array object

2013-02-25 Thread Sebastian Berg
On Mon, 2013-02-25 at 10:50 -0500, Skipper Seabold wrote: > On Mon, Feb 25, 2013 at 10:43 AM, Till Stensitzki > wrote: > > > > First, sorry that i didnt search for an old thread, but because i > disagree with > > conclusion i would at least address my reason: > > > >> I don't like > >> np.abs(arr)

Re: [Numpy-discussion] What should np.ndarray.__contains__ do

2013-02-25 Thread Sebastian Berg
e true. I am not sure if this kind of matching should be part of the in operator or not, though on the other hand it would only do something reasonable when otherwise an error would be thrown and it definitely is useful and compatible to what anyone else might expect. > On Feb 25, 2013 5:34 PM, &quo

Re: [Numpy-discussion] What should np.ndarray.__contains__ do

2013-02-25 Thread Sebastian Berg
On Mon, 2013-02-25 at 16:33 +, Nathaniel Smith wrote: > On Mon, Feb 25, 2013 at 3:10 PM, Sebastian Berg > wrote: > > Hello all, > > > > currently the `__contains__` method or the `in` operator on arrays, does > > not return what the user would expect when in the

[Numpy-discussion] What should np.ndarray.__contains__ do

2013-02-25 Thread Sebastian Berg
Hello all, currently the `__contains__` method or the `in` operator on arrays, does not return what the user would expect when in the operation `a in b` the `a` is not a single element (see "In [3]-[4]" below). The first solution coming to mind might be checking `all()` for all dimensions given i

Re: [Numpy-discussion] Array accumulation in numpy

2013-02-19 Thread Sebastian Berg
On Tue, 2013-02-19 at 10:00 -0500, Tony Ladd wrote: > I want to accumulate elements of a vector (x) to an array (f) based on > an index list (ind). > > For example: > > x=[1,2,3,4,5,6] > ind=[1,3,9,3,4,1] > f=np.zeros(10) > > What I want would be produced by the loop > > for i=range(6): >

Re: [Numpy-discussion] np.percentile docstring

2013-02-17 Thread Sebastian Berg
Hey, On Sun, 2013-02-17 at 11:50 +0100, Andreas Hilboll wrote: > In my numpy 1.6.1 (from Ubuntu 12.04LTS repository), the docstring of > np.percentile is wrong. I'm not just submitting a PR because I don't > understand something. > > in the "Notes" and "Examples" sections, there seems to be some

Re: [Numpy-discussion] Where's that function?

2013-02-06 Thread Sebastian Berg
On Wed, 2013-02-06 at 13:08 -0500, josef.p...@gmail.com wrote: > I'm convinced that I saw a while ago a function that uses a list of > interval boundaries to index into an array, either to iterate or to > take. > I thought that's very useful, but didn't make a note. > > Now, I have no idea where I

Re: [Numpy-discussion] Building numpy for python3.3: No _numpyconfig.h

2013-02-06 Thread Sebastian Berg
On Wed, 2013-02-06 at 13:31 +, gk230-free...@yahoo.de wrote: > Hi, > > I'm currently trying to build numpy 1.6.2 for python python 3.3 from ports on > FreeBSD. Unfortunately, the setup.py execution fails because some [1] gcc > command trying to access _numpyconfig.h fails since _numpyconfig.

Re: [Numpy-discussion] Issues to fix for 1.7.0rc2.

2013-02-06 Thread Sebastian Berg
On Wed, 2013-02-06 at 10:18 +0100, Dag Sverre Seljebotn wrote: > On 02/06/2013 08:41 AM, Charles R Harris wrote: > > > > > > On Tue, Feb 5, 2013 at 11:50 PM, Jason Grout > > mailto:jason-s...@creativetrax.com>> wrote: > > > > On 2/6/13 12:46 AM, Charles R Harris wrote: > > > if we decide t

Re: [Numpy-discussion] Subclassing ndarray with concatenate

2013-01-30 Thread Sebastian Berg
On Wed, 2013-01-30 at 10:24 +0100, Todd wrote: > On Tue, Jan 22, 2013 at 1:44 PM, Sebastian Berg > wrote: > Hey, > > On Tue, 2013-01-22 at 10:21 +0100, Todd wrote: > > > > The main exception I have found is concat

Re: [Numpy-discussion] numpythonically getting elements with the minimum sum

2013-01-29 Thread Sebastian Berg
On Tue, 2013-01-29 at 14:53 +0100, Lluís wrote: > Gregor Thalhammer writes: > > > Am 28.1.2013 um 23:15 schrieb Lluís: > > >> Hi, > >> > >> I have a somewhat convoluted N-dimensional array that contains information > >> of a > >> set of experiments. > >> > >> The last dimension has as many ent

Re: [Numpy-discussion] Subclassing ndarray with concatenate

2013-01-22 Thread Sebastian Berg
On Tue, 2013-01-22 at 13:44 +0100, Sebastian Berg wrote: > Hey, > > On Tue, 2013-01-22 at 10:21 +0100, Todd wrote: > > I am trying to create a subclass of ndarray that has additional > > attributes. These attributes are maintained with most numpy functions > > if

Re: [Numpy-discussion] Subclassing ndarray with concatenate

2013-01-22 Thread Sebastian Berg
Hey, On Tue, 2013-01-22 at 10:21 +0100, Todd wrote: > I am trying to create a subclass of ndarray that has additional > attributes. These attributes are maintained with most numpy functions > if __array_finalize__ is used. > You can cover a bit more if you also implement `__array_wrap__`, thou

Re: [Numpy-discussion] return index of maximum value in an array easily?

2013-01-11 Thread Sebastian Berg
On Sat, 2013-01-12 at 00:26 +0100, Chao YUE wrote: > Hi, > > I don't know how others think about this. Like you point out, one can > use > np.nonzero(a==np.max(a)) as a workaround. > > For the second point, in case I have an array: > a = np.arange(24.).reshape(2,3,4) > > suppose I want to find

Re: [Numpy-discussion] int and long issues

2013-01-10 Thread Sebastian Berg
On Thu, 2013-01-10 at 11:32 +0100, Mads Ipsen wrote: > Hi, > > I find this to be a little strange: > > x = numpy.arange(10) > isinstance(x[0],int) > > gives True > > y = numpy.where(x < 5)[0] > isinstance(y[0],int) > > gives False > > isinstance(y[0],long) > Check what t

Re: [Numpy-discussion] int and long issues

2013-01-10 Thread Sebastian Berg
On Thu, 2013-01-10 at 11:32 +0100, Mads Ipsen wrote: > Hi, > > I find this to be a little strange: > > x = numpy.arange(10) > isinstance(x[0],int) > > gives True > > y = numpy.where(x < 5)[0] > isinstance(y[0],int) > > gives False > > isinstance(y[0],long) > Check what t

Re: [Numpy-discussion] Do we want scalar casting to behave as it does at the moment?

2013-01-08 Thread Sebastian Berg
On Tue, 2013-01-08 at 19:59 +, Nathaniel Smith wrote: > On 8 Jan 2013 17:24, "Andrew Collette" wrote: > > > > Hi, > > > > > I think you are voting strongly for the current casting rules, because > > > they make it less obvious to the user that scalars are different from > > > arrays. > > > > M

Re: [Numpy-discussion] high dimensional array -> python scalar/index

2013-01-06 Thread Sebastian Berg
On Sun, 2013-01-06 at 13:28 -0500, josef.p...@gmail.com wrote: > On Sun, Jan 6, 2013 at 12:57 PM, Sebastian Berg > wrote: > > Question for everyone, is this really reasonable: > > > >>>> import numpy as np > >>>> from operator import index > &g

[Numpy-discussion] high dimensional array -> python scalar/index

2013-01-06 Thread Sebastian Berg
Question for everyone, is this really reasonable: >>> import numpy as np >>> from operator import index >>> index(np.array([[5]])) 5 >>> int(np.array([[5]])) 5 >>> [0,1,2,3][np.array([[2]])] 2 To me, this does not make sense, why should we allow to use a high dimensional object like a normal scal

Re: [Numpy-discussion] Rank-0 arrays - reprise

2013-01-06 Thread Sebastian Berg
On Sun, 2013-01-06 at 08:58 +0100, Dag Sverre Seljebotn wrote: > On 01/05/2013 10:31 PM, Nathaniel Smith wrote: > > On 5 Jan 2013 12:16, "Matthew Brett" wrote: > >> > >> Hi, > >> > >> Following on from Nathaniel's explorations of the scalar - array > >> casting rules, some resources on rank-0 arra

Re: [Numpy-discussion] Howto bisect old commits correctly

2013-01-04 Thread Sebastian Berg
On Sat, 2013-01-05 at 00:17 +0100, Sebastian Berg wrote: > Hey, > > this is probably just because I do not have any experience with bisect > and the like, but when I try running a bisect keep running into: > Nevermind that. Probably I just stumbled on some bad versions...

[Numpy-discussion] Howto bisect old commits correctly

2013-01-04 Thread Sebastian Berg
Hey, this is probably just because I do not have any experience with bisect and the like, but when I try running a bisect keep running into: ImportError: /home/sebastian/.../lib/python2.7/site-packages/numpy/core/multiarray.so: undefined symbol: PyDataMem_NEW or: RuntimeError: module compiled a

Re: [Numpy-discussion] non-integer index misfeature?

2012-12-12 Thread Sebastian Berg
On Wed, 2012-12-12 at 20:48 +, Nathaniel Smith wrote: > On Wed, Dec 12, 2012 at 8:20 PM, Ralf Gommers wrote: > > > > On Tue, Dec 11, 2012 at 5:44 PM, Neal Becker wrote: > >> > >> I think it's a misfeature that a floating point is silently accepted as an > >> index. I would prefer a warning f

[Numpy-discussion] Numpy's definition of contiguous arrays

2012-12-04 Thread Sebastian Berg
Hi, maybe someone has an opinion about how this can be handled and was not yet aware of this. In current numpy master (probably being reverted), the definition for contiguous arrays is changed such that it means "Contiguous in memory" and nothing more. What this means is this: 1. An array of siz

[Numpy-discussion] Allowing 0-d arrays in np.take

2012-12-04 Thread Sebastian Berg
Hey, Maybe someone has an opinion about this (since in fact it is new behavior, so it is undefined). `np.take` used to not allow 0-d/scalar input but did allow any other dimensions for the indices. Thinking about changing this, meaning that: np.take(np.arange(5), 0) works. I was wondering if an

Re: [Numpy-discussion] result shape from dot for 0d, 1d, 2d scalar

2012-11-28 Thread Sebastian Berg
On Wed, 2012-11-28 at 11:11 -0500, Skipper Seabold wrote: > On Tue, Nov 27, 2012 at 11:16 AM, Sebastian Berg > wrote: > On Mon, 2012-11-26 at 13:54 -0500, Skipper Seabold wrote: > > I discovered this because scipy.optimize.fmin_powell appears > to >

Re: [Numpy-discussion] result shape from dot for 0d, 1d, 2d scalar

2012-11-27 Thread Sebastian Berg
On Mon, 2012-11-26 at 13:54 -0500, Skipper Seabold wrote: > I discovered this because scipy.optimize.fmin_powell appears to > squeeze 1d argmin to 0d unlike the other optimizers, but that's a > different story. > > > I would expect the 0d array to behave like the 1d array not the 2d as > it does

Re: [Numpy-discussion] When are 0-d arrays writeable?

2012-11-23 Thread Sebastian Berg
On Fri, 2012-11-23 at 10:49 +, Nathaniel Smith wrote: > On 23 Nov 2012 03:34, "Charles R Harris" > wrote: > > > > Examples, > > > > In [13]: ones(()).flags.writeable > > Out[13]: True > > > > In [14]: (-ones(())).flags.writeable > > Out[14]: False > > > > In [15]: (-1*ones(())).flags.writeable

Re: [Numpy-discussion] the mean, var, std of empty arrays

2012-11-22 Thread Sebastian Berg
On Thu, 2012-11-22 at 16:05 +0100, Daπid wrote: > On Thu, Nov 22, 2012 at 3:54 PM, wrote: > > Why don't operations on empty arrays not return empty arrays? > > Because functions like mean or std are expected to return a scalar. > Functions that are piecewiese can (and should) return an empty arr

Re: [Numpy-discussion] the mean, var, std of empty arrays

2012-11-22 Thread Sebastian Berg
On Wed, 2012-11-21 at 22:58 -0500, josef.p...@gmail.com wrote: > On Wed, Nov 21, 2012 at 10:35 PM, Charles R Harris > wrote: > > > > > > On Wed, Nov 21, 2012 at 7:45 PM, wrote: > >> > >> On Wed, Nov 21, 2012 at 9:22 PM, Olivier Delalleau wrote: > >> > Current behavior looks sensible to me. I per

Re: [Numpy-discussion] Crash using "reshape"...

2012-11-21 Thread Sebastian Berg
Hey, On Wed, 2012-11-21 at 01:12 -0800, Terry J. Ligocki wrote: > I am having a problem with "reshape" crashing: > > python > Python 2.6.4 (r264:75706, Jan 16 2010, 21:11:47) > [GCC 4.3.2] on linux2 > Type "help", "copyright", "credits" or "license" for more >

Re: [Numpy-discussion] fix random.choice for 1.7?

2012-11-13 Thread Sebastian Berg
On Mon, 2012-11-12 at 22:44 -0500, Alan G Isaac wrote: > On 11/12/2012 8:18 PM, Sebastian Berg wrote: > > I have created a pull request > > > This is still a bit different than I thought you intended. > With `size=None` we don't get an element, > but rather a 0

Re: [Numpy-discussion] fix random.choice for 1.7?

2012-11-12 Thread Sebastian Berg
On Mon, 2012-11-12 at 18:36 -0500, Alan G Isaac wrote: > On 11/12/2012 5:46 PM, Nathaniel Smith wrote: > > Want to make a pull request? > > > Well, I'd be happy to help Sebastien to change the > code, but I'm not a git user. > I have created a pull request, but tests are still needed... If you

Re: [Numpy-discussion] fix random.choice for 1.7?

2012-11-12 Thread Sebastian Berg
On Mon, 2012-11-12 at 17:52 +0100, Nathaniel Smith wrote: > On Mon, Nov 12, 2012 at 5:31 PM, Alan G Isaac wrote: > > In a comment on the issue https://github.com/numpy/numpy/issues/2724 > > Sebastian notes: > > "it could also be reasonable to have size=None as default and have it > > return a sc

Re: [Numpy-discussion] fix random.choice for 1.7?

2012-11-12 Thread Sebastian Berg
Hey, On Mon, 2012-11-12 at 08:48 -0500, Alan G Isaac wrote: > On 11/9/2012 12:21 PM, Nathaniel Smith wrote: > > you might want to double-check that the > > np.random.choice in 1.7 actually*does* give an error if the input > > array is not 1-d > > > Any idea where I can look at the code? > I bro

Re: [Numpy-discussion] Scipy dot

2012-11-09 Thread Sebastian Berg
On Fri, 2012-11-09 at 14:52 -0800, Nicolas SCHEFFER wrote: > Ok: comparing apples to apples. I'm clueless on my observations and > would need input from you guys. > > Using ATLAS 3.10, numpy with and without my changes, I'm getting these > timings and comparisons. > > # > #I. Generate matrices us

Re: [Numpy-discussion] Scipy dot

2012-11-08 Thread Sebastian Berg
On Fri, 2012-11-09 at 00:24 +0100, Sebastian Berg wrote: > Hey, > > On Thu, 2012-11-08 at 14:44 -0800, Nicolas SCHEFFER wrote: > > Well, hinted by what Fabien said, I looked at the C level dot function. > > Quite verbose! > > > > But starting line 757, we can

Re: [Numpy-discussion] Scipy dot

2012-11-08 Thread Sebastian Berg
Hey, On Thu, 2012-11-08 at 14:44 -0800, Nicolas SCHEFFER wrote: > Well, hinted by what Fabien said, I looked at the C level dot function. > Quite verbose! > > But starting line 757, we can see that it shouldn't be too much work > to fix that bug (well there is even a comment there that states jus

Re: [Numpy-discussion] using numpy.argmax to index into another array

2012-10-31 Thread Sebastian Berg
On Thu, 2012-11-01 at 01:30 +0100, Sebastian Berg wrote: > Hey, > > On Wed, 2012-10-31 at 20:22 -0400, David Warde-Farley wrote: > > On Wed, Oct 31, 2012 at 7:23 PM, Moroney, Catherine M (388D) > > wrote: > > > Hello Everybody, > > > > > > I have

Re: [Numpy-discussion] using numpy.argmax to index into another array

2012-10-31 Thread Sebastian Berg
Hey, On Wed, 2012-10-31 at 20:22 -0400, David Warde-Farley wrote: > On Wed, Oct 31, 2012 at 7:23 PM, Moroney, Catherine M (388D) > wrote: > > Hello Everybody, > > > > I have the following problem that I would be interested in finding an > > easy/elegant solution to. > > I've got it working, but

Re: [Numpy-discussion] Regression in mpl: AttributeError: incompatible shape for a non-contiguous array

2012-10-29 Thread Sebastian Berg
6dfdc408f0a1e59ef54ac490cccbd6b8d73 > Author: Sebastian Berg > Date: Sun Oct 21 18:50:28 2012 +0200 > > > API: Change Flags Updateing to allow C-/F-contiguous arrays > > This changes UpdateFlags to ignore 1-dimensional axis when &

Re: [Numpy-discussion] Regression in mpl: AttributeError: incompatible shape for a non-contiguous array

2012-10-29 Thread Sebastian Berg
Hey, On Mon, 2012-10-29 at 09:54 -0400, Benjamin Root wrote: > This error started showing up in the test suite for mpl when using > numpy master. > > AttributeError: incompatible shape for a non-contiguous array > > The tracebacks all point back to various code points where we are > trying to se

Re: [Numpy-discussion] copy/deepcopy pull request, Travis build failure

2012-10-26 Thread Sebastian Berg
Hey On Thu, 2012-10-25 at 19:27 -0600, Charles R Harris wrote: > Hi Sebastian, > > > You seem to becoming more involved in the code maintenance. Would you > be interested in gaining commit rights at some point? > Maybe, but honestly I am not sure if I will keep following numpy very closely in

Re: [Numpy-discussion] copy/deepcopy pull request, Travis build failure

2012-10-25 Thread Sebastian Berg
On Thu, 2012-10-25 at 17:48 -0400, David Warde-Farley wrote: > I submitted a pull request and one of the Travis builds is failing: > > https://travis-ci.org/#!/numpy/numpy/jobs/2933551 > Don't worry about that failure on Travis... It happens randomly on at the moment and its unrelated to anyt

Re: [Numpy-discussion] Fwd: [numpy] ENH: Initial implementation of a 'neighbor' calculation (#303)

2012-10-11 Thread Sebastian Berg
On Wed, 2012-10-10 at 12:55 -0400, Cera, Tim wrote: > On Wed, Oct 10, 2012 at 1:58 AM, Travis E. > Oliphant wrote: > I'm not sure what to make of no comments on this PR. This > seems like a useful addition. @timcera are you still > interested in having this PR merged? >

Re: [Numpy-discussion] ANN: NumPy 1.7.0b2 release

2012-10-01 Thread Sebastian Berg
On Mon, 2012-10-01 at 10:59 -0600, Charles R Harris wrote: > > > On Mon, Oct 1, 2012 at 10:09 AM, Sebastian Berg > wrote: > Hey, > > About the imaginary part being ignored for all/any function... > > > >

Re: [Numpy-discussion] ANN: NumPy 1.7.0b2 release

2012-10-01 Thread Sebastian Berg
Hey, About the imaginary part being ignored for all/any function... > The all method fails also. > > In [1]: a = zeros(5, complex) > > In [2]: a.imag = 1 > > In [3]: a.all() > Out[3]: False > > Chuck > I believe this diff fixes the issue (also posted on Tracker), I doubt its the best way

Re: [Numpy-discussion] np.array execution path

2012-09-23 Thread Sebastian Berg
On Sun, 2012-09-23 at 18:54 +0100, Nathaniel Smith wrote: > On Sat, Sep 22, 2012 at 10:24 PM, Sebastian Berg > wrote: > > In case you are interested, the second (real odditiy), is caused by > > ISFORTRAN and IS_F_CONTIGUOUS mixup, I have found three occurances where > >

Re: [Numpy-discussion] np.array execution path

2012-09-23 Thread Sebastian Berg
On Sat, 2012-09-22 at 13:12 -0500, Travis Oliphant wrote: > Check to see if this expression is true > > no is o > > In the first case no and o are the same object > > > Travis > > -- > Travis Oliphant > (on a mobile) > 512-826-7480 > > > On Se

Re: [Numpy-discussion] np.array execution path

2012-09-22 Thread Sebastian Berg
Travis > > -- > Travis Oliphant > (on a mobile) > 512-826-7480 > > > On Sep 22, 2012, at 1:01 PM, Sebastian Berg > wrote: > > > Hi, > > > > I have a bit of trouble figuring this out. I would have expected > > np.asarray(array) to go thr

[Numpy-discussion] np.array execution path

2012-09-22 Thread Sebastian Berg
Hi, I have a bit of trouble figuring this out. I would have expected np.asarray(array) to go through ctors, PyArray_NewFromArray, but it seems to me it does not, so which execution path is exactly taken here? The reason I am asking is that I want to figure out this behavior/bug, and I really am no

[Numpy-discussion] Ignore axes with dimension==1 for contiguous flags

2012-09-22 Thread Sebastian Berg
Hey, Numpy currently assumes that if "ndim > 1" then it is impossible for any array to be both C- and F-contiguous, however an axes of dimension 1 does have no effect on the memory layout. I think I have made most important changes (actually really very few), though I bet some parts of numpy still

Re: [Numpy-discussion] ZeroRank memmap behavior?

2012-09-21 Thread Sebastian Berg
Hey, this is indirectly related (I think it might fix many of these memmap oddities though?)... Why does the memmap object not implement: def __array_wrap__(self, obj): if self is obj: return obj return np.array(obj, copy=False, subok=False) By doing so if we hav

[Numpy-discussion] np.delete fix

2012-09-20 Thread Sebastian Berg
Hey, I have written a small PR, to fix np.delete, since it would change the behavior a little (to the better IMO) I think I should also write to the list? So here is the problem with np.delete: 1. When using slices with negative strides, it does not work (best case) or give even wrong results. 2.

Re: [Numpy-discussion] numpy.ma.MaskedArray.min() makes a copy?

2012-09-18 Thread Sebastian Berg
On Tue, 2012-09-18 at 08:42 -1000, Eric Firing wrote: > On 2012/09/18 7:40 AM, Benjamin Root wrote: > > > > > > On Fri, Sep 7, 2012 at 12:05 PM, Nathaniel Smith > > wrote: > > > > On 7 Sep 2012 14:38, "Benjamin Root" > > wrote: > > > > >

Re: [Numpy-discussion] how is y += x computed when y.strides = (0, 8) and x.strides=(16, 8) ?

2012-09-05 Thread Sebastian Berg
Hey, No idea if this is simply not support or just a bug, though I am guessing that such usage simply is not planned. However, this also has to do with buffering, so unless the behaviour is substantially changed, I would not expect even predictable results. I have used things like a[1:] += a[:-1]

Re: [Numpy-discussion] Difference between np.loadtxt depending on whether you supply a file object or a filename

2012-08-20 Thread Sebastian Berg
Hello, On Mo, 2012-08-20 at 20:55 +1000, Andrew Nelson wrote: > Dear list, > I observe a difference when I try to load a 2D numpy array from a file > object compared to if I supply a filename viz: > > > >>> np.version.version > '1.5.1' > >>> f=open('fit_theoretical.txt') > >>> a=np.loadtxt(f) >

[Numpy-discussion] Functions for stride manipulations

2012-08-19 Thread Sebastian Berg
Hey, Inspired by an existing PR into numpy, I created two functions based on stride_tricks which I thought might be useful inside numpy. So if I get any feedback/pointers, I would add some tests and create a PR. The first function rolling_window is to create for every point of the original array,

Re: [Numpy-discussion] Multidimensional neighbours

2012-08-16 Thread Sebastian Berg
Hello, Just to throw it in, if you do not mind useing scipy, you can use its multidimensional correlate method instead: stamp = np.ones((3,3,3)) stamp[1,1,1] = 0 num_neighbours = scipy.ndimage.correlate(x, stamp, mode='wrap')) In the link np.roll is used to implement periodic boundaries (mode='w

Re: [Numpy-discussion] Bug in as_strided/reshape

2012-08-09 Thread Sebastian Berg
>[5], >[5], >[5], >[5], >[5], >[5], >[5], >[5]]) > > In [32]: y.reshape([5, 2]) > Out[32]: > array([[5, 5], >[5, 5], >[5, 5], >[5, 5], > [5, 5]]) > > I

Re: [Numpy-discussion] Data cube optimization for combination

2012-03-06 Thread Sebastian Berg
Hello, On Tue, 2012-03-06 at 13:00 +0100, Jose Miguel Ibáñez wrote: > Hello everyone, > > does anyone know of an efficient implementation (maybe using > numpy.where statement) of the next code for data cube (3d array) > combining ? > You use the axis keyword/argument to sum, at which point you w

Re: [Numpy-discussion] Trick for fast

2012-02-03 Thread Sebastian Berg
I guess Einsum is much cleaner, but I already had started with this and maybe someone likes it, this is fully vectorized and uses a bit of funny stuff too: # The dot product(s), written using broadcasting rules: a = -(x.reshape(-1,1,3) * x[...,None]) # Magic, to avoid the eye thing, takes all dia

Re: [Numpy-discussion] SVD does not converge

2011-06-28 Thread Sebastian Berg
Hi, On Tue, 2011-06-28 at 10:56 -0500, santhu kumar wrote: > Hello, > > I have a 380X5 matrix and when I am calculating pseudo-inverse of the > matrix using pinv(numpy.linalg) I get the following error message: > > raise LinAlgError, 'SVD did not converge' > numpy.linalg.linalg.LinAlgError: SVD

Re: [Numpy-discussion] Vectorize or rewrite function to work with array inputs?

2011-01-31 Thread Sebastian Berg
Hello, On Mon, 2011-01-31 at 10:15 -0500, dpar...@chromalloy.com wrote: > I have several functions like the example below that I would like to > make compatible with array inputs. The problem is the conditional > statements give a ValueError: The truth value of an array with more > than one elemen

Re: [Numpy-discussion] speed of numpy.ndarray compared to Numeric.array

2011-01-10 Thread Sebastian Berg
Hey, On Mon, 2011-01-10 at 08:09 +, EMMEL Thomas wrote: > #~ > def bruteForceSearch(points, point): > > minpt = min([(vec2Norm(pt, point), pt, i) > for i, pt in enumerate(points)], key=itemgetter(0))

Re: [Numpy-discussion] min bug

2009-11-16 Thread Sebastian Berg
Known issue, I think someone posted about it a while ago too. The numpy min is array aware, and it expects an array. The second argument is the axis, which in the case of a single number doesn't matter. On Tue, 2009-11-17 at 07:07 +, Chris wrote: > I'm pretty sure this shouldn't happen: > > I

<    1   2   3   4   5