The linear algebra of pairwise comparisons