// Lemma 4.2 private PermutationNetwork CreateTournament(int sortInaccuracy) { PermutationNetwork pn = new PermutationNetwork(1 << K); int blockSize = 1 << sortInaccuracy; // for the permutation rho PermutationGate permuteGate = new PermutationGate(GenerateArbitraryPermutation(blockSize)); pn.AppendGate(permuteGate.Copy() as Gate, 0); pn.AppendNetwork(SortingNetworkFactory.CreateButterflyTournament(blockSize), 0); return(pn); }