v2 = np.where(np.repeat(N[:, (0)] != 0, 3).reshape(1000, 3), np.cross(N, e1
    ), np.cross(N, e2))
v3 = forloop2()
(v3 == v1).all()
(v1 == v2).all()
Python - how to speed up a for loop creating a numpy array from another numpy array calculation