예제 #1
0
파일: tbm_andnot.cs 프로젝트: 0xCM/arrows
        public void AndNot8()
        {
            var lhs = Random.BitMatrix8();
            var rhs = lhs.Replicate();

            Claim.yea(lhs.AndNot(rhs).IsZero());
        }
예제 #2
0
 public void bmm_8x8()
 {
     for (var i = 0; i < SampleSize; i++)
     {
         var m1 = Random.BitMatrix8();
         var m2 = m1.Replicate();
         var m3 = Random.BitMatrix8();
         var m4 = m2 * m3;
         var m5 = BitRef.bmm(m1, m3);
         Claim.yea(m4 == m5);
     }
 }
예제 #3
0
 void CycleColExtract8(int cycles = DefaltCycleCount)
 {
     for (var j = 0; j < cycles; j++)
     {
         var src = Random.BitMatrix8();
         for (var c = 0; c < src.ColCount; c++)
         {
             var col = src.ColVector(c);
             for (var r = 0; r < src.RowCount; r++)
             {
                 Claim.eq(col[r], src[r, c]);
             }
         }
     }
 }
예제 #4
0
        public void bmm_8x8_bench()
        {
            var opcount = RoundCount * CycleCount;
            var sw      = stopwatch(false);
            var last    = BitMatrix8.Zero;

            for (var i = 0; i < opcount; i++)
            {
                var m1 = Random.BitMatrix8();
                var m2 = Random.BitMatrix8();
                sw.Start();
                last = m1 * m2;
                sw.Stop();
            }

            Collect((opcount, snapshot(sw), "bmm_8x8"));
        }
예제 #5
0
        public void bmv_8x8()
        {
            for (var sample = 0; sample < SampleSize; sample++)
            {
                var m  = Random.BitMatrix8();
                var c  = Random.BitVector8();
                var z1 = m * c;
                var z2 = BitVector8.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 bm_unpack_8x8x8_8x8x8()
        {
            var dst = Matrix.Alloc <N8, byte>();
            var m   = dst.ColCount;
            var n   = dst.RowCount;

            for (var sample = 0; sample < SampleSize; sample++)
            {
                var src = Random.BitMatrix8();
                BitMatrix.unpack(src, ref dst);

                for (var i = 0; i < m; i++)
                {
                    for (var j = 0; j < n; j++)
                    {
                        Claim.eq(src[i, j], dst[i, j] == 0 ? Bit.Off : Bit.On);
                    }
                }
            }
        }