-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shakemap functions #6624
Shakemap functions #6624
Conversation
Refactor if/else order so that all loops and calculations are skipped if corr='no'
Use numpy function to multiply matrices instead of for loops. Improve performance more than 10x.
Also, there are two more "direct" ways to calculate the LLT matrix in the cholesky function, which however give no performance improvement: using: it is possible to get LLT
or
Without any direct performance or readability improvement I didn't see a reason to include those changes. I can include them however if you want. |
I like this. |
else: | ||
cross_matrix = numpy.eye(M) | ||
if corr == 'full': | ||
cross_matrix = numpy.full((M, M), 0.99999) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would need a comment here explaining the magic number 0.99999
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took the magic number from line 214 of the original code.
I can only guess that there is some numerical reason? "Not quite 1"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, it was there from the beginning. Let's me accept the PR as it is, then.
My results of trying to improve performance of the correlation calculations for shakemaps.