Timeline for What is the equivalent of MATLAB's accumarray?
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 13 at 18:26 | comment | added | eldo |
Shorter: Merge[Mean]@Thread[a -> b]
|
|
Aug 18, 2017 at 13:59 | vote | accept | Kay | ||
Aug 18, 2017 at 12:50 | history | edited | Henrik Schumacher | CC BY-SA 3.0 |
edited body
|
Aug 18, 2017 at 9:07 | comment | added | J. M.'s missing motivation♦ |
Probably the only thing I would have done differently would be to put in sparseresult = SparseArray[a -> b]; sparseresult["NonzeroValues"] (or even SparseArray[a -> b] @ "NonzeroValues" if you like things terse) as the second argument to Internal`WithLocalSettings[] ; as mentioned in the answer I linked to, whatever is in the second argument is automatically returned. But, your way works too.
|
|
Aug 18, 2017 at 1:41 | comment | added | Henrik Schumacher | @J.M.: Thanks for the hint! I have incorporated it into the answer and also into my own utility package. | |
Aug 18, 2017 at 1:39 | history | edited | Henrik Schumacher | CC BY-SA 3.0 |
added 69 characters in body
|
Aug 17, 2017 at 15:39 | comment | added | J. M.'s missing motivation♦ |
For safety, one might consider using Internal`WithLocalSettings[] (see e.g. this) when playing around with SetSystemOptions[] .
|
|
Aug 17, 2017 at 15:06 | history | edited | Henrik Schumacher | CC BY-SA 3.0 |
deleted 9 characters in body
|
Aug 17, 2017 at 15:06 | comment | added | Henrik Schumacher | None. I removed it. | |
Aug 17, 2017 at 15:03 | comment | added | Kay |
What is the purpose of Flatten@b in groupbyresult ? b already has a flattened form?!
|
|
Aug 17, 2017 at 14:53 | history | answered | Henrik Schumacher | CC BY-SA 3.0 |