Example #1
0
        /// <summary>
        /// Creates the matrix determined by a permutation
        /// </summary>
        /// <param name="src">The source permutation</param>
        public static BitMatrix8 ToBitMatrix(this Perm <N8> src)
        {
            var dst = BitMatrix8.Alloc();

            for (var row = 0; row < src.Length; row++)
            {
                dst[row, src[row]] = Bit.On;
            }
            return(dst);
        }
Example #2
0
        public static BitMatrix8 bmm(BitMatrix8 lhs, BitMatrix8 rhs)
        {
            var dst = BitMatrix8.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);
        }