Skip to content

Instantly share code, notes, and snippets.

@vlavorini
Created August 13, 2017 19:50
Show Gist options
  • Save vlavorini/5f811189da184a3a1900d5e982d2d9f6 to your computer and use it in GitHub Desktop.
Save vlavorini/5f811189da184a3a1900d5e982d2d9f6 to your computer and use it in GitHub Desktop.
def _dist_poinc(a, b):
num=np.dot(a-b, a-b)
den1=1-np.dot(a,a)
den2=1-np.dot(b,b)
return np.arccosh(1+ 2* (num) / (den1*den2))
def dist_poinc(a, A):
res=np.empty(A.shape[0])
for i, el in enumerate(A):
res[i]=_dist_poinc(a, el)
return res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment