fixed routine calculate_local_matrix_size. now, gather works collectly