1package umontreal.ssj.mcqmctools;
3import umontreal.ssj.hups.*;
4import umontreal.ssj.rng.RandomStream;
5import umontreal.ssj.stat.*;
6import umontreal.ssj.stat.list.ListOfTallies;
7import umontreal.ssj.stat.list.lincv.ListOfTalliesWithCV;
8import umontreal.ssj.util.Chrono;
9import umontreal.ssj.util.PrintfFormat;
43 for (
int rep = 0; rep < m; rep++) {
69 Tally statReps,
double[][] data) {
71 data =
new double[m][];
75 for (
int rep = 0; rep < m; rep++) {
97 str.
append(
"Randomization: " + rand.toString() +
"\n");
120 str.
append(
"Randomization: " + rand.toString() +
"\n");
122 str.
append(
"Total CPU time: " + timer.
format() +
"\n\n");
123 str.
append(
"MC Variance per run: ");
124 str.
append(12, 5, 4, variancePerRunMC);
126 str.
append(
"RQMC Variance per run: ");
127 str.
append(10, 5, 4, varianceRQMC);
129 str.
append(
"Variance ratio: ");
130 str.
append(12, 3, 4, variancePerRunMC / varianceRQMC);
132 str.
append(
"Efficiency ratio: ");
133 str.
append(12, 3, 4, (variancePerRunMC * secondsPerRunMC) / (varianceRQMC * secondsRQMC));
134 str.
append(
"\n---------------------------------------------------------------\n");
162 Tally statMC =
new Tally(
"Statistics with MC");
163 Tally statRQMC =
new Tally(
"Statistics on RQMC averages");
205 for (
int rep = 0; rep < m; rep++) {
209 double[] means =
new double[t];
211 statRepsList.
add(means);
258 for (
int rep = 0; rep < m; rep++) {
263 double[] means =
new double[t];
265 statRepsList.
add(means);
266 for (
int i = 0; i < t; i++)
271 for (
int k = 0; k < n; k++)
273 data[rep][k][i] = statSave.get(i).getArray()[k];
305 for (
int rep = 0; rep < m; rep++) {
308 double sumValues = 0.0;
309 double[] sumValuesCV =
new double[numCV];
310 double[] curValuesCV =
new double[numCV];
311 for (
int i = 0; i < n; i++) {
315 for (
int k = 0; k < numCV; k++)
316 sumValuesCV[k] += curValuesCV[k];
319 for (
int k = 0; k < numCV; k++)
320 sumValuesCV[k] /= (
double) n;
321 statWithCV.
add(sumValues / (
double) n, sumValuesCV);
334 for (
int j = 0; j < m; j++) {
338 average1 = statValue.
average();
341 statDiffRQMC.
add((statValue.
average() - average1) / delta);
This abstract class represents a general point set.
void randomize(PointSetRandomization rand)
Randomizes this point set using the given rand.
PointSetIterator iterator()
Constructs and returns a point set iterator.
int getNumPoints()
Returns the number of points.
String toString()
Formats a string that contains information about the point set.
This class is used for randomized quasi-Monte Carlo (RQMC) simulations.
PointSet getPointSet()
Returns the point set associated to this object.
PointSetRandomization getRandomization()
Returns the randomization associated to this object.
This class is a variant of Tally for which the individual observations are stored in a list implement...
void quickSort()
Sorts the elements of this probe using the quicksort from Colt.
double[] getArray()
Returns the observations stored in this probe.
double average()
Returns the average value of the observations since the last initialization.
void setConfidenceIntervalStudent()
Indicates that a confidence interval on the true mean, based on the normality assumption,...
double variance()
Returns the sample variance of the observations since the last initialization.
void init()
Initializes the statistical collector.
void add(double x)
Gives a new observation x to the statistical collector.
String report()
Returns a formatted string that contains a report on this probe.
void init()
Initializes this list of statistical probes by calling umontreal.ssj.stat.StatProbe....
Represents a list of tally statistical collectors.
static ListOfTallies< Tally > createWithTally(int size)
This factory method constructs and returns a list of tallies with size instances of umontreal....
void average(double[] r)
Computes the average for each tally in this list, and stores the averages in the array r.
static ListOfTallies< TallyStore > createWithTallyStore(int size)
This factory method constructs and returns a list of tallies with size instances of umontreal....
void add(double[] x)
Adds the observation x[i] in tally i of this list, for i = 0,…, size() - 1.
Represents a list of tallies with control variables that inherits the functionalities of a list of ta...
void add(double[] x, double[] c)
Adds a new observation to this list of tallies.
String format()
Converts the CPU time used by the program since its last call to init for this AbstractChrono to a St...
double getSeconds()
Returns the CPU time in seconds used by the program since the last call to init for this AbstractChro...
The Chrono class extends the umontreal.ssj.util.AbstractChrono class and computes the CPU time for th...
This is the interface for iterators that permit one to go through the points of a PointSet and the su...
This interface is for a randomization that can be used to randomize a umontreal.ssj....
void randomize(PointSet p)
This method must randomize p.
This interface defines the basic structures to handle multiple streams of uniform (pseudo)random numb...
void resetNextSubstream()
Reinitializes the stream to the beginning of its next substream:
void resetStartStream()
Reinitializes the stream to its initial state : and are set to .