race fuinctions vectorized (A and b)