add average_matrix