There's no function in numpy for that. Just divide the vector by its length. v_hat = v / (v**2).sum()**0.5. or v_hat = v / np.linalg.norm(v).
確定! 回上一頁