Besides being the area under the ROC curve, AUC is has a slightly less known interpretation:
If you choose a random pair of samples (one positive and one negative) - AUC is the probability that the positive-sample score is above the negative-sample score.
Here we compute the AUC by counting these pairs.
Lior Kirsch (2020). Fast AUC (https://www.mathworks.com/matlabcentral/fileexchange/50962-fast-auc), MATLAB Central File Exchange. Retrieved .