The legacy algorithm (use_fast=False) uses an O(N**2) implementation
which provides exact results and is reliable for all dataset sizes,
including small inputs and cases with ties. However, it requires a O(N**2)
memory allocations, and so may not work for very large arrays (N>10000).
The fast algorithm (use_fast=True) implements an O(N log N)
approximation which is optimized for large datasets. It is not intended
for small sample sizes (N < 10) or datasets with a high proportion of
ties, as it may yield numerically unstable or inaccurate results in these
cases. For such inputs, prefer use_fast=False to ensure correctness.
If NaNs are present in the input when use_fast=True, the result will be
NaN. To preserve legacy behavior, a number may be returned when
use_fast=False.
If the size of y is less than 3 and use_fast=True, the result will
be NaN. To preserve legacy behavior, a value may be returned when
use_fast=False.
Small numerical differences are possible based on the choice of algorithm.