SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
NakagamiGen.java
1/*
2 * Class: NakagamiGen
3 * Description: random variate generators for the Nakagami distribution.
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.randvar;
26
27import umontreal.ssj.rng.*;
28import umontreal.ssj.probdist.*;
29
40public class NakagamiGen extends RandomVariateGen {
41 // Distribution parameters
42 protected double a;
43 protected double lambda;
44 protected double c;
45
51 public NakagamiGen(RandomStream s, double a, double lambda, double c) {
52 super(s, new NakagamiDist(a, lambda, c));
53 setParams(a, lambda, c);
54 }
55
60 super(s, dist);
61 if (dist != null)
62 setParams(dist.getA(), dist.getLambda(), dist.getC());
63 }
64
75 public static double nextDouble(RandomStream s, double a, double lambda, double c) {
76 return NakagamiDist.inverseF(a, lambda, c, s.nextDouble());
77 }
78
84 public double getA() {
85 return a;
86 }
87
93 public double getLambda() {
94 return lambda;
95 }
96
102 public double getC() {
103 return c;
104 }
105
106 protected void setParams(double a, double lambda, double c) {
107 if (lambda <= 0.0)
108 throw new IllegalArgumentException("lambda <= 0");
109 if (c <= 0.0)
110 throw new IllegalArgumentException("c <= 0");
111 this.a = a;
112 this.lambda = lambda;
113 this.c = c;
114 }
115}
Extends the class ContinuousDistribution for the Nakagami distribution with location parameter ,...
double inverseF(double u)
Returns the inverse distribution function .
static double nextDouble(RandomStream s, double a, double lambda, double c)
Generates a variate from the Nakagami distribution with parameters.
double getLambda()
Returns the scale parameter of this object.
NakagamiGen(RandomStream s, double a, double lambda, double c)
Creates a new Nakagami generator with parameters a,.
double getA()
Returns the location parameter of this object.
NakagamiGen(RandomStream s, NakagamiDist dist)
Creates a new generator for the distribution dist, using stream s.
double getC()
Returns the shape parameter of this object.
This interface defines the basic structures to handle multiple streams of uniform (pseudo)random numb...
double nextDouble()
Returns a (pseudo)random number from the uniform distribution over the interval , using this stream,...