Esempio n. 1
0
        public void bm_transpose_16x16x16()
        {
            var m1 = Random.BitMatrix(n16);
            var m2 = m1.Transpose();
            var m3 = m2.Transpose();

            Claim.yea(m3 == m1);
        }
Esempio n. 2
0
        public void bm_transpose_8x8x8()
        {
            var m1 = Random.BitMatrix(n8);
            var m2 = m1.Transpose();
            var m3 = m2.Transpose();

            Claim.yea(m1 == m3);
        }
Esempio n. 3
0
 public void VectorExtract()
 {
     check_extract(Random.BitMatrix <N9, N9, byte>());
     check_extract(Random.BitMatrix <N9, N9, ushort>());
     check_extract(Random.BitMatrix <N128, N128, uint>());
     check_extract(Random.BitMatrix <N16, N128, uint>());
     check_extract(Random.BitMatrix <N5, N7, uint>());
 }
Esempio n. 4
0
        public void bm_transpose_32x32x32()
        {
            var m1 = Random.BitMatrix(n32);
            var m2 = m1.Transpose();
            var m3 = m2.Transpose();

            Claim.yea(m3 == m1);
        }
Esempio n. 5
0
        public void bm_transpose_64x64x64()
        {
            var m1 = Random.BitMatrix(n64);
            var m2 = m1.Transpose();
            var m3 = m2.Transpose();

            Claim.yea(m3 == m1);
        }
Esempio n. 6
0
        public void bm_rowswap_32x32x32()
        {
            var m1 = Random.BitMatrix(n32);
            var m2 = m1.Replicate();

            m2.RowSwap(0, 1);
            m2.RowSwap(1, 2);
            m2.RowSwap(2, 3);

            Claim.yea(m1.RowVector(0) == m2.RowVector(3));
        }
Esempio n. 7
0
 public void bm_and_64x64x64g_check()
 {
     for (var i = 0; i < SampleSize; i++)
     {
         var A  = Random.BitMatrix <N64, ulong>();
         var B  = Random.BitMatrix <N64, ulong>();
         var C1 = BitMatrix.and(in A, in B);
         var C2 = BitMatrix64.From(C1);
         var C3 = BitMatrix64.From(A) & BitMatrix64.From(B);
         Claim.yea(C2 == C3);
     }
 }
Esempio n. 8
0
 public void bm_and_32x32x32g()
 {
     for (var i = 0; i < SampleSize; i++)
     {
         var A  = Random.BitMatrix <N32, uint>();
         var B  = Random.BitMatrix <N32, uint>();
         var C1 = BitMatrix.and(in A, in B);
         var C2 = BitMatrix32.From(C1);
         var C3 = BitMatrix32.From(A) & BitMatrix32.From(B);
         Claim.yea(C2 == C3);
     }
 }
Esempio n. 9
0
 void bm_and_16x16_bench_run(SystemCounter counter = default)
 {
     //var sw = stopwatch(false);
     for (var i = 0; i < OpCount; i++)
     {
         var x = Random.BitMatrix(n16);
         var y = Random.BitMatrix(n16);
         counter.Start();
         var result = x & y;
         counter.Stop();
     }
     Benchmark("bm_and_16x16", counter);
 }
Esempio n. 10
0
        public void bm_and_64x64x64_bench()
        {
            var sw = stopwatch(false);

            for (var i = 0; i < OpCount; i++)
            {
                var x = Random.BitMatrix(n64);
                var y = Random.BitMatrix(n64);
                sw.Start();
                var result = x & y;
                sw.Stop();
            }
            Collect((OpCount, sw, "bm_and_64x64"));
        }
Esempio n. 11
0
        public void bm_and_64x64x64g_bench()
        {
            var sw = stopwatch(false);

            for (var i = 0; i < OpCount; i++)
            {
                var A = Random.BitMatrix <N64, ulong>();
                var B = Random.BitMatrix <N64, ulong>();
                sw.Start();
                var result = A & B;
                sw.Stop();
            }
            Collect((OpCount, sw, "bm_and_64x64x64g"));
        }
Esempio n. 12
0
        public void bm_and_16x16x16g_bench()
        {
            var sw = stopwatch(false);

            for (var i = 0; i < OpCount; i++)
            {
                var A = Random.BitMatrix <N16, ushort>();
                var B = Random.BitMatrix <N16, ushort>();
                sw.Start();
                var result = A & B;
                sw.Stop();
            }
            Collect((OpCount, sw, "bm_and_16x16x16g"));
        }
Esempio n. 13
0
        public void bm_and_8x8x8g_bench()
        {
            var sw = stopwatch(false);

            for (var i = 0; i < SampleSize; i++)
            {
                var A = Random.BitMatrix <N8, byte>();
                var B = Random.BitMatrix <N8, byte>();
                sw.Start();
                var result = A & B;
                sw.Stop();
            }
            Collect((SampleSize, sw, "bm_and_8x8x8g"));
        }
Esempio n. 14
0
        /// <summary>
        /// Performs no allocation during the benchmark period
        /// </summary>
        /// <param name="sw">The counter</param>
        void bm_xor_32x32_bench_noalloc(SystemCounter sw = default)
        {
            var opname = "bm_xor_32x32";
            var last   = BitMatrix32.Alloc();

            for (var i = 0; i < OpCount; i++)
            {
                var A = Random.BitMatrix(n32);
                var B = Random.BitMatrix(n32);
                sw.Start();
                BitMatrix.xor(in A, in B, ref last);
                sw.Stop();
            }

            Benchmark(opname, sw);
        }
Esempio n. 15
0
        public void bm_and_32x32x32_bench()
        {
            var sw = stopwatch(false);

            for (var i = 0; i < OpCount; i++)
            {
                var x = Random.BitMatrix(n32);
                var y = Random.BitMatrix(n32);
                sw.Start();
                var result = x & y;
                sw.Stop();
            }
            OpTime time = (OpCount, sw, "bm_and_32x32");

            Collect(time);
        }
Esempio n. 16
0
        public void bm_and_4x4_check()
        {
            for (var i = 0; i < SampleSize; i++)
            {
                var x = Random.BitMatrix(n4);
                var y = Random.BitMatrix(n4);

                var xBytes = x.Data.Replicate();
                var yBytes = y.Data.Replicate();
                var zBytes = mathspan.xor(xBytes, yBytes);
                var expect = BitMatrix4.Define(zBytes);

                var actual = x + y;
                Claim.yea(expect == actual);
            }
        }
Esempio n. 17
0
        public void bm_and_32x32_check()
        {
            for (var i = 0; i < SampleSize; i++)
            {
                var A = Random.BitMatrix(n32);
                var B = Random.BitMatrix(n32);

                var xBytes = A.Bytes.Replicate();
                var yBytes = B.Bytes.Replicate();
                var zBytes = gbitspan.and(xBytes, yBytes);
                var expect = BitMatrix32.From(zBytes);

                var C = A & B;
                Claim.yea(expect == C);
            }
        }
Esempio n. 18
0
        /// <summary>
        /// Performs allocation during each operation of the benchmark period
        /// </summary>
        /// <param name="sw">The counter</param>
        void bm_xor_16x16_bench_alloc(SystemCounter sw = default)
        {
            var opname = "bm_xor_16x16_alloc";
            var last   = default(BitMatrix16);

            for (var i = 0; i < OpCount; i++)
            {
                var A = Random.BitMatrix(n16);
                var B = Random.BitMatrix(n16);
                sw.Start();
                last = BitMatrix.xor(in A, in B);
                sw.Stop();
            }

            Benchmark(opname, sw);
        }
Esempio n. 19
0
 public void bm_xor_16x16_check()
 {
     for (var sample = 0; sample < SampleSize; sample++)
     {
         var A = Random.BitMatrix(n16);
         var B = Random.BitMatrix(n16);
         var C = BitMatrix.xor(in A, in B);
         for (var i = 0; i < C.RowCount; i++)
         {
             for (var j = 0; j < C.ColCount; j++)
             {
                 Claim.eq(C[i, j], A[i, j] ^ B[i, j]);
             }
         }
     }
 }
Esempio n. 20
0
        public void bm_iszero()
        {
            Claim.yea(BitMatrix8.Zero.IsZero());
            Claim.nea(BitMatrix8.Identity.IsZero());
            Claim.nea(Random.BitMatrix(n8).IsZero());

            Claim.yea(BitMatrix16.Zero.IsZero());
            Claim.nea(BitMatrix16.Identity.IsZero());
            Claim.nea(Random.BitMatrix(n16).IsZero());

            Claim.yea(BitMatrix32.Zero.IsZero());
            Claim.nea(BitMatrix32.Identity.IsZero());
            Claim.nea(Random.BitMatrix(n32).IsZero());

            Claim.yea(BitMatrix64.Zero.IsZero());
            Claim.nea(BitMatrix64.Identity.IsZero());
            Claim.nea(Random.BitMatrix(n64).IsZero());
        }
Esempio n. 21
0
 void bm_transpose_gn_check <M, N, T>()
     where M : ITypeNat, new()
     where N : ITypeNat, new()
     where T : unmanaged
 {
     for (var sample = 0; sample < SampleSize; sample++)
     {
         var src  = Random.BitMatrix <M, N, T>();
         var tSrc = src.Transpose();
         for (var i = 0; i < tSrc.RowCount; i++)
         {
             for (var j = 0; j < tSrc.ColCount; j++)
             {
                 Claim.eq(tSrc[i, j], src[j, i]);
             }
         }
     }
 }