Exchanged numpy.sum + **2 with numpy.dot which is faster