Class MvnRectangle
SolverFluid.getProbAggr under the moment-closure methods. Java twin of
the MATLAB fluid_mvn_rectangle and of the Python mvn_rectangle.
The integral has no closed form beyond one dimension, so it is evaluated by the separation-of-variables transformation of Genz (1992): the Cholesky factor of C turns the rectangle into an iterated integral over the unit cube whose integrand is a product of normal-CDF differences, and the first coordinate is integrated exactly. The remaining cube is integrated with a DETERMINISTIC Richtmyer lattice rule, frac(k*sqrt(p_j)) over the first primes, averaged with its antithetic reflection. Determinism is required here, not merely convenient: the MATLAB, Java and Python twins must return the same number, and a randomized rule would make them agree only in distribution.
C may be SINGULAR, which is the common case: a closed population fixes the sum of the station coordinates, so the covariance of a station holding a whole class is rank deficient. A coordinate whose CONDITIONAL variance vanishes is not integrated; it is a hard constraint, contributing 1 when the conditional mean falls inside its interval and 0 otherwise.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intLattice points per antithetic pair. -
Method Summary
Modifier and TypeMethodDescriptionstatic doublelogProbability(double[] m, double[][] C, double[] a, double[] b) Natural logarithm ofprobability(double[], double[][], double[], double[]), negative infinity when the probability is zero.static doubleprobability(double[] m, double[][] C, double[] a, double[] b) Probability that a normal vector falls in the rectangle [a,b].static doubleprobability(double[] m, double[][] C, double[] a, double[] b, int npoints) Probability that a normal vector falls in the rectangle [a,b].
-
Field Details
-
DEFAULT_POINTS
public static final int DEFAULT_POINTSLattice points per antithetic pair.- See Also:
-
-
Method Details
-
probability
public static double probability(double[] m, double[][] C, double[] a, double[] b) Probability that a normal vector falls in the rectangle [a,b].- Parameters:
m- mean vector, length dC- covariance matrix, d-by-d, symmetric positive semi-definitea- lower corner, -infinity allowedb- upper corner, +infinity allowed- Returns:
- the probability in [0,1]
-
probability
public static double probability(double[] m, double[][] C, double[] a, double[] b, int npoints) Probability that a normal vector falls in the rectangle [a,b].- Parameters:
m- mean vector, length dC- covariance matrix, d-by-d, symmetric positive semi-definitea- lower corner, -infinity allowedb- upper corner, +infinity allowednpoints- lattice points per antithetic pair- Returns:
- the probability in [0,1]
-
logProbability
public static double logProbability(double[] m, double[][] C, double[] a, double[] b) Natural logarithm ofprobability(double[], double[][], double[], double[]), negative infinity when the probability is zero.- Parameters:
m- mean vectorC- covariance matrixa- lower cornerb- upper corner- Returns:
- log of the rectangle probability
-