[Numpy-discussion] Re: C API could be more consistent with returning NPY_SUCCEED/NPY_FAIL

2024-10-31 Thread Sebastian Berg
The Python C-API almost exclusively uses `-1` for errors and I consider it a wart that some NumPy API uses `NPY_FAIL`/`NPY_SUCCEED`, i would not do this for new API. The one exception are all "argument parsing functions". For those Python again dictates the use of 0 (NPY_FAIL) and 1 (NPY_SUCCEED)

[Numpy-discussion] Re: What to do with np.matrix

2024-10-14 Thread Sebastian Berg
On Sat, 2024-10-12 at 12:13 -0400, Marten van Kerkwijk wrote: > Hi Dan, others, > > Regardless, since there have been 7 years of > PendingDeprecationWarning, > I think changing that to a regular DeprecationWarning should not > surprise anybody, at least not if they had built a package based on

[Numpy-discussion] Re: Expected behavior of np.array(..., copy=True)

2024-10-08 Thread Sebastian Berg
On Tue, 2024-10-08 at 09:34 +0100, Kevin Sheppard via NumPy-Discussion wrote: > Can anyone shed some light on the expected behavior of code using > array(..., copy=True) with pandas objects? We ran into this in > statsmodels > and I think there are probably plenty of places where we explicitly > ca

[Numpy-discussion] Re: Endorsing SPECs 1, 6, 7, and 8

2024-10-07 Thread Sebastian Berg
only weigh in when it is relevant to our community > experience > Matti > > On Mon, Oct 7, 2024 at 1:04 PM Sebastian Berg > wrote: > > > > Hi all, > > > > TL;DR: NumPy should endorse some or all of the new SPECs if we like > > them.  If you don't

[Numpy-discussion] Endorsing SPECs 1, 6, 7, and 8

2024-10-07 Thread Sebastian Berg
Hi all, TL;DR: NumPy should endorse some or all of the new SPECs if we like them. If you don't or do like them, please discuss, otherwise I suspect we will propose and endorsing them soon and do it if a few core maintainers agree. --- The Scientific Python project has the SPEC process to write

[Numpy-discussion] Re: ENH: Uniform interface for accessing minimum or maximum value of a dtype

2024-08-26 Thread Sebastian Berg
On Mon, 2024-08-26 at 11:26 -0400, Marten van Kerkwijk wrote: > I think a NEP is a good idea.  It would also seem to make sense to > consider how the dtype itself can hold/calculate this type of > information, since that will be the only way a generic ``info()`` > function can get information for a

[Numpy-discussion] Welcome Joren Hammudoglu to the NumPy Maintainers Team

2024-08-19 Thread Sebastian Berg
Hi all, please join me in welcoming Joren (https://github.com/jorenham) to the NumPy maintainers team. Joren has done a lot of work recently contributing, reviewing, and maintaining typing related improvements to NumPy. We are looking forward to see new momentum to improve NumPy typing. Thanks f

[Numpy-discussion] Re: Enhancement for generalized ufuncs

2024-07-12 Thread Sebastian Berg
On Fri, 2024-07-12 at 09:56 -0400, Warren Weckesser wrote: > On Fri, Jul 12, 2024 at 7:47 AM Sebastian Berg > wrote: > > > > > (You won't be able to know these relations from reading the > > signature, > > but I doubt it's worth worrying about

[Numpy-discussion] Re: Enhancement for generalized ufuncs

2024-07-12 Thread Sebastian Berg
On Thu, 2024-07-11 at 19:31 -0400, Warren Weckesser wrote: > I have implemented quite a few generalized ufuncs over in ufunclab > (https://github.com/WarrenWeckesser/ufunclab), and in the process I > have accumulated a gufunc "wish list". Two items on that list are: > > (1) the ability to impose c

[Numpy-discussion] Re: Mysterious issue to build pyFFTW with Numpy 2.0 on Windows

2024-07-03 Thread Sebastian Berg
The most probably change seems to me that NumPy now includes `complex.h`. But not sure that is the right direction or why it would lead to cryptic errors. - Sebastian On Wed, 2024-07-03 at 10:30 +0200, PIERRE AUGIER wrote: > Hi, > > We have a strange issue with building pyFFTW with Numpy 2.0

[Numpy-discussion] Re: Unexpected return values for np.mod with x2=np.inf and similar

2024-06-10 Thread Sebastian Berg
On Mon, 2024-06-10 at 10:49 +0300, Matti Picus wrote: > What operating system? > > > If I recall correctly, NumPy tries to be compatible with CPython for > these edge cases. > Right, and there seems nothing odd here to me. Try using `divmod()` on a few numbers (not infinities) to realize that

[Numpy-discussion] Re: Please consider dropping Python 3.9 support for Numpy 2.0

2024-05-08 Thread Sebastian Berg
On Mon, 2024-05-06 at 22:39 +, Henry Schreiner wrote: > This will be messier for projects building wheels and wanting to > support non-EoL Python versions. To build a wheel with anything other > than pybind11, you now need the oldest supported NumPy for Python < > 3.9, the latest NumPy 1 for Py

[Numpy-discussion] Re: Please consider dropping Python 3.9 support for Numpy 2.0

2024-05-07 Thread Sebastian Berg
On Tue, 2024-05-07 at 11:41 +0200, Gael Varoquaux wrote: > On Tue, May 07, 2024 at 11:31:02AM +0200, Ralf Gommers wrote: > > make `pip install scikit-image==0.22` work if that version of > > scikit-image depends on an unconstrained numpy version. > > Would an option be for the scikit-image maintai

[Numpy-discussion] Re: Please consider dropping Python 3.9 support for Numpy 2.0

2024-05-07 Thread Sebastian Berg
On Tue, 2024-05-07 at 15:46 +1000, Juan Nunez-Iglesias wrote: > On Tue, 7 May 2024, at 7:04 AM, Ralf Gommers wrote: > > This problem could have been avoided by proper use of upper bounds. > > Scikit-image 0.22 not including a `numpy<2.0` upper bound is a bug > > in scikit-image (definitely for ABI

[Numpy-discussion] Re: Please consider dropping Python 3.9 support for Numpy 2.0

2024-05-06 Thread Sebastian Berg
On Mon, 2024-05-06 at 09:17 +1000, Matti Picus wrote: > On 05/05/2024 11:32, Mark Harfouche wrote: > > > > > Thank you for considering this last minute request. I know it adds > > work at this stage. > > > > Mark > > > I think NumPy should not be the leader in dropping versions, rather > sh

[Numpy-discussion] Re: Automatic Clipping of array to upper / lower bounds of dtype

2024-03-25 Thread Sebastian Berg
On Mon, 2024-03-25 at 13:49 +, percynichols...@gmail.com wrote: > Many thanks! > > Just one more inquiry along those lines, if I may. The code asserts > that clip should outpace np.maximum(mp.minumum(arr, max), min). > Despite this: > *time a = np.arange(100)it.clip(4, 20)    # 8.48 µs > %time

[Numpy-discussion] Re: Proposal to accept NEP 55: Add a UTF-8 variable-width string DType to NumPy

2024-01-24 Thread Sebastian Berg
On Mon, 2024-01-22 at 17:08 -0700, Nathan wrote: > Hi all, > > I propose we accept NEP 55 and merge PR #25347 implementing the NEP > in time > for the NumPy 2.0 RC: I really like this work and I think it is a big improvement! At this point we probably have to expect some things to be still bugg

[Numpy-discussion] Re: Fixing definition of reduceat for Numpy 2.0?

2024-01-07 Thread Sebastian Berg
On Sat, 2023-12-23 at 09:56 -0500, Marten van Kerkwijk wrote: > Hi Sebastian, > > > That looks nice, I don't have a clear feeling on the order of > > items, if > > we think of it in terms of `(start, stop)` there was also the idea > > voiced to simply add another name in which case you would allow

[Numpy-discussion] Re: Fixing definition of reduceat for Numpy 2.0?

2023-12-23 Thread Sebastian Berg
On Sat, 2023-12-23 at 09:56 -0500, Marten van Kerkwijk wrote: > Hi Sebastian, > > > That looks nice, I don't have a clear feeling on the order of > > items, if > > we think of it in terms of `(start, stop)` there was also the idea > > voiced to simply add another name in which case you would allow

[Numpy-discussion] Re: Fixing definition of reduceat for Numpy 2.0?

2023-12-23 Thread Sebastian Berg
On Fri, 2023-12-22 at 18:01 -0500, Marten van Kerkwijk wrote: > Hi Martin, > > I agree it is a long-standing issue, and I was reminded of it by your > comment.  I have a draft PR at > https://github.com/numpy/numpy/pull/25476 > that does not change the old behaviour, but allows you to pass in a >

[Numpy-discussion] Re: Switching default order to column-major

2023-11-13 Thread Sebastian Berg
Few things in the Python API care about order, but there are also quite a few places that will return C-order (and are faster for C-order inputs) whether you change those defaults or not. The main issue is that e.g. some cython wrappers will probably assume that the newly created array is C-order.

[Numpy-discussion] Re: Windows default integer now 64bit in main

2023-11-03 Thread Sebastian Berg
e. There is no 1.27 planned as of now, if it happens it would be a (big) backport release, though. (Due to files having been moved around backports seem to be getting harder, though.) - Sebastian > > Best, Michael > > > On 2. Nov 2023, at 16:25, Sebastian Berg < > > seb

[Numpy-discussion] Windows default integer now 64bit in main

2023-11-02 Thread Sebastian Berg
Hi all, just a heads up, the PR to change the default integer is merged on main. This may cause issues, especially with Cython code because `np.int_t` cannot be reasonably defined anymore. Other code may also want to vet usage of "long" in any variation. Much code (like SciPy) simply supports a

[Numpy-discussion] Merging very limited weights support for quantiles/percentiles

2023-10-27 Thread Sebastian Berg
Hi all, there is a PR to merge very limited support for weights in quantiles, which given no further input I will probably merge based on sklearn devs saying that they will use it. This means, adding a `weights` kwarg [1]. See: https://github.com/numpy/numpy/pull/24254 Limited here means th

[Numpy-discussion] Re: Curious performance different with np.unique on arrays of characters

2023-09-29 Thread Sebastian Berg
On Fri, 2023-09-29 at 11:39 +0200, Klaus Zimmermann wrote: > Hi, > > one thing that's been on my mind about this discussion: > > Isn't sorting strings simply a much harder job? Particularly Unicode > strings? Yes, but in theory if they are length 1 it is just sorting integers (8 or 64bit) for

[Numpy-discussion] Re: Dealing with static local variables in Numpy

2023-09-01 Thread Sebastian Berg
On Tue, 2023-08-29 at 08:01 +, Nicolas Holzschuch wrote: > Hello, > > This is my first post to this group; I'd like to start by expressing > my appreciation for the amazing work in developing and maintaining > Numpy. > > I have a question. Numpy has quite a lot of static local variables  > (

[Numpy-discussion] Re: Add to NumPy a function to compute cumulative sums from 0.

2023-08-11 Thread Sebastian Berg
On Fri, 2023-08-11 at 13:43 -0400, Benjamin Root wrote: > I'm really confused. Summing from zero should be what cumsum() does > now. > What they mean is *including* the "implicit" 0 in the result. There are some old NumPy issues on this, suggesting something like a new kwarg like `include_initia

[Numpy-discussion] Re: Is there a desire to implement more functions as ufuncs? e.g. round, astype, real

2023-07-14 Thread Sebastian Berg
On Thu, 2023-07-13 at 21:53 -0500, Aaron Meurer wrote: > Does astype make sense as a ufunc? Yes and no. Implementation wise casting is practically a ufunc. But there are real semantic differences: Casting _must_ provide the exact output dtype (something that ufuncs do support, you have to pass

[Numpy-discussion] Re: Create a method to index N-dim tensors using 1D index #23992

2023-06-20 Thread Sebastian Berg
On Tue, 2023-06-20 at 12:07 -0400, Robert Kern wrote: > On Tue, Jun 20, 2023 at 11:38 AM Daniel Salles Civitarese < > sall...@br.ibm.com> wrote: > > > ### Proposed new feature or change: > > > > I work with geospatial data that requires tensors with many > > dimensions. > > One challenge I used t

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

2023-06-09 Thread Sebastian Berg
On Fri, 2022-10-28 at 10:54 +0200, Sebastian Berg wrote: > Hi all, > > As mentioned earlier, I would like to propose changing the > representation of scalars in NumPy.  Discussion and ideas on changes > are much appreciated! > > The main change is to show scalars as: &

[Numpy-discussion] Re: Precision changes to sin/cos in the next release?

2023-05-30 Thread Sebastian Berg
hat could happen and how the new trade-offs would be. - Sebastian > > Overall, I feel this is a rather invasive change to NumPy that > affects results that have been stable for many years, so it warrants > careful consideration--perhaps even postponing until 2.0? > > Best regards,

[Numpy-discussion] Precision changes to sin/cos in the next release?

2023-05-30 Thread Sebastian Berg
Hi all, there was recently a PR to NumPy to improve the performance of sin/cos on most platforms (on my laptop it seems to be about 5x on simple inputs). This changes the error bounds on platforms that were not previously accelerated (most users): https://github.com/numpy/numpy/pull/23399 Th

[Numpy-discussion] Re: Categorical dtypes

2023-05-30 Thread Sebastian Berg
On Mon, 2023-05-29 at 10:55 +1000, Juan Nunez-Iglesias wrote: > Hi folks, > > Apologies if this is documented somewhere, but I haven't been able to > find it. I've read through NEP-42 [1] and skimmed NEP-41 [2], but I'm > not sure: > > (a) at what point of implementation we are, and > (b) if it's

[Numpy-discussion] Welcome Nathan Goldbaum as a Maintainer

2023-05-29 Thread Sebastian Berg
Hi all, On behalf of the steering council, I am very happy to announce that Nathan has joined us as a Maintainer! Nathan has been consistently contributing and reviewing NumPy PRs for a while and is for example actively working on a better string DType which often means diving into the NumPy core

[Numpy-discussion] Re: Giving deprecation of e.g. `float(np.array([1]))` a shot (not 0-d)

2023-05-16 Thread Sebastian Berg
On Tue, 2023-05-16 at 11:46 -0400, Warren Weckesser wrote: > On 4/21/23, Sebastian Berg wrote: > > On Thu, 2023-04-20 at 20:17 +0200, Sebastian Berg wrote: > > > On Thu, 2023-04-20 at 13:59 -0400, Warren Weckesser wrote: > > > > On 4/20/23, Sebastian

[Numpy-discussion] uint64 and int64 comparisons are now exact

2023-05-07 Thread Sebastian Berg
Hi all, Just in case anyone has an opinion. We just merged:     https://github.com/numpy/numpy/pull/23713/files That PR makes comparisons like `uint64(2**62) == int64(2**62+1)` exact. It may seem confusing, why it isn't before.  The reason is that NumPy promotes `uint64` and `int64` to `float6

[Numpy-discussion] Re: Managing integer overflow

2023-05-02 Thread Sebastian Berg
On Mon, 2023-05-01 at 17:50 +, jmsa...@gmail.com wrote: > > I think this example shows that you don't need any special > > infrastructure > > from numpy. I don't think there is going to be much appetite to > > expand our > > API in this direction. > > But I do! I'm looking for something that i

[Numpy-discussion] Re: Giving deprecation of e.g. `float(np.array([1]))` a shot (not 0-d)

2023-04-21 Thread Sebastian Berg
On Thu, 2023-04-20 at 20:17 +0200, Sebastian Berg wrote: > On Thu, 2023-04-20 at 13:59 -0400, Warren Weckesser wrote: > > On 4/20/23, Sebastian Berg wrote: > > > Hi all, > > > > > > > > > > > > > In [64]: np.float64(np.array([0.0])) &

[Numpy-discussion] Re: Giving deprecation of e.g. `float(np.array([1]))` a shot (not 0-d)

2023-04-20 Thread Sebastian Berg
On Thu, 2023-04-20 at 13:59 -0400, Warren Weckesser wrote: > On 4/20/23, Sebastian Berg wrote: > > Hi all, > > > > > > In [64]: np.float64(np.array([0.0])) > :1: DeprecationWarning: Conversion of > an array with ndim > 0 to a scalar is deprecated, an

[Numpy-discussion] Giving deprecation of e.g. `float(np.array([1]))` a shot (not 0-d)

2023-04-20 Thread Sebastian Berg
Hi all, Unlike conversions of 0-d arrays via:     float(np.array([1])) conversions of 1-D or higher dimensional arrays with a single element are a bit strange:     float(np.array([1])) And deprecating it has come up often enough with many in favor, but also many worried about the possible ann

[Numpy-discussion] Re: broadcasting question

2023-03-23 Thread Sebastian Berg
On Wed, 2023-03-22 at 12:00 -0400, Robert Kern wrote: > On Wed, Mar 22, 2023 at 9:34 AM Neal Becker > wrote: > > > I have a function F > > def F(a, b): > >     c = a * b > > > > Initially, a is a scalar, b[240,3000].  No problem. > > Later I want to use F, where a[240] is a vector.  I want to al

[Numpy-discussion] Re: Dispatching on `where=` in `__array_ufunc__`?

2023-03-22 Thread Sebastian Berg
On Mon, 2023-03-13 at 11:22 +0100, Sebastian Berg wrote: > Hi all, > > Without concerns voiced, I will probbaly merge the PR: > >     https://github.com/numpy/numpy/pull/23240 I put this PR in, if it turns out there are issues or general dislike, please let us know and we

[Numpy-discussion] Re: `dtype` parameter in `clip` method

2023-03-17 Thread Sebastian Berg
On Fri, 2023-03-17 at 07:44 +, Ralf Gommers wrote: > On Thu, Mar 16, 2023 at 7:57 PM Sergio Callegari < > sergio.calleg...@gmail.com> > wrote: > > > I am trying to use the `clip` method to transform floats to > > integers with > > clipping. I was expecting to be able to do both the clipping an

[Numpy-discussion] Dispatching on `where=` in `__array_ufunc__`?

2023-03-13 Thread Sebastian Berg
Hi all, Without concerns voiced, I will probbaly merge the PR: https://github.com/numpy/numpy/pull/23240 soon. It proposes to dispatch also on the `where=` argument to ufuncs for __array_ufunc__. This allows a use-case of an "uncertainty" boolean array (which is not really boolean). I gues

[Numpy-discussion] Re: deprecation of product, cumproduct, alltrue, sometrue functions

2023-03-07 Thread Sebastian Berg
On Tue, 2023-03-07 at 12:17 +, Ralf Gommers wrote: > On Mon, Mar 6, 2023 at 8:12 AM Sebastian Berg < > sebast...@sipsolutions.net> > wrote: > > > On Thu, 2023-03-02 at 15:20 +, Ralf Gommers wrote: > > > Hi all, > > > > > > In https:/

[Numpy-discussion] Re: deprecation of product, cumproduct, alltrue, sometrue functions

2023-03-06 Thread Sebastian Berg
On Thu, 2023-03-02 at 15:20 +, Ralf Gommers wrote: > Hi all, > > In https://github.com/numpy/numpy/pull/23314 I am deprecating four > functions: `product`, `cumproduct`, `alltrue`, `sometrue`. These are > all > aliases (for `prod`, `cumprod`, `all` and `any`), were already not > part of > the

[Numpy-discussion] Re: Introducing `np.types`

2023-02-15 Thread Sebastian Berg
On Fri, 2023-02-10 at 10:34 -0700, Nathan wrote: > On Fri, Feb 10, 2023 at 3:31 AM Sebastian Berg < > sebast...@sipsolutions.net> > wrote: > > > Hi all, > > > > I was wondering if we should introduce a new `np.types` namespace.  > > The > > mai

[Numpy-discussion] Re: Introducing `np.types`

2023-02-15 Thread Sebastian Berg
On Tue, 2023-02-14 at 13:07 -0800, Stefan van der Walt wrote: > On Tue, Feb 14, 2023, at 12:27, Ralf Gommers wrote: > > Okay, as long as we keep in mind that it should contain all these > > not-for-main-namespace functions/classes, it seems fine with me. We > > can live with two namespaces (`types`

[Numpy-discussion] Re: Introducing `np.types`

2023-02-13 Thread Sebastian Berg
On Sat, 2023-02-11 at 11:24 +, Ralf Gommers wrote: > On Fri, Feb 10, 2023 at 5:35 PM Nathan > wrote: > > > > > > > > Small bikeshed: the name np.types indicates to me that it has > > something to > > do with static typing. If this namespace only includes dtype > > classes, then > > np.dty

[Numpy-discussion] Introducing `np.types`

2023-02-10 Thread Sebastian Berg
Hi all, I was wondering if we should introduce a new `np.types` namespace. The main reason is that we have the DType classes, that most users don't need to worry about. These mirror the scalar classes, but getting them is weird currently. I never wanted to put these in the top-level (because I

[Numpy-discussion] Re: Standard for dtype string representation?

2023-02-08 Thread Sebastian Berg
On Wed, 2023-02-08 at 17:08 +0100, Francesc Alted wrote: > On Wed, Feb 8, 2023 at 3:19 PM Sebastian Berg < > sebast...@sipsolutions.net> > wrote: > > > On Wed, 2023-02-08 at 14:31 +0100, Francesc Alted wrote: > > > On Wed, Feb 8, 2023 at 1:42 PM Sebastian Berg &

[Numpy-discussion] Re: Standard for dtype string representation?

2023-02-08 Thread Sebastian Berg
On Wed, 2023-02-08 at 14:31 +0100, Francesc Alted wrote: > On Wed, Feb 8, 2023 at 1:42 PM Sebastian Berg < > sebast...@sipsolutions.net> > wrote: > > > On Wed, 2023-02-08 at 12:48 +0100, Francesc Alted wrote: > > > Hi, > > > > > > > >

[Numpy-discussion] Re: Standard for dtype string representation?

2023-02-08 Thread Sebastian Berg
On Wed, 2023-02-08 at 12:48 +0100, Francesc Alted wrote: > Hi, > > > Is there a way (or an ongoing effort) to express the variety of data > types > in NumPy that beats the above (which seems somewhat inconsistent to > me)? How about using the Python buffer interface format string (maybe with

[Numpy-discussion] Road to NumPy 2.0

2023-01-11 Thread Sebastian Berg
t changes will be done to make this worthwhile. * Status: Planning * Champion: Matti Picus (?), Sebastian Berg (?) * Severity: Severe (for maintainers without a plan), typical for users * Affects: Library maintainers, some users * Notes:Many users may have issues if pip installing a very

[Numpy-discussion] Re: ndarray.sort x86 dispatch

2023-01-05 Thread Sebastian Berg
On Wed, 2023-01-04 at 04:06 +, Peter Schneider-Kamp wrote: > Hi guys, > > I am trying to understand how the x86 dispatch for ndarray sort > works. The following call in Line 137 of > numpy/core/src/npysort/quicksort.cpp returns 0 for my test cases: > > if (x86_dispatch::quicksort(start, num))

[Numpy-discussion] Re: Vectorize matrix-vector product with multiple matrices of the same size (like np.linalg.solve does ...)

2022-12-22 Thread Sebastian Berg
On Wed, 2022-12-21 at 14:58 +0100, Thibaut Lunet wrote: > Hi everyone, > > I want to vectorize multiple matrix-vector products and avoid a for > loop, a little bit like np.linalg.solve does, for instance : > > > dimension > 2. > > Since np.linalg.solve does this vectorization naturally, I

[Numpy-discussion] array.any() and array.all() always returning boolean values?

2022-12-14 Thread Sebastian Berg
Hi all, TL;DR: If nobody has concerns, I think we may give always returning boolean values for `any()` and `all()` a shot soon (for object input). Today in the triage meeting, and generally once in a while it comes up that: object_arr.any() object_arr.all() should always return boolean

[Numpy-discussion] Re: Addition of useful new functions from the array API specification

2022-12-12 Thread Sebastian Berg
On Mon, 2022-12-12 at 18:20 -0500, Warren Weckesser wrote: > On 12/12/22, Aaron Meurer wrote: > > On Mon, Dec 12, 2022 at 8:46 AM Sebastian Berg > > wrote: > > > > > > On Wed, 2022-12-07 at 14:21 -0700, Aaron Meurer wrote: > > > > Hi all. >

[Numpy-discussion] Re: Addition of useful new functions from the array API specification

2022-12-12 Thread Sebastian Berg
On Wed, 2022-12-07 at 14:21 -0700, Aaron Meurer wrote: > Hi all. > > As discussed in today's community meeting, I plan to start working on > adding some useful functions to NumPy which are part of the array API > standard https://data-apis.org/array-api/latest/index.html. > > Although these are a

[Numpy-discussion] Re: Create `np.exceptions` for new exceptions in NumPy?

2022-12-02 Thread Sebastian Berg
On Fri, 2022-11-11 at 14:46 +0100, Sebastian Berg wrote: > Hi all, > > I want to add a new exception or two.  It is a longer story, that you > can find at the bottom :). > > Lets create a namespace for custom errors!  I don't want to propose > new > exceptions that j

[Numpy-discussion] Re: ANN: NumPy Fellowship Program & Sayed Adel as our first Developer in Residence

2022-12-02 Thread Sebastian Berg
On Fri, 2022-12-02 at 03:42 +0200, Sayed Adel wrote: > I feel delighted and more motivated to work. I am now working on > accepting the new reality and organize the tasks entrusted to me. > Thanks > to the NumPy team who supported me from the beginning until now. It is very exciting to have you

[Numpy-discussion] Behavior of round(array)

2022-11-30 Thread Sebastian Berg
Hi all, there is a discussion about how `round(array)` should behave in: https://github.com/numpy/numpy/issues/6248 There is some discussion about object arrays which should probably be fixed for `around()` in that ago. Otherwise, the is the question what to do about the fact that: * round

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

2022-11-30 Thread Sebastian Berg
On Tue, 2022-11-29 at 14:51 -0700, Aaron Meurer wrote: > On Fri, Nov 25, 2022 at 9:36 AM Sebastian Berg > wrote: > > > > Hi all, > > > > I would like to formally propose accepting NEP 51.  Without any > > concern > > voiced, we will consider it accept

[Numpy-discussion] Re: Adding bit_count ufunc

2022-11-25 Thread Sebastian Berg
Thanks for bringing this up again. The Python method exists and it seems like relatively basic functionality. Overall, I am slightly in favor of adding the ufunc. So if nobody voices an opinion that it doesn't seem a good fit for NumPy, I would be happy to move forward with it. - Sebastian PS

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

2022-11-25 Thread Sebastian Berg
I plan on adding a brief note on about helping with doc updates to NEP when accepting it. Ross was planning to add a table of changed examples, although I don't think that is necessary for accepting. Cheers, Sebastian On Fri, 2022-10-28 at 10:54 +0200, Sebastian Berg wrote: > Hi all, &

[Numpy-discussion] Re: status of long double support and what to do about it

2022-11-18 Thread Sebastian Berg
On Thu, 2022-11-17 at 17:48 -0800, Stephan Hoyer wrote: > On Thu, Nov 17, 2022 at 5:29 PM Scott Ransom > wrote: > > > > > > Hi Scott, > > Thanks for sharing your feedback! > > Would you or some of your colleagues be open to helping maintain a > library > that adds the 80-bit extended preci

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

2022-11-16 Thread Sebastian Berg
Hi again, On Tue, 2022-10-25 at 11:41 +0200, Sebastian Berg wrote: > Hi all, > > I would like to expose more of the ufunc internals in the following > PR: > >     https://github.com/numpy/numpy/pull/22422/ Just to note that this PR is now merged and scheduled for release (w

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

2022-11-11 Thread Sebastian Berg
ways available to discuss such possibilities, there are some corners w.r.t. to such bit-sized thoughts which are still shrouded in fog. - Sebastian > > Greg > > [1] Specifically, this is for very low bandwidth satellite data where > we > try to pack as much information in the

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

2022-11-11 Thread Sebastian Berg
On Fri, 2022-11-11 at 17:03 +0300, Evgeni Burovski wrote: > > (2) a more important one, the `.c.src` format. In SciPy we got rid > > of it, and we're not going to make Meson understand an ad-hoc > > templating method that only NumPy uses. So we have two choices: > > also get rid of it, or write a n

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

2022-11-11 Thread Sebastian Berg
uss in NumPy issues or directly). - Sebastian > > BR Oscar > > Den tors 10 nov. 2022 kl 15:13 skrev Sebastian Berg < > sebast...@sipsolutions.net>: > > > On Thu, 2022-11-10 at 14:55 +0100, Oscar Gustafsson wrote: > > > Den tors 10 nov. 2022 kl 13

[Numpy-discussion] Create `np.exceptions` for new exceptions in NumPy?

2022-11-11 Thread Sebastian Berg
Hi all, I want to add a new exception or two. It is a longer story, that you can find at the bottom :). Lets create a namespace for custom errors! I don't want to propose new exceptions that just get dumped in to the main namespace, so why not make one like `errors` in pandas or `exceptions` in

[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

[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: 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: 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-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 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] 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] 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] 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] 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] 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: 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] 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] 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: 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] 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-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] 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: 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] 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: 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: 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] 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] 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] 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] 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: 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: 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: 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

  1   2   3   4   5   6   7   >