public void NullRandomNumberGenerator()
        {
            var normal = new Normal(0.0, 1.0);
            var ms     = new MetropolisSampler <double>(0.2, normal.Density, x => Normal.Sample(new System.Random(), x, 0.1), 10);

            ms.RandomSource = null;
        }
Beispiel #2
0
        public void NullRandomNumberGenerator()
        {
            var normal = new Normal(0.0, 1.0);
            var ms     = new MetropolisSampler <double>(0.2, normal.Density, x => Normal.Sample(new Random(), x, 0.1), 10);

            Assert.Throws <ArgumentNullException>(() => ms.RandomSource = null);
        }
        public void SampleArrayTest()
        {
            var normal = new Normal(0.0, 1.0);
            var rnd = new MersenneTwister();

            var ms = new MetropolisSampler<double>(0.2, normal.Density, x => Normal.Sample(rnd, x, 0.1), 10);
            ms.RandomSource = rnd;

            double[] sample = ms.Sample(5);
        }
        public void MetropolisConstructor()
        {
            var normal = new Normal(0.0, 1.0);
            var rnd = new MersenneTwister();

            var ms = new MetropolisSampler<double>(0.2, normal.Density, x => Normal.Sample(rnd, x, 0.1), 10);
            Assert.IsNotNull(ms.RandomSource);

            ms.RandomSource = rnd;
            Assert.IsNotNull(ms.RandomSource);
        }
        public void SampleArrayTest()
        {
            var normal = new Normal(0.0, 1.0);
            var rnd    = new MersenneTwister();

            var ms = new MetropolisSampler <double>(0.2, normal.Density, x => Normal.Sample(rnd, x, 0.1), 10);

            ms.RandomSource = rnd;

            double[] sample = ms.Sample(5);
        }
Beispiel #6
0
        public void MetropolisConstructor()
        {
            var normal = new Normal(0.0, 1.0);
            var rnd    = new MersenneTwister();

            var ms = new MetropolisSampler <double>(0.2, normal.Density, x => Normal.Sample(rnd, x, 0.1), 10);

            Assert.IsNotNull(ms.RandomSource);

            ms.RandomSource = rnd;
            Assert.IsNotNull(ms.RandomSource);
        }
Beispiel #7
0
        public void SampleArrayTest()
        {
            var normal = new Normal(0.0, 1.0);
            var rnd    = new SystemRandomSource(1);

            var ms = new MetropolisSampler <double>(0.2, normal.Density, x => Normal.Sample(rnd, x, 0.1), 10)
            {
                RandomSource = rnd
            };

            ms.Sample(5);
        }
        public void SampleTest()
        {
            var normal = new Normal(0.0, 1.0);
            var rnd = new SystemRandomSource(1);

            var ms = new MetropolisSampler<double>(0.2, normal.Density, x => Normal.Sample(rnd, x, 0.1), 10)
                {
                    RandomSource = rnd
                };

            ms.Sample();
        }
 public void NullRandomNumberGenerator()
 {
     var normal = new Normal(0.0, 1.0);
     var ms = new MetropolisSampler<double>(0.2, normal.Density, x => Normal.Sample(new System.Random(), x, 0.1), 10);
     ms.RandomSource = null;
 }
 public void NullRandomNumberGenerator()
 {
     var normal = new Normal(0.0, 1.0);
     var ms = new MetropolisSampler<double>(0.2, normal.Density, x => Normal.Sample(new Random(), x, 0.1), 10);
     Assert.Throws<ArgumentNullException>(() => ms.RandomSource = null);
 }