Re: [Numpy-discussion] ndrange, like range but multidimensiontal

2018-10-11 Thread Mark Harfouche
I’m really open to these kinds of array extensions but, I (personally) just don’t know how to do this efficiently. I feel like ogrid and mgrid are probably enough for people that want think kind of feature. My implementation would just be based on python primitives which would yield performance si

Re: [Numpy-discussion] ndrange, like range but multidimensiontal

2018-10-11 Thread Eric Wieser
If you use this as the dtype, you both set and get element as tuples. Elements are not got as tuples, but they can be explicitly cast What about it makes tuple coercion awkward? This explicit cast >>> dt_ind2d = np.dtype([('i0', np.intp), ('i1', np.intp)]) >>> ind = np.zeros((), dt_ind2d)[0] >>

Re: [Numpy-discussion] ndrange, like range but multidimensiontal

2018-10-11 Thread Eric Wieser
Isn’t that what arange is for? Imagining ourselves in python2 land for now - I’m proposing arange is to range, as ndrange is to xrange I’m not convinced it should return an ndarray I agree - I think it should return a range-like object that: - Is convertible via __array__ if needed - Look

[Numpy-discussion] LaTeX version of boolean indexing

2018-10-11 Thread Matthew Harrigan
Hello, I am documenting some code, translating the core of the algorithm to LaTeX. The style I have currently is very similar to the einsum syntax (which is awesome btw). Here is an example of some of the basic operations in

Re: [Numpy-discussion] LaTeX version of boolean indexing

2018-10-11 Thread Andras Deak
On Thu, Oct 11, 2018 at 6:54 PM Matthew Harrigan wrote: > > Hello, > > I am documenting some code, translating the core of the algorithm to LaTeX. > The style I have currently is very similar to the einsum syntax (which is > awesome btw). Here is an example of some of the basic operations in N

Re: [Numpy-discussion] LaTeX version of boolean indexing

2018-10-11 Thread Matthew Harrigan
My apologies, never write code directly in an email... s/b: mask = np.array([1, 0, 1], dtype=bool) What do you mean by indicator? On Thu, Oct 11, 2018 at 1:31 PM Andras Deak wrote: > On Thu, Oct 11, 2018 at 6:54 PM Matthew Harrigan > wrote: > > > > Hello, > > > > I am documenting some code, tr

Re: [Numpy-discussion] LaTeX version of boolean indexing

2018-10-11 Thread Andras Deak
On Thu, Oct 11, 2018 at 7:45 PM Matthew Harrigan wrote: > > What do you mean by indicator? > I mostly meant what wikipedia seems to call "set-builder notation" (https://en.wikipedia.org/wiki/Set-builder_notation#Sets_defined_by_a_predicate). Since your "input" is `{x_i | i in [0,1,2]}` but your o

Re: [Numpy-discussion] ndrange, like range but multidimensiontal

2018-10-11 Thread Mark Harfouche
Eric, interesting ideas. > __getitem__(Tuple[int]) which returns numpy scalars I'm not sure what you mean. Even if you supply a numpy uint8 to range, it still returns a python int class. Would you like ndrange to return a tuple of `uint8` in this case? ``` In [3]: a = iter(range(np.uint8(10)))

Re: [Numpy-discussion] ndrange, like range but multidimensiontal

2018-10-11 Thread Eric Wieser
I’m not sure if we ever want the ndrange object to return a full matrix. np.array(ndrange(...)) should definitely return a full array, because that’s what the user asked for. Even if you supply a numpy uint8 to range, it still returns a python int class. If we want to design ndrange with the int

Re: [Numpy-discussion] ndrange, like range but multidimensiontal

2018-10-11 Thread Mark Harfouche
> If we want to design ndrange with the intent of indexing only This is the only use I had in mind. But I feel like you are able to envision different use cases. > Whatever we pick, the return value should be such that > np.array(ndrange(...))[ind] == ndrange(...)[idx] I can see the appeal to t

[Numpy-discussion] BIDS/NumPy dev meetings, Wednesdays 12pm Pacific

2018-10-11 Thread Stefan van der Walt
Hi everyone, The team at BIDS meets once a week to discuss progress, priorities, and roadblocks. While our priorities are broadly determined by the project roadmap [0], we would like to provide an opportunity for the community to give more regular and detailed feedback on our work. We therefore