This repository provides code for fast computation of the Gini coefficient using the bsxfun function in Matlab, plus a faster code based on sorting for cases where N is very large. A slower code using explicit calculation and a double 'for' loop is provided to illustrate the speed gains.