public void create_8x8() { var src = Random.Stream<ulong>().Take(Pow2.T07).GetEnumerator(); while(src.MoveNext()) { var m1 = BitMatrix8.From(src.Current); var n = new N8(); var m2 = BitMatrix.Load(n,n, src.Current.ToBytes()); for(var i=0; i<8; i++) for(var j=0; j<8; j++) Claim.eq(m1[i,j], m2[i,j]); } }
/// <summary> /// Defines a binary polynomial of natural degree N = 8 /// </summary> /// <param name="degree">The degree of the polynomial</param> /// <param name="exponents">The exponent values for nonzero coefficients</param> public static GfPoly <N8, ushort> Poly(N8 degree, params byte[] exponents) => Poly <N8, ushort>(exponents);
public static BitVector8 BitVector(this IPolyrand random, N8 n) => random.Next <byte>();
public static BitBlock <BitBlock8> ToBitBlock(this BitString src, N8 n) => BitBlock.FromSpan <BitBlock8>(src.BitSeq);
public static BitVector8 ToBitVector(this BitString src, N8 n) => BitVector8.FromBitString(src);
public static BitVector8 ToBitVector(this ushort src, N8 n) => (byte)src;
public static BitVector8 ToBitVector(this byte src, N8 n) => src;
public static BitVector8 ToBitVector(this sbyte src, N8 n) => (byte)src;
public static BitMatrix8 BitMatrix(this IPolyrand random, N8 n) => Z0.BitMatrix8.From(random.Next <ulong>());