def compute_rotations_from_accumulators(A, mu, count, num_buckets):

    V, D = mu.shape

    # For each cluster, use accumulator variables to estimate covariance matrix
    # and compute rotation matrix
    for i in xrange(V):

        # Normalize
        num_points = count[i]
        mu[i] /= num_points

        # Compute covariance estimator
        cov = (A[i] + A[i].transpose()) / (2 * (num_points - 1)) - np.outer(mu[i], mu[i])

        # Compute eigenvalues, reuse A matrix
        if num_points < D:
            logger.warn('Fewer points (%d) than dimensions (%d) in rotation computation for cluster %d' % (num_points, D, i))
            eigenvalues = np.ones(D)
            A[i] = np.eye(D)
        else:
            eigenvalues, A[i] = np.linalg.eigh(cov)

        # Permute eigenvectors to balance variance in subquantizers
        permuted_inds = eigenvalue_allocation(num_buckets, eigenvalues)
        A[i] = A[i, :, permuted_inds]

    return A, mu
L{util.switchUID} calls L{util.initgroups} and then C{os.setuid} with
dataset/ETHPy150Open yahoo/lopq/python/lopq/model.py/compute_rotations_from_accumulators--crossover with--dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/python/test/test_util.py/SwitchUIDTest.test_uid