common
Class Util.InversePolynomialSampler

java.lang.Object
  extended by common.Util.InversePolynomialSampler
Enclosing class:
Util

public static class Util.InversePolynomialSampler
extends java.lang.Object

A sampler of nonnegative reals following an inverse polynomial density 1/((x+\delta)^n), \delta > 0. The purpose of /delta is to avoid 0 having infinite density. For practical purposes, the sampler only returns numbers in [0, u), for u an upper limit given by the user. The class also lets the user declare how much mass should be left beyond the upper limit; this should be a small probability. There is a constructor with a default mass beyond upper limit set to 0.01. Given n and these two parameters, the class automatically sets \delta to a value that makes it so.


Constructor Summary
Util.InversePolynomialSampler(double upperLimit)
          Creates sampler with mass beyond upper limit set to 0.01, with n = 2..
Util.InversePolynomialSampler(double n, double upperLimit)
          Creates sampler with mass beyond upper limit set to 0.01.
Util.InversePolynomialSampler(double n, double upperLimit, double massBeyondUpperLimit)
           
 
Method Summary
 int nextSample()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util.InversePolynomialSampler

public Util.InversePolynomialSampler(double upperLimit)
Creates sampler with mass beyond upper limit set to 0.01, with n = 2..


Util.InversePolynomialSampler

public Util.InversePolynomialSampler(double n,
                                     double upperLimit)
Creates sampler with mass beyond upper limit set to 0.01.


Util.InversePolynomialSampler

public Util.InversePolynomialSampler(double n,
                                     double upperLimit,
                                     double massBeyondUpperLimit)
Method Detail

nextSample

public int nextSample()