SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.stat.matrix.MatrixOfTallies< E extends Tally > Class Template Reference

Represents a matrix of tally statistical collectors. More...

Inheritance diagram for umontreal.ssj.stat.matrix.MatrixOfTallies< E extends Tally >:
umontreal.ssj.stat.matrix.MatrixOfStatProbes< E >

Public Member Functions

 MatrixOfTallies (int numRows, int numColumns)
 Constructs a new unnamed matrix of tallies with numRows rows, and numColumns columns, and filled with null references.
 MatrixOfTallies (String name, int numRows, int numColumns)
 Constructs a new matrix of tallies with name name, numRows rows, and numColumns columns, and filled with null references.
void add (DoubleMatrix2D x)
 Adds the observation x.get(r, c) in the tally whose row is r and column is c, for r = 0, …, umontreal.ssj.stat.matrix.MatrixOfStatProbes.rows - 1, and c = 0, …, umontreal.ssj.stat.matrix.MatrixOfStatProbes.columns - 1.
void add (double[][] x)
 Same as add(DoubleMatrix2D) for a 2D array.
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 this matrix has 0 row or column.
boolean areAllNumberObsEqual ()
 Tests that every tally in this matrix contains the same number of observations.
void average (DoubleMatrix2D m)
 Computes the average for each tally in the matrix.
void variance (DoubleMatrix2D m)
 For each tally in the matrix, computes the sample variance, and stores it into the given matrix.
void standardDeviation (DoubleMatrix2D m)
 For each tally in the matrix, computes the standard deviation, and stores it into the given matrix.
MatrixOfTallies< E > clone ()
 Clones this object.
Public Member Functions inherited from umontreal.ssj.stat.matrix.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.
String getName ()
 Returns the global name of this matrix of statistical probes.
void setName (String name)
 Sets the global name of this matrix to name.
int rows ()
 Returns the number of rows in this matrix.
int columns ()
 Returns the number of columns in this matrix.
void setRows (int newRows)
 Sets the number of rows of this matrix of statistical probes to newRows, adding or removing cells as necessary.
void setColumns (int newColumns)
 Similar to setRows(int), for setting the number of columns.
get (int r, int c)
 Returns the statistical probe corresponding to the row r and column c.
void set (int r, int c, E probe)
 Sets the statistical probe corresponding to the row r and column c to probe.
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.
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.
boolean isCollecting ()
 Determines if this matrix of statistical probes is collecting values.
void setCollecting (boolean c)
 Sets the status of the statistical collecting mechanism to c.
boolean isBroadcasting ()
 Determines if this matrix of statistical probes is broadcasting values to registered observers.
void setBroadcasting (boolean b)
 Sets the status of the observation broadcasting mechanism to b.
void addMatrixOfObservationListener (MatrixOfObservationListener l)
 Adds the observation listener l to the list of observers of this matrix of statistical probes.
void removeMatrixOfObservationListener (MatrixOfObservationListener l)
 Removes the observation listener l from the list of observers of this matrix of statistical probes.
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.
List< E > viewRow (int r)
 Returns a list representing a view on row r of this matrix of statistical probe.
List< E > viewColumn (int c)
 Returns a list representing a view on column c of this matrix of statistical probe.
String rowReport (int r)
 Formats a report for the row r of the statistical probe matrix.
String columnReport (int c)
 Formats a report for the column c of the statistical probe matrix.
MatrixOfStatProbes< E > clone ()
 Clones this object.

Static Public Member Functions

static MatrixOfTallies< TallycreateWithTally (int numRows, int numColumns)
 This factory method constructs and returns a matrix of tallies with numRows rows, numColumns columns, and filled with new instances of umontreal.ssj.stat.Tally.
static MatrixOfTallies< TallyStorecreateWithTallyStore (int numRows, int numColumns)
 This factory method constructs and returns a matrix of tallies with numRows rows, numColumns columns, and filled with new instances of umontreal.ssj.stat.TallyStore.

Detailed Description

Represents a matrix of tally statistical collectors.

Each element of such a matrix is an instance of umontreal.ssj.stat.Tally, and observations can be added with the add(DoubleMatrix2D) method. This class defines factory methods to fill a newly-constructed matrix with Tally or TallyStore instances.

Definition at line 43 of file MatrixOfTallies.java.

Constructor & Destructor Documentation

◆ MatrixOfTallies() [1/2]

umontreal.ssj.stat.matrix.MatrixOfTallies< E extends Tally >.MatrixOfTallies ( int numRows,
int numColumns )

Constructs a new unnamed matrix of 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.

Definition at line 54 of file MatrixOfTallies.java.

◆ MatrixOfTallies() [2/2]

umontreal.ssj.stat.matrix.MatrixOfTallies< E extends Tally >.MatrixOfTallies ( String name,
int numRows,
int numColumns )

Constructs a new matrix of 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.

Definition at line 68 of file MatrixOfTallies.java.

Member Function Documentation

◆ add() [1/2]

void umontreal.ssj.stat.matrix.MatrixOfTallies< E extends Tally >.add ( double x[][])

Same as add(DoubleMatrix2D) for a 2D array.

Definition at line 142 of file MatrixOfTallies.java.

◆ add() [2/2]

void umontreal.ssj.stat.matrix.MatrixOfTallies< E extends Tally >.add ( DoubleMatrix2D x)

Adds the observation x.get(r, c) in the tally whose row is r and column is c, for r = 0, …, umontreal.ssj.stat.matrix.MatrixOfStatProbes.rows - 1, and c = 0, …, umontreal.ssj.stat.matrix.MatrixOfStatProbes.columns - 1.

No observation is added if the value is Double.NaN, or if observations collecting is turned OFF. If broadcasting is ON, the given matrix is notified to all registered observers. The given matrix x not being stored by this object, it can be freely used and modified after the call to this method.

Parameters
xthe matrix of observations.
Exceptions
NullPointerExceptionif `x` is `null`.
IllegalArgumentExceptionif the dimensions of `x` do not correspond to the dimensions of this matrix of tallies.

Definition at line 122 of file MatrixOfTallies.java.

◆ areAllNumberObsEqual()

boolean umontreal.ssj.stat.matrix.MatrixOfTallies< E extends Tally >.areAllNumberObsEqual ( )

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

This returns true if and only if all tallies have the same number of observations.

Returns
the success indicator of the test.

Definition at line 183 of file MatrixOfTallies.java.

◆ average()

void umontreal.ssj.stat.matrix.MatrixOfTallies< E extends Tally >.average ( DoubleMatrix2D m)

Computes the average for each 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, and column c.

Definition at line 201 of file MatrixOfTallies.java.

◆ clone()

Clones this object.

Definition at line 271 of file MatrixOfTallies.java.

◆ createWithTally()

MatrixOfTallies< Tally > umontreal.ssj.stat.matrix.MatrixOfTallies< E extends Tally >.createWithTally ( int numRows,
int numColumns )
static

This factory method constructs and returns a matrix of tallies with numRows rows, numColumns columns, and filled with new instances of umontreal.ssj.stat.Tally.

Parameters
numRowsthe number of rows in the matrix.
numColumnsthe number of columns in the matrix.
Returns
the created matrix.

Definition at line 81 of file MatrixOfTallies.java.

◆ createWithTallyStore()

MatrixOfTallies< TallyStore > umontreal.ssj.stat.matrix.MatrixOfTallies< E extends Tally >.createWithTallyStore ( int numRows,
int numColumns )
static

This factory method constructs and returns a matrix of tallies with numRows rows, numColumns columns, and filled with new instances of umontreal.ssj.stat.TallyStore.

Parameters
numRowsthe number of rows in the matrix.
numColumnsthe number of columns in the matrix.
Returns
the created matrix.

Definition at line 98 of file MatrixOfTallies.java.

◆ numberObs()

int umontreal.ssj.stat.matrix.MatrixOfTallies< E extends Tally >.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 this matrix has 0 row or column.

Returns
the number of observations.

Definition at line 169 of file MatrixOfTallies.java.

◆ standardDeviation()

void umontreal.ssj.stat.matrix.MatrixOfTallies< E extends Tally >.standardDeviation ( DoubleMatrix2D m)

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

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.

Definition at line 254 of file MatrixOfTallies.java.

◆ variance()

void umontreal.ssj.stat.matrix.MatrixOfTallies< E extends Tally >.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 rows, or m.columns() does not correspond to
Parameters
mthe matrix to be filled with sample variances.
Exceptions
NullPointerExceptionif `m` is `null`.
IllegalArgumentExceptionif `m.rows()` does not correspond to rows , or m.columns() does not correspond to columns.

Definition at line 227 of file MatrixOfTallies.java.


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