示例#1
0
文件: tbv_perm.cs 项目: 0xCM/arrows
 public void perm64()
 {
     for (var j = 0; j < SampleSize; j++)
     {
         var p1 = Random.Perm(n64);
         var v1 = Random.BitVector64();
         var v2 = v1.Replicate(p1);
         for (var i = 0; i < v1.Length; i++)
         {
             Claim.eq(v1[p1[i]], v2[i]);
         }
     }
 }
示例#2
0
        void dot64_check()
        {
            for (var i = 0; i < SampleSize; i++)
            {
                var x = Random.BitVector64();
                var y = Random.BitVector64();
                var a = x % y;
                var b = ModProd(x, y);
                Claim.yea(a == b);

                var zx = x.ToGeneric();
                var zy = y.ToGeneric();
                var c  = zx % zy;
                Claim.yea(a == c);
            }
        }
示例#3
0
        public void bmv_64x64x8()
        {
            for (var sample = 0; sample < SampleSize; sample++)
            {
                var A = Random.BitMatrix64();
                var x = Random.BitVector64();
                var z = A * x;
                var y = BitVector64.Alloc();
                for (var i = 0; i < A.RowCount; i++)
                {
                    var r = A.RowVector(i);
                    y[i] = r % x;
                }



                Claim.yea(z == y);
            }
        }
示例#4
0
        public void bvrank_64()
        {
            void Test()
            {
                var x   = Random.BitVector64();
                var pos = Random.Next(1, 50);

                var actual = x.Rank(pos);
                var expect = 0u;

                for (var i = 0; i <= pos; i++)
                {
                    expect += (x[i] ? 1u : 0u);
                }
                Claim.eq(expect, actual);
            }

            Verify(Test);
        }