-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scalar type for broadcasting #18379
Comments
@TotalVerb, can you give an example of where you needed this? |
Wouldn't storing something in a 0-dimensional array do the trick? |
After #16986 you might also wrap the array with a tuple as pointed out here #17411 (comment). |
That's a good point; this |
@stevengj The current implementation of |
@stevengj An example of where I needed this is to support broadcasting for Another example is given in the README for Scalars.jl. |
(An aside: I don't think you need to define |
@stevengj It's to override the method inherited from |
Oh, right. |
A simpler solution, that wouldn't require us to define any new types, is for |
Related: #18271 (comment), wherein I proposed using |
I'm worried that the compiler may not be able to eliminate the allocation of a Ref. |
@StefanKarpinski, since you access a ref with @TotalVerb, in the rare cases where the heap allocation of a |
Put another way, I tend to think that |
@stevengj I think that's a very sane approach. |
FYI I'm working on a StaticArrays implementation over at JuliaArrays/StaticArrays.jl#50 (it made sense there since this is basically an immutable version of |
I'd really like this before 1.0; I'll try to make a PR soon.
Aside from being a problem with |
Also, while
|
Confusion about https://discourse.julialang.org/t/how-to-select-multiple-items-using-dataframesmeta/16231/2 Just echoing that it would be nice if we had a |
Note that one option we've discussed, without having a new type, is to define |
Here's a minimal implementation of a Is there still interest in putting such a thing Base? I could try opening a PR if people are interested. |
I found myself needing a
Scalar
type for broadcasting purposes, to trickbroadcast
into not trying to broadcast something, even though it is a matrix. An initial (bad) implementation is here.With #16986 close to merging, I wonder if such a feature would be desirable in
Base
.The text was updated successfully, but these errors were encountered: