SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
ChiSquareNoncentralPoisGen.java
1/*
2 * Class: ChiSquareNoncentralPoisGen
3 * Description: noncentral chi square random variate generators using Poisson
4 and central chi square generators
5 * Environment: Java
6 * Software: SSJ
7 * Copyright (C) 2001 Pierre L'Ecuyer and Universite de Montreal
8 * Organization: DIRO, Universite de Montreal
9 * @author Richard Simard
10 * @since
11 *
12 *
13 * Licensed under the Apache License, Version 2.0 (the "License");
14 * you may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
16 *
17 * http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 *
25 */
26package umontreal.ssj.randvar;
27
28import umontreal.ssj.rng.*;
29
54
62 public ChiSquareNoncentralPoisGen(RandomStream stream, double nu, double lambda) {
63 super(stream, null);
64 setParams(nu, lambda);
65 if (lambda > 4290000000.0)
66 throw new UnsupportedOperationException(" lambda too large");
67 }
68
69 public double nextDouble() {
70 return poisGenere(stream, nu, lambda);
71 }
72
79 public static double nextDouble(RandomStream stream, double nu, double lambda) {
80 return poisGenere(stream, nu, lambda);
81 }
82
83//>>>>>>>>>>>>>>>>>>>> P R I V A T E S M E T H O D S <<<<<<<<<<<<<<<<<<<<
84
85 private static double poisGenere(RandomStream s, double nu, double lambda) {
86 int j = PoissonTIACGen.nextInt(s, 0.5 * lambda);
87 return GammaAcceptanceRejectionGen.nextDouble(s, 0.5 * nu + j, 0.5);
88 }
89
90}
void setParams(double nu, double lambda)
Sets the parameters nu and lambda of this object.
ChiSquareNoncentralGen(RandomStream s, double nu, double lambda)
Creates a noncentral chi square random variate generator with nu.
static double nextDouble(RandomStream stream, double nu, double lambda)
Generates a variate from the noncentral chi square distribution with parameters &#160;nu,...
ChiSquareNoncentralPoisGen(RandomStream stream, double nu, double lambda)
Creates a noncentral chi square random variate generator with.
double nextDouble()
Generates a random number from the continuous distribution contained in this object.
This class implements gamma random variate generators using a method that combines acceptance-rejecti...
static double nextDouble(RandomStream s, RandomStream aux, double alpha, double lambda)
Generates a new gamma variate with parameters &#160;alpha and &#160;lambda, using main stream s and auxilia...
This class implements random variate generators having the Poisson distribution (see PoissonGen ).
int nextInt()
Generates a random number (an integer) from the discrete distribution contained in this object.
This interface defines the basic structures to handle multiple streams of uniform (pseudo)random numb...