Exemple #1
0
        public void Next_4DNonzeroSeed_ReturnsExpectedSequence()
        {
            SobolSequence sobol = new SobolSequence(4, 95);
            int           count = 16;

            for (int i = 0; i < count; i++)
            {
                var element = sobol.Next();
                Assert.That(element, Is.EqualTo(expectedFromIndex95[i]).Within(6E-7));
            }
        }
        public void SobolSequentialTest()
        {
            SobolSequence[] qrng = new SobolSequence[this.d];
            for (int i = 0; i < this.d; i++)
            {
                qrng[i] = new SobolSequence();
            }

            for (int i = 0; i < this.n; i++)
            {
                double[] value = new double[this.d];
                for (int j = 0; j < this.d; j++)
                {
                    value[j] = qrng[j].NextDouble();
                    Console.Write(value[j] + " ");
                    Assert.AreEqual(this.reference[i][j], value[j]);
                }
                Console.WriteLine();
            }
        }
Exemple #3
0
        public void Next_4DZeroSeed_ReturnsExpectedSequence()
        {
            SobolSequence sobol = new SobolSequence(4);
            int           count = 12;

            for (int i = 0; i < count; i++)
            {
                var element = sobol.Next();
                Assert.That(element, Is.EqualTo(expectedFromIndex0[i]));
            }

            // fast-forward to index 95
            for (int i = count; i < 95; i++)
            {
                sobol.Next();
            }

            count = 16;
            for (int i = 0; i < count; i++)
            {
                var element = sobol.Next();
                Assert.That(element, Is.EqualTo(expectedFromIndex95[i]).Within(6E-7));
            }
        }