-
-
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
array recycling/bsxfun-like operator #436
Comments
Another alternative is to define a type like |
|
StefanKarpinski
pushed a commit
that referenced
this issue
Feb 8, 2018
Temporarily disable the OffsetArrays tests for 0.7
KristofferC
added a commit
that referenced
this issue
Jul 3, 2018
cmcaine
pushed a commit
to cmcaine/julia
that referenced
this issue
Nov 11, 2022
* Add debug.md Co-authored-by: Angelika Tyborska <angelikatyborska@fastmail.com> * Update exercises/shared/.docs/debug.md Co-authored-by: Angelika Tyborska <angelikatyborska@fastmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Having some kind of array recycling (as e.g. in R) for some (all?) binary operators can aid vectorized computation. (Rather, it allows one to write code without thinking too much about vectorization.) I am not sure that R's version of this Does The Right Thing, however:
bsxfun
, instead of considering a multidimensional array as a single vector and recycling modulo its length. For example, I often deal with multidimensional (5d or higher) arrays; to compute a Z-score 'along' dimensiondim
, in Matlab I can writex_zscore = bsxfun(@rdivide,bsxfun(@minus,x,mean(x,dim)),std(x,1,dim))
. While this is agnostic to the dimensionality ofx
and the value indim
, it is a right PITA to read. It would be preferrable to have, instead,x_zscore = (x - mean(x,dim)) / std(x,1,dim)
.Perhaps there should be some way to 'turn on' this kind of recycling in a given scope, which would result in overloading of the binary operators. (And perhaps this mechanism could support other kinds of recycling, e.g. R style.)
The text was updated successfully, but these errors were encountered: