SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
RandomMultivariateGen.java
1/*
2 * Class: RandomMultivariateGen
3 * Description: base class for multidimensional random variate generators
4 * Environment: Java
5 * Software: SSJ
6 * Copyright (C) 2001 Pierre L'Ecuyer and Universite de Montreal
7 * Organization: DIRO, Universite de Montreal
8 * @author
9 * @since
10 *
11 *
12 * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 * http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 *
24 */
25package umontreal.ssj.randvarmulti;
26
27import umontreal.ssj.probdistmulti.ContinuousDistributionMulti;
28import umontreal.ssj.rng.RandomStream;
29import umontreal.ssj.randvar.RandomVariateGen;
30
51public abstract class RandomMultivariateGen {
52 protected int dimension;
53 // Careful here: there is also a RandomStream inside gen1. But only one
54 // of these two is used in a given class.
55 protected RandomStream stream; // stream used to generate random numbers
56 protected RandomVariateGen gen1; // 1-dim generator used to generate random variates
57// This constructor is needed for subclasses with no associated distribution.
58// protected RandomMultivariateGen() {}
59
64 abstract public void nextPoint(double[] p);
65
78 public void nextArrayOfPoints(double[][] v, int start, int n) {
79 if (n <= 0)
80 throw new IllegalArgumentException("n must be positive.");
81 for (int i = 0; i < n; i++)
82 nextPoint(v[start + i]);
83 }
84
89 public int getDimension() {
90 return dimension;
91 }
92
99 if (null != gen1)
100 return gen1.getStream();
101 return stream;
102 }
103
107 public void setStream(RandomStream stream) {
108 if (null != gen1)
109 gen1.setStream(stream);
110 else
111 this.stream = stream;
112 }
113
114}
This is the base class for all random variate generators over the real line.
This class is the multivariate counterpart of.
void setStream(RandomStream stream)
Sets the umontreal.ssj.rng.RandomStream used by this object to stream.
RandomStream getStream()
Returns the umontreal.ssj.rng.RandomStream used by this object.
int getDimension()
Returns the dimension of this multivariate generator (the dimension of the random points).
void nextArrayOfPoints(double[][] v, int start, int n)
Generates random points.
abstract void nextPoint(double[] p)
Generates a random point using the the stream contained in this object.
This interface defines the basic structures to handle multiple streams of uniform (pseudo)random numb...