Mean: avoid unneeded array copy
One memcpy
on the mean values can be omitted in update_global_mean
if the temporary array contains the starting values of mean->mean
instead of the global mean, i.e., instead of
global_mean = copy(mean->mean)
global_mean[i] = update(mean->mean[i], mean_rank[i]), i=1,2...,n
copy(destination=mean->mean, source=global_mean)
do
old_mean = copy(mean->mean)
mean->mean[i] = update(old_mean[i], mean_rank[i]), i=1,2,...,n
Edited by Christoph Conrads