public void NullRandomNumberGenerator() { var normal = new Normal(0.0, 1.0); var ms = new MetropolisHastingsSampler <double>(0.2, normal.Density, (x, y) => (new Normal(x, 0.1)).Density(y), x => Normal.Sample(new Random(), x, 0.1), 10); Assert.Throws <ArgumentNullException>(() => ms.RandomSource = null); }
public void NullRandomNumberGenerator() { var random = MersenneTwister.Default; var normal = new Normal(0.0, 1.0, random); var ms = new MetropolisHastingsSampler<double>(0.2, normal.Density, (x, y) => Normal.PDF(x, 0.1, y), x => Normal.Sample(random, x, 0.1), 10); Assert.That(() => ms.RandomSource = null, Throws.TypeOf<ArgumentNullException>()); }
public void NullRandomNumberGenerator() { var normal = new Normal(0.0, 1.0); var ms = new MetropolisHastingsSampler <double>(0.2, normal.Density, (x, y) => (new Normal(x, 0.1)).Density(y), x => Normal.Sample(new System.Random(), x, 0.1), 10); ms.RandomSource = null; }
public void NullRandomNumberGenerator() { var random = MersenneTwister.Default; var normal = new Normal(0.0, 1.0, random); var ms = new MetropolisHastingsSampler <double>(0.2, normal.Density, (x, y) => Normal.PDF(x, 0.1, y), x => Normal.Sample(random, x, 0.1), 10); Assert.That(() => ms.RandomSource = null, Throws.TypeOf <ArgumentNullException>()); }
public void SampleArrayTest() { var normal = new Normal(0.0, 1.0); var rnd = new MersenneTwister(); var ms = new MetropolisHastingsSampler <double>(0.2, normal.Density, (x, y) => (new Normal(x, 0.1)).Density(y), x => Normal.Sample(rnd, x, 0.1), 10) { RandomSource = rnd }; ms.Sample(5); }
public void SampleArrayTest() { var normal = new Normal(0.0, 1.0); var rnd = new SystemRandomSource(1); var ms = new MetropolisHastingsSampler <double>(0.2, normal.Density, (x, y) => Normal.PDF(x, 0.1, y), 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 MersenneTwister(); var ms = new MetropolisHastingsSampler<double>(0.2, normal.Density, (x, y) => (new Normal(x, 0.1)).Density(y), x => Normal.Sample(rnd, x, 0.1), 10) { RandomSource = rnd }; ms.Sample(); }
public void SampleTest() { var normal = new Normal(0.0, 1.0); var rnd = new SystemRandomSource(1); var ms = new MetropolisHastingsSampler<double>(0.2, normal.Density, (x, y) => Normal.PDF(x, 0.1, y), x => Normal.Sample(rnd, x, 0.1), 10) { RandomSource = rnd }; ms.Sample(); }
public void MetropolisHastingsConstructor() { var normal = new Normal(0.0, 1.0); var rnd = new MersenneTwister(); var ms = new MetropolisHastingsSampler <double>(0.2, normal.Density, (x, y) => (new Normal(x, 0.1)).Density(y), x => Normal.Sample(rnd, x, 0.1), 10); ms.RandomSource = rnd; Assert.IsNotNull(ms.RandomSource); ms.RandomSource = new System.Random(); Assert.IsNotNull(ms.RandomSource); }
public void MetropolisHastingsConstructor() { var normal = new Normal(0.0, 1.0); var rnd = new MersenneTwister(); var ms = new MetropolisHastingsSampler<double>(0.2, normal.Density, (x, y) => (new Normal(x, 0.1)).Density(y), x => Normal.Sample(rnd, x, 0.1), 10) { RandomSource = rnd }; Assert.IsNotNull(ms.RandomSource); ms.RandomSource = new Random(); Assert.IsNotNull(ms.RandomSource); }
public void MetropolisHastingsConstructor() { var normal = new Normal(0.0, 1.0); var rnd = new SystemRandomSource(1); var ms = new MetropolisHastingsSampler<double>(0.2, normal.Density, (x, y) => Normal.PDF(x, 0.1, y), x => Normal.Sample(rnd, x, 0.1), 10) { RandomSource = rnd }; Assert.IsNotNull(ms.RandomSource); ms.RandomSource = new System.Random(0); Assert.IsNotNull(ms.RandomSource); }
public void MetropolisHastingsConstructor() { var normal = new Normal(0.0, 1.0); var rnd = new SystemRandomSource(1); var ms = new MetropolisHastingsSampler <double>(0.2, normal.Density, (x, y) => Normal.PDF(x, 0.1, y), x => Normal.Sample(rnd, x, 0.1), 10) { RandomSource = rnd }; Assert.IsNotNull(ms.RandomSource); ms.RandomSource = new System.Random(0); Assert.IsNotNull(ms.RandomSource); }
public void NullRandomNumberGenerator() { var normal = new Normal(0.0, 1.0); var ms = new MetropolisHastingsSampler<double>(0.2, normal.Density, (x, y) => (new Normal(x, 0.1)).Density(y), x => Normal.Sample(new Random(), x, 0.1), 10); Assert.Throws<ArgumentNullException>(() => ms.RandomSource = null); }