SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | Static Public Member Functions | Package Attributes | List of all members
MatrixOfFunctionOfMultipleMeansTallies< E extends FunctionOfMultipleMeansTally > Class Template Reference

Represents a matrix of statistical collectors for functions of multiple means. More...

Inheritance diagram for MatrixOfFunctionOfMultipleMeansTallies< E extends FunctionOfMultipleMeansTally >:
[legend]
Collaboration diagram for MatrixOfFunctionOfMultipleMeansTallies< E extends FunctionOfMultipleMeansTally >:
[legend]

Public Member Functions

 MatrixOfFunctionOfMultipleMeansTallies (int numRows, int numColumns)
 Constructs a new unnamed matrix of function of multiple means tallies with numRows rows, and numColumns columns, and filled with null references. More...
 
 MatrixOfFunctionOfMultipleMeansTallies (String name, int numRows, int numColumns)
 Constructs a new empty matrix of function of multiple means tallies with name name, numRows rows, and numColumns columns, and filled with null references. More...
 
void add (double[][][] x)
 For each function of multiple means tally with row index r and column index c, adds the vector of observations x[r][c] if collecting is turned ON. More...
 
void add (DoubleMatrix3D x)
 Equivalent to add(x.toArray()), without copying the elements of x into a temporary 3D array. More...
 
void addSameDimension (DoubleMatrix2D... x)
 For each element (r, c) of this matrix of tallies, adds the vector of observations x[0].get (r, c), …, x[d-1].get (r, c). More...
 
int getDimension ()
 Assuming that each tally in this matrix has the same dimension, returns the dimension of tally (0, 0), or 0 if the matrix has no row or column. More...
 
int numberObs ()
 Assuming that each tally in this matrix contains the same number of observations, returns the number of observations in tally (0, 0), or 0 if the matrix has no row or column. More...
 
boolean areAllNumberObsEqual ()
 Tests that every tally in this matrix contains the same number of observations. More...
 
void average (DoubleMatrix2D m)
 Computes the average for each function of multiple means tally in the matrix. More...
 
void variance (DoubleMatrix2D m)
 For each tally in the matrix, computes the sample variance, and stores it into the given matrix. More...
 
void standardDeviation (DoubleMatrix2D m)
 For each tally in the matrix, computes the standard deviation, and stores it into the matrix m. More...
 
MatrixOfFunctionOfMultipleMeansTallies< E > clone ()
 Clones this object. More...
 
- Public Member Functions inherited from MatrixOfStatProbes< E >
 MatrixOfStatProbes (int numRows, int numColumns)
 Constructs a new unnamed matrix of statistical probes with numRows rows, and numColumns columns, and filled with null references. More...
 
 MatrixOfStatProbes (String name, int numRows, int numColumns)
 Constructs a new matrix of statistical probes with name name, numRows rows, and numColumns columns, and filled with null references. More...
 
String getName ()
 Returns the global name of this matrix of statistical probes. More...
 
void setName (String name)
 Sets the global name of this matrix to name. More...
 
int rows ()
 Returns the number of rows in this matrix. More...
 
int columns ()
 Returns the number of columns in this matrix. More...
 
void setRows (int newRows)
 Sets the number of rows of this matrix of statistical probes to newRows, adding or removing cells as necessary. More...
 
void setColumns (int newColumns)
 Similar to setRows(int), for setting the number of columns. More...
 
get (int r, int c)
 Returns the statistical probe corresponding to the row r and column c. More...
 
void set (int r, int c, E probe)
 Sets the statistical probe corresponding to the row r and column c to probe. More...
 
void init ()
 Initializes this matrix of statistical probes by calling StatProbe.init on each element.
 
void sum (DoubleMatrix2D m)
 For each probe in the matrix, computes the sum by calling umontreal.ssj.stat.StatProbe.sum, and stores it into the given matrix m. More...
 
void average (DoubleMatrix2D m)
 For each statistical probe in the matrix, computes the average by calling umontreal.ssj.stat.StatProbe.average, and stores it into the given matrix m. More...
 
boolean isCollecting ()
 Determines if this matrix of statistical probes is collecting values. More...
 
void setCollecting (boolean c)
 Sets the status of the statistical collecting mechanism to c. More...
 
boolean isBroadcasting ()
 Determines if this matrix of statistical probes is broadcasting values to registered observers. More...
 
void setBroadcasting (boolean b)
 Sets the status of the observation broadcasting mechanism to b. More...
 
void addMatrixOfObservationListener (MatrixOfObservationListener l)
 Adds the observation listener l to the list of observers of this matrix of statistical probes. More...
 
void removeMatrixOfObservationListener (MatrixOfObservationListener l)
 Removes the observation listener l from the list of observers of this matrix of statistical probes. More...
 
void clearMatrixOfObservationListeners ()
 Removes all observation listeners from the list of observers of this matrix of statistical probes.
 
void notifyListeners (DoubleMatrix2D x)
 Notifies the observation x to all registered observers if broadcasting is ON. More...
 
List< E > viewRow (int r)
 Returns a list representing a view on row r of this matrix of statistical probe. More...
 
List< E > viewColumn (int c)
 Returns a list representing a view on column c of this matrix of statistical probe. More...
 
String rowReport (int r)
 Formats a report for the row r of the statistical probe matrix. More...
 
String columnReport (int c)
 Formats a report for the column c of the statistical probe matrix. More...
 
MatrixOfStatProbes< E > clone ()
 Clones this object. More...
 
Iterator< E > iterator ()
 

Static Public Member Functions

static MatrixOfFunctionOfMultipleMeansTallies< FunctionOfMultipleMeansTallycreate (MultivariateFunction func, int d, int numRows, int numColumns)
 This factory method constructs and returns a matrix of function of multiple means tallies with numRows rows, numColumns columns, and filled with instances of
umontreal.ssj.stat.FunctionOfMultipleMeansTally. More...
 

Package Attributes

double [][][] temp
 

Additional Inherited Members

- Protected Attributes inherited from MatrixOfStatProbes< E >
boolean collect
 
boolean broadcast
 
String name
 

Detailed Description

Represents a matrix of statistical collectors for functions of multiple means.

Each element of such a matrix is an instance of umontreal.ssj.stat.FunctionOfMultipleMeansTally, and observations can be added with the add(double[][][]) method. This class defines a factory method to construct a matrix of tallies computing the same function and sharing the same dimension.

Constructor & Destructor Documentation

◆ MatrixOfFunctionOfMultipleMeansTallies() [1/2]

MatrixOfFunctionOfMultipleMeansTallies ( int  numRows,
int  numColumns 
)

Constructs a new unnamed matrix of function of multiple means tallies with numRows rows, and numColumns columns, and filled with null references.

Parameters
numRowsthe number of rows in the matrix.
numColumnsthe number of columns in the matrix.
Exceptions
NegativeArraySizeExceptionif numRows or numColumns are negative.

◆ MatrixOfFunctionOfMultipleMeansTallies() [2/2]

MatrixOfFunctionOfMultipleMeansTallies ( String  name,
int  numRows,
int  numColumns 
)

Constructs a new empty matrix of function of multiple means tallies with name name, numRows rows, and numColumns columns, and filled with null references.

Parameters
namethe global name of the matrix.
numRowsthe number of rows in the matrix.
numColumnsthe number of columns in the matrix.
Exceptions
NegativeArraySizeExceptionif numRows or numColumns are negative.

Member Function Documentation

◆ add() [1/2]

void add ( double  x[][][])

For each function of multiple means tally with row index r and column index c, adds the vector of observations x[r][c] if collecting is turned ON.

Parameters
xthe vectors of observations to be added.
Exceptions
IllegalArgumentExceptionif the dimensions of x, x[r], or x[r][c] are incorrect.

◆ add() [2/2]

void add ( DoubleMatrix3D  x)

Equivalent to add(x.toArray()), without copying the elements of x into a temporary 3D array.

Each slice of the 3D matrix x corresponds to a row of the matrix of probes. Each row of the 3D matrix corresponds to a column of the matrix of probes. Each column of the 3D matrix corresponds to a component of a vector of observations added to a function of multiple means tally. This can be used only when all the function of multiple means tallies in the array share the same dimension.

Parameters
xthe matrix of observations.
Exceptions
IllegalArgumentExceptionif the dimensions of the matrix are incorrect.

◆ addSameDimension()

void addSameDimension ( DoubleMatrix2D...  x)

For each element (r, c) of this matrix of tallies, adds the vector of observations x[0].get (r, c), …, x[d-1].get (r, c).

This method can be used only when all tallies in this matrix share the same dimension. It creates a transposed 3D array compatible with add(double[][][]), and calls the latter method with this array. For example, let mt be a matrix of tallies with dimensions \(r\times c\) whose l  \(=rc\) elements correspond to ratios. If a program can generate two matrices num and den of dimensions \(r\times c\) representing observations for the numerator and denominator of the ratios, respectively, the observations can be added using mt.add (num, den) instead of creating an intermediate 3D array of observations.

Parameters
xthe array of matrices of observations.
Exceptions
IllegalArgumentExceptionif the length of x does not correspond to the dimension of the tally, or the dimensions of the matrices x[j] are not equal for all j=0,…,d-1.

◆ areAllNumberObsEqual()

boolean areAllNumberObsEqual ( )

Tests that every tally in this matrix contains the same number of observations.

This returns true if and only if the matrix has no row and no column, or if all tallies have the same number of observations.

Returns
the success indicator of the test.

◆ average()

void average ( DoubleMatrix2D  m)

Computes the average for each function of multiple means tally in the matrix.

If the tally \((r, c)\) has no observation, the Double.NaN value is stored in the given matrix, at row r, column c.

◆ clone()

Clones this object.

Makes a shallow copy of this matrix, i.e., does not clone all the probes in the matrix.

◆ create()

static MatrixOfFunctionOfMultipleMeansTallies<FunctionOfMultipleMeansTally> create ( MultivariateFunction  func,
int  d,
int  numRows,
int  numColumns 
)
static

This factory method constructs and returns a matrix of function of multiple means tallies with numRows rows, numColumns columns, and filled with instances of
umontreal.ssj.stat.FunctionOfMultipleMeansTally.

Each tally computes the multivariate function func, in d dimensions.

Parameters
functhe multivariate function computed by the tallies.
dthe dimension of the tallies.
numRowsthe number of rows in the matrix.
numColumnsthe number of columns in the matrix.
Returns
the created matrix.

◆ getDimension()

int getDimension ( )

Assuming that each tally in this matrix has the same dimension, returns the dimension of tally (0, 0), or 0 if the matrix has no row or column.

Returns
the dimension.

◆ numberObs()

int numberObs ( )

Assuming that each tally in this matrix contains the same number of observations, returns the number of observations in tally (0, 0), or 0 if the matrix has no row or column.

Returns
the number of observations.

◆ standardDeviation()

void standardDeviation ( DoubleMatrix2D  m)

For each tally in the matrix, computes the standard deviation, and stores it into the matrix m.

This is equivalent to calling variance(DoubleMatrix2D) and performing a square root on every element of the filled matrix.

Parameters
mthe matrix to be filled with standard deviations.
Exceptions
NullPointerExceptionif m is null.
IllegalArgumentExceptionif m.rows() does not correspond to umontreal.ssj.stat.matrix.MatrixOfStatProbes.rows, or m.columns() does not correspond to umontreal.ssj.stat.matrix.MatrixOfStatProbes.columns.

◆ variance()

void variance ( DoubleMatrix2D  m)

For each tally in the matrix, computes the sample variance, and stores it into the given matrix.

If, for some tally \((r, c)\), there are not enough observations for estimating the variance, Double.NaN is stored in the corresponding element of the given matrix m.

Parameters
mthe matrix to be filled with sample variances.
Exceptions
NullPointerExceptionif m is null.
IllegalArgumentExceptionif m.rows() does not correspond to umontreal.ssj.stat.matrix.MatrixOfStatProbes.rows, or m.columns() does not correspond to umontreal.ssj.stat.matrix.MatrixOfStatProbes.columns.

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