SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
DiscreteDistributionIntMulti.java
1/*
2 * Class: DiscreteDistributionIntMulti
3 * Description: mother class for discrete distributions over the integers
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.probdistmulti;
26
39public abstract class DiscreteDistributionIntMulti {
40 protected int dimension;
41
49 public abstract double prob(int[] x);
50
58 public double cdf(int x[]) {
59 int is[] = new int[x.length];
60 for (int i = 0; i < is.length; i++)
61 is[i] = 0;
62
63 boolean end = false;
64 double sum = 0.0;
65 int j;
66 while (!end) {
67 sum += prob(is);
68 is[0]++;
69
70 if (is[0] > x[0]) {
71 is[0] = 0;
72 j = 1;
73 while (j < x.length && is[j] == x[j])
74 is[j++] = 0;
75
76 if (j == x.length)
77 end = true;
78 else
79 is[j]++;
80 }
81 }
82
83 return sum;
84 }
85
89 public int getDimension() {
90 return dimension;
91 }
92
96 public abstract double[] getMean();
97
102 public abstract double[][] getCovariance();
103
109 public abstract double[][] getCorrelation();
110
111}
Classes implementing multi-dimensional discrete distributions over the integers should inherit from t...
abstract double[] getMean()
Returns the mean vector of the distribution, defined as .
abstract double[][] getCorrelation()
Returns the correlation matrix of the distribution, defined as.
int getDimension()
Returns the dimension of the distribution.
double cdf(int x[])
Computes the cumulative probability function of the distribution evaluated at x, assuming the lowest...
abstract double[][] getCovariance()
Returns the variance-covariance matrix of the distribution, defined as .
abstract double prob(int[] x)
Returns the probability mass function , which should be a real number in .