|
SSJ V. labo. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectumontreal.iro.lecuyer.stat.matrix.MatrixOfStatProbes<E>
umontreal.iro.lecuyer.stat.matrix.MatrixOfTallies<E>
public class MatrixOfTallies<E extends Tally>
Represents a matrix of tally statistical collectors. Each element of such a
matrix is an instance of
Tally
, and observations
can be added with
the add
method.
This class defines factory methods to fill a newly-constructed matrix
with Tally or TallyStore instances.
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
void |
add(double[][] x)
Same as add for a 2D array. |
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, ..., rows -
1, and c = 0, ..., columns - 1. |
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. |
MatrixOfTallies<E> |
clone()
Clones this object. |
static MatrixOfTallies<Tally> |
createWithTally(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 Tally . |
static MatrixOfTallies<TallyStore> |
createWithTallyStore(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 TallyStore . |
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. |
void |
standardDeviation(DoubleMatrix2D m)
For each tally in the matrix, computes the standard deviation, and stores it into the given matrix. |
void |
variance(DoubleMatrix2D m)
For each tally in the matrix, computes the sample variance, and stores it into the given matrix. |
Methods inherited from class umontreal.iro.lecuyer.stat.matrix.MatrixOfStatProbes |
---|
addMatrixOfObservationListener, clearMatrixOfObservationListeners, columnReport, columns, get, getName, init, isBroadcasting, isCollecting, iterator, notifyListeners, removeMatrixOfObservationListener, rowReport, rows, set, setBroadcasting, setCollecting, setColumns, setName, setRows, sum, viewColumn, viewRow |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MatrixOfTallies(int numRows, int numColumns)
numRows
- the number of rows in the matrix.numColumns
- the number of columns in the matrix.
NegativeArraySizeException
- if
numRows or numColumns are negative.public MatrixOfTallies(String name, int numRows, int numColumns)
name
- the global name of the matrix.numRows
- the number of rows in the matrix.numColumns
- the number of columns in the matrix.
NegativeArraySizeException
- if
numRows or numColumns are negative.Method Detail |
---|
public static MatrixOfTallies<Tally> createWithTally(int numRows, int numColumns)
Tally
.
numRows
- the number of rows in the matrix.numColumns
- the number of columns in the matrix.
public static MatrixOfTallies<TallyStore> createWithTallyStore(int numRows, int numColumns)
TallyStore
.
numRows
- the number of rows in the matrix.numColumns
- the number of columns in the matrix.
public void add(DoubleMatrix2D x)
rows
-
1, and c = 0, ..., 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.
x
- the matrix of observations.
NullPointerException
- if x is null.
IllegalArgumentException
- if the dimensions of x do not correspond to the
dimensions of this matrix of tallies.public void add(double[][] x)
add
for a 2D array.
public int numberObs()
public boolean areAllNumberObsEqual()
public void average(DoubleMatrix2D m)
average
in class MatrixOfStatProbes<E extends Tally>
m
- the matrix to be filled with averages.public void variance(DoubleMatrix2D m)
m
- the matrix to be filled with sample variances.
NullPointerException
- if m is null.
IllegalArgumentException
- if m.rows() does not correspond to rows
,
or m.columns() does not correspond to
columns
.public void standardDeviation(DoubleMatrix2D m)
variance
and performing a square root on every element of the filled matrix.
m
- the matrix to be filled with standard deviations.
NullPointerException
- if m is null.
IllegalArgumentException
- if m.rows() does not correspond to rows
,
or m.columns() does not correspond to
columns
.public MatrixOfTallies<E> clone()
clone
in class MatrixOfStatProbes<E extends Tally>
|
SSJ V. labo. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |