Open thibautjombart opened 1 year ago
Sorry, missed this. This is not terrible to do tbh. I doubt I'll get it done in a short period of time, but it's certainly something that won't break anything.
In the meantime you can do this in odin.dust with custom C code I believe: https://github.com/mrc-ide/odin.dust/blob/master/tests/testthat/test-odin-dust.R#L424-L439 and https://github.com/mrc-ide/odin.dust/blob/master/tests/testthat/include.cpp -- I'm not sure offhand if OG odin allows passing a vector in like this. If you need to have it sweep across array dimensions though that will be unsatisfying.
This is now supported in odin2
(which will become odin
in due course): https://github.com/mrc-ide/odin2/pull/72
Great, thanks!
Context
I am trying to retrieve the largest value of an array in odin. It seems min/max accept comma-separated, atomic numbers, but do not process arrays. I feel I must be missing something obvious... any tip welcome.
Reprex
This is not my actual use-case, but a minimal example generating a vector of Poisson-distributed values and reporting the sum, or maximum value for each iteration.
Created on 2023-05-10 with reprex v2.0.2