Skip to content

Instantly share code, notes, and snippets.

@zeffii
Created February 5, 2017 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeffii/7fd0c1ba5661a3d4ca9f75c3bdd6393f to your computer and use it in GitHub Desktop.
Save zeffii/7fd0c1ba5661a3d4ca9f75c3bdd6393f to your computer and use it in GitHub Desktop.
hugglu
import svrx
from svrx.util.transforms import vector_norm
import numpy as np
u = np.array(
[
[1,1,1],
[2,2,2]
]
)
new_u = np.empty(np.shape(u))
for idx, v in enumerate(u):
new_u[idx] = v / np.sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2])
print(new_u)
A = np.power(u, 2)
B = np.sum(A, axis=1)
C = np.sqrt(B)
D = u / C
print(D)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment