17 0, 0, 1, 12, 12, 12, 12, 12, 12, 12, 12, 15, 15, 15, 8,
18 0, 1, 1, 2, 2, 4, 4, 13, 13, 14, 14, 15, 15, 15, 8,
19 1, 1, 2, 2, 2, 4, 4, 14, 14, 14, 14, 15, 15, 15, 9,
20 1, 1, 2, 4, 4, 4, 4, 6, 6, 15, 15, 15, 15, 15, 9,
21 1, 2 , 2, 4, 4, 5 , 5, 7, 7, 16 ,16, 16, 11, 11, 10,
22 1, 2 , 4, 4 , 4, 5 , 5, 7, 7, 16, 16, 16, 11, 11, 11,
23 1, 2 , 3, 3, 5, 5 , 7, 7, 16, 16, 16, 16, 16, 11, 11,
24 1, 2 , 3 , 3 , 5, 5, 17, 17, 17, 17, 16, 16, 16, 11, 11
27 static const double HRANGE[] = {0.02, 0.06, 0.09, 0.125, 0.26, 0.4, 0.6, 1.6,
28 1.7, 2.33, 2.4, 3.36, 3.4, 4.8};
30 static const double ARANGE[] = {0.025, 0.09, 0.15, 0.36, 0.5, 0.9, 0.99999};
32 static const double ORD[] = {2, 3, 4, 5, 7, 10, 12, 18, 10, 20, 30, 0, 4, 7,
35 static const int METHODS[] = {1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 4, 4, 4, 4,
38 static const double C[] = {
39 0.99999999999999999999999729978162447266851932041876728736094298092917625009873,
40 -0.99999999999999999999467056379678391810626533251885323416799874878563998732905968,
41 0.99999999999999999824849349313270659391127814689133077036298754586814091034842536,
42 -0.9999999999999997703859616213643405880166422891953033591551179153879839440241685,
43 0.99999999999998394883415238173334565554173013941245103172035286759201504179038147,
44 -0.9999999999993063616095509371081203145247992197457263066869044528823599399470977,
45 0.9999999999797336340409464429599229870590160411238245275855903767652432017766116267,
46 -0.999999999574958412069046680119051639753412378037565521359444170241346845522403274,
47 0.9999999933226234193375324943920160947158239076786103108097456617750134812033362048,
48 -0.9999999188923242461073033481053037468263536806742737922476636768006622772762168467,
49 0.9999992195143483674402853783549420883055129680082932629160081128947764415749728967,
50 -0.999993935137206712830997921913316971472227199741857386575097250553105958772041501,
51 0.99996135597690552745362392866517133091672395614263398912807169603795088421057688716,
52 -0.99979556366513946026406788969630293820987757758641211293079784585126692672425362469,
53 0.999092789629617100153486251423850590051366661947344315423226082520411961968929483,
54 -0.996593837411918202119308620432614600338157335862888580671450938858935084316004769854,
55 0.98910017138386127038463510314625339359073956513420458166238478926511821146316469589567,
56 -0.970078558040693314521331982203762771512160168582494513347846407314584943870399016019,
57 0.92911438683263187495758525500033707204091967947532160289872782771388170647150321633673,
58 -0.8542058695956156057286980736842905011429254735181323743367879525470479126968822863,
59 0.73796526033030091233118357742803709382964420335559408722681794195743240930748630755,
60 -0.58523469882837394570128599003785154144164680587615878645171632791404210655891158,
61 0.415997776145676306165661663581868460503874205343014196580122174949645271353372263,
62 -0.2588210875241943574388730510317252236407805082485246378222935376279663808416534365,
63 0.1375535825163892648504646951500265585055789019410617565727090346559210218472356689,
64 -0.0607952766325955730493900985022020434830339794955745989150270485056436844239206648,
65 0.0216337683299871528059836483840390514275488679530797294557060229266785853764115,
66 -0.00593405693455186729876995814181203900550014220428843483927218267309209471516256,
67 0.0011743414818332946510474576182739210553333860106811865963485870668929503649964142,
68 -1.489155613350368934073453260689881330166342484405529981510694514036264969925132E-4,
69 9.072354320794357587710929507988814669454281514268844884841547607134260303118208E-6
72 static const double PTS[] = {
73 0.35082039676451715489E-02, 0.31279042338030753740E-01,
74 0.85266826283219451090E-01, 0.16245071730812277011E+00,
75 0.25851196049125434828E+00, 0.36807553840697533536E+00,
76 0.48501092905604697475E+00, 0.60277514152618576821E+00,
77 0.71477884217753226516E+00, 0.81475510988760098605E+00,
78 0.89711029755948965867E+00, 0.95723808085944261843E+00,
79 0.99178832974629703586E+00
82 static const double WTS[] = {
83 0.18831438115323502887E-01, 0.18567086243977649478E-01,
84 0.18042093461223385584E-01, 0.17263829606398753364E-01,
85 0.16243219975989856730E-01, 0.14994592034116704829E-01,
86 0.13535474469662088392E-01, 0.11886351605820165233E-01,
87 0.10070377242777431897E-01, 0.81130545742299586629E-02,
88 0.60419009528470238773E-02, 0.38862217010742057883E-02,
89 0.16793031084546090448E-02
99 for (
i = 0;
i < 14;
i++) {
106 for (
i = 0;
i < 7;
i++) {
130 double hs = -0.5 *
h *
h;
131 double dhs =
exp(hs);
133 double aj =
a / (2 *
M_PI);
134 double dj =
expm1(hs);
135 double gj = hs * dhs;
156 static double owensT2(
double h,
double a,
double ah,
double m) {
158 int maxi = 2 *
m + 1;
164 double z = (
ndtr(ah) - 0.5) /
h;
171 z =
y * (vi -
i *
z);
182 double aa, hh,
y, vi, zi,
result;
193 for(
i = 0;
i<= 30;
i++) {
195 zi =
y * ((2 *
i + 1) * zi - vi);
214 ai =
a *
exp(-hh * (1 - naa) / 2) / (2 *
M_PI);
226 yi = (1 - hh * yi) /
i;
235 double result, r, aa, nhh;
243 for (
i = 1;
i < 14;
i++) {
244 r = 1 + aa *
PTS[
i - 1];
260 result = normh * (1 - normh) / 2;
271 int index, meth_code;
316 double result, fabs_a, fabs_ah, normh, normah;
331 fabs_ah = fabs_a *
h;
333 if (fabs_a == INFINITY) {
337 else if (
h == INFINITY) {
340 else if (fabs_a <= 1) {
344 if (fabs_ah <= 0.67) {
347 result = 0.25 - normh * normah -
353 result = (normh + normah) / 2 - normh * normah -