[apophenia] 01/01: RC #793998 - eg/test_updating - fix (hardden)

Jerome Benoit calculus-guest at moszumanska.debian.org
Sun Aug 30 18:19:42 UTC 2015


This is an automated email from the git hooks/post-receive script.

calculus-guest pushed a commit to branch master
in repository apophenia.

commit e952608796790733637947f2b461e8e87c69a35a
Author: Jerome Benoit <calculus at rezozer.net>
Date:   Sun Aug 30 20:00:00 2015 +0200

    RC #793998 - eg/test_updating - fix (hardden)
---
 debian/changelog                                   |  2 +-
 .../upstream-bug-793998-eg_test_updating.patch     | 33 +++++++++++++++++++---
 2 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index f79089e..865f203 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,7 +6,7 @@ apophenia (0.999e+ds-3) UNRELEASED; urgency=medium
     - tests/distribution_tests FAILURE on some 32bit architectures: double
       comparison issue, fix via a numerical approach (based on GSL_DBL_EPSILN).
 
- -- Jerome Benoit <calculus at rezozer.net>  Sat, 29 Aug 2015 01:56:36 +0000
+ -- Jerome Benoit <calculus at rezozer.net>  Sun, 30 Aug 2015 17:58:03 +0000
 
 apophenia (0.999e+ds-2) unstable; urgency=medium
 
diff --git a/debian/patches/upstream-bug-793998-eg_test_updating.patch b/debian/patches/upstream-bug-793998-eg_test_updating.patch
index 4bf4379..3387e08 100644
--- a/debian/patches/upstream-bug-793998-eg_test_updating.patch
+++ b/debian/patches/upstream-bug-793998-eg_test_updating.patch
@@ -1,21 +1,28 @@
 Description: upstream -- RC bug fix 793998 -- eg/test_updating
  Fix a type conversion bug that failed the eg/test_updating test on some
- architectures (e.g., arm64 and ppc64el).
+ architectures (e.g., arm64 and ppc64el). The initial fix has been harden
+ as it raised new issues on the 32bit i386 architecture.
+ The patch was designed with 'gcc (Debian 5.2.1-15) 5.2.1 20150808' on
+ i386, arm64, and ppc64el Debian porters (sid).
+ The raised issue is likely due to some unexpected (broken ?) optimization
+ at compile time: the use of the function modf appeared to break the
+ faulty optimization.
 Origin: debian
 Author: Jerome Benoit <calculus at rezozer.net>
-Last-Update: 2015-08-29
+Last-Update: 2015-08-30
 
 --- a/apop_mcmc.c
 +++ b/apop_mcmc.c
-@@ -196,13 +196,13 @@
+@@ -196,13 +196,14 @@
  }
  
  
 -void main_mcmc_loop(apop_data *d, apop_model *m, apop_data *out, gsl_vector *draw, 
 +void main_mcmc_loop(apop_data *d, apop_model *m, apop_data *out, gsl_vector *draw,
                          apop_mcmc_settings *s, gsl_rng *rng, int *constraint_fails){
++		double integerpart_periods_burnin = GSL_NAN; modf((double)(s->periods)*s->burnin,&integerpart_periods_burnin);
      s->accept_count = 0;
-+    int out_row = - s->periods*s->burnin;
++    int out_row = -lround(integerpart_periods_burnin);
      int block = 0;
 -    for (s->proposal_count=1; s->proposal_count< s->periods+1; s->proposal_count++){
 -        one_step(d, draw, m, s, rng, constraint_fails, out, block
@@ -25,3 +32,21 @@ Last-Update: 2015-08-29
          block = (block+1) % s->block_count;
          s->proposals[block].adapt_fn(s->proposals+block, s);
          //if (constraint_fails>10000) break;
+@@ -300,11 +301,14 @@
+     apop_prep(d, m); //typically a no-op
+     s->last_ll = GSL_NEGINF;
+     gsl_vector * drawv = apop_data_pack(m->parameters);
+-    Apop_stopif(s->burnin > 1, s->burnin/=(s->periods + 0.0), 
++    const double double_periods = (double)(s->periods);
++    Apop_stopif(s->burnin > 1, s->burnin/=double_periods,
+                 1, "Burn-in should be a fraction of the number of periods, "
+                    "not a whole number of periods. Rescaling to burnin=%g."
+-                   , s->burnin/(s->periods+0.0));
+-    apop_data *out = apop_data_alloc(s->periods*(1-s->burnin), drawv->size);
++                   , s->burnin/double_periods);
++		double integerpart_periods_cburnin = GSL_NAN; modf(double_periods*(1.0-s->burnin),&integerpart_periods_cburnin);
++		const size_t data_size1 = llround(integerpart_periods_cburnin);
++    apop_data *out = apop_data_alloc(data_size1, drawv->size);
+ 
+     if (!s->proposals){
+         set_block_count_and_block_starts(m->parameters, s, drawv->size);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/apophenia.git



More information about the debian-science-commits mailing list