fastest way to create Average array from multiple arrays of numbers

Viewed 4467

I have multiple input arrays of Float all of equal size and a single dimension. I want to create a single output Array that contains the average of all the input arrays.

e.g.

//input arrays
float[] array1 = new float[] { 1, 1, 1, 1 };
float[] array2 = new float[] { 2, 2, 2, 2 };
float[] array3 = new float[] { 3, 3, 3, 3 };
float[] array4 = new float[] { 4, 4, 4, 4 };

//the output should be
float[2.5, 2.5, 2.5, 2.5]

I would also like to calculate the standard deviation of the input arrays to.

What is the fastest approach to do this task?

Thanks in advance. Pete

4 Answers
Related