Exemplo n.º 1
0
        /// <summary>
        /// Creates the matrix determined by a permutation
        /// </summary>
        /// <param name="src">The source permutation</param>
        public static BitMatrix64 ToBitMatrix(this Perm <N64> src)
        {
            var dst = BitMatrix64.Alloc();

            for (var row = 0; row < src.Length; row++)
            {
                dst[row, src[row]] = Bit.On;
            }
            return(dst);
        }
Exemplo n.º 2
0
        public static BitMatrix64 bmm(BitMatrix64 lhs, BitMatrix64 rhs)
        {
            var dst = BitMatrix64.Alloc();

            rhs = rhs.Transpose();
            for (var i = 0; i < lhs.RowCount; i++)
            {
                var row = lhs.RowVector(i);
                for (var j = 0; j < rhs.ColCount; j++)
                {
                    var col = rhs.RowVector(j);
                    dst[i, j] = ModProd(row, col);
                }
            }
            return(dst);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Performs no allocation during the benchmark period
        /// </summary>
        /// <param name="sw">The counter</param>
        void bm_xor_64x64_bench_noalloc(SystemCounter sw = default)
        {
            var opname = "bm_xor_64x64";
            var last   = BitMatrix64.Alloc();

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

            Benchmark(opname, sw);
        }