Example #1
0
        public void HaltonRationalPrimesTest()
        {
            var g = new Generator("HaltonRationalPrimesTest");

            foreach (var item in Subrandom.HaltonR(3).Take(100))
            {
                System.Diagnostics.Trace.WriteLine($"{item[0]}, {item[1]}, {item[2]}");
            }
        }
Example #2
0
        public void HaltonDecimalTest()
        {
            var g = new Generator("HaltonDecimalTest");

            foreach (var item in Subrandom.HaltonM(new[] { 2, 3 }).Take(100))
            {
                System.Diagnostics.Trace.WriteLine($"{item[0]}, {item[1]}");
            }
        }
Example #3
0
        public void HammersleyRationalPrimesTest()
        {
            var g = new Generator("HammersleyRationalPrimesTest");

            foreach (var item in Subrandom.HammersleyR(2, 256))
            {
                System.Diagnostics.Trace.WriteLine($"{item[0]}, {item[1]}");
            }
        }
Example #4
0
        public void SobolRationalCodeTest()
        {
            var s = Subrandom.SobolR(13, 1, 1, 1, 3, 11);

            foreach (var item in s.Take(1000))
            {
                System.Diagnostics.Trace.WriteLine(item);
            }
        }
Example #5
0
        public void SobolInitialValues(int max)
        {
            int d = 2;
            var g = new Generator("SobolInitialValue");
            var v = new bool[max + 1][];

            v[0]    = new bool[max];
            v[0][0] = true;

            foreach (var p in PolyGF2.GetAllPrimitive().Take(max - 1))
            {
                v[d - 1] = new bool[max];
                int s = p.Degree;
                var m = new int[s];
                var V = new SquareMatrixGF2(d);

                while (true)
                {
                    for (int i = 0; i < s; i++)
                    {
                        m[i] = g.Int32(2 << i) | 1;
                    }
                    var dv = Subrandom.SobolDirectionVectors(max, p, m);

                    for (int i = 0; i < max; i++)
                    {
                        v[d - 1][i] = dv[i] > (ulong)long.MaxValue;
                    }

                    for (int row = 0; row < d; row++)
                    {
                        for (int col = 0; col < d; col++)
                        {
                            V[row, col] = v[row][col];
                        }
                    }
                    bool det = V.GetDeterminant();
                    if (det)
                    {
                        break;
                    }
                }

                Trace.Write($"{d}\t{s}\t{p.GetCode() / 2 ^ (1UL << (s-1))}\t");
                for (int i = 0; i < s; i++)
                {
                    Trace.Write($"{m[i]} ");
                }
                Trace.WriteLine("");
                d++;
            }
        }
Example #6
0
        public void SobolRationalTest()
        {
            var p = new PolyGF2(3, 1, 0);
            var m = new[] { 1, 3, 7 };

            foreach (var item in Subrandom.SobolR(p, m).Take(1000))
            {
                System.Diagnostics.Trace.WriteLine(item);
            }

            var g = new Generator("SobolRationalTest");

            Test(g, () => Subrandom.SobolR(p, m));
        }
Example #7
0
        public void AdditiveRecurrenceSZeroAlphaDecimalTest()
        {
            var g = new Generator("AdditiveRecurrenceSZeroAlphaDecimalTest");

            Test(g, () => Subrandom.AdditiveRecurrence(g.Decimal(), g.Decimal()));
        }
Example #8
0
        public void AdditiveRecurrenceSingleTest()
        {
            var g = new Generator("AdditiveRecurrenceSingleTest");

            Test(g, () => Subrandom.AdditiveRecurrenceF());
        }
Example #9
0
        public void AdditiveRecurrenceGeneratorDoubleTest()
        {
            var g = new Generator("AdditiveRecurrenceGeneratorDoubleTest");

            Test(g, () => Subrandom.AdditiveRecurrenceD(g));
        }
Example #10
0
        public void AdditiveRecurrenceSZeroAlphaSingleTest()
        {
            var g = new Generator("AdditiveRecurrenceSZeroAlphaSingleTest");

            Test(g, () => Subrandom.AdditiveRecurrence(g.Single(), g.Single()));
        }
Example #11
0
 public void AdditiveRecurrenceSZeroHighAlphaSingleTest()
 {
     Test(null, () => Subrandom.AdditiveRecurrence(1F, 0.5F));
 }
Example #12
0
        public void VanDerCorputRationalBase3Test()
        {
            var g = new Generator("VanDerCorputRationalBase3Test");

            Test(g, () => Subrandom.VanDerCorputR(3));
        }
Example #13
0
 public void AdditiveRecurrenceHighSZeroDoubleTest()
 {
     Test(null, () => Subrandom.AdditiveRecurrence(0.5D, 1D));
 }
Example #14
0
        public void VanDerCorputDecimalBase2Test()
        {
            var g = new Generator("VanDerCorputDecimalBase2Test");

            Test(g, () => Subrandom.VanDerCorputM(2));
        }
Example #15
0
 public void AdditiveRecurrenceNullGeneratorDoubleTest()
 {
     Test(null, () => Subrandom.AdditiveRecurrenceD((Generator)null));
 }
Example #16
0
 public void AdditiveRecurrenceLowAlphaDoubleTest()
 {
     Test(null, () => Subrandom.AdditiveRecurrence(0D));
 }
Example #17
0
 public void AdditiveRecurrenceLowAlphaDecimalTest()
 {
     Test(null, () => Subrandom.AdditiveRecurrence(0M));
 }
Example #18
0
 public void AdditiveRecurrenceNullGeneratorDecimalTest()
 {
     Test(null, () => Subrandom.AdditiveRecurrenceM((Generator)null));
 }
Example #19
0
        public void AdditiveRecurrenceDecimalTest()
        {
            var g = new Generator("AdditiveRecurrenceDecimalTest");

            Test(g, () => Subrandom.AdditiveRecurrenceM());
        }
Example #20
0
        public void VanDerCorputSingleBase3Test()
        {
            var g = new Generator("VanDerCorputSingleBase3Test");

            Test(g, () => Subrandom.VanDerCorputF(3));
        }
Example #21
0
 public void AdditiveRecurrenceHighSZeroSingleTest()
 {
     Test(null, () => Subrandom.AdditiveRecurrence(0.5F, 1F));
 }
Example #22
0
        public void AdditiveRecurrenceAlphaDoubleTest()
        {
            var g = new Generator("AdditiveRecurrenceAlphaDoubleTest");

            Test(g, () => Subrandom.AdditiveRecurrence(g.Double()));
        }
Example #23
0
 public void AdditiveRecurrenceSZeroHighAlphaDecimalTest()
 {
     Test(null, () => Subrandom.AdditiveRecurrence(1M, 0.5M));
 }
Example #24
0
 public void AdditiveRecurrenceHighSZeroDecimalTest()
 {
     Test(null, () => Subrandom.AdditiveRecurrence(0.5M, 1M));
 }
Example #25
0
 public void AdditiveRecurrenceSZeroHighAlphaDoubleTest()
 {
     Test(null, () => Subrandom.AdditiveRecurrence(1D, 0.5D));
 }