Does Stan has a function similar to the Apply function in R?

Do we have a Stan function that works similar to the R Apply functions (

map_rect in Stan is somewhat similar to sapply but less so to apply unless you write your two-dimensional structure as an array or row_vectors or column vectors.

Thank you very much!
I’m a little confused about the parallelization of map_rect in Stan. Is it doing things like MPI via multi-thread or CPU? Or using a single thread with all arrays of data and parameters loaded together to reduce the communication cost from memory to caches?

You can do MPI, it is easier to get threading to work, or you could use it serially. I was just saying that conceptually it is like sapply in that you are applying a function to each element of an array (which is like a homogenous R list).