Re: [Numpy-discussion] Numpy Development Queries

2017-02-22 Thread Matthew Harrigan
Ashwin, I don't know your background but perhaps it is similar to mine. I use numpy extensively in my day job and starting contributing to numpy a few months ago. From using numpy, I found some things that I thought should be added/improved. I researched them and the associated numpy code

Re: [Numpy-discussion] Fortran order in recarray.

2017-02-22 Thread Matthew Harrigan
Alex, Can you please post some code showing exactly what you are trying to do and any issues you are having, particularly the "irritating problems with its row indexing and some other problems" you quote above? On Wed, Feb 22, 2017 at 10:34 AM, Robert McLeod wrote: > Just

Re: [Numpy-discussion] From Python to Numpy

2017-01-13 Thread Matthew Harrigan
I coded up an all_equal gufunc here . Benchmark results are also in that repo. For the specific problem in the book which started this, its 40x faster than the optimized code in the book. For large arrays which have any early non equal

Re: [Numpy-discussion] From Python to Numpy

2017-01-09 Thread Matthew Harrigan
I also have been stalking this email thread. First, excellent book! Regarding the vectorization example mentioned above, one thing to note is that it increases the order of the algorithm relative to the pure python. The vectorized approach uses correlate, which requires ~(len(seq) * len(sub))

Re: [Numpy-discussion] ufunc for sum of squared difference

2016-11-16 Thread Matthew Harrigan
sho...@gmail.com> wrote: > On Mon, Nov 14, 2016 at 5:40 PM, Matthew Harrigan < > harrigan.matt...@gmail.com> wrote: > >> Essentially it creates a reduce for a function which isn't binary. I >> think this would be generally useful. >> > > NumPy already has a gene

Re: [Numpy-discussion] ufunc for sum of squared difference

2016-11-14 Thread Matthew Harrigan
think this would make ufuncs even more universal. On Mon, Nov 14, 2016 at 3:38 AM, Jerome Kieffer <jerome.kief...@esrf.fr> wrote: > On Fri, 11 Nov 2016 11:25:58 -0500 > Matthew Harrigan <harrigan.matt...@gmail.com> wrote: > > > I started a ufunc to compute the sum

Re: [Numpy-discussion] ufunc for sum of squared difference

2016-11-11 Thread Matthew Harrigan
> like PyUFunc_d_d. > > Having an option to mark arguments of a ufunc as special in reductions > could be useful, e.g. it would allow a potential > (fused-)multiply-and-add ufunc to be used to implement a weighted sum. > > On 11.11.2016 17:25, Matthew Harrigan wrote: > > I

Re: [Numpy-discussion] ufunc for sum of squared difference

2016-11-11 Thread Matthew Harrigan
mple where "data" was used in a ufunc inner loop? How can that value be set at runtime? Thanks On Fri, Nov 4, 2016 at 5:33 PM, Sebastian Berg <sebast...@sipsolutions.net> wrote: > On Fr, 2016-11-04 at 15:42 -0400, Matthew Harrigan wrote: > > I didn't notice identity before.

Re: [Numpy-discussion] ufunc for sum of squared difference

2016-11-04 Thread Matthew Harrigan
code and would therefore have the same accuracy. Thanks On Fri, Nov 4, 2016 at 1:56 PM, Sebastian Berg <sebast...@sipsolutions.net> wrote: > On Fr, 2016-11-04 at 13:11 -0400, Matthew Harrigan wrote: > > I was reading this and got thinking about if a ufunc could compute > &g

[Numpy-discussion] ufunc for sum of squared difference

2016-11-04 Thread Matthew Harrigan
I was reading this and got thinking about if a ufunc could compute the sum of squared differences in a single pass without a temporary array. The python code below demonstrates a possible approach. import numpy as np x =

Re: [Numpy-discussion] padding options for diff

2016-10-26 Thread Matthew Harrigan
Would it be preferable to have to_begin='first' as an option under the existing kwarg to avoid overlapping? On Wed, Oct 26, 2016 at 3:35 PM, Peter Creasey < p.e.creasey...@googlemail.com> wrote: > > Date: Wed, 26 Oct 2016 09:05:41 -0400 > > From: Matthew Harrigan <harri

Re: [Numpy-discussion] padding options for diff

2016-10-26 Thread Matthew Harrigan
ate: Mon, 24 Oct 2016 08:44:46 -0400 > > From: Matthew Harrigan <harrigan.matt...@gmail.com> > > > > I posted a pull request <https://github.com/numpy/numpy/pull/8206> which > > adds optional padding kwargs "to_begin" and "to_end" to diff. Th

Re: [Numpy-discussion] Preserving NumPy views when pickling

2016-10-25 Thread Matthew Harrigan
It seems pickle keeps track of references for basic python types. x = [1] y = [x] x,y = pickle.loads(pickle.dumps((x,y))) x.append(2) print(y) >>> [[1,2]] Numpy arrays are different but references are forgotten after pickle/unpickle. Shared objects do not remain shared. Based on the quote

[Numpy-discussion] padding options for diff

2016-10-24 Thread Matthew Harrigan
I posted a pull request which adds optional padding kwargs "to_begin" and "to_end" to diff. Those options are based on what's available in ediff1d. It closes this issue

[Numpy-discussion] add elementwise addition & subtraction to einsum

2016-10-16 Thread Matthew Harrigan
Hello, This is a follow on for issue 8139 . I propose adding elementwise addition and subtraction functionality to einsum. I love einsum as it clearly and concisely defines complex linear algebra. However elementwise addition is a very common linear