difference between the fraction of sample points in one of those
subsets and the volume of that subset. There are different definitions of
discrepancy corresponding to different collections of subsets. Some
versions take a root mean square difference over subsets instead of
a maximum.

A measure of uniformity is reasonable if it satisfies the following
criteria [1]_:

1. It is invariant under permuting factors and/or runs.
2. It is invariant under rotation of the coordinates.
3. It can measure not only uniformity of the sample over the hypercube,
   but also the projection uniformity of the sample over non-empty
   subset of lower dimension hypercubes.
4. There is some reasonable geometric meaning.
5. It is easy to compute.
6. It satisfies the Koksma-Hlawka-like inequality.
7. It is consistent with other criteria in experimental design.

Four methods are available:

* ``CD``: Centered Discrepancy - subspace involves a corner of the
  hypercube
* ``WD``: Wrap-around Discrepancy - subspace can wrap around bounds
* ``MD``: Mixture Discrepancy - mix between CD/WD covering more criteria
* ``L2-star``: L2-star discrepancy - like CD BUT variant to rotation

See [2]_ for precise definitions of each method.

Lastly, using ``iterative=True``, it is possible to compute the
discrepancy as if we had :math:`n+1` samples. This is useful if we want
to add a point to a sampling and check the candidate which would give the
lowest discrepancy. Then you could just update the discrepancy with
each candidate using `update_discrepancy`. This method is faster than
computing the discrepancy for a large number of candidates.

References
----------
.. [1] Fang et al. "Design and modeling for computer experiments".
   Computer Science and Data Analysis Series, 2006.
.. [2] Zhou Y.-D. et al. "Mixture discrepancy for quasi-random point sets."
   Journal of Complexity, 29 (3-4) , pp. 283-301, 2013.
.. [3] T. T. Warnock. "Computational investigations of low discrepancy
   point sets." Applications of Number Theory to Numerical
   Analysis, Academic Press, pp. 319-343, 1972.

Examples
--------
Calculate the quality of the sample using the discrepancy:

>>> import numpy as np
>>> from scipy.stats import qmc
>>> space = np.array([[1, 3], [2, 6], [3, 2], [4, 5], [5, 1], [6, 4]])
>>> l_bounds = [0.5, 0.5]
>>> u_bounds = [6.5, 6.5]
>>> space = qmc.scale(space, l_bounds, u_bounds, reverse=True)
>>> space
array([[0.08333333, 0.41666667],
       [0.25      , 0.91666667],
       [0.41666667, 0.25      ],
       [0.58333333, 0.75      ],
       [0.75      , 0.08333333],
       [0.91666667, 0.58333333]])
>>> qmc.discrepancy(space)
0.008142039609053464

We can also compute iteratively the ``CD`` discrepancy by using
``iterative=True``.

>>> disc_init = qmc.discrepancy(space[:-1], iterative=True)
>>> disc_init
0.04769081147119336
>>> qmc.update_discrepancy(space[-1], space[:-1], disc_init)
0.008142039609053513

rh