Maximum for SArray



Is there a way to call maximum along multiple dimensions so that it works for StaticArrays.SArray, and also in a type-stable way? MWE:

# setup code
using StaticArrays
dims = (2,3,5)
A = randn(dims...)
SA = SArray(Size(dims...)(A))

# type-stable version for that also works for SA?
vec(maximum(A, dims = (2, 3)))


I think you’d have to write a new method for _mapreduce that accepts dims other than colon or a single number.