示例#1
0
文件: tbm_andnot.cs 项目: 0xCM/arrows
        public void AndNot32()
        {
            var lhs = Random.BitMatrix32();
            var rhs = lhs.Replicate();

            Claim.yea(lhs.AndNot(rhs).IsZero());
        }
示例#2
0
        public void eq32()
        {
            var x = Random.BitMatrix32();
            var y = Random.BitMatrix32();

            Claim.nea(x.Equals(y));
            Claim.yea(x.Equals(x));
            Claim.yea(y.Equals(y));
        }
示例#3
0
 public void bmm_32x32()
 {
     for (var i = 0; i < SampleSize; i++)
     {
         var m1 = Random.BitMatrix32();
         var m2 = m1.Replicate();
         var m3 = Random.BitMatrix32();
         var m4 = m2 * m3;
         var m5 = BitRef.bmm(m1, m3);
         Claim.yea(m4 == m5);
     }
 }
示例#4
0
 void CycleColExtract32(int cycles = DefaltCycleCount)
 {
     for (var j = 0; j < cycles; j++)
     {
         var src = Random.BitMatrix32();
         for (var c = 0; c < src.ColCount; c++)
         {
             var col = src.ColVec(c);
             for (var r = 0; r < src.RowCount; r++)
             {
                 Claim.eq(col[r], src[r, c]);
             }
         }
     }
 }
示例#5
0
        public void bmv_32x32()
        {
            for (var sample = 0; sample < SampleSize; sample++)
            {
                var m  = Random.BitMatrix32();
                var c  = Random.BitVector(n32);
                var z1 = m * c;
                var z2 = BitVector32.Alloc();
                for (var i = 0; i < m.RowCount; i++)
                {
                    var r = m.RowVector(i);
                    z2[i] = r % c;
                }

                Claim.yea(z1 == z2);
            }
        }
示例#6
0
        public void bmm_32x32_bench()
        {
            var last    = BitMatrix32.Zero;
            var sw      = stopwatch(false);
            var opcount = RoundCount * CycleCount;

            var dst = BitMatrix32.Alloc();

            for (var i = 0; i < opcount; i++)
            {
                var m1 = Random.BitMatrix32();
                var m3 = Random.BitMatrix32();
                sw.Start();
                last = BitMatrixOps.Mul(in m1, in m3, ref dst);
                sw.Stop();
            }

            Collect((opcount, snapshot(sw), "bmm_32x32_prealloc"));
        }