Uploaded image for project: 'Commons RNG'
  1. Commons RNG
  2. RNG-146

GaussianSampler should not allow infinite standard deviation

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 1.3
    • 1.4
    • sampling
    • None

    Description

      The GaussianSampler requires the standard deviation is strictly positive. It allows an infinite value. This will produce a NaN output if the NormalizedGaussianSampler returns 0:

      @Test
      public void testInfiniteStdDev() {
          NormalizedGaussianSampler gauss = new NormalizedGaussianSampler() {
              @Override
              public double sample() {
                  return 0;
              }
          };
          GaussianSampler s = new GaussianSampler(gauss, 0, Double.POSITIVE_INFINITY);
          Assert.assertEquals(Double.NaN, s.sample(), 0.0);
      }
      

      A fix is to require the standard deviation is finite.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            aherbert Alex Herbert
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment