Пример #1
0
        /// <summary>
        /// Compultes the scalar product between two bitvectors using modular arithmetic
        /// </summary>
        /// <param name="lhs">The first vector</param>
        /// <param name="rhs">The second vector</param>
        public static int ModProd(BitVector4 lhs, BitVector4 rhs)
        {
            var result = 0;

            for (var i = 0; i < lhs.Length; i++)
            {
                var x = lhs[i] ? 1 : 0;
                var y = rhs[i] ? 1 : 0;
                result += x * y;
            }
            return(result % 2);
        }
Пример #2
0
 public static BitVector4 ToBitVector(this BitString src, N4 n)
 => BitVector4.FromBitString(src);