25package umontreal.ssj.probdistmulti.norta;
27import umontreal.ssj.util.*;
28import umontreal.ssj.probdist.*;
68 super(rX, dist1, dist2, tr);
79 double[] x =
new double[3];
80 double[] y =
new double[3];
81 double[] c =
new double[3];
82 double xtemp = 0.0, temp = 0.0;
90 double dold, dmid, dnew;
95 double h = (1 - delta) / (2 * m);
101 double intg1 = mu1 * mu2;
102 double gr = rX * sd1 * sd2 + mu1 * mu2;
112 if (0 < rX && rX < 1) {
117 for (
int i = 1; i <= m; i++) {
118 dmid =
deriv(xold + h);
121 inew = iold + hd3 * (dold + 4 * dmid + dnew);
131 b = (c[2] * (xtemp + xold) - c[1]
132 + Math.sqrt((c[1] - c[2] * (xtemp + xold)) * (c[1] - c[2] * (xtemp + xold))
133 - 4 * c[2] * (c[0] - c[1] * xtemp + c[2] * xtemp * xold - gr)))
148 if (-1 < rX && rX < 0) {
153 for (
int i = 1; i <= m; i++) {
154 dmid =
deriv(xold - h);
157 inew = iold - hd3 * (dold + 4 * dmid + dnew);
167 b = (c[2] * (xnew + xold) - c[1]
168 + Math.sqrt((c[1] - c[2] * (xnew + xold)) * (c[1] - c[2] * (xnew + xold))
169 - 4 * c[2] * (c[0] - c[1] * xnew + c[2] * xnew * xold - gr)))
186 public String toString() {
187 String desc = super.toString();
188 desc +=
"m : " + m +
"\n";
189 desc +=
"delta : " + delta +
"\n";
Classes implementing discrete distributions over the integers should inherit from this class.
double computeCorr()
Computes and returns the correlation using the algorithm NI2b.
NI2b(double rX, DiscreteDistributionInt dist1, DiscreteDistributionInt dist2, double tr, int m, double delta)
Constructor with the target rank correlation rX, the two discrete marginals dist1 and dist2,...
NortaInitDisc(double rX, DiscreteDistributionInt dist1, DiscreteDistributionInt dist2, double tr)
Constructor with the target rank correlation rX, the two discrete marginals dist1 and dist2 and the p...
double deriv(double r)
Computes the derivative of , given by.
void computeParams()
Computes the following inputs of each marginal distribution:
This class provides miscellaneous functions that are hard to classify.
static void interpol(int n, double[] X, double[] Y, double[] C)
Computes the Newton interpolating polynomial.