SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
IIDMultivariateGen.java
1/*
2 * Class: IIDMultivariateGen
3 * Description: vector of independent identically distributed random variables
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 David Munger
9 * @since January 2011
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.randvar.RandomVariateGen;
28
36
45 setGen1(gen1);
46 this.stream = gen1.getStream();
47 dimension = d;
48 }
49
53 public void setDimension(int d) {
54 dimension = d;
55 }
56
60 public void nextPoint(double[] p) {
61 if (p.length != dimension)
62 throw new IllegalArgumentException(
63 String.format("p's dimension (%d) does not mach dimension (%d)", p.length, dimension));
64
65 for (int i = 0; i < dimension; i++)
66 p[i] = gen1.nextDouble();
67 }
68
72 public void setGen1(RandomVariateGen gen1) {
73 if (gen1 == null)
74 throw new NullPointerException("gen1 is null");
75 this.gen1 = gen1;
76 }
77
82 return gen1;
83 }
84
88 public String toString() {
89 return dimension + "-dimensional vector of i.i.d. " + gen1.getDistribution().toString();
90 }
91
92}
This is the base class for all random variate generators over the real line.
void setDimension(int d)
Changes the dimension of the vector to d.
String toString()
Returns a string representation of the generator.
IIDMultivariateGen(RandomVariateGen gen1, int d)
Constructs a generator for a d-dimensional vector of i.i.d.
void setGen1(RandomVariateGen gen1)
Sets the common one-dimensional generator to gen1.
RandomVariateGen getGen1()
Returns the common one-dimensional generator used in this class.
void nextPoint(double[] p)
Generates a vector of i.i.d.
This class is the multivariate counterpart of.