[Numpy-discussion] NumPy Development Meeting Wednesday - Triage Focus

2021-11-02 Thread Sebastian Berg
Hi all, Our bi-weekly triage-focused NumPy development meeting is Wednesday, November 3rd at 16:30 UTC (9:30am Pacific Time). Everyone is invited to join in and edit the work-in-progress meeting topics and notes: https://hackmd.io/68i_JvOYQfy9ERiHgXMPvg I encourage everyone to notify us of issues

[Numpy-discussion] Re: Percentile/Quantile "interpolation" refactor

2021-11-04 Thread Sebastian Berg
On Wed, 2021-10-13 at 10:25 -0500, Sebastian Berg wrote: > Hi all, > > after a long time Abel has helped us and refactored the quantile and > percentile functions' `interpolation` keyword. > This PR is now merged to be included in the upcoming 1.22 release. Please don'

[Numpy-discussion] Re: Revert the return of a single NaN for `np.unique` with floating point numbers?

2021-11-08 Thread Sebastian Berg
mers wrote: > > > > > > On Mon, Aug 2, 2021 at 7:49 PM Ralf Gommers > > wrote: > > > > > > > > > On Mon, Aug 2, 2021 at 7:04 PM Sebastian Berg > > > wrote: > > > > Hi all, > > > > > > > > In

[Numpy-discussion] Re: Make the pickle default protocol 4.

2021-11-08 Thread Sebastian Berg
On Sun, 2021-11-07 at 12:36 -0700, Charles R Harris wrote: > Hi All, > > I'd like to propose making the NumPy default pickle protocol 4, the > same as > the Python 3.8 default. That would have the advantage of supporting > large > pickles. The current default protocol is 2, last the default in > P

[Numpy-discussion] NumPy Community Meeting Wednesday (For those in the US: end of daylight saving means this is one hour earlier)

2021-11-09 Thread Sebastian Berg
Hi all, There will be a NumPy Community meeting Wednesday November 10th at 16:30 UTC. Everyone is invited and encouraged to join in and edit the work-in-progress meeting topics and notes at: https://hackmd.io/76o-IxCjQX2mOXO_wwkcpg?both Best wishes Sebastian signature.asc Description: This i

[Numpy-discussion] Re: Conversion from C-layout to Fortran-layout in Cython

2021-11-10 Thread Sebastian Berg
On Thu, 2021-11-11 at 01:04 +0100, Ilhan Polat wrote: > Hmm not sure I understand the question but this is what I mean by naive > looping, suppose I allocate a scratch register work3, then > > for i in range(n): for j in range(n): work3[j*n+i] = work2[i*n+j] > NumPy does not end up doing anythin

[Numpy-discussion] Re: Code formatters

2021-11-15 Thread Sebastian Berg
On Mon, 2021-11-15 at 14:28 -0700, Charles R Harris wrote: > On Sun, Nov 14, 2021 at 4:28 PM Juan Nunez-Iglesias > > wrote: > > > > https://github.com/jni/skan/blob/74507344b4cd4453cc43b4dbd0b5742fc08eb5a0/.style.yapf > > > > As Stéfan said, fix the knobs (yours might be different), then > >

[Numpy-discussion] NumPy Development Meeting Wednesday - Triage Focus

2021-11-17 Thread Sebastian Berg
Hi all, Our bi-weekly triage-focused NumPy development meeting is Wednesday, November 17rd at 16:30 UTC (8:30am Pacific Time). Everyone is invited to join in and edit the work-in-progress meeting topics and notes: https://hackmd.io/68i_JvOYQfy9ERiHgXMPvg I encourage everyone to notify us of issue

[Numpy-discussion] Putting in `np.ma.ndenumerate` MaskedArray specific ndenumerate

2021-11-17 Thread Sebastian Berg
Hi all, the `np.ndenumerate` does not work well for masked arrays (like many main namespace functions, it simply ignores/drops the mask). There is a PR (https://github.com/numpy/numpy/pull/20020) to add a version of it to `np.ma` (masked array specific). And we thought it seemed reasonable and w

[Numpy-discussion] Re: Putting in `np.ma.ndenumerate` MaskedArray specific ndenumerate

2021-11-17 Thread Sebastian Berg
On Wed, 2021-11-17 at 19:49 +0100, Andras Deak wrote: > On Wed, Nov 17, 2021 at 7:39 PM Sebastian Berg > > wrote: > > > Hi all, > > > > the `np.ndenumerate` does not work well for masked arrays (like > > many > > main namespace functions, it simply ig

[Numpy-discussion] Re: Code formatters

2021-11-18 Thread Sebastian Berg
> On Mon, Nov 15, 2021 at 2:33 PM Charles R Harris > > wrote: > > > > > > > On Mon, Nov 15, 2021 at 3:02 PM Sebastian Berg > > > > wrote: > > > > > On Mon, 2021-11-15 at 14:28 -0700, Charles R Harris wrote: > > > >

[Numpy-discussion] CANCELLED: NumPy Community Meeting (typically Wednesday's)

2021-11-21 Thread Sebastian Berg
Hi all, There is no Community planned this Wednesday, since I am traveling and a few others who typically attend are also on vacation. Best wishes Sebastian ___ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email

[Numpy-discussion] Re: Allow for callable in indexing

2021-11-29 Thread Sebastian Berg

[Numpy-discussion] NumPy Development Meeting Wednesday - Triage Focus

2021-11-30 Thread Sebastian Berg
Hi all, Our bi-weekly triage-focused NumPy development meeting is Wednesday, December 1st at 16:30 UTC (8:30am Pacific Time). Everyone is invited to join in and edit the work-in-progress meeting topics and notes: https://hackmd.io/68i_JvOYQfy9ERiHgXMPvg I encourage everyone to notify us of issues

[Numpy-discussion] Re: Fwd: ndarray should offer __format__ that can adjust precision

2021-12-03 Thread Sebastian Berg
On Mon, 2021-07-26 at 01:04 -0400, Ivan Gonzalez wrote: > It would be nice to be able to use the Python syntax we already use to > format the precision of floating numbers in numpy: > > > > a = np.array([-np.pi, np.pi]) > > > > print(f"{a:+.2f}") > [-3.14 +3.14] > This is particularly useful when y

[Numpy-discussion] NumPy Community Meeting Wednesday -- Later time!

2021-12-07 Thread Sebastian Berg
Hi all, There will be a NumPy Community meeting Wednesday December 8th at 19:00 UTC. Everyone is invited and encouraged to join in and edit the work-in-progress meeting topics and notes at: https://hackmd.io/76o-IxCjQX2mOXO_wwkcpg?both Best wishes Sebastian PS: 19:00 UTC is 11am Pacific time

[Numpy-discussion] Speeding up __array_function__ by moving to C (interest in pushing that forward?)

2021-12-08 Thread Sebastian Berg
Hi all, is anyone interested in digging into speeding up __array_function__? I distracted myself briefly looking into moving (more) of it to C and got up with this: https://github.com/numpy/numpy/compare/main...seberg:faster-array-function The effect seems to be an up to 40% speed improvement f

[Numpy-discussion] NumPy Development Meeting Wednesday - Triage Focus

2021-12-14 Thread Sebastian Berg
Hi all, Our bi-weekly triage-focused NumPy development meeting is Wednesday, December 15th at 17:30 UTC (9:30am Pacific Time). Everyone is invited to join in and edit the work-in-progress meeting topics and notes: https://hackmd.io/68i_JvOYQfy9ERiHgXMPvg I encourage everyone to notify us of issue

[Numpy-discussion] NumPy Community Meeting Wednesday

2021-12-21 Thread Sebastian Berg
Hi all, It is almost holiday for many, so happy holidays everyone! For those still around and busy tomorrow: There will be a NumPy Community meeting Wednesday December 22nd at 19:00 UTC. Everyone is invited and encouraged to join in and edit the work-in-progress meeting topics and notes at: htt

[Numpy-discussion] NumPy Community Meeting Wednesday

2022-01-04 Thread Sebastian Berg
Hi all, There will be a NumPy Community meeting Wednesday January 5th at 19:00 UTC. Everyone is invited and encouraged to join in and edit the work-in-progress meeting topics and notes at: https://hackmd.io/76o-IxCjQX2mOXO_wwkcpg?both Best wishes Sebastian ___

[Numpy-discussion] Re: Writing an array subclass in a compiled language with proper dispatch

2022-01-10 Thread Sebastian Berg
On Mon, 2022-01-10 at 15:25 -0800, Stephan Hoyer wrote: > There are no C-level APIs for __array_function__ or __array_ufunc__, > so > yes, at a high-level Python methods will be invoked by NumPy. > > That said, NumPy's logic for handling __array_function__ and > __array_ufunc__ methods is written

[Numpy-discussion] NumPy Development Meeting Wednesday - Triage Focus

2022-01-11 Thread Sebastian Berg
Hi all, Our bi-weekly triage-focused NumPy development meeting is Wednesday, January 12th at 17:00 UTC (9:00am Pacific Time). Everyone is invited to join in and edit the work-in-progress meeting topics and notes: https://hackmd.io/68i_JvOYQfy9ERiHgXMPvg I encourage everyone to notify us of issues

[Numpy-discussion] Re: advice for using datetime64 in C binding

2022-01-18 Thread Sebastian Berg
On Tue, 2022-01-18 at 14:56 +0100, Benoit Gschwind wrote: > Hello, > > I using the following code: > > if (PyArray_TYPE(arr1) == NPY_DATETIME) { > // Ensure datetime64[ms] > auto tmp = > reinterpret_cast(PyObject_CallMethod(reinterpret_cast > (arr1), "astype", "(s)", "datetime64[m

[Numpy-discussion] Re: advice for using datetime64 in C binding

2022-01-18 Thread Sebastian Berg
> > Best regards > > On Tue, 2022-01-18 at 09:22 -0600, Sebastian Berg wrote: > > On Tue, 2022-01-18 at 14:56 +0100, Benoit Gschwind wrote: > > > Hello, > > > > > > I using the following code: > > > > > > if (PyArray

[Numpy-discussion] Re: Performance mystery

2022-01-19 Thread Sebastian Berg
On Wed, 2022-01-19 at 11:49 +0100, Francesc Alted wrote: > On Wed, Jan 19, 2022 at 7:33 AM Stefan van der Walt > > wrote: > > > On Tue, Jan 18, 2022, at 21:55, Warren Weckesser wrote: > > > expr = 'z.real**2 + z.imag**2' > > > > > > z = generate_sample(n, rng) > > > > 🤔 If I duplicate the `z =

[Numpy-discussion] Re: Performance mystery

2022-01-19 Thread Sebastian Berg
expert in kernel virtual memory/page management :). Cheers, Sebastian > > > > > > > > On Wed, Jan 19, 2022 at 9:06 AM Sebastian Berg > > > > wrote: > > > > > On Wed, 2022-01-19 at 11:49 +0100, Francesc Alted wrote: > > > > On Wed

[Numpy-discussion] Re: Performance mystery

2022-01-19 Thread Sebastian Berg
On Wed, 2022-01-19 at 20:49 +0100, Jerome Kieffer wrote: > On Wed, 19 Jan 2022 19:48:32 +0100 > Francesc Alted wrote: > > > What puzzles me is that the timeit loops access `z` data 3*1 > > times, which is plenty of time for doing the allocation (just > > should > > require just a single itera

[Numpy-discussion] Re: Performance mystery

2022-01-20 Thread Sebastian Berg
t; memory allocation strategies in NumPy and come up with suggestions > for > users. You are probably aware, but Matti and Elias now added the ability to customize array data allocation in NumPy, so it should be straight forward to write a small package/module that tweaks the allocatio

[Numpy-discussion] Re: Proposal for new function to determine if a float contains an integer

2022-01-24 Thread Sebastian Berg
On Sun, 2022-01-23 at 14:12 -0800, Brock Mendel wrote: > Have any of the numpy devs weighed in on this?  If an efficient > version of > this were available in numpy there is a lot of pandas code I would > enjoy > ripping out. As this is a Python float method, that is an argument for implementing i

[Numpy-discussion] Re: exp(NINF) returns underflow error after version 1.20

2022-01-24 Thread Sebastian Berg
On Mon, 2022-01-24 at 19:37 +, Michael Gutteridge wrote: > We have an interesting situation where a test suite that checks the > value of e^-inf is behaving differently depending on Numpy version.  > The minimal test I'm using is: > > #!/usr/bin/env python3 > import numpy as np > np.seterr(und

[Numpy-discussion] NumPy Development Meeting Wednesday - Triage Focus

2022-01-25 Thread Sebastian Berg
Hi all, Our bi-weekly triage-focused NumPy development meeting is Wednesday, January 26th at 17:00 UTC (9:00am Pacific Time). Everyone is invited to join in and edit the work-in-progress meeting topics and notes: https://hackmd.io/68i_JvOYQfy9ERiHgXMPvg I encourage everyone to notify us of issues

[Numpy-discussion] New experimental DType example (for physical Unit handling)

2022-01-27 Thread Sebastian Berg
Hi all, I have created a new prototype showcasing the new experimental DType and ufunc API here: https://github.com/seberg/unitdtype Aside from showing Units, this is also a good resource to get an idea of how the new (including very complicated) DTypes will look like, as well as how UFuncs

[Numpy-discussion] Changes to `np.loadtxt`

2022-02-08 Thread Sebastian Berg
Hi all, just a brief heads up that: https://github.com/numpy/numpy/pull/20580 is now merged. This moves `np.loadtxt` to C. Mainly making it much faster. There are also some other improvements and changes though: * It now supports `quotechar='"'` to support Excel dialect CSV. * Parsing so

[Numpy-discussion] NumPy Development Meeting Wednesday - Triage Focus

2022-02-08 Thread Sebastian Berg
Hi all, Our bi-weekly triage-focused NumPy development meeting is Wednesday, Feburary 9th at 17:00 UTC (9:00am Pacific Time). Everyone is invited to join in and edit the work-in-progress meeting topics and notes: https://hackmd.io/68i_JvOYQfy9ERiHgXMPvg I encourage everyone to notify us of issues

[Numpy-discussion] Poll: Future NumPy behavior when mixing arrays, NumPy scalars, and Python scalars

2022-02-09 Thread Sebastian Berg
Hi all, One issue we have in NumPy is that there is fairly common confusion about operations that mix NumPy arrays and scalars (Python scalars or NumPy scalars). This also adds trickier logic to NumPy it may help both users and the NumPy code complexity if we could move forward with a simplificat

[Numpy-discussion] Unpacking 0-D object arrays when setting item/filling

2022-02-14 Thread Sebastian Berg
Hi all, TL;DR: Are there strong opinions on what: arr = np.array([None]) arr[0] = np.array(3) arr.fill(np.array(3)) Should give? Right now NumPy usually stores the 0-D array, I want to make `arr.fill()` consistent, so that is what it would be doing also. **Long discussion:** NumPy

[Numpy-discussion] Re: Unpacking 0-D object arrays when setting item/filling

2022-02-15 Thread Sebastian Berg
On Tue, 2022-02-15 at 10:21 +0200, Matti Picus wrote: > > On 15/2/22 09:53, Stefan van der Walt wrote: > > On Mon, Feb 14, 2022, at 12:45, Sebastian Berg wrote: > > > But this is currently *not* consistently the case.  I wish to > > > make this > > > cons

[Numpy-discussion] Re: advice for using datetime64 in C binding

2022-02-18 Thread Sebastian Berg
08 +0100, Benoit Gschwind wrote: > > > Hello Sebastian, > > > > > > Thanks for the precision > > > > > > Best regards > > > > > > On Tue, 2022-01-18 at 11:52 -0600, Sebastian Berg wrote: > > > > On Tue,

[Numpy-discussion] NEP draft for the future behaviour of scalar promotion

2022-02-21 Thread Sebastian Berg
Hi all, NumPy has awkward behaviour when it comes to promotion with 0-D arrays, and Python scalars. This is both a technical challenge (numpy needs to inspect the values where it shouldn't), as well as surprising for users. Roughly speaking, I have made a proposal under the 3 points: * NumPy sca

[Numpy-discussion] Re: NEP draft for the future behaviour of scalar promotion

2022-02-22 Thread Sebastian Berg
On Tue, 2022-02-22 at 01:43 -0600, Juan Nunez-Iglesias wrote: > > On Tue, 22 Feb 2022, at 1:01 AM, Stefan van der Walt wrote: > > it is easier to explain away `x + 1` behaving oddly over `x[0] + 1` > > behaving oddly > > Is it? I find the two equivalent, honestly. > > > given that we pretend lik

[Numpy-discussion] NumPy Development Meeting Wednesday - Triage Focus

2022-02-22 Thread Sebastian Berg
Hi all, Our bi-weekly triage-focused NumPy development meeting is Wednesday, February 23rd at 17:00 UTC (9:00am Pacific Time). Everyone is invited to join in and edit the work-in-progress meeting topics and notes: https://hackmd.io/68i_JvOYQfy9ERiHgXMPvg I encourage everyone to notify us of issue

[Numpy-discussion] NumPy Development Meeting Wednesday - Triage Focus

2022-03-01 Thread Sebastian Berg
Hi all, Our bi-weekly triage-focused NumPy development meeting is Wednesday, March 2nd at 17:00 UTC (9:00am Pacific Time). Everyone is invited to join in and edit the work-in-progress meeting topics and notes: https://hackmd.io/68i_JvOYQfy9ERiHgXMPvg I encourage everyone to notify us of issues or

[Numpy-discussion] Re: NumPy Development Meeting Wednesday - Triage Focus

2022-03-01 Thread Sebastian Berg
Sorry all, this week is community meeting, I had just edited the meeting notes and somehow got it wrong. Inessa already send the correct Community meeting invite (different time!) yesterday :). Cheers, Sebastian On Tue, 2022-03-01 at 13:28 -0800, Sebastian Berg wrote: > Hi all, > &g

[Numpy-discussion] Exposing `from_dlpack` to the main namespace

2022-03-08 Thread Sebastian Berg
Hi, just a brief note that: https://github.com/numpy/numpy/pull/21145 will add `np.from_dlpack` (to import objects implementing the `__dlpack__` dunder [1]. It was added with an underscore mainly due to unlucky timing, IIRC. There may also be some choices that could be different, but I bel

[Numpy-discussion] Re: Exposing `from_dlpack` to the main namespace

2022-03-08 Thread Sebastian Berg
On Tue, 2022-03-08 at 08:26 -0800, Stefan van der Walt wrote: > Hi Sebastian, > > On Tue, Mar 8, 2022, at 07:41, Sebastian Berg wrote: > > just a brief note that: > > > > https://github.com/numpy/numpy/pull/21145 > > > > will add `np.from_dlpa

[Numpy-discussion] NumPy Development Meeting Wednesday - Triage Focus

2022-03-08 Thread Sebastian Berg
Hi all, Our bi-weekly triage-focused NumPy development meeting is Wednesday, March 9th at 17:00 UTC (9:00am Pacific Time). Everyone is invited to join in and edit the work-in-progress meeting topics and notes: https://hackmd.io/68i_JvOYQfy9ERiHgXMPvg I encourage everyone to notify us of issues or

[Numpy-discussion] Re: np.bool_ vs Python bool behavior

2022-03-13 Thread Sebastian Berg
Hi Jacob, adding to what Chuck mentioned, a few inline comments if you are interested in some gory details. On Sat, 2022-03-12 at 21:40 +, Jacob Reinhold wrote: > A pain point I ran into a while ago was assuming that an np.ndarray > with dtype=np.bool_ would act similarly to the Python built

[Numpy-discussion] NumPy Development Meeting Wednesday - Triage Focus (NOTE: Earlier for most!)

2022-03-21 Thread Sebastian Berg
Note: The time is earlier than last ones in UTC (so earlier if you did not just switched to daylight-savings time). The reason was not daylight saving time, but happens to coincide... Hi all, Our bi-weekly triage-focused NumPy development meeting is Wednesday, March 9th at 16:00 UTC (9:00am Pac

[Numpy-discussion] Re: np.bool_ vs Python bool behavior

2022-03-21 Thread Sebastian Berg
On Wed, 2022-03-16 at 18:14 +, Jacob Reinhold wrote: > Hi Sebastian and Chuck, > > Thanks for the response! (Sorry about the formatting in my original > post, I wasn't familiar with how to display code in this setting). > > I think keeping + as "logical or" and * as "logical and" on np.bool_

[Numpy-discussion] NumPy Development Meeting Wednesday - Triage Focus

2022-04-04 Thread Sebastian Berg
Hi all, Our bi-weekly triage-focused NumPy development meeting is Wednesday, August 6th at 16:00 UTC (9:00am Pacific Time). Everyone is invited to join in and edit the work-in-progress meeting topics and notes: https://hackmd.io/68i_JvOYQfy9ERiHgXMPvg I encourage everyone to notify us of issues o

[Numpy-discussion] NumPy Development Meeting Wednesday - Triage Focus

2022-05-03 Thread Sebastian Berg
Hi all, Our bi-weekly triage-focused NumPy development meeting is Wednesday, May 4th at 16:00 UTC (9:00am Pacific Time). Everyone is invited to join in and edit the work-in-progress meeting topics and notes: https://hackmd.io/68i_JvOYQfy9ERiHgXMPvg I encourage everyone to notify us of issues or P

[Numpy-discussion] Re: overhead of numpy scalars

2022-05-04 Thread Sebastian Berg
On Tue, 2022-05-03 at 15:06 +0200, Pieter Eendebak wrote: > Hi everyone, > > Operations such as np.sqrt or np.cos on numpy scalars are much slower > than > operations on an array of size 1 (benchmark below). The reason seems > to be > that a numpy scalar (e.g. np.float64(1.1)) is converted interna

[Numpy-discussion] Re: Automatic formatters for only changed lines

2022-05-06 Thread Sebastian Berg
On Thu, 2022-05-05 at 15:32 -0700, Stefan van der Walt wrote: > On Thu, May 5, 2022, at 12:00, Trevor Gross wrote: > > I don't necessarily know that this should be enforced on CI off the > > bat (though in the future it could be), but at least having the > > tool available and easily usable would h

[Numpy-discussion] Re: Automatic formatters for only changed lines

2022-05-08 Thread Sebastian Berg
On Sat, 2022-05-07 at 22:37 -0700, Juan Nunez-Iglesias wrote: > With the caveat that I am just an interested bystander, I would like > to point back to yapf as an alternative. I agree with what has > already been echoed by the majority of the community, that setting > *some* auto-formatter is a hug

[Numpy-discussion] Fixing/changing structured dtype casting safety, promotion, and comparisons

2022-05-11 Thread Sebastian Berg
Hi all, This was probably announced before, but I wanted to mention it again, with https://github.com/numpy/numpy/pull/19226 as the last step the casting safety, promotion, and comparisons of structured (void) dtypes will be updated to fix some bugs and fit better with changes that happened a few

[Numpy-discussion] NumPy Development Meeting Wednesday - Triage Focus

2022-05-16 Thread Sebastian Berg
Hi all, Our bi-weekly triage-focused NumPy development meeting is Wednesday, May 18th at 16:00 UTC (9:00am Pacific Time). Everyone is invited to join in and edit the work-in-progress meeting topics and notes: https://hackmd.io/68i_JvOYQfy9ERiHgXMPvg I encourage everyone to notify us of issues or

[Numpy-discussion] Re: ndarray shape permutation

2022-05-17 Thread Sebastian Berg
On Tue, 2022-05-17 at 12:16 +0200, Andras Deak wrote: > On Mon, May 16, 2022, at 17:54, Paul Korir wrote: > > Hellos, > > I would like to propose > > `numpy.ndarray.permute_shape()` > > method to predictably permute the shape of an ndarray. In my > > opinion, > > the current alternatives (`swapax

[Numpy-discussion] Re: New stable documentation

2022-05-21 Thread Sebastian Berg
On Sat, 2022-05-21 at 10:33 +0300, matti picus wrote: > On Sat, 21 May 2022 at 08:46, Ralf Gommers > wrote: > > > > > > > On Sat, May 21, 2022 at 3:40 AM Charles R Harris < > > charlesr.har...@gmail.com> wrote: > > > > > Hi All, > > > > > > I've put up new stable documentation for NumPy 1.22.

[Numpy-discussion] NumPy Development Meeting Wednesday - Triage Focus

2022-05-30 Thread Sebastian Berg
Hi all, Our bi-weekly triage-focused NumPy development meeting is Wednesday, June 1st at 16:00 UTC (9:00am Pacific Time). Everyone is invited to join in and edit the work-in-progress meeting topics and notes: https://hackmd.io/68i_JvOYQfy9ERiHgXMPvg I encourage everyone to notify us of issues or

[Numpy-discussion] NEP 50: Promotion rules for Python scalars

2022-06-01 Thread Sebastian Berg
Hi all, I would like to share the first formal draft of NEP 50: Promotion rules for Python scalars with everyone. The full text can be found here: https://numpy.org/neps/nep-0050-scalar-promotion.html NEP 50 is an attempt to remove value-based casting/promotion. We wish to replace it

[Numpy-discussion] Re: NEP 50: Promotion rules for Python scalars

2022-06-01 Thread Sebastian Berg
On Wed, 2022-06-01 at 20:23 +0200, Ralf Gommers wrote: > On Wed, Jun 1, 2022 at 5:51 PM Sebastian Berg > > wrote: > > > > > An important part of moving forward will be assessing the real > > world > > impact.  To start that process, I have created a branch

[Numpy-discussion] Small API addition: unique now has `equal_nan=False` keyword argument

2022-06-01 Thread Sebastian Berg
Hi all, this has been discussed before, so mainly a brief announcement that we merged a PR to add the `equal_nan` kwarg to `np.unique`. If set to False, multiple `NaN`s will be reported multiple times (which was the behavior prior to NumPy 1.21). The keyword argument name was chosen to match tha

[Numpy-discussion] API Addition: Polynomial classes now have a "symbol" denoting the variable

2022-06-01 Thread Sebastian Berg
Hi all, just another small API announcement, that I merged: https://github.com/numpy/numpy/pull/16154 which adds `symbol="x"` to the polynomial classes. Ross' more detailed explanation is copied below. Cheers, Sebastian New attribute ``symbol`` added to polynomial classes -

[Numpy-discussion] Re: NEP 50: Promotion rules for Python scalars

2022-06-01 Thread Sebastian Berg
On Wed, 2022-06-01 at 18:37 -0500, Juan Nunez-Iglesias wrote: > > For example, in NumPy: > > > >    np.median(np.float32([1, 2, 3, 4])) > > > > did return a float64 before and will now return a float32.  I > > assume > > because somewhere we write: `(np.float64(3) + np.float32(2)) / 2`. > > Sorr

[Numpy-discussion] NumPy Development Meeting Wednesday - Triage Focus

2022-06-14 Thread Sebastian Berg
Hi all, Our bi-weekly triage-focused NumPy development meeting is Wednesday, June 15st at 16:00 UTC (9:00am Pacific Time). Everyone is invited to join in and edit the work-in-progress meeting topics and notes: https://hackmd.io/68i_JvOYQfy9ERiHgXMPvg I encourage everyone to notify us of issues or

[Numpy-discussion] Re: numpy build question

2022-06-15 Thread Sebastian Berg
On Wed, 2022-06-15 at 15:11 +0300, Matti Picus wrote: > > On 14/6/22 18:14, Jesse Peet wrote: > > I am trying to build numpy 1.22.3 in container using a rhel8 host  > > and > > the container being rhel7. > > My version of gcc is 4.8.5-44.   Here is the error I get > > > > RuntimeError: Broken to

[Numpy-discussion] Speeding up isin1d and adding a "method" or similar

2022-06-16 Thread Sebastian Berg
Hi all, there is a PR to add a faster path to `np.isin`, that uses a look-up- table for all the elements that are included in the haystack (`test_elements`): https://github.com/numpy/numpy/pull/12065/files Such a table means that the memory overhead can be very significant, but the speedup a

[Numpy-discussion] Re: numpy build question

2022-06-17 Thread Sebastian Berg
On Thu, 2022-06-16 at 10:42 +, jesse.p...@raytheon.com wrote: > When I run it I add the CPPFLAGS=std=-C++11 > Here is the output I get when  I added the  above flag > COMMAND: CPPFLAGS=-std=c++11 /awips2/python/bin/python setup.py build > --cpu-baseline="native" --cpu-dispatch="none" Sorry, I

[Numpy-discussion] Re: Speeding up isin1d and adding a "method" or similar

2022-06-17 Thread Sebastian Berg
with > np.sort. :+1:, I agree with both points. I am also not sure about the choice of "dictionary", since we don't use a dictionary (or even hashtable)? (Although I may have missed discussion on the name.) Cheers, Sebastian > > On Thu, Jun 16, 2022 at 6:14 AM Sebasti

[Numpy-discussion] MERGED: Speeding up in1d and adding a "method" or similar

2022-06-23 Thread Sebastian Berg
he old behavior The new documentation is available at: https://numpy.org/devdocs/reference/generated/numpy.in1d.html It seems this addition should be useful in many cases, but if you have any concern about the choice of API please comment! Cheers, Sebastian On Thu, 2022-06-16 at 06:08 -0700,

[Numpy-discussion] NumPy Development Meeting Wednesday - Triage Focus

2022-06-27 Thread Sebastian Berg
Hi all, Our bi-weekly triage-focused NumPy development meeting is Wednesday, June 29th at 16:00 UTC (9:00am Pacific Time). Everyone is invited to join in and edit the work-in-progress meeting topics and notes: https://hackmd.io/68i_JvOYQfy9ERiHgXMPvg I encourage everyone to notify us of issues or

[Numpy-discussion] Re: Speeding up `unique` and adding "kind" parameter

2022-06-29 Thread Sebastian Berg
On Wed, 2022-06-29 at 12:56 +, Miles Cranmer wrote: > So, this new method is in fact a hash table as discussed in that blog > post. However, because it assumes integer arrays, we can go even > further than that blog, and simply use `np.arange(ar_min, ar_max + > 1)` is the "hash table". Thus, yo

[Numpy-discussion] Re: Changes to `np.loadtxt(..., max_rows=)`

2022-06-29 Thread Sebastian Berg
s the old meaning (I think). One reasoning for me was that users may also read too few data right now thinking `max_rows` has the new meaning already (i.e. we fix a bug for them). Cheers, Sebastian On Tue, 2022-02-08 at 08:08 -0600, Sebastian Berg wrote: > Hi all, > > just a brief

[Numpy-discussion] Re: Feature request: dot product along arbitrary axes

2022-07-05 Thread Sebastian Berg
On Tue, 2022-07-05 at 23:36 +, rmccampbe...@gmail.com wrote: > Maybe I wasn't clear, I'm talking about the 1-dimensional vector > product, but applied to N-D arrays of vectors. Certainly dot products > can be realized as matrix products, and often are in mathematics for > convenience, but matri

[Numpy-discussion] Re: NEP 50: Promotion rules for Python scalars

2022-07-06 Thread Sebastian Berg
On Wed, 2022-06-01 at 08:49 -0700, Sebastian Berg wrote: > Hi all, > > I would like to share the first formal draft of > >     NEP 50: Promotion rules for Python scalars > > with everyone.  The full text can be found here: > >     https://numpy.org/neps/nep-0050-sca

[Numpy-discussion] Re: Need help extending a NumPy array in C

2022-07-08 Thread Sebastian Berg
On Thu, 2022-07-07 at 22:37 +, lpsm...@uw.edu wrote: > Hello!  I am maintaining a C++ codebase with extensive ties to Python > bindings (via SWIG).  One of the features of the code is that we > define (in C) a subclass of a NumPy Array.  Everything worked until > we started getting this message

[Numpy-discussion] CANCELLED: No triage meeting this week

2022-07-11 Thread Sebastian Berg
Hi all, since this week is SciPy and a few of us are there and busy, there will be no triage meeting on Wednesday. Cheers Sebastian ___ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-le...

[Numpy-discussion] Team Summit at SciPy 2022

2022-07-19 Thread Sebastian Berg
Hi all, Last week we had a team meeting at the SciPy conference with part of the team calling in remotely. The main discussions were about SIMD and updating our Roadmap. Most discussion should simply lead to an updated roadmap, but if anyone is curious, the meeting notes are archived here: http

[Numpy-discussion] Re: Need help extending a NumPy array in C

2022-08-19 Thread Sebastian Berg
On Fri, 2022-08-19 at 23:56 +, lpsm...@uw.edu wrote: > Thanks for the information!  I've had to work on other project in the > meantime, but was able to get back to this again. > > In an effort to wrap my head around the project's code, I realized > that I did not have a line like: > > #defin

[Numpy-discussion] Re: Support for Multiple Interpreters (Subinterpreters) in numpy

2022-08-23 Thread Sebastian Berg
On Tue, 2022-08-23 at 03:16 +0300, Matti Picus wrote: > > On 22/8/22 18:59, Eric Snow wrote: > > Hi all, > > > > devs than just me.  Do you have any preference for or against any > > particular venue? > > > > Thanks! > > > > -eric > > ___ > > NumPy

[Numpy-discussion] Re: Support for Multiple Interpreters (Subinterpreters) in numpy

2022-08-23 Thread Sebastian Berg
On Tue, 2022-08-23 at 14:00 +0200, Petr Viktorin wrote: > On 23. 08. 22 11:46, Sebastian Berg wrote: > > On Tue, 2022-08-23 at 03:16 +0300, Matti Picus wrote: > > > > > > On 22/8/22 18:59, Eric Snow wrote: > > > > Hi all, > > > > > &g

[Numpy-discussion] Re: Need help extending a NumPy array in C

2022-09-03 Thread Sebastian Berg
On Sat, 2022-09-03 at 00:03 +, lpsm...@uw.edu wrote: > Sebastian Berg wrote: > > On Fri, 2022-08-19 at 23:56 +, lpsm...@uw.edu wrote: > > > Thanks for the information!  I've had to work on other project in > > > the > > > meantime, but was able to g

[Numpy-discussion] Representation of NumPy scalars

2022-09-08 Thread Sebastian Berg
TL;DR: NumPy scalars representation is e.g. `34.3` instead of `float32(34.3)`. So the representation is missing the type information. What are your thoughts on changing that? Hi all, I am thinking about the next steps for NEP 50 (The NEP wants to fix the NumPy promotion rules, especially wit

[Numpy-discussion] Re: Representation of NumPy scalars

2022-09-08 Thread Sebastian Berg
impact besides documentation, but I am not certain. - Sebastian > > > > np.array([34.3, 10.1, -0.5], np.float32) > array([34.3, 10.1, -0.5], dtype=float32) > > > > np.array([5, 10, 0], np.uint8) > array([ 5, 10,  0], dtype=uint8) > > Thanks, > &g

[Numpy-discussion] Re: Representation of NumPy scalars

2022-09-09 Thread Sebastian Berg
On Thu, 2022-09-08 at 21:15 -0400, Warren Weckesser wrote: > On 9/8/22, Andrew Nelson wrote: > > > > > For many types, this function makes an attempt to return a string > > that would yield an object with the same value when passed to > > eval(); > > Sebastian, is this an explicit goal of th

[Numpy-discussion] Re: Representation of NumPy scalars

2022-09-09 Thread Sebastian Berg
On Thu, 2022-09-08 at 23:19 -0700, Stefan van der Walt wrote: > I am in favor of such a change. It will make what is returned more > transparent to users (and reduce confusion for newcomers). > > With NEP50, we're already adopting a philosophy of explicit scalar > usage anyway: no longer pretendi

[Numpy-discussion] NEP 50 and integers (e.g. uint8 together -1)

2022-09-28 Thread Sebastian Berg
Hi all, In NEP 50 (https://numpy.org/neps/nep-0050-scalar-promotion.html) my current proposal is that the following: np.array([1, 2], dtype="uint8") + (-1) which currently returns an "int16" array must raise an error. This is because we want to return a uint8 array but the -1 cannot be repr

[Numpy-discussion] Re: NEP 50 and integers (e.g. uint8 together -1)

2022-09-29 Thread Sebastian Berg
On Wed, 2022-09-28 at 16:44 -0700, Stefan van der Walt wrote: > Hi Sebastian, > > On Wed, Sep 28, 2022, at 12:11, Sebastian Berg wrote: > >     np.array([1, 2], dtype="uint8") + (-1) > > > > which currently returns an "int16" array must raise an er

[Numpy-discussion] Re: NEP 50 and integers (e.g. uint8 together -1)

2022-10-11 Thread Sebastian Berg
17:24 +0200, Ralf Gommers wrote: > On Thu, Sep 29, 2022 at 10:10 AM Sebastian Berg > > wrote: > > > On Wed, 2022-09-28 at 16:44 -0700, Stefan van der Walt wrote: > > > Hi Sebastian, > > > > > > On Wed, Sep 28, 2022, at 12:11, Sebastian Berg wrote: >

[Numpy-discussion] NEP 50 and cast safety for scalar assignment/conversions

2022-10-20 Thread Sebastian Berg
Hi all, I am happy that we have the correct integer handling for NEP 50 merged, so the relevant parts of the proposal can now be tested. [1] However, this has highlighted that NumPy has problems with applying the "cast safety" logic to scalars. We had discussed this a bit yesterday, and this is

[Numpy-discussion] Re: Passing output array to bincount

2022-10-21 Thread Sebastian Berg
On Thu, 2022-10-20 at 23:26 +, ntess...@pm.me wrote: > Hello, > Hi, I don't have a strong opinion yet it does seem potentially useful, but I think there would be some details to hash out in the proposal. Some thoughts: * `np.add.at` should be able to do what you want (but of course is very

[Numpy-discussion] Re: NEP 50 and cast safety for scalar assignment/conversions

2022-10-22 Thread Sebastian Berg
hould be a new type of casting rule that > is non-value based only. > > Unless your entire suggestion is to change the definition of 'safe' > to > not be value-based. I wasn't completely clear about that. > > Aaron Meurer > > On Thu, Oct 20, 2022 at 7:30 AM

[Numpy-discussion] New methods exposing UFunc dtype resolution/promotion and internals

2022-10-25 Thread Sebastian Berg
Hi all, I would like to expose more of the ufunc internals in the following PR: https://github.com/numpy/numpy/pull/22422/ There are three new proposed functions. I hope the first one can be generally useful while the last two are very specific (and thus underscored), but will hopefully bec

[Numpy-discussion] NEP 51: Changing the Representation of NumPy Scalars

2022-10-28 Thread Sebastian Berg
wait on NEP approval. Cheers, Sebastian On Thu, 2022-09-08 at 11:38 +0200, Sebastian Berg wrote: > > TL;DR:  NumPy scalars representation is e.g. `34.3` instead of > `float32(34.3)`.  So the representation is missing the type > information.  What are your thoughts on changing that? &g

[Numpy-discussion] Re: NEP 51: Changing the Representation of NumPy Scalars

2022-11-02 Thread Sebastian Berg
es in repr, I would also be happy to not do it. It would make a bit of a presumption that NumPy is the obvious provider of `int32` (and if others do, they are likely compatible). - Sebastian > > Aaron Meurer > > On Fri, Oct 28, 2022 at 2:55 AM Sebastian Berg > wrote: > &

[Numpy-discussion] Re: New feature: binary (arbitrary base) rounding

2022-11-08 Thread Sebastian Berg
On Thu, 2022-11-03 at 11:37 +0100, Oscar Gustafsson wrote: > Hi all, > > I hope this is the correct way to propose a new feature. > https://github.com/numpy/numpy/issues/22522 > Thanks for the proposal. I don't have much of an opinion on this and right now I am mainly wondering whether there is

[Numpy-discussion] Re: NEP 50 and integers (e.g. uint8 together -1)

2022-11-08 Thread Sebastian Berg
ese Python integers. I will bring this up again also, but it is not directly related. On Tue, 2022-10-11 at 14:00 +0200, Sebastian Berg wrote: > Hi all, > > just to mention it, there is a PR ready on this: > >     https://github.com/numpy/numpy/pull/22385 > > it necesseci

[Numpy-discussion] Re: New feature: binary (arbitrary base) rounding

2022-11-10 Thread Sebastian Berg
On Thu, 2022-11-10 at 11:08 +0100, Oscar Gustafsson wrote: > > > > I'm not an expert, but I never encountered rounding floating point > > numbers > > in bases different from 2 and 10. > > > > I agree that this is probably not very common. More a possibility if > one > would supply a base argumen

[Numpy-discussion] Re: New feature: binary (arbitrary base) rounding

2022-11-10 Thread Sebastian Berg
On Thu, 2022-11-10 at 14:55 +0100, Oscar Gustafsson wrote: > Den tors 10 nov. 2022 kl 13:10 skrev Sebastian Berg < > sebast...@sipsolutions.net>: > > > On Thu, 2022-11-10 at 11:08 +0100, Oscar Gustafsson wrote: > > > > > > > > I'm not an

[Numpy-discussion] Re: plan for moving to Meson

2022-11-11 Thread Sebastian Berg
On Fri, 2022-11-11 at 12:27 +0100, Ralf Gommers wrote: > Hi all, > > With distutils now removed from the stdlib in the Python 3.12 release > cycle, the clock is ticking a bit for dealing with our build system > situation. With SciPy's move to Meson now basically complete - there > are > always loo

<    1   2   3   4   5   6   7   >