scilib/pdm.py: implement Phase Dispersion Minimization

The Monte Carlo stuff can make it pretty slow.