[Subject Prev][Subject Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hts-users:01757] bug fix in HGen.c for random parameter generation


There's a bug in the random parameter generation part of Forward_Substitution in HGen.c. When using random parameter generation (flag 'p'), it causes very distorted output, with a few large artefacts every second.

The fix is to take the code which adds GaussDeviate to g[t] outside the loop which generates g[t]. Previously there was a feedback effect, where random values of g[t] for small t were influencing the mean value for g[t] for larger t, which mathematically shouldn't happen.

Manual patch-like diff follows:

   /* forward substitution */
   for (t=1; t<=T; t++) {
      g[t] = r[t];
      for (i=1; (i<width) && (t-i>0); i++)
         g[t] -= U[t-i][i+1] * g[t-i];
      g[t] /= U[t][1];
-
-      /* random generation */
-      if (rFlags&RNDPAR)
-         g[t] += GaussDeviate(rndParMean, rndParVar);
   }
+
+   if (rFlags&RNDPAR) {
+      /* random generation */
+      for (t=1; t<=T; t++) {
+         g[t] += GaussDeviate(rndParMean, rndParVar);
+      }
+   }

Matt Shannon

Follow-Ups
[hts-users:01761] Re: bug fix in HGen.c for random parameter generation, Keiichi Tokuda