SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.discrepancy.DiscrepancyContainer Class Reference

This class is used to compute, store and display discrepancies. More...

Public Member Functions

 DiscrepancyContainer (Discrepancy[] discrepancies)
 Creates a DiscrepancyContainer for the given discrepancies.
void init (int n, String title, String xLabel, String yLabel)
 Initialize the container with enough space for n values of the parameter and sets the values to 0.
void init (int n)
 Calls init(n,"","Parameter", "Discrepancy").
void reset (int i)
 Resets the values of the discrepancies at index i to 0.
void reset ()
 Calls reset(i) for all indices i.
void compute (int i, double[] points, int n)
 Computes the discrepancies of the first n values contained in points and sets the values at index i.
void compute (int i, double[][] points, int n, int s)
 Computes the discrepancies of the first n values contained in points using the first s coordinates and sets the values at index i.
void add (int i, double[] points, int n)
 Computes the discrepancies of the first n values contained in points, and adds the values at index i.
void addSquare (int i, double[] points, int n)
 Computes the square of the discrepancies of the first n values contained in points, and adds the values at index i.
void add (int i, double[][] points, int n, int s)
 Computes the discrepancies of the first n values contained in points using the first s coordinates, and adds the values at index i.
void addSquare (int i, double[][] points, int n, int s)
 Computes the square discrepancies of the first n values contained in points using the first s coordinates, and adds the values at index i.
void scale (int i, double scale)
 Multiplies all the discrepancies at index i by scale;.
void scale (double scale)
 Calls scale(i,scale) for all indices i.
void log2 (int i)
 Takes the logarithm in base 2 of the discrepancy values at index i.
void square (int i)
 Squares the discrepancy values at index i.
void setParam (int i, double paramValue)
 Sets the parameter value at index i to parmValue.
String regressionToString ()
 Formats and returns a String containing the linear regression slopes for the discrepancies as function of the parameter.
void toTexFile (String filename)
 Creates a file named filename.tex containing LaTeX code that can be compiled by pdfLaTeX to a graph of the discrepancies as function of the parameter.
void toDatFile (String filename, String header)
 Creates a file named filename.dat and writes in it the given header, a table showing the discrepancies for the different values of the parameter and the linear regression slopes.
String toString ()
 Returns a String containing a table showing the discrepancies for the different values of the parameter.

Protected Member Functions

void calcRegressionSlope ()
 Computes the linear regression slope for the discrepancies as function of the parameter.

Detailed Description

This class is used to compute, store and display discrepancies.

The method add computes the discrepancy of a given array of points for the selected discrepancies and associates them with a given index. One can assign a parameter value to this index (using setParam ) so that a graph or a data file is created showing the discrepancies as functions of the parameter. One can also scale the discrepancies of an index with a given scale factor or take the logarithm of the discrepancies.

The discrepancies are computed, assuming that the theoretical distribution of the points is over the unit hypercube \([0,1]^s\); thus all the coordinates of the points must be in \([0,1]\).

Definition at line 47 of file DiscrepancyContainer.java.

Constructor & Destructor Documentation

◆ DiscrepancyContainer()

umontreal.ssj.discrepancy.DiscrepancyContainer.DiscrepancyContainer ( Discrepancy[] discrepancies)

Creates a DiscrepancyContainer for the given discrepancies.

Parameters
discrepanciesarray containing the discrepancies to be used

Definition at line 59 of file DiscrepancyContainer.java.

Member Function Documentation

◆ add() [1/2]

void umontreal.ssj.discrepancy.DiscrepancyContainer.add ( int i,
double[] points,
int n )

Computes the discrepancies of the first n values contained in points, and adds the values at index i.

**NOTE: This method does not replace the values, it adds to them. Can be used with scale to calculate an average discrepancy over more than one point set.

Parameters
iindex where to add the discrepancies
pointsvalues for which to compute the discrepancies
nnumber of points to use

Definition at line 148 of file DiscrepancyContainer.java.

◆ add() [2/2]

void umontreal.ssj.discrepancy.DiscrepancyContainer.add ( int i,
double points[][],
int n,
int s )

Computes the discrepancies of the first n values contained in points using the first s coordinates, and adds the values at index i.

**NOTE: This method does not replace the values, it adds to them. Can be used with scale to calculate an average discrepancy over more than one point set.

Parameters
iindex where to add the discrepancies
pointsvalues for which to compute the discrepancies
nnumber of points to use
snumber of coordinates to use for each point

Definition at line 182 of file DiscrepancyContainer.java.

◆ addSquare() [1/2]

void umontreal.ssj.discrepancy.DiscrepancyContainer.addSquare ( int i,
double[] points,
int n )

Computes the square of the discrepancies of the first n values contained in points, and adds the values at index i.

**NOTE: This method does not replace the values, it adds to them. Can be used with scale to calculate an average square discrepancy over more than one point set.

Parameters
iindex where to add the discrepancies
pointsvalues for which to compute the discrepancies
nnumber of points to use

Definition at line 163 of file DiscrepancyContainer.java.

◆ addSquare() [2/2]

void umontreal.ssj.discrepancy.DiscrepancyContainer.addSquare ( int i,
double points[][],
int n,
int s )

Computes the square discrepancies of the first n values contained in points using the first s coordinates, and adds the values at index i.

**NOTE: This method does not replace the values, it adds to them. Can be used with scale to calculate an average square discrepancy over more than one point set.

Parameters
iindex where to add the discrepancies
pointsvalues for which to compute the discrepancies
nnumber of points to use
snumber of coordinates to use for each point

Definition at line 199 of file DiscrepancyContainer.java.

◆ calcRegressionSlope()

void umontreal.ssj.discrepancy.DiscrepancyContainer.calcRegressionSlope ( )
protected

Computes the linear regression slope for the discrepancies as function of the parameter.

Used by regressionToString.

Definition at line 272 of file DiscrepancyContainer.java.

◆ compute() [1/2]

void umontreal.ssj.discrepancy.DiscrepancyContainer.compute ( int i,
double[] points,
int n )

Computes the discrepancies of the first n values contained in points and sets the values at index i.

Parameters
iindex where to add the discrepancies
pointsvalues for which to compute the discrepancies
nnumber of points to use

Definition at line 119 of file DiscrepancyContainer.java.

◆ compute() [2/2]

void umontreal.ssj.discrepancy.DiscrepancyContainer.compute ( int i,
double points[][],
int n,
int s )

Computes the discrepancies of the first n values contained in points using the first s coordinates and sets the values at index i.

Parameters
iindex where to add the discrepancies
pointsvalues for which to compute the discrepancies
nnumber of points to use
snumber of coordinates to use for each point

Definition at line 133 of file DiscrepancyContainer.java.

◆ init() [1/2]

void umontreal.ssj.discrepancy.DiscrepancyContainer.init ( int n)

Calls init(n,"","Parameter", "Discrepancy").

Parameters
nNumber of values the parameter will take.

Definition at line 89 of file DiscrepancyContainer.java.

◆ init() [2/2]

void umontreal.ssj.discrepancy.DiscrepancyContainer.init ( int n,
String title,
String xLabel,
String yLabel )

Initialize the container with enough space for n values of the parameter and sets the values to 0.

Also sets the labels for the parameter and the discrepancy that will be used for graphs and data file.

Parameters
nnumber of values the parameter will take
titletitle
xLabellabel name for the parameter
yLabellabel name for the discrepancy

Definition at line 75 of file DiscrepancyContainer.java.

◆ log2()

void umontreal.ssj.discrepancy.DiscrepancyContainer.log2 ( int i)

Takes the logarithm in base 2 of the discrepancy values at index i.

Parameters
iindex where to take the logarithm

Definition at line 233 of file DiscrepancyContainer.java.

◆ regressionToString()

String umontreal.ssj.discrepancy.DiscrepancyContainer.regressionToString ( )

Formats and returns a String containing the linear regression slopes for the discrepancies as function of the parameter.

Definition at line 281 of file DiscrepancyContainer.java.

◆ reset() [1/2]

void umontreal.ssj.discrepancy.DiscrepancyContainer.reset ( )

Calls reset(i) for all indices i.

Definition at line 106 of file DiscrepancyContainer.java.

◆ reset() [2/2]

void umontreal.ssj.discrepancy.DiscrepancyContainer.reset ( int i)

Resets the values of the discrepancies at index i to 0.

Parameters
iindex to reset

Definition at line 98 of file DiscrepancyContainer.java.

◆ scale() [1/2]

void umontreal.ssj.discrepancy.DiscrepancyContainer.scale ( double scale)

Calls scale(i,scale) for all indices i.

Parameters
scalescale factor

Definition at line 223 of file DiscrepancyContainer.java.

◆ scale() [2/2]

void umontreal.ssj.discrepancy.DiscrepancyContainer.scale ( int i,
double scale )

Multiplies all the discrepancies at index i by scale;.

Parameters
iindex where to scale
scalescale factor

Definition at line 213 of file DiscrepancyContainer.java.

◆ setParam()

void umontreal.ssj.discrepancy.DiscrepancyContainer.setParam ( int i,
double paramValue )

Sets the parameter value at index i to parmValue.

Parameters
iindex where to set the parameter value
paramValuevalue to set the parameter

Definition at line 254 of file DiscrepancyContainer.java.

◆ square()

void umontreal.ssj.discrepancy.DiscrepancyContainer.square ( int i)

Squares the discrepancy values at index i.

Parameters
iindex where to take the logarithm

Definition at line 243 of file DiscrepancyContainer.java.

◆ toDatFile()

void umontreal.ssj.discrepancy.DiscrepancyContainer.toDatFile ( String filename,
String header )

Creates a file named filename.dat and writes in it the given header, a table showing the discrepancies for the different values of the parameter and the linear regression slopes.

Parameters
filenamename of the output file (without any extension)
headerheader of the file (can be empty)

Definition at line 327 of file DiscrepancyContainer.java.

◆ toString()

String umontreal.ssj.discrepancy.DiscrepancyContainer.toString ( )

Returns a String containing a table showing the discrepancies for the different values of the parameter.

Definition at line 343 of file DiscrepancyContainer.java.

◆ toTexFile()

void umontreal.ssj.discrepancy.DiscrepancyContainer.toTexFile ( String filename)

Creates a file named filename.tex containing LaTeX code that can be compiled by pdfLaTeX to a graph of the discrepancies as function of the parameter.

Parameters
filenamename of the LaTeX file to be created (without the .tex extension)

Definition at line 300 of file DiscrepancyContainer.java.


The documentation for this class was generated from the following file: