Skip to content

Performance Improvement and Robustness#4

Open
LeanderSilur wants to merge 3 commits into
volkerp:masterfrom
LeanderSilur:patch-1
Open

Performance Improvement and Robustness#4
LeanderSilur wants to merge 3 commits into
volkerp:masterfrom
LeanderSilur:patch-1

Conversation

@LeanderSilur
Copy link
Copy Markdown

Added performance improvements for the magnitude.
This post says:

%timeit np.apply_along_axis(np.linalg.norm, 1, vectors)
# Output: 100 loops, best of 3: 2.39 ms per loop

%timeit np.sqrt((vectors ** 2).sum(-1))[..., np.newaxis]
# Output: 10000 loops, best of 3: 13.8 us per loop

Normalize method now won't fail, if the input has no length.

Added performance improvements for the magnitude.
This [post](https://stackoverflow.com/a/12712725) says:

    %timeit np.apply_along_axis(np.linalg.norm, 1, vectors)
    # Output: 100 loops, best of 3: 2.39 ms per loop
    
    %timeit np.sqrt((vectors ** 2).sum(-1))[..., np.newaxis]
    # Output: 10000 loops, best of 3: 13.8 us per loop

Normalize method now won't fail, if the input has no length.
@LeanderSilur
Copy link
Copy Markdown
Author

Typo.

@LeanderSilur LeanderSilur reopened this Sep 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant