[Numpy-discussion] Re: Assessment of the difficulty in porting CPU architecture for numpy

2023-11-17 Thread Ralf Gommers
Hi Xuanbao, On Thu, Nov 16, 2023 at 2:59 PM xuanbao via NumPy-Discussion < numpy-discussion@python.org> wrote: > Hello everyone! I am working on implementing a tool to assess the > complexity of CPU architecture porting. It primarily focuses on RISC-V > architecture porting. In fact, the tool may

[Numpy-discussion] next NumPy Optimization Team meeting

2023-11-17 Thread Inessa Pawson
The next NumPy Optimization Team meeting will be held on Monday, November 20th at 4pm UTC. Join us via Zoom: https://numfocus-org.zoom.us/j/88162122074?pwd=a3h0cTZubzlLcTZzMVhCL1AxUVFMdz09 . Everyone is welcome and encouraged to attend. To add to the meeting agenda the topics you’d like to discuss,

[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 Robert Kern
On Fri, Nov 17, 2023 at 1:54 PM Stefan van der Walt via NumPy-Discussion < numpy-discussion@python.org> wrote: > 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 >

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

2023-11-17 Thread Aaron Meurer
On Fri, Nov 17, 2023 at 12:10 PM Robert Kern wrote: > > On Fri, Nov 17, 2023 at 1:54 PM Stefan van der Walt via NumPy-Discussion > wrote: >> >> Hi all, >> >> I am trying to sample k N-dimensional vectors from a uniform distribution >> without replacement. >> It seems like this should be straigh

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

2023-11-17 Thread Robert Kern
On Fri, Nov 17, 2023 at 4:15 PM Aaron Meurer wrote: > On Fri, Nov 17, 2023 at 12:10 PM 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

[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 Robert Kern
On Fri, Nov 17, 2023 at 5:34 PM Stefan van der Walt wrote: > 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. > If you're going to do the set-checking yourself, then you don't ne

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

2023-11-17 Thread Aaron Meurer
rng.integers() (or np.random.randint) lets you specify lists for low and high. So you can just use rng.integers((0,)*len(dims), dims). Although I'm not seeing how to use this to generate a bunch of vectors at once. I would have thought something like size=(10, dims) would let you generate 10 vecto

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

2023-11-17 Thread Robert Kern
On Fri, Nov 17, 2023 at 7:11 PM Aaron Meurer wrote: > rng.integers() (or np.random.randint) lets you specify lists for low > and high. So you can just use rng.integers((0,)*len(dims), dims). > > Although I'm not seeing how to use this to generate a bunch of vectors > at once. I would have thought

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

2023-11-17 Thread Dom Grigonis
Is numba solution an option for you? > On 17 Nov 2023, at 20:49, Stefan van der Walt via NumPy-Discussion > wrote: > > 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

[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