def count_tied_groups(x, use_missing=False):
    nmasked = ma.getmask(x).sum()
    # We need the copy as find_repeats will overwrite the initial data
    data = ma.compressed(x).copy()
    (ties, counts) = find_repeats(data)
    nties = {}
    if len(ties):
        nties = dict(zip(np.unique(counts), itertools.repeat(1)))
        nties.update(dict(zip(*find_repeats(counts))))

    if nmasked and use_missing:
        try:
            nties[nmasked] += 1
        except KeyError:
            nties[nmasked] = 1

    return nties
.. todo::
dataset/ETHPy150Open scipy/scipy/scipy/stats/mstats_basic.py/count_tied_groups--crossover with--dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/models/dbm/ising.py/IsingVisible.set_biases