Let's imagine I have an array my_array
whose elements are instances of myType
, so the array type is given by Array{myType,1}
.
Now let's say each instance of myType
within my_array
has some field x
that stores a vector of data (e.g. typeof(instance_of_myType.x) == Array{Float32,1}
).
If I know the different fields x
of each instance of the myType
struct in the Array have the same size, is there a way I can broadcast a function (e.g. averaging or summing) across the different fields x
of all the instances of myType
in the array, that will give me a single Array{Float32,1}
vector, that is the resulting of applying the function to all the x
fields of the structs within my_array
? Is there a way to do this without a for-loop, is basically what I'm asking?