24package umontreal.ssj.stat.list;
26import umontreal.ssj.stat.FunctionOfMultipleMeansTally;
27import umontreal.ssj.util.MultivariateFunction;
28import cern.colt.matrix.DoubleMatrix1D;
29import cern.colt.matrix.DoubleMatrix2D;
43 double[][] temp =
null;
75 for (
int i = 0; i < size; i++)
93 public void add(
double[][] x) {
94 if (x.length != size())
95 throw new IllegalArgumentException(
"Invalid number of vectors of observations: the given length is " + x.length
96 +
", but the required length is " + size());
98 for (
int i = 0; i < size(); i++) {
117 public void add(DoubleMatrix2D x) {
118 if (x.rows() != size())
119 throw new IllegalArgumentException(
"Invalid number of vectors of observations: the given number is " + x.rows()
120 +
", but the required number is " + size());
122 for (
int i = 0; i < size(); i++) {
125 ta.
add(x.viewRow(i).toArray());
147 final int l = size();
150 throw new IllegalArgumentException(
151 "The length of the given array must be " + d +
" while its actual length is " + x.length);
153 if (x.length == 0 || l == 0)
156 if (l != x[0].length)
157 throw new IllegalArgumentException(
"The given arrays must have the same length");
159 for (
int i = 0; i < x.length - 1; i++)
160 if (x[i].length != x[i + 1].length)
161 throw new IllegalArgumentException(
"The given arrays must have the same length");
163 if ((temp ==
null) || (temp.length != l) || (temp[0].length != d))
164 temp =
new double[l][d];
166 for (
int i = 0; i < l; i++)
167 for (
int j = 0; j < d; j++)
168 temp[i][j] = x[j][i];
178 final int l = size();
181 throw new IllegalArgumentException(
182 "The length of the given array must be " + d +
" while its actual length is " + x.length);
184 if (x.length == 0 || l == 0)
187 if (l != x[0].size())
188 throw new IllegalArgumentException(
"The given arrays must have the same length");
190 for (
int i = 0; i < x.length - 1; i++)
191 if (x[i].size() != x[i + 1].size())
192 throw new IllegalArgumentException(
"The given arrays must have the same length");
194 if ((temp ==
null) || (temp.length != l) || (temp[0].length != d))
195 temp =
new double[l][d];
197 for (
int i = 0; i < l; i++)
198 for (
int j = 0; j < d; j++)
199 temp[i][j] = x[j].
get(i);
238 final int l = size();
240 for (
int i = 1; i < l; i++) {
255 for (
int i = 0; i < a.length; i++)
256 if (!Double.isNaN(a[i]) &&
get(i).numberObs() == 0)
272 if (v.length != size())
273 throw new IllegalArgumentException(
"Incompatible array length: the given length is " + v.length
274 +
" while the required length is " + size());
275 for (
int i = 0; i < v.length; i++) {
277 if (tally ==
null || tally.
numberObs() < 2)
295 if (v.length != size())
296 throw new IllegalArgumentException(
"Incompatible array length: the given length is " + v.length
297 +
" while the required length is " + size());
298 for (
int i = 0; i < v.length; i++) {
300 if (tally ==
null || tally.
numberObs() < 2)
315 clone.temp =
new double[temp.length][temp[0].length];
316 for (
int i = 0; i < temp.length; i++)
317 for (
int j = 0; j < temp[i].length; i++)
318 clone.temp[i][j] = temp[i][j];
Represents a statistical collector for estimating a function of multiple means with a confidence inte...
int numberObs()
Returns the number of vectors of observations given to this probe since its last initialization.
int getDimension()
Returns the dimension of this tally, i.e., the size of any vector of observations.
double standardDeviation()
Returns the square root of variance.
double variance()
Estimates where is the number of vectors of observations given to this collector since the last ini...
void add(double[][] x)
For each tally i in this list, adds the vector x[i].
void addSameDimension(double[]... x)
For each element i of this list of tallies, adds the vector of observations x[0][i],...
static ListOfFunctionOfMultipleMeansTallies< FunctionOfMultipleMeansTally > create(MultivariateFunction func, int d, int size)
This factory method constructs and returns a list of tallies with size instances of .
ListOfFunctionOfMultipleMeansTallies(String name)
Constructs a new empty list of tallies with name name.
int getDimension()
Assuming that each tally in this list has the same dimension, returns the dimension of tally 0,...
void standardDeviation(double[] v)
For each tally in this list, computes the standard deviation, and stores it into v.
boolean areAllNumberObsEqual()
Tests that every tally in this list contains the same number of observations.
void variance(double[] v)
For each tally in this list, computes the sample variance and stores it into v.
ListOfFunctionOfMultipleMeansTallies()
Constructs a new empty list of tallies.
void average(double[] a)
Computes the function of averages for each tally in this list.
void addSameDimension(DoubleMatrix1D... x)
Equivalent to addSameDimension(double[][]) x.toArray(), without copying the elements of x into a temp...
void add(DoubleMatrix2D x)
Equivalent to add(x.toArray()), without copying the elements of x into a temporary 2D array.
int numberObs()
Assuming that each tally in this list contains the same number of observations, returns the number of...
ListOfFunctionOfMultipleMeansTallies< E > clone()
Clones this object.
Represents a function of multiple variables.
Provides support for lists of statistical probes.