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

2016-11-11 Thread Matthew Harrigan
My possibly poorly thought out API would be something like np.add_sq_diff.set_c(42.0).reduce(x), basically add a setter method which returned self. Thanks for explaining what data was intended to do. All of this is really just a dance around the requirement that reduce only works on binary functi

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

2016-11-11 Thread Julian Taylor
here is an old unfinished PR adding max_abs which has a similar purpose as yours: https://github.com/numpy/numpy/pull/5509 So far I know data is set during runtime construction and is part of the ufunc object, so it is not really very suitable to pass in constants on call. Its intended purpose is

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

2016-11-11 Thread Matthew Harrigan
I started a ufunc to compute the sum of square differences here . It is about 4x faster and uses half the memory compared to np.sum(np.square(x-c)). This could significantly speed up common operations like std and var (where c=