Skip to content

Rewrite Gini coefficient in O(n log n) - #937

Open
russlan23 wants to merge 1 commit into
QuantEcon:mainfrom
russlan23:agent/rewrite-gini-nlogn
Open

Rewrite Gini coefficient in O(n log n)#937
russlan23 wants to merge 1 commit into
QuantEcon:mainfrom
russlan23:agent/rewrite-gini-nlogn

Conversation

@russlan23

Copy link
Copy Markdown

Replaces the quadratic pairwise implementation with the sorted closed-form calculation requested in #926. This removes the module's only prange use and the parallel=True compilation path that blocks the in-browser runtime.

The existing Pareto and Weibull assertions remain unchanged. I added a fixed-array regression against the pairwise definition.

Validation:

  • pytest -q quantecon/tests/test_inequality.py — 4 passed
  • flake8 --select=F401,F405,E231 quantecon
  • Independent agreement checks against the pairwise definition for n = 4, 10, 100, and 1,000

The separate Phase 0 browser deployment in #928 is still open, so that project-level browser check remains outstanding.

Closes #926.

AI assistance: Used for implementation support and test execution; I reviewed the diff and validation results.

@mmcky

mmcky commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

thanks for your PR @russlan23

@kp992 can you please review this as part of the WASM project

@mmcky mmcky added the review label Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WASM: remove @njit(parallel=True) from gini_coefficient via an O(n log n) rewrite

3 participants