25package umontreal.ssj.probdistmulti.norta;
27import umontreal.ssj.util.*;
28import umontreal.ssj.probdist.*;
80 super(rX, dist1, dist2, tr);
91 double[] x =
new double[3];
92 double[] y =
new double[3];
93 double[] c =
new double[3];
94 double xtemp = 0.0, temp = 0.0;
102 double dold, dmid, dnew;
115 double h2 = 0.0, hd3 = 0.0;
118 double rho1 = 2 * Math.sin(Math.PI * rX / 6);
119 double intg1 =
integ(rho1);
120 double gr = rX * sd1 * sd2 + mu1 * mu2;
127 if (0 < rX && rX < 1)
128 d = 1 - delta - rho1;
129 if (-1 < rX && rX < 0)
131 m = (int) Math.ceil(d / (2 * h));
139 for (
int i = 1; i <= m; i++) {
140 dmid =
deriv(xold + h);
143 inew = iold + hd3 * (dold + 4 * dmid + dnew);
154 b = (c[2] * (xtemp + xold) - c[1]
155 + Math.sqrt((c[1] - c[2] * (xtemp + xold)) * (c[1] - c[2] * (xtemp + xold))
156 - 4 * c[2] * (c[0] - c[1] * xtemp + c[2] * xtemp * xold - gr)))
170 if (0 < rX && rX < 1)
172 if (-1 < rX && rX < 0)
173 d = rho1 + 1 - delta;
174 m = (int) Math.ceil(d / (2 * h));
181 for (
int i = 1; i <= m; i++) {
182 dmid =
deriv(xold - h);
185 inew = iold - hd3 * (dold + 4 * dmid + dnew);
195 b = (c[2] * (xnew + xold) - c[1]
196 + Math.sqrt((c[1] - c[2] * (xnew + xold)) * (c[1] - c[2] * (xnew + xold))
197 - 4 * c[2] * (c[0] - c[1] * xnew + c[2] * xnew * xold - gr)))
212 public String toString() {
213 String desc = super.toString();
214 desc +=
"h : " + h +
"\n";
215 desc +=
" delta : " + delta +
"\n";
Classes implementing discrete distributions over the integers should inherit from this class.
NI2a(double rX, DiscreteDistributionInt dist1, DiscreteDistributionInt dist2, double tr, double h, double delta)
Constructor with the target rank correlation rX, the two discrete marginals dist1 and dist2,...
double computeCorr()
Computes and returns the correlation using the algorithm NI2a.
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:
double integ(double r)
Computes the function.
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.