Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

riso.distributions
Class Uniform  view Uniform download Uniform.java

java.lang.Object
  extended byriso.distributions.AbstractDistribution
      extended byriso.distributions.Uniform
All Implemented Interfaces:
ConditionalDistribution, Distribution, java.io.Serializable

public class Uniform
extends AbstractDistribution

An instance of this class represents a uniform distribution over an interval. Rectangles and hyper-rectangles are not supported; maybe they should be.


Field Summary
 double a
          The left end of the interval on which this uniform distribution is defined.
 double b
          The right end of the interval on which this uniform distribution is defined.
 
Fields inherited from class riso.distributions.AbstractDistribution
associated_variable
 
Constructor Summary
Uniform()
          Empty constructor so objects can be constructed from description files.
Uniform(double a, double b)
          Construct a uniform distribution from the specified endpoints.
 
Method Summary
 double cdf(double x)
          Compute the cumulative distribution function.
 java.lang.Object clone()
          Create and return a copy of this uniform distribution.
 double[] effective_support(double epsilon)
          Returns the support of this distribution.
 double expected_value()
          Returns the expected value of this distribution.
 java.lang.String format_string(java.lang.String leading_ws)
          Format this uniform distribution into a string, which can be parsed by parse_string.
 MixGaussians initial_mix(double[] support)
          Returns an approximation containing several components.
 int ndimensions()
          Always returns 1.
 double p(double[] x)
          Compute the density at the point x.
 void pretty_input(riso.general.SmarterTokenizer st)
          Inputs the parameters of this uniform distribution from a stream.
 double[] random()
          Returns a random number drawn from the interval [a,b].
 double sqrt_variance()
          Returns the square root of the variance of this distribution.
 
Methods inherited from class riso.distributions.AbstractDistribution
get_density, get_nstates, log_p, log_prior, ndimensions_child, ndimensions_parent, p, parse_string, pretty_output, random, set_variable, toString, update
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

a

public double a
The left end of the interval on which this uniform distribution is defined.


b

public double b
The right end of the interval on which this uniform distribution is defined.

Constructor Detail

Uniform

public Uniform()
Empty constructor so objects can be constructed from description files.


Uniform

public Uniform(double a,
               double b)
Construct a uniform distribution from the specified endpoints.

Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Create and return a copy of this uniform distribution.

Specified by:
clone in interface ConditionalDistribution
Overrides:
clone in class AbstractDistribution

ndimensions

public int ndimensions()
Always returns 1.

Specified by:
ndimensions in interface Distribution
Overrides:
ndimensions in class AbstractDistribution

cdf

public double cdf(double x)
           throws java.lang.Exception
Compute the cumulative distribution function.

Specified by:
cdf in interface Distribution
Overrides:
cdf in class AbstractDistribution

p

public double p(double[] x)
Compute the density at the point x. This returns 1/(b-a) if x is between a and b, inclusive, and zero otherwise.


random

public double[] random()
Returns a random number drawn from the interval [a,b].

Specified by:
random in interface Distribution
Overrides:
random in class AbstractDistribution

pretty_input

public void pretty_input(riso.general.SmarterTokenizer st)
                  throws java.io.IOException
Inputs the parameters of this uniform distribution from a stream.

Overrides:
pretty_input in class AbstractDistribution

format_string

public java.lang.String format_string(java.lang.String leading_ws)
Format this uniform distribution into a string, which can be parsed by parse_string.

Specified by:
format_string in interface ConditionalDistribution
Overrides:
format_string in class AbstractDistribution

expected_value

public double expected_value()
Returns the expected value of this distribution.

Specified by:
expected_value in interface Distribution
Overrides:
expected_value in class AbstractDistribution

sqrt_variance

public double sqrt_variance()
Returns the square root of the variance of this distribution.

Specified by:
sqrt_variance in interface Distribution
Overrides:
sqrt_variance in class AbstractDistribution

effective_support

public double[] effective_support(double epsilon)
Returns the support of this distribution.

Specified by:
effective_support in interface Distribution
Overrides:
effective_support in class AbstractDistribution

initial_mix

public MixGaussians initial_mix(double[] support)
Returns an approximation containing several components. The approximation is not very good.

Specified by:
initial_mix in interface Distribution
Overrides:
initial_mix in class AbstractDistribution