Skip to content

Commit

Permalink
DOCS: math
Browse files Browse the repository at this point in the history
  • Loading branch information
brunobeltran committed Jun 3, 2019
1 parent 8a11519 commit 4fb8776
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nuc_chain/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
def r2(r, axis=None):
"""Calculate the instantaneous r^2 along a given axis.
r.shape == (N,3) ==> r2(r, axis=0) would give the r^2"""
r.shape == (N,3) ==> r2(r, axis=0) would give the r^2 of shape (N,)"""
zero = [slice(None)]*len(r.shape) # [:,:,...,:]
zero[axis] = slice(0, 1) # [:,:,..,0,..,:]
return np.sum(np.power(r - r[zero], 2), axis=1-axis)
Expand Down

0 comments on commit 4fb8776

Please sign in to comment.