示例#1
0
文件: t_shuffle.cs 项目: 0xCM/arrows
        public void Shuffle1()
        {
            var  src  = Perm.Identity(24);
            Perm dst0 = src;
            Perm dst1 = Random.Shuffle(src.Replicate());
            Perm dst2 = Random.Shuffle(src.Replicate());
            Perm dst3 = Random.Shuffle(src.Replicate());

            Claim.eq(dst1.Length, src.Length);
            Claim.eq(dst2.Length, src.Length);
            Claim.eq(dst3.Length, src.Length);
        }
示例#2
0
文件: tbm_create.cs 项目: 0xCM/arrows
        public void permrev_64x64()
        {
            for(var i= 0; i<SampleSize; i++)
            {
                //Creates an "exchange" matrix            
                var perm = Perm.Identity(n64).Reverse();
                var mat = perm.ToBitMatrix();

                var v1 = Random.BitVector(n64);
                var v2 = mat * v1;
                var v3 = v1.Replicate();
                v3.Reverse();
                Claim.eq(v3,v2);
            }
        }
示例#3
0
文件: t_perm.cs 项目: 0xCM/arrows
        OpTime Shuffle(int n, int count, out int duplicates)
        {
            duplicates = 0;

            var sw = stopwatch();
            var p0 = Perm.Identity(n);
            var p1 = Random.Shuffle(in p0);
            var p2 = Random.Shuffle(in p0);

            for (var i = 0; i < count; i++)
            {
                p1 = Random.Shuffle(in p1);
                p2 = Random.Shuffle(in p2);
                if (p1 == p2)
                {
                    duplicates++;
                }
            }

            return(count, snapshot(sw));
        }