Builds  mxm matrix. Entry at i,j has #i>j - #i<j
        :param ranks:
        :return: mxm matrix

def _build_mat(self, ranks, n_candidates, prefcounts):
        """
        Builds  mxm matrix. Entry at i,j has #i>j - #i<j
        :param ranks:
        :return: mxm matrix
        """

        mat = zeros((n_candidates, n_candidates))
        for i, j in itertools.combinations(range(n_candidates), 2):
            preference = ranks[:, i] - ranks[:, j]
            h_ij = dot((preference < 0), prefcounts)  # prefers i to j
            h_ji = dot((preference > 0), prefcounts)  # prefers j to i
            mat[i, j] = h_ij - h_ji
            mat[j, i] = h_ji - h_ij
        return mat