star-mc

Parallel estimation of Monte Carlo integrators
git clone git://git.meso-star.fr/star-mc.git
Log | Files | Refs | README | LICENSE

commit 06a979444b015abc862abb8c6b0955b0f13c293c
parent 615a7b2350a9cbb80d63cac057fd8ef2bc02d611
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Thu,  2 Apr 2015 14:23:37 +0200

Use the new StarSP API

Diffstat:
Msrc/test_smc_solve.c | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/test_smc_solve.c b/src/test_smc_solve.c @@ -45,19 +45,19 @@ rcp_x(void* value, struct ssp_rng* rng, void* ctx) NCHECK(value, NULL); NCHECK(rng, NULL); CHECK(ctx, NULL); - samp = ssp_rng_get_canonical(rng) + 1; /* samp in [1, 2] */ - *result = 1.f / samp; + samp = ssp_rng_uniform_double(rng, 1.0, 2.0); + *result = 1.0 / samp; } static void cos_x(void* value, struct ssp_rng* rng, void* ctx) { float* result = value; - /* samp in [PI/4, 3PI/4] */ - float samp = ((float)rand() / (float)RAND_MAX) * (float)(2.0*PI/4.0 + PI/4.0); + double samp; NCHECK(value, NULL); NCHECK(rng, NULL); CHECK(ctx, (void*)0xC0DE); + samp = ssp_rng_uniform_double(rng, PI/4.0, (3.0*PI)/4.0); *result = (float)cos(samp); } @@ -101,6 +101,7 @@ main(int argc, char** argv) CHECK(smc_estimator_ref_put(estimator), RES_OK); CHECK(smc_solve(dev, cos_x, &smc_float, (void*)0xC0DE, &estimator), RES_OK); + CHECK(smc_estimator_get_status(estimator, &status), RES_OK); CHECK(eq_eps ((float)(sin(3.0*PI/4.0) - sin(PI/4.0)), SMC_FLOAT(status.E), SMC_FLOAT(status.SE)), 1);