25package umontreal.ssj.stochprocess;
27import umontreal.ssj.rng.*;
28import umontreal.ssj.probdist.*;
29import umontreal.ssj.randvar.*;
60 this.otherStream = otherStream;
62 numberOfRandomStreams = 2;
73 for (
int i = 0; i < d; i++) {
78 observationCounter = d;
88 public double[]
generatePath(
double[] unifNorm,
double[] unifOther) {
94 for (
int i = 0; i < d; i++) {
99 observationCounter = d;
100 normalGen.setStream(stream);
108 throw new UnsupportedOperationException(
"Use generatePath with 2 streams");
112 double s = path[observationIndex];
115 observationCounter = observationIndex;
116 path[observationIndex] = s;
125 if (stream != otherStream)
126 throw new IllegalStateException(
"Two different streams or more are present");
134 super.setStream(stream);
135 normalGen.setStream(stream);
143 super.setStream(stream);
144 normalGen.setStream(stream);
153 this.otherStream = otherStream;
169 this.normalGen = normalGen;
170 stream = normalGen.getStream();
190 public NonRandomStream(
double[] array) {
195 public NonRandomStream(
double value) {
196 this.array =
new double[] { value };
201 return array[position++];
205 for (
int i = 0; i < n; i++)
206 u[start + i] = array[position++];
210 double diff = (double) (j - i);
211 for (
int ii = 0; ii < n; ii++)
212 u[start + ii] = i + (
int) Math.round(diff * array[position++]);
216 return (
int) Math.round((
double) (j - i) * array[position]);
230 return new String(
"NonRandomStream of length " + array.length);
This class implements inverse gaussian random variate generators using the many-to-one transformation...
static double nextDouble(RandomStream s, NormalGen sn, double mu, double lambda)
Generates a new variate from the inverse gaussian distribution with parameters mu and lambda,...
This class implements methods for generating random variates from the normal distribution .
NonRandomStream: Given a double array, this class will return those values as if it where a random st...
void resetNextSubstream()
Reinitializes the stream to the beginning of its next substream:
double nextDouble()
Returns a (pseudo)random number from the uniform distribution over the interval , using this stream,...
void resetStartStream()
Reinitializes the stream to its initial state : and are set to .
void nextArrayOfDouble(double[] u, int start, int n)
Generates n (pseudo)random numbers from the uniform distribution and stores them into the array u sta...
void nextArrayOfInt(int i, int j, int[] u, int start, int n)
Generates n (pseudo)random numbers from the discrete uniform distribution over the integers ,...
String toString()
Returns a string containing the current state of this stream.
void resetStartSubstream()
Reinitializes the stream to the beginning of its current substream:
int nextInt(int i, int j)
Returns a (pseudo)random number from the discrete uniform distribution over the integers ,...
double nextObservation()
Generates and returns the next observation of the stochastic process.
double[] generatePath()
Generates the path.
void setStream(RandomStream stream, RandomStream otherStream)
Sets the streams.
RandomStream getStream()
Only returns a stream if both inner umontreal.ssj.rng.RandomStream ’s are the same.
void setStream(RandomStream stream)
Sets both inner streams to stream.
InverseGaussianProcessMSH(double s0, double delta, double gamma, RandomStream stream, RandomStream otherStream)
Constructs a new InverseGaussianProcessMSH.
void setNormalGen(NormalGen normalGen)
Sets the normal generator.
void setOtherStream(RandomStream otherStream)
Sets the otherStream, which is the stream used to choose between the two roots in the MSH method.
RandomStream getOtherStream()
Returns the otherStream, which is the stream used to choose between the two quadratic roots from the ...
double[] generatePath(double[] uniforms01)
Not implemented, requires two umontreal.ssj.rng.RandomStream ’s.
double[] generatePath(double[] unifNorm, double[] unifOther)
Instead of using the internal streams to generate the path, uses two arrays of uniforms .
NormalGen getNormalGen()
Returns the normal generator.
void setParams(double delta, double gamma)
Sets the parameters.
This interface defines the basic structures to handle multiple streams of uniform (pseudo)random numb...