before merge with master
parent
c8646712c0
commit
be6449f27d
|
@ -18,7 +18,7 @@ public class MixNetwork {
|
||||||
int[] permutation = randomPermutation.permutation;
|
int[] permutation = randomPermutation.permutation;
|
||||||
int n = permutation.length;
|
int n = permutation.length;
|
||||||
assert ((n & n-1) == 0); //n == 2^k
|
assert ((n & n-1) == 0); //n == 2^k
|
||||||
int layers = (int)(2*Math.log(n)/Math.log(2));
|
int layers = (int)(2*Math.log(n)/Math.log(2)) - 1;
|
||||||
|
|
||||||
int[] pi, piL, piR;
|
int[] pi, piL, piR;
|
||||||
Queue<int[]> permutationsQueue = new ArrayBlockingQueue<int[]>(n);
|
Queue<int[]> permutationsQueue = new ArrayBlockingQueue<int[]>(n);
|
||||||
|
@ -40,8 +40,8 @@ public class MixNetwork {
|
||||||
piR = new int[iDiv2];
|
piR = new int[iDiv2];
|
||||||
for (int k = 0; k < iDiv2; k++) // k == switch index in permutation j
|
for (int k = 0; k < iDiv2; k++) // k == switch index in permutation j
|
||||||
{
|
{
|
||||||
index1 = k + j;
|
index1 = k + (j << 1);
|
||||||
index2 = k + j + iDiv2;
|
index2 = index1 + iDiv2;
|
||||||
switches[layers - layer - 1][k + j] = new Switch(index1,index2,layers - layer - 1,graph.getSwitchValue(k, true));
|
switches[layers - layer - 1][k + j] = new Switch(index1,index2,layers - layer - 1,graph.getSwitchValue(k, true));
|
||||||
switches[layer][k + j] = new Switch(index1,index2,layer,graph.getSwitchValue(k, false));
|
switches[layer][k + j] = new Switch(index1,index2,layer,graph.getSwitchValue(k, false));
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class MixNetworkTest {
|
||||||
public void testMixNetwork() throws Exception{
|
public void testMixNetwork() throws Exception{
|
||||||
|
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
int logn = random.nextInt()%10 + 5;
|
int logn = 10;
|
||||||
|
|
||||||
int n = 1 << logn;
|
int n = 1 << logn;
|
||||||
int layers = 2*logn - 1;
|
int layers = 2*logn - 1;
|
||||||
|
|
Loading…
Reference in New Issue