Ejemplo n.º 1
0
        Task <uint[]> Collect(uint[] state, ulong width, int points)
        {
            return(Task.Factory.StartNew((Func <uint[]>)(() =>
            {
                var dst = MemorySpan.Alloc <uint>(points);

                var src = Z0.Rng.XOr128((ReadOnlySpan <uint>)state);
                var subseq = RngX.SubSeq <uint>(src, (int)Pow2.T14, (ulong)width, (int)points);
                var total = BigInteger.Zero;

                for (var i = 0; i < points; i++)
                {
                    (var idx, var value) = subseq[i];
                    total += idx;

                    print(appMsg($"src[{i.ToString().PadLeft(3,'0')}:{total.ToString().PadLeft(12,'0')}] = {value.FormatHex()}"));
                }

                return dst;
            })));
        }
Ejemplo n.º 2
0
 public static Matrix <M, N, T> Alloc <M, N, T>(M m = default, N n = default, T exemplar = default)
     where M : ITypeNat, new()
     where N : ITypeNat, new()
     where T : unmanaged
 => new Matrix <M, N, T>(MemorySpan.Alloc <T>(nati <M>() * nati <N>()));
Ejemplo n.º 3
0
 public static Vector <T> Alloc <T>(int minlen, T?fill = null)
     where T : unmanaged
 => new Vector <T>(MemorySpan.Alloc <T>(minlen, fill));