def _deterministic_vector_sign_flip(u):
 max_abs_rows = np.argmax(np.abs(u), axis=1)
 signs = np.sign(u[(range(u.shape[0]), max_abs_rows)])
 u *= signs[:, np.newaxis]
 return u

def _deterministic_vector_sign_flip ( u ) : max_abs_rows = np . argmax ( np . abs ( u ) , axis = 1 ) signs = np . sign ( u [ ( range ( u . shape [ 0 ] ) , max_abs_rows ) ] ) u *= signs [ : , np . newaxis ] return u
modify the sign of vectors for reproducibility flips the sign of elements of all the vectors such that the absolute maximum element of each vector is positive .