[Numpy-discussion] How to sample unique vectors

2023-11-17 Thread Stefan van der Walt via NumPy-Discussion
Hi all, I am trying to sample k N-dimensional vectors from a uniform distribution without replacement. It seems like this should be straightforward, but I can't seem to pin it down. Specifically, I am trying to get random indices in an d0 x d1 x d2.. x dN-1 array. I thought about sneaking in a

[Numpy-discussion] Re: How to sample unique vectors

2023-11-17 Thread Stefan van der Walt via NumPy-Discussion
On Fri, Nov 17, 2023, at 11:07, Robert Kern wrote: > If the arrays you are drawing indices for are real in-memory arrays for > present-day 64-bit computers, this should be adequate. If it's a notional > array that is larger, then you'll need actual arbitrary-sized integer > sampling. The builtin

[Numpy-discussion] Re: How to sample unique vectors

2023-11-17 Thread Stefan van der Walt via NumPy-Discussion
On Fri, Nov 17, 2023, at 14:28, Stefan van der Walt wrote: > Attached is a script that implements this solution. And the version with set duplicates checking. Stéfan import random import functools import itertools import operator import numpy as np def cumulative_prod(arr): return list(ite

[Numpy-discussion] Re: How to sample unique vectors

2023-11-17 Thread Stefan van der Walt via NumPy-Discussion
On Fri, Nov 17, 2023, at 16:52, Robert Kern wrote: > That optimistic optimization makes this the fastest solution. That'd work great, thanks Robert, Aaron, and everyone who shared input. Stéfan___ NumPy-Discussion mailing list -- numpy-discussion@pytho

[Numpy-discussion] Re: Meson - C extension - Finding numpy includes in virtual env

2023-11-25 Thread Stefan van der Walt via NumPy-Discussion
Hi Doug, On Sat, Nov 25, 2023, at 07:14, Doug Turnbull wrote: > Unfortunately the following command fails: > > incdir_numpy = run_command(py, > ['-c', 'import numpy; print(numpy.get_include())'], > capture: true, > check: false, > ).stdout().strip() In your repo it says stderr, but the ver

[Numpy-discussion] Re: Meson - C extension - Finding numpy includes in virtual env

2023-11-26 Thread Stefan van der Walt via NumPy-Discussion
Hi Doug, On Sun, Nov 26, 2023, at 06:29, Doug Turnbull wrote: > To debug, I ran `pip install . --no-build-isolation` it worked (using venv's > numpy) When developing NumPy, we typically build in the existing environment. This is done either via `pip install -e .` (which installs hooks to trigge

[Numpy-discussion] Re: Meson - C extension - Finding numpy includes in virtual env

2023-11-26 Thread Stefan van der Walt via NumPy-Discussion
On Sun, Nov 26, 2023, at 12:03, Nathan wrote: > For my work I tend to use a persistent build directory with build isolation > disabled as discussed in the meson-python docs. Out of curiosity, how is this different from, e.g., `spin build` which builds into `./build-install`? Stéfan

[Numpy-discussion] Re: Meson - C extension - Finding numpy includes in virtual env

2023-11-28 Thread Stefan van der Walt via NumPy-Discussion
Hi Nathan, On Tue, Nov 28, 2023, at 08:42, Nathan wrote: > It looks like `spin build` does `meson build` and `meson install` and doesn't > do `pip install`. I'd like numpy to be importable in a python environment of > my choosing, so I tend to instead manually install numpy into that > environm

[Numpy-discussion] Re: welcome Raghuveer, Chris, Mateusz and Matt to the NumPy maintainers team

2024-01-26 Thread Stefan van der Walt via NumPy-Discussion
On Fri, Jan 26, 2024, at 12:04, Ralf Gommers wrote: > We've got four new NumPy maintainers! Welcome to the team, and > congratulations to: > > - Raghuveer Devulapalli (https://github.com/r-devulap) > - Chris Sidebottom (https://github.com/mousius) > - Mateusz Sokół (https://github.com/mtsokol/) >

[Numpy-discussion] Re: New DType and ArrayMethod C APIs are public

2024-02-14 Thread Stefan van der Walt via NumPy-Discussion
On Wed, Feb 14, 2024, at 14:34, Nathan wrote: > The DType API publicly exposes the PyArray_DTypeMeta C struct, which > represents DType metaclasses. It also exposes a function for registering > user-defined DTypes and a set of slot IDs and function typedefs that users > can implement in C to wri

[Numpy-discussion] Re: Improved 2DFFT Approach

2024-03-14 Thread Stefan van der Walt via NumPy-Discussion
Hi Alexander, On 2024-03-14 22:43:38, Alexander Levin via NumPy-Discussion wrote: Memory Usage - https://github.com/2D-FFT-Project/2d-fft/blob/testnotebook/notebooks/memory_usage.ipynb Timing comparisons(updated) - https://github.com/2D-FFT-Project/2d-fft/blob/testnotebook/notebooks/comparis

[Numpy-discussion] Re: Policy on AI-generated code

2024-07-04 Thread Stefan van der Walt via NumPy-Discussion
On Thu, Jul 4, 2024, at 08:18, Daniele Nicolodi wrote: > I wish it for be common sense for contributors to an open source > codebase that they need to own the copyright on their contributions, but > I don't think it can be assumed. Adding something to these lines to the > project policy has also

[Numpy-discussion] Re: numpy-user-dtypes updated for NumPy 2.0

2024-07-17 Thread Stefan van der Walt via NumPy-Discussion
Hi Nathan, On Tue, Jul 16, 2024, at 12:24, Nathan wrote: > I just pushed some commits to the numpy-user-dtypes repo > (https://github.com/numpy/numpy-user-dtypes) that fixes compatibility with > the public version of the DType API that shipped in NumPy 2.0. If you’ve been > waiting for some run

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

2024-08-19 Thread Stefan van der Walt via NumPy-Discussion
On Mon, Aug 19, 2024, at 03:00, Sebastian Berg wrote: > please join me in welcoming Joren (https://github.com/jorenham) to the > NumPy maintainers team. Thanks for your contributions, Joren, great to have you on board! Stéfan ___ NumPy-Discussion mailin

[Numpy-discussion] Re: What should remain on PyPi

2024-09-03 Thread Stefan van der Walt via NumPy-Discussion
Hi Chuck, On Tue, Sep 3, 2024, at 08:18, Charles R Harris wrote: > I just got through deleting a bunch of pre-releases on PyPi and it occurred > to me that we should have a policy as to what releases should be kept. I > think that reproducibility requires that we keep all the major and micro >

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

2024-10-08 Thread Stefan van der Walt via NumPy-Discussion
On Mon, Oct 7, 2024, at 06:04, Rohit Goswami wrote: > I second Matti's comments about the validity of endorsing things we don't > implement. I don't think it is possible to make ecosystem-wide recommendation that will fit each project like a glove. At best, we can try to come together as a com

[Numpy-discussion] Re: Add a bit_width function

2025-03-06 Thread Stefan van der Walt via NumPy-Discussion
Hi Carlos, On Thu, Mar 6, 2025, at 10:08, Carlos Martin wrote: > Feature request: Add a `bit_width` function to NumPy's [bit-wise > operations](https://numpy.org/doc/stable/reference/routines.bitwise.html) > that computes the [bit-width](https://en.wikipedia.org/wiki/Bit-width) > (also called b