-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Vectorize lorenz_curve and gini #702
base: main
Are you sure you want to change the base?
Conversation
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.
Maybe add tests?
Hmm, The tests are already present in https://github.com/QuantEcon/QuantEcon.py/blob/main/quantecon/tests/test_inequality.py so I thought to skip adding them. |
Is this adding new features or refactoring the code? |
This is just refactoring the code and removing some |
@Smit-create It is usually advised to use for loops (and avoid creation of intermediate arrays) in |
I found this better in terms of time performance as this is vectorized version while the extra space complexity (creating new arrays) is still the same for both the functions -- O(n) |
@Smit-create thanks for opening this PR. Would you mind to update the top level comment box with a description of the change and document the performance improvements you mention in this thread so it's clear what this change is about. |
Thanks @mmcky. Done |
@Smit-create I haven't merged this as it isn't clear what level of performance improvement is being made. Is it 2% or 20% for example, it would be helpful to have timings between the different versions to make an assessment here. @oyamad makes a good point around |
lorenz_curve
andgini_coefficient
.