vectorize for "m" loop (no of training examples)

increased speed order of magnitude