/// <summary> /// Creates the matrix determined by a permutation /// </summary> /// <param name="src">The source permutation</param> public static BitMatrix16 ToBitMatrix(this Perm <N16> src) { var dst = BitMatrix16.Alloc(); for (var row = 0; row < src.Length; row++) { dst[row, src[row]] = Bit.On; } return(dst); }
public static BitMatrix16 bmm(BitMatrix16 lhs, BitMatrix16 rhs) { var dst = BitMatrix16.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); }
/// <summary> /// Performs no allocation during the benchmark period /// </summary> /// <param name="sw">The counter</param> void bm_xor_16x16_bench_noalloc(SystemCounter sw = default) { var opname = "bm_xor_16x16"; var last = BitMatrix16.Alloc(); for (var i = 0; i < OpCount; i++) { var A = Random.BitMatrix(n16); var B = Random.BitMatrix(n16); sw.Start(); BitMatrix.xor(in A, in B, ref last); sw.Stop(); } Benchmark(opname, sw); }
public static BitMatrix16 From <T>(Vector256 <T> src) where T : struct => BitMatrix16.From(ByteSpan.FromValue(src));
public static ref Matrix <N16, T> unpack <T>(BitMatrix16 src, ref Matrix <N16, T> dst) where T : unmanaged { gbits.unpack(src.Data, dst.Data.AsSpan()); return(ref dst); }