Xmipp  v3.23.11-Nereus
statistics.cpp
Go to the documentation of this file.
1 /*************************************************************************
2 Copyright (c) Sergey Bochkanov (ALGLIB project).
3 
4 >>> SOURCE LICENSE >>>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation (www.fsf.org); either version 2 of the
8 License, or (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 A copy of the GNU General Public License is available at
16 http://www.fsf.org/licensing/licenses
17 >>> END OF LICENSE >>>
18 *************************************************************************/
19 #include "stdafx.h"
20 #include "statistics.h"
21 
22 // disable some irrelevant warnings
23 #if (AE_COMPILER==AE_MSVC)
24 #pragma warning(disable:4100)
25 #pragma warning(disable:4127)
26 #pragma warning(disable:4702)
27 #pragma warning(disable:4996)
28 #endif
29 using namespace std;
30 
32 //
33 // THIS SECTION CONTAINS IMPLEMENTATION OF C++ INTERFACE
34 //
36 namespace alglib
37 {
38 
39 
40 /*************************************************************************
41 Calculation of the distribution moments: mean, variance, skewness, kurtosis.
42 
43 INPUT PARAMETERS:
44  X - sample
45  N - N>=0, sample size:
46  * if given, only leading N elements of X are processed
47  * if not given, automatically determined from size of X
48 
49 OUTPUT PARAMETERS
50  Mean - mean.
51  Variance- variance.
52  Skewness- skewness (if variance<>0; zero otherwise).
53  Kurtosis- kurtosis (if variance<>0; zero otherwise).
54 
55 
56  -- ALGLIB --
57  Copyright 06.09.2006 by Bochkanov Sergey
58 *************************************************************************/
59 void samplemoments(const real_1d_array &x, const ae_int_t n, double &mean, double &variance, double &skewness, double &kurtosis)
60 {
61  alglib_impl::ae_state _alglib_env_state;
62  alglib_impl::ae_state_init(&_alglib_env_state);
63  try
64  {
65  alglib_impl::samplemoments(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &mean, &variance, &skewness, &kurtosis, &_alglib_env_state);
66  alglib_impl::ae_state_clear(&_alglib_env_state);
67  return;
68  }
70  {
71  throw ap_error(_alglib_env_state.error_msg);
72  }
73 }
74 
75 /*************************************************************************
76 Calculation of the distribution moments: mean, variance, skewness, kurtosis.
77 
78 INPUT PARAMETERS:
79  X - sample
80  N - N>=0, sample size:
81  * if given, only leading N elements of X are processed
82  * if not given, automatically determined from size of X
83 
84 OUTPUT PARAMETERS
85  Mean - mean.
86  Variance- variance.
87  Skewness- skewness (if variance<>0; zero otherwise).
88  Kurtosis- kurtosis (if variance<>0; zero otherwise).
89 
90 
91  -- ALGLIB --
92  Copyright 06.09.2006 by Bochkanov Sergey
93 *************************************************************************/
94 void samplemoments(const real_1d_array &x, double &mean, double &variance, double &skewness, double &kurtosis)
95 {
96  alglib_impl::ae_state _alglib_env_state;
97  ae_int_t n;
98 
99  n = x.length();
100  alglib_impl::ae_state_init(&_alglib_env_state);
101  try
102  {
103  alglib_impl::samplemoments(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &mean, &variance, &skewness, &kurtosis, &_alglib_env_state);
104 
105  alglib_impl::ae_state_clear(&_alglib_env_state);
106  return;
107  }
109  {
110  throw ap_error(_alglib_env_state.error_msg);
111  }
112 }
113 
114 /*************************************************************************
115 Calculation of the mean.
116 
117 INPUT PARAMETERS:
118  X - sample
119  N - N>=0, sample size:
120  * if given, only leading N elements of X are processed
121  * if not given, automatically determined from size of X
122 
123 NOTE:
124 
125 This function return result which calculated by 'SampleMoments' function
126 and stored at 'Mean' variable.
127 
128 
129  -- ALGLIB --
130  Copyright 06.09.2006 by Bochkanov Sergey
131 *************************************************************************/
132 double samplemean(const real_1d_array &x, const ae_int_t n)
133 {
134  alglib_impl::ae_state _alglib_env_state;
135  alglib_impl::ae_state_init(&_alglib_env_state);
136  try
137  {
138  double result = alglib_impl::samplemean(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &_alglib_env_state);
139  alglib_impl::ae_state_clear(&_alglib_env_state);
140  return *(reinterpret_cast<double*>(&result));
141  }
143  {
144  throw ap_error(_alglib_env_state.error_msg);
145  }
146 }
147 
148 /*************************************************************************
149 Calculation of the mean.
150 
151 INPUT PARAMETERS:
152  X - sample
153  N - N>=0, sample size:
154  * if given, only leading N elements of X are processed
155  * if not given, automatically determined from size of X
156 
157 NOTE:
158 
159 This function return result which calculated by 'SampleMoments' function
160 and stored at 'Mean' variable.
161 
162 
163  -- ALGLIB --
164  Copyright 06.09.2006 by Bochkanov Sergey
165 *************************************************************************/
166 double samplemean(const real_1d_array &x)
167 {
168  alglib_impl::ae_state _alglib_env_state;
169  ae_int_t n;
170 
171  n = x.length();
172  alglib_impl::ae_state_init(&_alglib_env_state);
173  try
174  {
175  double result = alglib_impl::samplemean(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &_alglib_env_state);
176 
177  alglib_impl::ae_state_clear(&_alglib_env_state);
178  return *(reinterpret_cast<double*>(&result));
179  }
181  {
182  throw ap_error(_alglib_env_state.error_msg);
183  }
184 }
185 
186 /*************************************************************************
187 Calculation of the variance.
188 
189 INPUT PARAMETERS:
190  X - sample
191  N - N>=0, sample size:
192  * if given, only leading N elements of X are processed
193  * if not given, automatically determined from size of X
194 
195 NOTE:
196 
197 This function return result which calculated by 'SampleMoments' function
198 and stored at 'Variance' variable.
199 
200 
201  -- ALGLIB --
202  Copyright 06.09.2006 by Bochkanov Sergey
203 *************************************************************************/
204 double samplevariance(const real_1d_array &x, const ae_int_t n)
205 {
206  alglib_impl::ae_state _alglib_env_state;
207  alglib_impl::ae_state_init(&_alglib_env_state);
208  try
209  {
210  double result = alglib_impl::samplevariance(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &_alglib_env_state);
211  alglib_impl::ae_state_clear(&_alglib_env_state);
212  return *(reinterpret_cast<double*>(&result));
213  }
215  {
216  throw ap_error(_alglib_env_state.error_msg);
217  }
218 }
219 
220 /*************************************************************************
221 Calculation of the variance.
222 
223 INPUT PARAMETERS:
224  X - sample
225  N - N>=0, sample size:
226  * if given, only leading N elements of X are processed
227  * if not given, automatically determined from size of X
228 
229 NOTE:
230 
231 This function return result which calculated by 'SampleMoments' function
232 and stored at 'Variance' variable.
233 
234 
235  -- ALGLIB --
236  Copyright 06.09.2006 by Bochkanov Sergey
237 *************************************************************************/
239 {
240  alglib_impl::ae_state _alglib_env_state;
241  ae_int_t n;
242 
243  n = x.length();
244  alglib_impl::ae_state_init(&_alglib_env_state);
245  try
246  {
247  double result = alglib_impl::samplevariance(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &_alglib_env_state);
248 
249  alglib_impl::ae_state_clear(&_alglib_env_state);
250  return *(reinterpret_cast<double*>(&result));
251  }
253  {
254  throw ap_error(_alglib_env_state.error_msg);
255  }
256 }
257 
258 /*************************************************************************
259 Calculation of the skewness.
260 
261 INPUT PARAMETERS:
262  X - sample
263  N - N>=0, sample size:
264  * if given, only leading N elements of X are processed
265  * if not given, automatically determined from size of X
266 
267 NOTE:
268 
269 This function return result which calculated by 'SampleMoments' function
270 and stored at 'Skewness' variable.
271 
272 
273  -- ALGLIB --
274  Copyright 06.09.2006 by Bochkanov Sergey
275 *************************************************************************/
276 double sampleskewness(const real_1d_array &x, const ae_int_t n)
277 {
278  alglib_impl::ae_state _alglib_env_state;
279  alglib_impl::ae_state_init(&_alglib_env_state);
280  try
281  {
282  double result = alglib_impl::sampleskewness(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &_alglib_env_state);
283  alglib_impl::ae_state_clear(&_alglib_env_state);
284  return *(reinterpret_cast<double*>(&result));
285  }
287  {
288  throw ap_error(_alglib_env_state.error_msg);
289  }
290 }
291 
292 /*************************************************************************
293 Calculation of the skewness.
294 
295 INPUT PARAMETERS:
296  X - sample
297  N - N>=0, sample size:
298  * if given, only leading N elements of X are processed
299  * if not given, automatically determined from size of X
300 
301 NOTE:
302 
303 This function return result which calculated by 'SampleMoments' function
304 and stored at 'Skewness' variable.
305 
306 
307  -- ALGLIB --
308  Copyright 06.09.2006 by Bochkanov Sergey
309 *************************************************************************/
311 {
312  alglib_impl::ae_state _alglib_env_state;
313  ae_int_t n;
314 
315  n = x.length();
316  alglib_impl::ae_state_init(&_alglib_env_state);
317  try
318  {
319  double result = alglib_impl::sampleskewness(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &_alglib_env_state);
320 
321  alglib_impl::ae_state_clear(&_alglib_env_state);
322  return *(reinterpret_cast<double*>(&result));
323  }
325  {
326  throw ap_error(_alglib_env_state.error_msg);
327  }
328 }
329 
330 /*************************************************************************
331 Calculation of the kurtosis.
332 
333 INPUT PARAMETERS:
334  X - sample
335  N - N>=0, sample size:
336  * if given, only leading N elements of X are processed
337  * if not given, automatically determined from size of X
338 
339 NOTE:
340 
341 This function return result which calculated by 'SampleMoments' function
342 and stored at 'Kurtosis' variable.
343 
344 
345  -- ALGLIB --
346  Copyright 06.09.2006 by Bochkanov Sergey
347 *************************************************************************/
348 double samplekurtosis(const real_1d_array &x, const ae_int_t n)
349 {
350  alglib_impl::ae_state _alglib_env_state;
351  alglib_impl::ae_state_init(&_alglib_env_state);
352  try
353  {
354  double result = alglib_impl::samplekurtosis(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &_alglib_env_state);
355  alglib_impl::ae_state_clear(&_alglib_env_state);
356  return *(reinterpret_cast<double*>(&result));
357  }
359  {
360  throw ap_error(_alglib_env_state.error_msg);
361  }
362 }
363 
364 /*************************************************************************
365 Calculation of the kurtosis.
366 
367 INPUT PARAMETERS:
368  X - sample
369  N - N>=0, sample size:
370  * if given, only leading N elements of X are processed
371  * if not given, automatically determined from size of X
372 
373 NOTE:
374 
375 This function return result which calculated by 'SampleMoments' function
376 and stored at 'Kurtosis' variable.
377 
378 
379  -- ALGLIB --
380  Copyright 06.09.2006 by Bochkanov Sergey
381 *************************************************************************/
383 {
384  alglib_impl::ae_state _alglib_env_state;
385  ae_int_t n;
386 
387  n = x.length();
388  alglib_impl::ae_state_init(&_alglib_env_state);
389  try
390  {
391  double result = alglib_impl::samplekurtosis(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &_alglib_env_state);
392 
393  alglib_impl::ae_state_clear(&_alglib_env_state);
394  return *(reinterpret_cast<double*>(&result));
395  }
397  {
398  throw ap_error(_alglib_env_state.error_msg);
399  }
400 }
401 
402 /*************************************************************************
403 ADev
404 
405 Input parameters:
406  X - sample
407  N - N>=0, sample size:
408  * if given, only leading N elements of X are processed
409  * if not given, automatically determined from size of X
410 
411 Output parameters:
412  ADev- ADev
413 
414  -- ALGLIB --
415  Copyright 06.09.2006 by Bochkanov Sergey
416 *************************************************************************/
417 void sampleadev(const real_1d_array &x, const ae_int_t n, double &adev)
418 {
419  alglib_impl::ae_state _alglib_env_state;
420  alglib_impl::ae_state_init(&_alglib_env_state);
421  try
422  {
423  alglib_impl::sampleadev(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &adev, &_alglib_env_state);
424  alglib_impl::ae_state_clear(&_alglib_env_state);
425  return;
426  }
428  {
429  throw ap_error(_alglib_env_state.error_msg);
430  }
431 }
432 
433 /*************************************************************************
434 ADev
435 
436 Input parameters:
437  X - sample
438  N - N>=0, sample size:
439  * if given, only leading N elements of X are processed
440  * if not given, automatically determined from size of X
441 
442 Output parameters:
443  ADev- ADev
444 
445  -- ALGLIB --
446  Copyright 06.09.2006 by Bochkanov Sergey
447 *************************************************************************/
448 void sampleadev(const real_1d_array &x, double &adev)
449 {
450  alglib_impl::ae_state _alglib_env_state;
451  ae_int_t n;
452 
453  n = x.length();
454  alglib_impl::ae_state_init(&_alglib_env_state);
455  try
456  {
457  alglib_impl::sampleadev(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &adev, &_alglib_env_state);
458 
459  alglib_impl::ae_state_clear(&_alglib_env_state);
460  return;
461  }
463  {
464  throw ap_error(_alglib_env_state.error_msg);
465  }
466 }
467 
468 /*************************************************************************
469 Median calculation.
470 
471 Input parameters:
472  X - sample (array indexes: [0..N-1])
473  N - N>=0, sample size:
474  * if given, only leading N elements of X are processed
475  * if not given, automatically determined from size of X
476 
477 Output parameters:
478  Median
479 
480  -- ALGLIB --
481  Copyright 06.09.2006 by Bochkanov Sergey
482 *************************************************************************/
483 void samplemedian(const real_1d_array &x, const ae_int_t n, double &median)
484 {
485  alglib_impl::ae_state _alglib_env_state;
486  alglib_impl::ae_state_init(&_alglib_env_state);
487  try
488  {
489  alglib_impl::samplemedian(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &median, &_alglib_env_state);
490  alglib_impl::ae_state_clear(&_alglib_env_state);
491  return;
492  }
494  {
495  throw ap_error(_alglib_env_state.error_msg);
496  }
497 }
498 
499 /*************************************************************************
500 Median calculation.
501 
502 Input parameters:
503  X - sample (array indexes: [0..N-1])
504  N - N>=0, sample size:
505  * if given, only leading N elements of X are processed
506  * if not given, automatically determined from size of X
507 
508 Output parameters:
509  Median
510 
511  -- ALGLIB --
512  Copyright 06.09.2006 by Bochkanov Sergey
513 *************************************************************************/
514 void samplemedian(const real_1d_array &x, double &median)
515 {
516  alglib_impl::ae_state _alglib_env_state;
517  ae_int_t n;
518 
519  n = x.length();
520  alglib_impl::ae_state_init(&_alglib_env_state);
521  try
522  {
523  alglib_impl::samplemedian(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &median, &_alglib_env_state);
524 
525  alglib_impl::ae_state_clear(&_alglib_env_state);
526  return;
527  }
529  {
530  throw ap_error(_alglib_env_state.error_msg);
531  }
532 }
533 
534 /*************************************************************************
535 Percentile calculation.
536 
537 Input parameters:
538  X - sample (array indexes: [0..N-1])
539  N - N>=0, sample size:
540  * if given, only leading N elements of X are processed
541  * if not given, automatically determined from size of X
542  P - percentile (0<=P<=1)
543 
544 Output parameters:
545  V - percentile
546 
547  -- ALGLIB --
548  Copyright 01.03.2008 by Bochkanov Sergey
549 *************************************************************************/
550 void samplepercentile(const real_1d_array &x, const ae_int_t n, const double p, double &v)
551 {
552  alglib_impl::ae_state _alglib_env_state;
553  alglib_impl::ae_state_init(&_alglib_env_state);
554  try
555  {
556  alglib_impl::samplepercentile(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, p, &v, &_alglib_env_state);
557  alglib_impl::ae_state_clear(&_alglib_env_state);
558  return;
559  }
561  {
562  throw ap_error(_alglib_env_state.error_msg);
563  }
564 }
565 
566 /*************************************************************************
567 Percentile calculation.
568 
569 Input parameters:
570  X - sample (array indexes: [0..N-1])
571  N - N>=0, sample size:
572  * if given, only leading N elements of X are processed
573  * if not given, automatically determined from size of X
574  P - percentile (0<=P<=1)
575 
576 Output parameters:
577  V - percentile
578 
579  -- ALGLIB --
580  Copyright 01.03.2008 by Bochkanov Sergey
581 *************************************************************************/
582 void samplepercentile(const real_1d_array &x, const double p, double &v)
583 {
584  alglib_impl::ae_state _alglib_env_state;
585  ae_int_t n;
586 
587  n = x.length();
588  alglib_impl::ae_state_init(&_alglib_env_state);
589  try
590  {
591  alglib_impl::samplepercentile(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, p, &v, &_alglib_env_state);
592 
593  alglib_impl::ae_state_clear(&_alglib_env_state);
594  return;
595  }
597  {
598  throw ap_error(_alglib_env_state.error_msg);
599  }
600 }
601 
602 /*************************************************************************
603 2-sample covariance
604 
605 Input parameters:
606  X - sample 1 (array indexes: [0..N-1])
607  Y - sample 2 (array indexes: [0..N-1])
608  N - N>=0, sample size:
609  * if given, only N leading elements of X/Y are processed
610  * if not given, automatically determined from input sizes
611 
612 Result:
613  covariance (zero for N=0 or N=1)
614 
615  -- ALGLIB --
616  Copyright 28.10.2010 by Bochkanov Sergey
617 *************************************************************************/
618 double cov2(const real_1d_array &x, const real_1d_array &y, const ae_int_t n)
619 {
620  alglib_impl::ae_state _alglib_env_state;
621  alglib_impl::ae_state_init(&_alglib_env_state);
622  try
623  {
624  double result = alglib_impl::cov2(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), const_cast<alglib_impl::ae_vector*>(y.c_ptr()), n, &_alglib_env_state);
625  alglib_impl::ae_state_clear(&_alglib_env_state);
626  return *(reinterpret_cast<double*>(&result));
627  }
629  {
630  throw ap_error(_alglib_env_state.error_msg);
631  }
632 }
633 
634 /*************************************************************************
635 2-sample covariance
636 
637 Input parameters:
638  X - sample 1 (array indexes: [0..N-1])
639  Y - sample 2 (array indexes: [0..N-1])
640  N - N>=0, sample size:
641  * if given, only N leading elements of X/Y are processed
642  * if not given, automatically determined from input sizes
643 
644 Result:
645  covariance (zero for N=0 or N=1)
646 
647  -- ALGLIB --
648  Copyright 28.10.2010 by Bochkanov Sergey
649 *************************************************************************/
650 double cov2(const real_1d_array &x, const real_1d_array &y)
651 {
652  alglib_impl::ae_state _alglib_env_state;
653  ae_int_t n;
654  if( (x.length()!=y.length()))
655  throw ap_error("Error while calling 'cov2': looks like one of arguments has wrong size");
656  n = x.length();
657  alglib_impl::ae_state_init(&_alglib_env_state);
658  try
659  {
660  double result = alglib_impl::cov2(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), const_cast<alglib_impl::ae_vector*>(y.c_ptr()), n, &_alglib_env_state);
661 
662  alglib_impl::ae_state_clear(&_alglib_env_state);
663  return *(reinterpret_cast<double*>(&result));
664  }
666  {
667  throw ap_error(_alglib_env_state.error_msg);
668  }
669 }
670 
671 /*************************************************************************
672 Pearson product-moment correlation coefficient
673 
674 Input parameters:
675  X - sample 1 (array indexes: [0..N-1])
676  Y - sample 2 (array indexes: [0..N-1])
677  N - N>=0, sample size:
678  * if given, only N leading elements of X/Y are processed
679  * if not given, automatically determined from input sizes
680 
681 Result:
682  Pearson product-moment correlation coefficient
683  (zero for N=0 or N=1)
684 
685  -- ALGLIB --
686  Copyright 28.10.2010 by Bochkanov Sergey
687 *************************************************************************/
688 double pearsoncorr2(const real_1d_array &x, const real_1d_array &y, const ae_int_t n)
689 {
690  alglib_impl::ae_state _alglib_env_state;
691  alglib_impl::ae_state_init(&_alglib_env_state);
692  try
693  {
694  double result = alglib_impl::pearsoncorr2(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), const_cast<alglib_impl::ae_vector*>(y.c_ptr()), n, &_alglib_env_state);
695  alglib_impl::ae_state_clear(&_alglib_env_state);
696  return *(reinterpret_cast<double*>(&result));
697  }
699  {
700  throw ap_error(_alglib_env_state.error_msg);
701  }
702 }
703 
704 /*************************************************************************
705 Pearson product-moment correlation coefficient
706 
707 Input parameters:
708  X - sample 1 (array indexes: [0..N-1])
709  Y - sample 2 (array indexes: [0..N-1])
710  N - N>=0, sample size:
711  * if given, only N leading elements of X/Y are processed
712  * if not given, automatically determined from input sizes
713 
714 Result:
715  Pearson product-moment correlation coefficient
716  (zero for N=0 or N=1)
717 
718  -- ALGLIB --
719  Copyright 28.10.2010 by Bochkanov Sergey
720 *************************************************************************/
722 {
723  alglib_impl::ae_state _alglib_env_state;
724  ae_int_t n;
725  if( (x.length()!=y.length()))
726  throw ap_error("Error while calling 'pearsoncorr2': looks like one of arguments has wrong size");
727  n = x.length();
728  alglib_impl::ae_state_init(&_alglib_env_state);
729  try
730  {
731  double result = alglib_impl::pearsoncorr2(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), const_cast<alglib_impl::ae_vector*>(y.c_ptr()), n, &_alglib_env_state);
732 
733  alglib_impl::ae_state_clear(&_alglib_env_state);
734  return *(reinterpret_cast<double*>(&result));
735  }
737  {
738  throw ap_error(_alglib_env_state.error_msg);
739  }
740 }
741 
742 /*************************************************************************
743 Spearman's rank correlation coefficient
744 
745 Input parameters:
746  X - sample 1 (array indexes: [0..N-1])
747  Y - sample 2 (array indexes: [0..N-1])
748  N - N>=0, sample size:
749  * if given, only N leading elements of X/Y are processed
750  * if not given, automatically determined from input sizes
751 
752 Result:
753  Spearman's rank correlation coefficient
754  (zero for N=0 or N=1)
755 
756  -- ALGLIB --
757  Copyright 09.04.2007 by Bochkanov Sergey
758 *************************************************************************/
759 double spearmancorr2(const real_1d_array &x, const real_1d_array &y, const ae_int_t n)
760 {
761  alglib_impl::ae_state _alglib_env_state;
762  alglib_impl::ae_state_init(&_alglib_env_state);
763  try
764  {
765  double result = alglib_impl::spearmancorr2(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), const_cast<alglib_impl::ae_vector*>(y.c_ptr()), n, &_alglib_env_state);
766  alglib_impl::ae_state_clear(&_alglib_env_state);
767  return *(reinterpret_cast<double*>(&result));
768  }
770  {
771  throw ap_error(_alglib_env_state.error_msg);
772  }
773 }
774 
775 /*************************************************************************
776 Spearman's rank correlation coefficient
777 
778 Input parameters:
779  X - sample 1 (array indexes: [0..N-1])
780  Y - sample 2 (array indexes: [0..N-1])
781  N - N>=0, sample size:
782  * if given, only N leading elements of X/Y are processed
783  * if not given, automatically determined from input sizes
784 
785 Result:
786  Spearman's rank correlation coefficient
787  (zero for N=0 or N=1)
788 
789  -- ALGLIB --
790  Copyright 09.04.2007 by Bochkanov Sergey
791 *************************************************************************/
793 {
794  alglib_impl::ae_state _alglib_env_state;
795  ae_int_t n;
796  if( (x.length()!=y.length()))
797  throw ap_error("Error while calling 'spearmancorr2': looks like one of arguments has wrong size");
798  n = x.length();
799  alglib_impl::ae_state_init(&_alglib_env_state);
800  try
801  {
802  double result = alglib_impl::spearmancorr2(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), const_cast<alglib_impl::ae_vector*>(y.c_ptr()), n, &_alglib_env_state);
803 
804  alglib_impl::ae_state_clear(&_alglib_env_state);
805  return *(reinterpret_cast<double*>(&result));
806  }
808  {
809  throw ap_error(_alglib_env_state.error_msg);
810  }
811 }
812 
813 /*************************************************************************
814 Covariance matrix
815 
816 SMP EDITION OF ALGLIB:
817 
818  ! This function can utilize multicore capabilities of your system. In
819  ! order to do this you have to call version with "smp_" prefix, which
820  ! indicates that multicore code will be used.
821  !
822  ! This note is given for users of SMP edition; if you use GPL edition,
823  ! or commercial edition of ALGLIB without SMP support, you still will
824  ! be able to call smp-version of this function, but all computations
825  ! will be done serially.
826  !
827  ! We recommend you to carefully read ALGLIB Reference Manual, section
828  ! called 'SMP support', before using parallel version of this function.
829  !
830  ! You should remember that starting/stopping worker thread always have
831  ! non-zero cost. Although multicore version is pretty efficient on
832  ! large problems, we do not recommend you to use it on small problems -
833  ! with covariance matrices smaller than 128*128.
834 
835 INPUT PARAMETERS:
836  X - array[N,M], sample matrix:
837  * J-th column corresponds to J-th variable
838  * I-th row corresponds to I-th observation
839  N - N>=0, number of observations:
840  * if given, only leading N rows of X are used
841  * if not given, automatically determined from input size
842  M - M>0, number of variables:
843  * if given, only leading M columns of X are used
844  * if not given, automatically determined from input size
845 
846 OUTPUT PARAMETERS:
847  C - array[M,M], covariance matrix (zero if N=0 or N=1)
848 
849  -- ALGLIB --
850  Copyright 28.10.2010 by Bochkanov Sergey
851 *************************************************************************/
852 void covm(const real_2d_array &x, const ae_int_t n, const ae_int_t m, real_2d_array &c)
853 {
854  alglib_impl::ae_state _alglib_env_state;
855  alglib_impl::ae_state_init(&_alglib_env_state);
856  try
857  {
858  alglib_impl::covm(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), n, m, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
859  alglib_impl::ae_state_clear(&_alglib_env_state);
860  return;
861  }
863  {
864  throw ap_error(_alglib_env_state.error_msg);
865  }
866 }
867 
868 
869 void smp_covm(const real_2d_array &x, const ae_int_t n, const ae_int_t m, real_2d_array &c)
870 {
871  alglib_impl::ae_state _alglib_env_state;
872  alglib_impl::ae_state_init(&_alglib_env_state);
873  try
874  {
875  alglib_impl::_pexec_covm(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), n, m, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
876  alglib_impl::ae_state_clear(&_alglib_env_state);
877  return;
878  }
880  {
881  throw ap_error(_alglib_env_state.error_msg);
882  }
883 }
884 
885 /*************************************************************************
886 Covariance matrix
887 
888 SMP EDITION OF ALGLIB:
889 
890  ! This function can utilize multicore capabilities of your system. In
891  ! order to do this you have to call version with "smp_" prefix, which
892  ! indicates that multicore code will be used.
893  !
894  ! This note is given for users of SMP edition; if you use GPL edition,
895  ! or commercial edition of ALGLIB without SMP support, you still will
896  ! be able to call smp-version of this function, but all computations
897  ! will be done serially.
898  !
899  ! We recommend you to carefully read ALGLIB Reference Manual, section
900  ! called 'SMP support', before using parallel version of this function.
901  !
902  ! You should remember that starting/stopping worker thread always have
903  ! non-zero cost. Although multicore version is pretty efficient on
904  ! large problems, we do not recommend you to use it on small problems -
905  ! with covariance matrices smaller than 128*128.
906 
907 INPUT PARAMETERS:
908  X - array[N,M], sample matrix:
909  * J-th column corresponds to J-th variable
910  * I-th row corresponds to I-th observation
911  N - N>=0, number of observations:
912  * if given, only leading N rows of X are used
913  * if not given, automatically determined from input size
914  M - M>0, number of variables:
915  * if given, only leading M columns of X are used
916  * if not given, automatically determined from input size
917 
918 OUTPUT PARAMETERS:
919  C - array[M,M], covariance matrix (zero if N=0 or N=1)
920 
921  -- ALGLIB --
922  Copyright 28.10.2010 by Bochkanov Sergey
923 *************************************************************************/
925 {
926  alglib_impl::ae_state _alglib_env_state;
927  ae_int_t n;
928  ae_int_t m;
929 
930  n = x.rows();
931  m = x.cols();
932  alglib_impl::ae_state_init(&_alglib_env_state);
933  try
934  {
935  alglib_impl::covm(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), n, m, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
936 
937  alglib_impl::ae_state_clear(&_alglib_env_state);
938  return;
939  }
941  {
942  throw ap_error(_alglib_env_state.error_msg);
943  }
944 }
945 
946 
948 {
949  alglib_impl::ae_state _alglib_env_state;
950  ae_int_t n;
951  ae_int_t m;
952 
953  n = x.rows();
954  m = x.cols();
955  alglib_impl::ae_state_init(&_alglib_env_state);
956  try
957  {
958  alglib_impl::_pexec_covm(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), n, m, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
959 
960  alglib_impl::ae_state_clear(&_alglib_env_state);
961  return;
962  }
964  {
965  throw ap_error(_alglib_env_state.error_msg);
966  }
967 }
968 
969 /*************************************************************************
970 Pearson product-moment correlation matrix
971 
972 SMP EDITION OF ALGLIB:
973 
974  ! This function can utilize multicore capabilities of your system. In
975  ! order to do this you have to call version with "smp_" prefix, which
976  ! indicates that multicore code will be used.
977  !
978  ! This note is given for users of SMP edition; if you use GPL edition,
979  ! or commercial edition of ALGLIB without SMP support, you still will
980  ! be able to call smp-version of this function, but all computations
981  ! will be done serially.
982  !
983  ! We recommend you to carefully read ALGLIB Reference Manual, section
984  ! called 'SMP support', before using parallel version of this function.
985  !
986  ! You should remember that starting/stopping worker thread always have
987  ! non-zero cost. Although multicore version is pretty efficient on
988  ! large problems, we do not recommend you to use it on small problems -
989  ! with correlation matrices smaller than 128*128.
990 
991 INPUT PARAMETERS:
992  X - array[N,M], sample matrix:
993  * J-th column corresponds to J-th variable
994  * I-th row corresponds to I-th observation
995  N - N>=0, number of observations:
996  * if given, only leading N rows of X are used
997  * if not given, automatically determined from input size
998  M - M>0, number of variables:
999  * if given, only leading M columns of X are used
1000  * if not given, automatically determined from input size
1001 
1002 OUTPUT PARAMETERS:
1003  C - array[M,M], correlation matrix (zero if N=0 or N=1)
1004 
1005  -- ALGLIB --
1006  Copyright 28.10.2010 by Bochkanov Sergey
1007 *************************************************************************/
1009 {
1010  alglib_impl::ae_state _alglib_env_state;
1011  alglib_impl::ae_state_init(&_alglib_env_state);
1012  try
1013  {
1014  alglib_impl::pearsoncorrm(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), n, m, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
1015  alglib_impl::ae_state_clear(&_alglib_env_state);
1016  return;
1017  }
1019  {
1020  throw ap_error(_alglib_env_state.error_msg);
1021  }
1022 }
1023 
1024 
1026 {
1027  alglib_impl::ae_state _alglib_env_state;
1028  alglib_impl::ae_state_init(&_alglib_env_state);
1029  try
1030  {
1031  alglib_impl::_pexec_pearsoncorrm(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), n, m, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
1032  alglib_impl::ae_state_clear(&_alglib_env_state);
1033  return;
1034  }
1036  {
1037  throw ap_error(_alglib_env_state.error_msg);
1038  }
1039 }
1040 
1041 /*************************************************************************
1042 Pearson product-moment correlation matrix
1043 
1044 SMP EDITION OF ALGLIB:
1045 
1046  ! This function can utilize multicore capabilities of your system. In
1047  ! order to do this you have to call version with "smp_" prefix, which
1048  ! indicates that multicore code will be used.
1049  !
1050  ! This note is given for users of SMP edition; if you use GPL edition,
1051  ! or commercial edition of ALGLIB without SMP support, you still will
1052  ! be able to call smp-version of this function, but all computations
1053  ! will be done serially.
1054  !
1055  ! We recommend you to carefully read ALGLIB Reference Manual, section
1056  ! called 'SMP support', before using parallel version of this function.
1057  !
1058  ! You should remember that starting/stopping worker thread always have
1059  ! non-zero cost. Although multicore version is pretty efficient on
1060  ! large problems, we do not recommend you to use it on small problems -
1061  ! with correlation matrices smaller than 128*128.
1062 
1063 INPUT PARAMETERS:
1064  X - array[N,M], sample matrix:
1065  * J-th column corresponds to J-th variable
1066  * I-th row corresponds to I-th observation
1067  N - N>=0, number of observations:
1068  * if given, only leading N rows of X are used
1069  * if not given, automatically determined from input size
1070  M - M>0, number of variables:
1071  * if given, only leading M columns of X are used
1072  * if not given, automatically determined from input size
1073 
1074 OUTPUT PARAMETERS:
1075  C - array[M,M], correlation matrix (zero if N=0 or N=1)
1076 
1077  -- ALGLIB --
1078  Copyright 28.10.2010 by Bochkanov Sergey
1079 *************************************************************************/
1081 {
1082  alglib_impl::ae_state _alglib_env_state;
1083  ae_int_t n;
1084  ae_int_t m;
1085 
1086  n = x.rows();
1087  m = x.cols();
1088  alglib_impl::ae_state_init(&_alglib_env_state);
1089  try
1090  {
1091  alglib_impl::pearsoncorrm(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), n, m, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
1092 
1093  alglib_impl::ae_state_clear(&_alglib_env_state);
1094  return;
1095  }
1097  {
1098  throw ap_error(_alglib_env_state.error_msg);
1099  }
1100 }
1101 
1102 
1104 {
1105  alglib_impl::ae_state _alglib_env_state;
1106  ae_int_t n;
1107  ae_int_t m;
1108 
1109  n = x.rows();
1110  m = x.cols();
1111  alglib_impl::ae_state_init(&_alglib_env_state);
1112  try
1113  {
1114  alglib_impl::_pexec_pearsoncorrm(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), n, m, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
1115 
1116  alglib_impl::ae_state_clear(&_alglib_env_state);
1117  return;
1118  }
1120  {
1121  throw ap_error(_alglib_env_state.error_msg);
1122  }
1123 }
1124 
1125 /*************************************************************************
1126 Spearman's rank correlation matrix
1127 
1128 SMP EDITION OF ALGLIB:
1129 
1130  ! This function can utilize multicore capabilities of your system. In
1131  ! order to do this you have to call version with "smp_" prefix, which
1132  ! indicates that multicore code will be used.
1133  !
1134  ! This note is given for users of SMP edition; if you use GPL edition,
1135  ! or commercial edition of ALGLIB without SMP support, you still will
1136  ! be able to call smp-version of this function, but all computations
1137  ! will be done serially.
1138  !
1139  ! We recommend you to carefully read ALGLIB Reference Manual, section
1140  ! called 'SMP support', before using parallel version of this function.
1141  !
1142  ! You should remember that starting/stopping worker thread always have
1143  ! non-zero cost. Although multicore version is pretty efficient on
1144  ! large problems, we do not recommend you to use it on small problems -
1145  ! with correlation matrices smaller than 128*128.
1146 
1147 INPUT PARAMETERS:
1148  X - array[N,M], sample matrix:
1149  * J-th column corresponds to J-th variable
1150  * I-th row corresponds to I-th observation
1151  N - N>=0, number of observations:
1152  * if given, only leading N rows of X are used
1153  * if not given, automatically determined from input size
1154  M - M>0, number of variables:
1155  * if given, only leading M columns of X are used
1156  * if not given, automatically determined from input size
1157 
1158 OUTPUT PARAMETERS:
1159  C - array[M,M], correlation matrix (zero if N=0 or N=1)
1160 
1161  -- ALGLIB --
1162  Copyright 28.10.2010 by Bochkanov Sergey
1163 *************************************************************************/
1165 {
1166  alglib_impl::ae_state _alglib_env_state;
1167  alglib_impl::ae_state_init(&_alglib_env_state);
1168  try
1169  {
1170  alglib_impl::spearmancorrm(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), n, m, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
1171  alglib_impl::ae_state_clear(&_alglib_env_state);
1172  return;
1173  }
1175  {
1176  throw ap_error(_alglib_env_state.error_msg);
1177  }
1178 }
1179 
1180 
1182 {
1183  alglib_impl::ae_state _alglib_env_state;
1184  alglib_impl::ae_state_init(&_alglib_env_state);
1185  try
1186  {
1187  alglib_impl::_pexec_spearmancorrm(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), n, m, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
1188  alglib_impl::ae_state_clear(&_alglib_env_state);
1189  return;
1190  }
1192  {
1193  throw ap_error(_alglib_env_state.error_msg);
1194  }
1195 }
1196 
1197 /*************************************************************************
1198 Spearman's rank correlation matrix
1199 
1200 SMP EDITION OF ALGLIB:
1201 
1202  ! This function can utilize multicore capabilities of your system. In
1203  ! order to do this you have to call version with "smp_" prefix, which
1204  ! indicates that multicore code will be used.
1205  !
1206  ! This note is given for users of SMP edition; if you use GPL edition,
1207  ! or commercial edition of ALGLIB without SMP support, you still will
1208  ! be able to call smp-version of this function, but all computations
1209  ! will be done serially.
1210  !
1211  ! We recommend you to carefully read ALGLIB Reference Manual, section
1212  ! called 'SMP support', before using parallel version of this function.
1213  !
1214  ! You should remember that starting/stopping worker thread always have
1215  ! non-zero cost. Although multicore version is pretty efficient on
1216  ! large problems, we do not recommend you to use it on small problems -
1217  ! with correlation matrices smaller than 128*128.
1218 
1219 INPUT PARAMETERS:
1220  X - array[N,M], sample matrix:
1221  * J-th column corresponds to J-th variable
1222  * I-th row corresponds to I-th observation
1223  N - N>=0, number of observations:
1224  * if given, only leading N rows of X are used
1225  * if not given, automatically determined from input size
1226  M - M>0, number of variables:
1227  * if given, only leading M columns of X are used
1228  * if not given, automatically determined from input size
1229 
1230 OUTPUT PARAMETERS:
1231  C - array[M,M], correlation matrix (zero if N=0 or N=1)
1232 
1233  -- ALGLIB --
1234  Copyright 28.10.2010 by Bochkanov Sergey
1235 *************************************************************************/
1237 {
1238  alglib_impl::ae_state _alglib_env_state;
1239  ae_int_t n;
1240  ae_int_t m;
1241 
1242  n = x.rows();
1243  m = x.cols();
1244  alglib_impl::ae_state_init(&_alglib_env_state);
1245  try
1246  {
1247  alglib_impl::spearmancorrm(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), n, m, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
1248 
1249  alglib_impl::ae_state_clear(&_alglib_env_state);
1250  return;
1251  }
1253  {
1254  throw ap_error(_alglib_env_state.error_msg);
1255  }
1256 }
1257 
1258 
1260 {
1261  alglib_impl::ae_state _alglib_env_state;
1262  ae_int_t n;
1263  ae_int_t m;
1264 
1265  n = x.rows();
1266  m = x.cols();
1267  alglib_impl::ae_state_init(&_alglib_env_state);
1268  try
1269  {
1270  alglib_impl::_pexec_spearmancorrm(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), n, m, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
1271 
1272  alglib_impl::ae_state_clear(&_alglib_env_state);
1273  return;
1274  }
1276  {
1277  throw ap_error(_alglib_env_state.error_msg);
1278  }
1279 }
1280 
1281 /*************************************************************************
1282 Cross-covariance matrix
1283 
1284 SMP EDITION OF ALGLIB:
1285 
1286  ! This function can utilize multicore capabilities of your system. In
1287  ! order to do this you have to call version with "smp_" prefix, which
1288  ! indicates that multicore code will be used.
1289  !
1290  ! This note is given for users of SMP edition; if you use GPL edition,
1291  ! or commercial edition of ALGLIB without SMP support, you still will
1292  ! be able to call smp-version of this function, but all computations
1293  ! will be done serially.
1294  !
1295  ! We recommend you to carefully read ALGLIB Reference Manual, section
1296  ! called 'SMP support', before using parallel version of this function.
1297  !
1298  ! You should remember that starting/stopping worker thread always have
1299  ! non-zero cost. Although multicore version is pretty efficient on
1300  ! large problems, we do not recommend you to use it on small problems -
1301  ! with covariance matrices smaller than 128*128.
1302 
1303 INPUT PARAMETERS:
1304  X - array[N,M1], sample matrix:
1305  * J-th column corresponds to J-th variable
1306  * I-th row corresponds to I-th observation
1307  Y - array[N,M2], sample matrix:
1308  * J-th column corresponds to J-th variable
1309  * I-th row corresponds to I-th observation
1310  N - N>=0, number of observations:
1311  * if given, only leading N rows of X/Y are used
1312  * if not given, automatically determined from input sizes
1313  M1 - M1>0, number of variables in X:
1314  * if given, only leading M1 columns of X are used
1315  * if not given, automatically determined from input size
1316  M2 - M2>0, number of variables in Y:
1317  * if given, only leading M1 columns of X are used
1318  * if not given, automatically determined from input size
1319 
1320 OUTPUT PARAMETERS:
1321  C - array[M1,M2], cross-covariance matrix (zero if N=0 or N=1)
1322 
1323  -- ALGLIB --
1324  Copyright 28.10.2010 by Bochkanov Sergey
1325 *************************************************************************/
1326 void covm2(const real_2d_array &x, const real_2d_array &y, const ae_int_t n, const ae_int_t m1, const ae_int_t m2, real_2d_array &c)
1327 {
1328  alglib_impl::ae_state _alglib_env_state;
1329  alglib_impl::ae_state_init(&_alglib_env_state);
1330  try
1331  {
1332  alglib_impl::covm2(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), const_cast<alglib_impl::ae_matrix*>(y.c_ptr()), n, m1, m2, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
1333  alglib_impl::ae_state_clear(&_alglib_env_state);
1334  return;
1335  }
1337  {
1338  throw ap_error(_alglib_env_state.error_msg);
1339  }
1340 }
1341 
1342 
1343 void smp_covm2(const real_2d_array &x, const real_2d_array &y, const ae_int_t n, const ae_int_t m1, const ae_int_t m2, real_2d_array &c)
1344 {
1345  alglib_impl::ae_state _alglib_env_state;
1346  alglib_impl::ae_state_init(&_alglib_env_state);
1347  try
1348  {
1349  alglib_impl::_pexec_covm2(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), const_cast<alglib_impl::ae_matrix*>(y.c_ptr()), n, m1, m2, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
1350  alglib_impl::ae_state_clear(&_alglib_env_state);
1351  return;
1352  }
1354  {
1355  throw ap_error(_alglib_env_state.error_msg);
1356  }
1357 }
1358 
1359 /*************************************************************************
1360 Cross-covariance matrix
1361 
1362 SMP EDITION OF ALGLIB:
1363 
1364  ! This function can utilize multicore capabilities of your system. In
1365  ! order to do this you have to call version with "smp_" prefix, which
1366  ! indicates that multicore code will be used.
1367  !
1368  ! This note is given for users of SMP edition; if you use GPL edition,
1369  ! or commercial edition of ALGLIB without SMP support, you still will
1370  ! be able to call smp-version of this function, but all computations
1371  ! will be done serially.
1372  !
1373  ! We recommend you to carefully read ALGLIB Reference Manual, section
1374  ! called 'SMP support', before using parallel version of this function.
1375  !
1376  ! You should remember that starting/stopping worker thread always have
1377  ! non-zero cost. Although multicore version is pretty efficient on
1378  ! large problems, we do not recommend you to use it on small problems -
1379  ! with covariance matrices smaller than 128*128.
1380 
1381 INPUT PARAMETERS:
1382  X - array[N,M1], sample matrix:
1383  * J-th column corresponds to J-th variable
1384  * I-th row corresponds to I-th observation
1385  Y - array[N,M2], sample matrix:
1386  * J-th column corresponds to J-th variable
1387  * I-th row corresponds to I-th observation
1388  N - N>=0, number of observations:
1389  * if given, only leading N rows of X/Y are used
1390  * if not given, automatically determined from input sizes
1391  M1 - M1>0, number of variables in X:
1392  * if given, only leading M1 columns of X are used
1393  * if not given, automatically determined from input size
1394  M2 - M2>0, number of variables in Y:
1395  * if given, only leading M1 columns of X are used
1396  * if not given, automatically determined from input size
1397 
1398 OUTPUT PARAMETERS:
1399  C - array[M1,M2], cross-covariance matrix (zero if N=0 or N=1)
1400 
1401  -- ALGLIB --
1402  Copyright 28.10.2010 by Bochkanov Sergey
1403 *************************************************************************/
1405 {
1406  alglib_impl::ae_state _alglib_env_state;
1407  ae_int_t n;
1408  ae_int_t m1;
1409  ae_int_t m2;
1410  if( (x.rows()!=y.rows()))
1411  throw ap_error("Error while calling 'covm2': looks like one of arguments has wrong size");
1412  n = x.rows();
1413  m1 = x.cols();
1414  m2 = y.cols();
1415  alglib_impl::ae_state_init(&_alglib_env_state);
1416  try
1417  {
1418  alglib_impl::covm2(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), const_cast<alglib_impl::ae_matrix*>(y.c_ptr()), n, m1, m2, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
1419 
1420  alglib_impl::ae_state_clear(&_alglib_env_state);
1421  return;
1422  }
1424  {
1425  throw ap_error(_alglib_env_state.error_msg);
1426  }
1427 }
1428 
1429 
1431 {
1432  alglib_impl::ae_state _alglib_env_state;
1433  ae_int_t n;
1434  ae_int_t m1;
1435  ae_int_t m2;
1436  if( (x.rows()!=y.rows()))
1437  throw ap_error("Error while calling 'covm2': looks like one of arguments has wrong size");
1438  n = x.rows();
1439  m1 = x.cols();
1440  m2 = y.cols();
1441  alglib_impl::ae_state_init(&_alglib_env_state);
1442  try
1443  {
1444  alglib_impl::_pexec_covm2(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), const_cast<alglib_impl::ae_matrix*>(y.c_ptr()), n, m1, m2, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
1445 
1446  alglib_impl::ae_state_clear(&_alglib_env_state);
1447  return;
1448  }
1450  {
1451  throw ap_error(_alglib_env_state.error_msg);
1452  }
1453 }
1454 
1455 /*************************************************************************
1456 Pearson product-moment cross-correlation matrix
1457 
1458 SMP EDITION OF ALGLIB:
1459 
1460  ! This function can utilize multicore capabilities of your system. In
1461  ! order to do this you have to call version with "smp_" prefix, which
1462  ! indicates that multicore code will be used.
1463  !
1464  ! This note is given for users of SMP edition; if you use GPL edition,
1465  ! or commercial edition of ALGLIB without SMP support, you still will
1466  ! be able to call smp-version of this function, but all computations
1467  ! will be done serially.
1468  !
1469  ! We recommend you to carefully read ALGLIB Reference Manual, section
1470  ! called 'SMP support', before using parallel version of this function.
1471  !
1472  ! You should remember that starting/stopping worker thread always have
1473  ! non-zero cost. Although multicore version is pretty efficient on
1474  ! large problems, we do not recommend you to use it on small problems -
1475  ! with correlation matrices smaller than 128*128.
1476 
1477 INPUT PARAMETERS:
1478  X - array[N,M1], sample matrix:
1479  * J-th column corresponds to J-th variable
1480  * I-th row corresponds to I-th observation
1481  Y - array[N,M2], sample matrix:
1482  * J-th column corresponds to J-th variable
1483  * I-th row corresponds to I-th observation
1484  N - N>=0, number of observations:
1485  * if given, only leading N rows of X/Y are used
1486  * if not given, automatically determined from input sizes
1487  M1 - M1>0, number of variables in X:
1488  * if given, only leading M1 columns of X are used
1489  * if not given, automatically determined from input size
1490  M2 - M2>0, number of variables in Y:
1491  * if given, only leading M1 columns of X are used
1492  * if not given, automatically determined from input size
1493 
1494 OUTPUT PARAMETERS:
1495  C - array[M1,M2], cross-correlation matrix (zero if N=0 or N=1)
1496 
1497  -- ALGLIB --
1498  Copyright 28.10.2010 by Bochkanov Sergey
1499 *************************************************************************/
1500 void pearsoncorrm2(const real_2d_array &x, const real_2d_array &y, const ae_int_t n, const ae_int_t m1, const ae_int_t m2, real_2d_array &c)
1501 {
1502  alglib_impl::ae_state _alglib_env_state;
1503  alglib_impl::ae_state_init(&_alglib_env_state);
1504  try
1505  {
1506  alglib_impl::pearsoncorrm2(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), const_cast<alglib_impl::ae_matrix*>(y.c_ptr()), n, m1, m2, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
1507  alglib_impl::ae_state_clear(&_alglib_env_state);
1508  return;
1509  }
1511  {
1512  throw ap_error(_alglib_env_state.error_msg);
1513  }
1514 }
1515 
1516 
1517 void smp_pearsoncorrm2(const real_2d_array &x, const real_2d_array &y, const ae_int_t n, const ae_int_t m1, const ae_int_t m2, real_2d_array &c)
1518 {
1519  alglib_impl::ae_state _alglib_env_state;
1520  alglib_impl::ae_state_init(&_alglib_env_state);
1521  try
1522  {
1523  alglib_impl::_pexec_pearsoncorrm2(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), const_cast<alglib_impl::ae_matrix*>(y.c_ptr()), n, m1, m2, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
1524  alglib_impl::ae_state_clear(&_alglib_env_state);
1525  return;
1526  }
1528  {
1529  throw ap_error(_alglib_env_state.error_msg);
1530  }
1531 }
1532 
1533 /*************************************************************************
1534 Pearson product-moment cross-correlation matrix
1535 
1536 SMP EDITION OF ALGLIB:
1537 
1538  ! This function can utilize multicore capabilities of your system. In
1539  ! order to do this you have to call version with "smp_" prefix, which
1540  ! indicates that multicore code will be used.
1541  !
1542  ! This note is given for users of SMP edition; if you use GPL edition,
1543  ! or commercial edition of ALGLIB without SMP support, you still will
1544  ! be able to call smp-version of this function, but all computations
1545  ! will be done serially.
1546  !
1547  ! We recommend you to carefully read ALGLIB Reference Manual, section
1548  ! called 'SMP support', before using parallel version of this function.
1549  !
1550  ! You should remember that starting/stopping worker thread always have
1551  ! non-zero cost. Although multicore version is pretty efficient on
1552  ! large problems, we do not recommend you to use it on small problems -
1553  ! with correlation matrices smaller than 128*128.
1554 
1555 INPUT PARAMETERS:
1556  X - array[N,M1], sample matrix:
1557  * J-th column corresponds to J-th variable
1558  * I-th row corresponds to I-th observation
1559  Y - array[N,M2], sample matrix:
1560  * J-th column corresponds to J-th variable
1561  * I-th row corresponds to I-th observation
1562  N - N>=0, number of observations:
1563  * if given, only leading N rows of X/Y are used
1564  * if not given, automatically determined from input sizes
1565  M1 - M1>0, number of variables in X:
1566  * if given, only leading M1 columns of X are used
1567  * if not given, automatically determined from input size
1568  M2 - M2>0, number of variables in Y:
1569  * if given, only leading M1 columns of X are used
1570  * if not given, automatically determined from input size
1571 
1572 OUTPUT PARAMETERS:
1573  C - array[M1,M2], cross-correlation matrix (zero if N=0 or N=1)
1574 
1575  -- ALGLIB --
1576  Copyright 28.10.2010 by Bochkanov Sergey
1577 *************************************************************************/
1579 {
1580  alglib_impl::ae_state _alglib_env_state;
1581  ae_int_t n;
1582  ae_int_t m1;
1583  ae_int_t m2;
1584  if( (x.rows()!=y.rows()))
1585  throw ap_error("Error while calling 'pearsoncorrm2': looks like one of arguments has wrong size");
1586  n = x.rows();
1587  m1 = x.cols();
1588  m2 = y.cols();
1589  alglib_impl::ae_state_init(&_alglib_env_state);
1590  try
1591  {
1592  alglib_impl::pearsoncorrm2(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), const_cast<alglib_impl::ae_matrix*>(y.c_ptr()), n, m1, m2, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
1593 
1594  alglib_impl::ae_state_clear(&_alglib_env_state);
1595  return;
1596  }
1598  {
1599  throw ap_error(_alglib_env_state.error_msg);
1600  }
1601 }
1602 
1603 
1605 {
1606  alglib_impl::ae_state _alglib_env_state;
1607  ae_int_t n;
1608  ae_int_t m1;
1609  ae_int_t m2;
1610  if( (x.rows()!=y.rows()))
1611  throw ap_error("Error while calling 'pearsoncorrm2': looks like one of arguments has wrong size");
1612  n = x.rows();
1613  m1 = x.cols();
1614  m2 = y.cols();
1615  alglib_impl::ae_state_init(&_alglib_env_state);
1616  try
1617  {
1618  alglib_impl::_pexec_pearsoncorrm2(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), const_cast<alglib_impl::ae_matrix*>(y.c_ptr()), n, m1, m2, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
1619 
1620  alglib_impl::ae_state_clear(&_alglib_env_state);
1621  return;
1622  }
1624  {
1625  throw ap_error(_alglib_env_state.error_msg);
1626  }
1627 }
1628 
1629 /*************************************************************************
1630 Spearman's rank cross-correlation matrix
1631 
1632 SMP EDITION OF ALGLIB:
1633 
1634  ! This function can utilize multicore capabilities of your system. In
1635  ! order to do this you have to call version with "smp_" prefix, which
1636  ! indicates that multicore code will be used.
1637  !
1638  ! This note is given for users of SMP edition; if you use GPL edition,
1639  ! or commercial edition of ALGLIB without SMP support, you still will
1640  ! be able to call smp-version of this function, but all computations
1641  ! will be done serially.
1642  !
1643  ! We recommend you to carefully read ALGLIB Reference Manual, section
1644  ! called 'SMP support', before using parallel version of this function.
1645  !
1646  ! You should remember that starting/stopping worker thread always have
1647  ! non-zero cost. Although multicore version is pretty efficient on
1648  ! large problems, we do not recommend you to use it on small problems -
1649  ! with correlation matrices smaller than 128*128.
1650 
1651 INPUT PARAMETERS:
1652  X - array[N,M1], sample matrix:
1653  * J-th column corresponds to J-th variable
1654  * I-th row corresponds to I-th observation
1655  Y - array[N,M2], sample matrix:
1656  * J-th column corresponds to J-th variable
1657  * I-th row corresponds to I-th observation
1658  N - N>=0, number of observations:
1659  * if given, only leading N rows of X/Y are used
1660  * if not given, automatically determined from input sizes
1661  M1 - M1>0, number of variables in X:
1662  * if given, only leading M1 columns of X are used
1663  * if not given, automatically determined from input size
1664  M2 - M2>0, number of variables in Y:
1665  * if given, only leading M1 columns of X are used
1666  * if not given, automatically determined from input size
1667 
1668 OUTPUT PARAMETERS:
1669  C - array[M1,M2], cross-correlation matrix (zero if N=0 or N=1)
1670 
1671  -- ALGLIB --
1672  Copyright 28.10.2010 by Bochkanov Sergey
1673 *************************************************************************/
1674 void spearmancorrm2(const real_2d_array &x, const real_2d_array &y, const ae_int_t n, const ae_int_t m1, const ae_int_t m2, real_2d_array &c)
1675 {
1676  alglib_impl::ae_state _alglib_env_state;
1677  alglib_impl::ae_state_init(&_alglib_env_state);
1678  try
1679  {
1680  alglib_impl::spearmancorrm2(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), const_cast<alglib_impl::ae_matrix*>(y.c_ptr()), n, m1, m2, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
1681  alglib_impl::ae_state_clear(&_alglib_env_state);
1682  return;
1683  }
1685  {
1686  throw ap_error(_alglib_env_state.error_msg);
1687  }
1688 }
1689 
1690 
1691 void smp_spearmancorrm2(const real_2d_array &x, const real_2d_array &y, const ae_int_t n, const ae_int_t m1, const ae_int_t m2, real_2d_array &c)
1692 {
1693  alglib_impl::ae_state _alglib_env_state;
1694  alglib_impl::ae_state_init(&_alglib_env_state);
1695  try
1696  {
1697  alglib_impl::_pexec_spearmancorrm2(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), const_cast<alglib_impl::ae_matrix*>(y.c_ptr()), n, m1, m2, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
1698  alglib_impl::ae_state_clear(&_alglib_env_state);
1699  return;
1700  }
1702  {
1703  throw ap_error(_alglib_env_state.error_msg);
1704  }
1705 }
1706 
1707 /*************************************************************************
1708 Spearman's rank cross-correlation matrix
1709 
1710 SMP EDITION OF ALGLIB:
1711 
1712  ! This function can utilize multicore capabilities of your system. In
1713  ! order to do this you have to call version with "smp_" prefix, which
1714  ! indicates that multicore code will be used.
1715  !
1716  ! This note is given for users of SMP edition; if you use GPL edition,
1717  ! or commercial edition of ALGLIB without SMP support, you still will
1718  ! be able to call smp-version of this function, but all computations
1719  ! will be done serially.
1720  !
1721  ! We recommend you to carefully read ALGLIB Reference Manual, section
1722  ! called 'SMP support', before using parallel version of this function.
1723  !
1724  ! You should remember that starting/stopping worker thread always have
1725  ! non-zero cost. Although multicore version is pretty efficient on
1726  ! large problems, we do not recommend you to use it on small problems -
1727  ! with correlation matrices smaller than 128*128.
1728 
1729 INPUT PARAMETERS:
1730  X - array[N,M1], sample matrix:
1731  * J-th column corresponds to J-th variable
1732  * I-th row corresponds to I-th observation
1733  Y - array[N,M2], sample matrix:
1734  * J-th column corresponds to J-th variable
1735  * I-th row corresponds to I-th observation
1736  N - N>=0, number of observations:
1737  * if given, only leading N rows of X/Y are used
1738  * if not given, automatically determined from input sizes
1739  M1 - M1>0, number of variables in X:
1740  * if given, only leading M1 columns of X are used
1741  * if not given, automatically determined from input size
1742  M2 - M2>0, number of variables in Y:
1743  * if given, only leading M1 columns of X are used
1744  * if not given, automatically determined from input size
1745 
1746 OUTPUT PARAMETERS:
1747  C - array[M1,M2], cross-correlation matrix (zero if N=0 or N=1)
1748 
1749  -- ALGLIB --
1750  Copyright 28.10.2010 by Bochkanov Sergey
1751 *************************************************************************/
1753 {
1754  alglib_impl::ae_state _alglib_env_state;
1755  ae_int_t n;
1756  ae_int_t m1;
1757  ae_int_t m2;
1758  if( (x.rows()!=y.rows()))
1759  throw ap_error("Error while calling 'spearmancorrm2': looks like one of arguments has wrong size");
1760  n = x.rows();
1761  m1 = x.cols();
1762  m2 = y.cols();
1763  alglib_impl::ae_state_init(&_alglib_env_state);
1764  try
1765  {
1766  alglib_impl::spearmancorrm2(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), const_cast<alglib_impl::ae_matrix*>(y.c_ptr()), n, m1, m2, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
1767 
1768  alglib_impl::ae_state_clear(&_alglib_env_state);
1769  return;
1770  }
1772  {
1773  throw ap_error(_alglib_env_state.error_msg);
1774  }
1775 }
1776 
1777 
1779 {
1780  alglib_impl::ae_state _alglib_env_state;
1781  ae_int_t n;
1782  ae_int_t m1;
1783  ae_int_t m2;
1784  if( (x.rows()!=y.rows()))
1785  throw ap_error("Error while calling 'spearmancorrm2': looks like one of arguments has wrong size");
1786  n = x.rows();
1787  m1 = x.cols();
1788  m2 = y.cols();
1789  alglib_impl::ae_state_init(&_alglib_env_state);
1790  try
1791  {
1792  alglib_impl::_pexec_spearmancorrm2(const_cast<alglib_impl::ae_matrix*>(x.c_ptr()), const_cast<alglib_impl::ae_matrix*>(y.c_ptr()), n, m1, m2, const_cast<alglib_impl::ae_matrix*>(c.c_ptr()), &_alglib_env_state);
1793 
1794  alglib_impl::ae_state_clear(&_alglib_env_state);
1795  return;
1796  }
1798  {
1799  throw ap_error(_alglib_env_state.error_msg);
1800  }
1801 }
1802 
1803 /*************************************************************************
1804 
1805 *************************************************************************/
1806 void rankdata(const real_2d_array &xy, const ae_int_t npoints, const ae_int_t nfeatures)
1807 {
1808  alglib_impl::ae_state _alglib_env_state;
1809  alglib_impl::ae_state_init(&_alglib_env_state);
1810  try
1811  {
1812  alglib_impl::rankdata(const_cast<alglib_impl::ae_matrix*>(xy.c_ptr()), npoints, nfeatures, &_alglib_env_state);
1813  alglib_impl::ae_state_clear(&_alglib_env_state);
1814  return;
1815  }
1817  {
1818  throw ap_error(_alglib_env_state.error_msg);
1819  }
1820 }
1821 
1822 
1823 void smp_rankdata(const real_2d_array &xy, const ae_int_t npoints, const ae_int_t nfeatures)
1824 {
1825  alglib_impl::ae_state _alglib_env_state;
1826  alglib_impl::ae_state_init(&_alglib_env_state);
1827  try
1828  {
1829  alglib_impl::_pexec_rankdata(const_cast<alglib_impl::ae_matrix*>(xy.c_ptr()), npoints, nfeatures, &_alglib_env_state);
1830  alglib_impl::ae_state_clear(&_alglib_env_state);
1831  return;
1832  }
1834  {
1835  throw ap_error(_alglib_env_state.error_msg);
1836  }
1837 }
1838 
1839 /*************************************************************************
1840 
1841 *************************************************************************/
1843 {
1844  alglib_impl::ae_state _alglib_env_state;
1845  ae_int_t npoints;
1846  ae_int_t nfeatures;
1847 
1848  npoints = xy.rows();
1849  nfeatures = xy.cols();
1850  alglib_impl::ae_state_init(&_alglib_env_state);
1851  try
1852  {
1853  alglib_impl::rankdata(const_cast<alglib_impl::ae_matrix*>(xy.c_ptr()), npoints, nfeatures, &_alglib_env_state);
1854 
1855  alglib_impl::ae_state_clear(&_alglib_env_state);
1856  return;
1857  }
1859  {
1860  throw ap_error(_alglib_env_state.error_msg);
1861  }
1862 }
1863 
1864 
1866 {
1867  alglib_impl::ae_state _alglib_env_state;
1868  ae_int_t npoints;
1869  ae_int_t nfeatures;
1870 
1871  npoints = xy.rows();
1872  nfeatures = xy.cols();
1873  alglib_impl::ae_state_init(&_alglib_env_state);
1874  try
1875  {
1876  alglib_impl::_pexec_rankdata(const_cast<alglib_impl::ae_matrix*>(xy.c_ptr()), npoints, nfeatures, &_alglib_env_state);
1877 
1878  alglib_impl::ae_state_clear(&_alglib_env_state);
1879  return;
1880  }
1882  {
1883  throw ap_error(_alglib_env_state.error_msg);
1884  }
1885 }
1886 
1887 /*************************************************************************
1888 
1889 *************************************************************************/
1890 void rankdatacentered(const real_2d_array &xy, const ae_int_t npoints, const ae_int_t nfeatures)
1891 {
1892  alglib_impl::ae_state _alglib_env_state;
1893  alglib_impl::ae_state_init(&_alglib_env_state);
1894  try
1895  {
1896  alglib_impl::rankdatacentered(const_cast<alglib_impl::ae_matrix*>(xy.c_ptr()), npoints, nfeatures, &_alglib_env_state);
1897  alglib_impl::ae_state_clear(&_alglib_env_state);
1898  return;
1899  }
1901  {
1902  throw ap_error(_alglib_env_state.error_msg);
1903  }
1904 }
1905 
1906 
1907 void smp_rankdatacentered(const real_2d_array &xy, const ae_int_t npoints, const ae_int_t nfeatures)
1908 {
1909  alglib_impl::ae_state _alglib_env_state;
1910  alglib_impl::ae_state_init(&_alglib_env_state);
1911  try
1912  {
1913  alglib_impl::_pexec_rankdatacentered(const_cast<alglib_impl::ae_matrix*>(xy.c_ptr()), npoints, nfeatures, &_alglib_env_state);
1914  alglib_impl::ae_state_clear(&_alglib_env_state);
1915  return;
1916  }
1918  {
1919  throw ap_error(_alglib_env_state.error_msg);
1920  }
1921 }
1922 
1923 /*************************************************************************
1924 
1925 *************************************************************************/
1927 {
1928  alglib_impl::ae_state _alglib_env_state;
1929  ae_int_t npoints;
1930  ae_int_t nfeatures;
1931 
1932  npoints = xy.rows();
1933  nfeatures = xy.cols();
1934  alglib_impl::ae_state_init(&_alglib_env_state);
1935  try
1936  {
1937  alglib_impl::rankdatacentered(const_cast<alglib_impl::ae_matrix*>(xy.c_ptr()), npoints, nfeatures, &_alglib_env_state);
1938 
1939  alglib_impl::ae_state_clear(&_alglib_env_state);
1940  return;
1941  }
1943  {
1944  throw ap_error(_alglib_env_state.error_msg);
1945  }
1946 }
1947 
1948 
1950 {
1951  alglib_impl::ae_state _alglib_env_state;
1952  ae_int_t npoints;
1953  ae_int_t nfeatures;
1954 
1955  npoints = xy.rows();
1956  nfeatures = xy.cols();
1957  alglib_impl::ae_state_init(&_alglib_env_state);
1958  try
1959  {
1960  alglib_impl::_pexec_rankdatacentered(const_cast<alglib_impl::ae_matrix*>(xy.c_ptr()), npoints, nfeatures, &_alglib_env_state);
1961 
1962  alglib_impl::ae_state_clear(&_alglib_env_state);
1963  return;
1964  }
1966  {
1967  throw ap_error(_alglib_env_state.error_msg);
1968  }
1969 }
1970 
1971 /*************************************************************************
1972 Obsolete function, we recommend to use PearsonCorr2().
1973 
1974  -- ALGLIB --
1975  Copyright 09.04.2007 by Bochkanov Sergey
1976 *************************************************************************/
1978 {
1979  alglib_impl::ae_state _alglib_env_state;
1980  alglib_impl::ae_state_init(&_alglib_env_state);
1981  try
1982  {
1983  double result = alglib_impl::pearsoncorrelation(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), const_cast<alglib_impl::ae_vector*>(y.c_ptr()), n, &_alglib_env_state);
1984  alglib_impl::ae_state_clear(&_alglib_env_state);
1985  return *(reinterpret_cast<double*>(&result));
1986  }
1988  {
1989  throw ap_error(_alglib_env_state.error_msg);
1990  }
1991 }
1992 
1993 /*************************************************************************
1994 Obsolete function, we recommend to use SpearmanCorr2().
1995 
1996  -- ALGLIB --
1997  Copyright 09.04.2007 by Bochkanov Sergey
1998 *************************************************************************/
2000 {
2001  alglib_impl::ae_state _alglib_env_state;
2002  alglib_impl::ae_state_init(&_alglib_env_state);
2003  try
2004  {
2005  double result = alglib_impl::spearmanrankcorrelation(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), const_cast<alglib_impl::ae_vector*>(y.c_ptr()), n, &_alglib_env_state);
2006  alglib_impl::ae_state_clear(&_alglib_env_state);
2007  return *(reinterpret_cast<double*>(&result));
2008  }
2010  {
2011  throw ap_error(_alglib_env_state.error_msg);
2012  }
2013 }
2014 
2015 /*************************************************************************
2016 Pearson's correlation coefficient significance test
2017 
2018 This test checks hypotheses about whether X and Y are samples of two
2019 continuous distributions having zero correlation or whether their
2020 correlation is non-zero.
2021 
2022 The following tests are performed:
2023  * two-tailed test (null hypothesis - X and Y have zero correlation)
2024  * left-tailed test (null hypothesis - the correlation coefficient is
2025  greater than or equal to 0)
2026  * right-tailed test (null hypothesis - the correlation coefficient is
2027  less than or equal to 0).
2028 
2029 Requirements:
2030  * the number of elements in each sample is not less than 5
2031  * normality of distributions of X and Y.
2032 
2033 Input parameters:
2034  R - Pearson's correlation coefficient for X and Y
2035  N - number of elements in samples, N>=5.
2036 
2037 Output parameters:
2038  BothTails - p-value for two-tailed test.
2039  If BothTails is less than the given significance level
2040  the null hypothesis is rejected.
2041  LeftTail - p-value for left-tailed test.
2042  If LeftTail is less than the given significance level,
2043  the null hypothesis is rejected.
2044  RightTail - p-value for right-tailed test.
2045  If RightTail is less than the given significance level
2046  the null hypothesis is rejected.
2047 
2048  -- ALGLIB --
2049  Copyright 09.04.2007 by Bochkanov Sergey
2050 *************************************************************************/
2051 void pearsoncorrelationsignificance(const double r, const ae_int_t n, double &bothtails, double &lefttail, double &righttail)
2052 {
2053  alglib_impl::ae_state _alglib_env_state;
2054  alglib_impl::ae_state_init(&_alglib_env_state);
2055  try
2056  {
2057  alglib_impl::pearsoncorrelationsignificance(r, n, &bothtails, &lefttail, &righttail, &_alglib_env_state);
2058  alglib_impl::ae_state_clear(&_alglib_env_state);
2059  return;
2060  }
2062  {
2063  throw ap_error(_alglib_env_state.error_msg);
2064  }
2065 }
2066 
2067 /*************************************************************************
2068 Spearman's rank correlation coefficient significance test
2069 
2070 This test checks hypotheses about whether X and Y are samples of two
2071 continuous distributions having zero correlation or whether their
2072 correlation is non-zero.
2073 
2074 The following tests are performed:
2075  * two-tailed test (null hypothesis - X and Y have zero correlation)
2076  * left-tailed test (null hypothesis - the correlation coefficient is
2077  greater than or equal to 0)
2078  * right-tailed test (null hypothesis - the correlation coefficient is
2079  less than or equal to 0).
2080 
2081 Requirements:
2082  * the number of elements in each sample is not less than 5.
2083 
2084 The test is non-parametric and doesn't require distributions X and Y to be
2085 normal.
2086 
2087 Input parameters:
2088  R - Spearman's rank correlation coefficient for X and Y
2089  N - number of elements in samples, N>=5.
2090 
2091 Output parameters:
2092  BothTails - p-value for two-tailed test.
2093  If BothTails is less than the given significance level
2094  the null hypothesis is rejected.
2095  LeftTail - p-value for left-tailed test.
2096  If LeftTail is less than the given significance level,
2097  the null hypothesis is rejected.
2098  RightTail - p-value for right-tailed test.
2099  If RightTail is less than the given significance level
2100  the null hypothesis is rejected.
2101 
2102  -- ALGLIB --
2103  Copyright 09.04.2007 by Bochkanov Sergey
2104 *************************************************************************/
2105 void spearmanrankcorrelationsignificance(const double r, const ae_int_t n, double &bothtails, double &lefttail, double &righttail)
2106 {
2107  alglib_impl::ae_state _alglib_env_state;
2108  alglib_impl::ae_state_init(&_alglib_env_state);
2109  try
2110  {
2111  alglib_impl::spearmanrankcorrelationsignificance(r, n, &bothtails, &lefttail, &righttail, &_alglib_env_state);
2112  alglib_impl::ae_state_clear(&_alglib_env_state);
2113  return;
2114  }
2116  {
2117  throw ap_error(_alglib_env_state.error_msg);
2118  }
2119 }
2120 
2121 /*************************************************************************
2122 Jarque-Bera test
2123 
2124 This test checks hypotheses about the fact that a given sample X is a
2125 sample of normal random variable.
2126 
2127 Requirements:
2128  * the number of elements in the sample is not less than 5.
2129 
2130 Input parameters:
2131  X - sample. Array whose index goes from 0 to N-1.
2132  N - size of the sample. N>=5
2133 
2134 Output parameters:
2135  BothTails - p-value for two-tailed test.
2136  If BothTails is less than the given significance level
2137  the null hypothesis is rejected.
2138  LeftTail - p-value for left-tailed test.
2139  If LeftTail is less than the given significance level,
2140  the null hypothesis is rejected.
2141  RightTail - p-value for right-tailed test.
2142  If RightTail is less than the given significance level
2143  the null hypothesis is rejected.
2144 
2145 Accuracy of the approximation used (5<=N<=1951):
2146 
2147 p-value relative error (5<=N<=1951)
2148 [1, 0.1] < 1%
2149 [0.1, 0.01] < 2%
2150 [0.01, 0.001] < 6%
2151 [0.001, 0] wasn't measured
2152 
2153 For N>1951 accuracy wasn't measured but it shouldn't be sharply different
2154 from table values.
2155 
2156  -- ALGLIB --
2157  Copyright 09.04.2007 by Bochkanov Sergey
2158 *************************************************************************/
2159 void jarqueberatest(const real_1d_array &x, const ae_int_t n, double &p)
2160 {
2161  alglib_impl::ae_state _alglib_env_state;
2162  alglib_impl::ae_state_init(&_alglib_env_state);
2163  try
2164  {
2165  alglib_impl::jarqueberatest(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &p, &_alglib_env_state);
2166  alglib_impl::ae_state_clear(&_alglib_env_state);
2167  return;
2168  }
2170  {
2171  throw ap_error(_alglib_env_state.error_msg);
2172  }
2173 }
2174 
2175 /*************************************************************************
2176 Mann-Whitney U-test
2177 
2178 This test checks hypotheses about whether X and Y are samples of two
2179 continuous distributions of the same shape and same median or whether
2180 their medians are different.
2181 
2182 The following tests are performed:
2183  * two-tailed test (null hypothesis - the medians are equal)
2184  * left-tailed test (null hypothesis - the median of the first sample
2185  is greater than or equal to the median of the second sample)
2186  * right-tailed test (null hypothesis - the median of the first sample
2187  is less than or equal to the median of the second sample).
2188 
2189 Requirements:
2190  * the samples are independent
2191  * X and Y are continuous distributions (or discrete distributions well-
2192  approximating continuous distributions)
2193  * distributions of X and Y have the same shape. The only possible
2194  difference is their position (i.e. the value of the median)
2195  * the number of elements in each sample is not less than 5
2196  * the scale of measurement should be ordinal, interval or ratio (i.e.
2197  the test could not be applied to nominal variables).
2198 
2199 The test is non-parametric and doesn't require distributions to be normal.
2200 
2201 Input parameters:
2202  X - sample 1. Array whose index goes from 0 to N-1.
2203  N - size of the sample. N>=5
2204  Y - sample 2. Array whose index goes from 0 to M-1.
2205  M - size of the sample. M>=5
2206 
2207 Output parameters:
2208  BothTails - p-value for two-tailed test.
2209  If BothTails is less than the given significance level
2210  the null hypothesis is rejected.
2211  LeftTail - p-value for left-tailed test.
2212  If LeftTail is less than the given significance level,
2213  the null hypothesis is rejected.
2214  RightTail - p-value for right-tailed test.
2215  If RightTail is less than the given significance level
2216  the null hypothesis is rejected.
2217 
2218 To calculate p-values, special approximation is used. This method lets us
2219 calculate p-values with satisfactory accuracy in interval [0.0001, 1].
2220 There is no approximation outside the [0.0001, 1] interval. Therefore, if
2221 the significance level outlies this interval, the test returns 0.0001.
2222 
2223 Relative precision of approximation of p-value:
2224 
2225 N M Max.err. Rms.err.
2226 5..10 N..10 1.4e-02 6.0e-04
2227 5..10 N..100 2.2e-02 5.3e-06
2228 10..15 N..15 1.0e-02 3.2e-04
2229 10..15 N..100 1.0e-02 2.2e-05
2230 15..100 N..100 6.1e-03 2.7e-06
2231 
2232 For N,M>100 accuracy checks weren't put into practice, but taking into
2233 account characteristics of asymptotic approximation used, precision should
2234 not be sharply different from the values for interval [5, 100].
2235 
2236  -- ALGLIB --
2237  Copyright 09.04.2007 by Bochkanov Sergey
2238 *************************************************************************/
2239 void mannwhitneyutest(const real_1d_array &x, const ae_int_t n, const real_1d_array &y, const ae_int_t m, double &bothtails, double &lefttail, double &righttail)
2240 {
2241  alglib_impl::ae_state _alglib_env_state;
2242  alglib_impl::ae_state_init(&_alglib_env_state);
2243  try
2244  {
2245  alglib_impl::mannwhitneyutest(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, const_cast<alglib_impl::ae_vector*>(y.c_ptr()), m, &bothtails, &lefttail, &righttail, &_alglib_env_state);
2246  alglib_impl::ae_state_clear(&_alglib_env_state);
2247  return;
2248  }
2250  {
2251  throw ap_error(_alglib_env_state.error_msg);
2252  }
2253 }
2254 
2255 /*************************************************************************
2256 Sign test
2257 
2258 This test checks three hypotheses about the median of the given sample.
2259 The following tests are performed:
2260  * two-tailed test (null hypothesis - the median is equal to the given
2261  value)
2262  * left-tailed test (null hypothesis - the median is greater than or
2263  equal to the given value)
2264  * right-tailed test (null hypothesis - the median is less than or
2265  equal to the given value)
2266 
2267 Requirements:
2268  * the scale of measurement should be ordinal, interval or ratio (i.e.
2269  the test could not be applied to nominal variables).
2270 
2271 The test is non-parametric and doesn't require distribution X to be normal
2272 
2273 Input parameters:
2274  X - sample. Array whose index goes from 0 to N-1.
2275  N - size of the sample.
2276  Median - assumed median value.
2277 
2278 Output parameters:
2279  BothTails - p-value for two-tailed test.
2280  If BothTails is less than the given significance level
2281  the null hypothesis is rejected.
2282  LeftTail - p-value for left-tailed test.
2283  If LeftTail is less than the given significance level,
2284  the null hypothesis is rejected.
2285  RightTail - p-value for right-tailed test.
2286  If RightTail is less than the given significance level
2287  the null hypothesis is rejected.
2288 
2289 While calculating p-values high-precision binomial distribution
2290 approximation is used, so significance levels have about 15 exact digits.
2291 
2292  -- ALGLIB --
2293  Copyright 08.09.2006 by Bochkanov Sergey
2294 *************************************************************************/
2295 void onesamplesigntest(const real_1d_array &x, const ae_int_t n, const double median, double &bothtails, double &lefttail, double &righttail)
2296 {
2297  alglib_impl::ae_state _alglib_env_state;
2298  alglib_impl::ae_state_init(&_alglib_env_state);
2299  try
2300  {
2301  alglib_impl::onesamplesigntest(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, median, &bothtails, &lefttail, &righttail, &_alglib_env_state);
2302  alglib_impl::ae_state_clear(&_alglib_env_state);
2303  return;
2304  }
2306  {
2307  throw ap_error(_alglib_env_state.error_msg);
2308  }
2309 }
2310 
2311 /*************************************************************************
2312 One-sample t-test
2313 
2314 This test checks three hypotheses about the mean of the given sample. The
2315 following tests are performed:
2316  * two-tailed test (null hypothesis - the mean is equal to the given
2317  value)
2318  * left-tailed test (null hypothesis - the mean is greater than or
2319  equal to the given value)
2320  * right-tailed test (null hypothesis - the mean is less than or equal
2321  to the given value).
2322 
2323 The test is based on the assumption that a given sample has a normal
2324 distribution and an unknown dispersion. If the distribution sharply
2325 differs from normal, the test will work incorrectly.
2326 
2327 INPUT PARAMETERS:
2328  X - sample. Array whose index goes from 0 to N-1.
2329  N - size of sample, N>=0
2330  Mean - assumed value of the mean.
2331 
2332 OUTPUT PARAMETERS:
2333  BothTails - p-value for two-tailed test.
2334  If BothTails is less than the given significance level
2335  the null hypothesis is rejected.
2336  LeftTail - p-value for left-tailed test.
2337  If LeftTail is less than the given significance level,
2338  the null hypothesis is rejected.
2339  RightTail - p-value for right-tailed test.
2340  If RightTail is less than the given significance level
2341  the null hypothesis is rejected.
2342 
2343 NOTE: this function correctly handles degenerate cases:
2344  * when N=0, all p-values are set to 1.0
2345  * when variance of X[] is exactly zero, p-values are set
2346  to 1.0 or 0.0, depending on difference between sample mean and
2347  value of mean being tested.
2348 
2349 
2350  -- ALGLIB --
2351  Copyright 08.09.2006 by Bochkanov Sergey
2352 *************************************************************************/
2353 void studentttest1(const real_1d_array &x, const ae_int_t n, const double mean, double &bothtails, double &lefttail, double &righttail)
2354 {
2355  alglib_impl::ae_state _alglib_env_state;
2356  alglib_impl::ae_state_init(&_alglib_env_state);
2357  try
2358  {
2359  alglib_impl::studentttest1(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, mean, &bothtails, &lefttail, &righttail, &_alglib_env_state);
2360  alglib_impl::ae_state_clear(&_alglib_env_state);
2361  return;
2362  }
2364  {
2365  throw ap_error(_alglib_env_state.error_msg);
2366  }
2367 }
2368 
2369 /*************************************************************************
2370 Two-sample pooled test
2371 
2372 This test checks three hypotheses about the mean of the given samples. The
2373 following tests are performed:
2374  * two-tailed test (null hypothesis - the means are equal)
2375  * left-tailed test (null hypothesis - the mean of the first sample is
2376  greater than or equal to the mean of the second sample)
2377  * right-tailed test (null hypothesis - the mean of the first sample is
2378  less than or equal to the mean of the second sample).
2379 
2380 Test is based on the following assumptions:
2381  * given samples have normal distributions
2382  * dispersions are equal
2383  * samples are independent.
2384 
2385 Input parameters:
2386  X - sample 1. Array whose index goes from 0 to N-1.
2387  N - size of sample.
2388  Y - sample 2. Array whose index goes from 0 to M-1.
2389  M - size of sample.
2390 
2391 Output parameters:
2392  BothTails - p-value for two-tailed test.
2393  If BothTails is less than the given significance level
2394  the null hypothesis is rejected.
2395  LeftTail - p-value for left-tailed test.
2396  If LeftTail is less than the given significance level,
2397  the null hypothesis is rejected.
2398  RightTail - p-value for right-tailed test.
2399  If RightTail is less than the given significance level
2400  the null hypothesis is rejected.
2401 
2402 NOTE: this function correctly handles degenerate cases:
2403  * when N=0 or M=0, all p-values are set to 1.0
2404  * when both samples has exactly zero variance, p-values are set
2405  to 1.0 or 0.0, depending on difference between means.
2406 
2407  -- ALGLIB --
2408  Copyright 18.09.2006 by Bochkanov Sergey
2409 *************************************************************************/
2410 void studentttest2(const real_1d_array &x, const ae_int_t n, const real_1d_array &y, const ae_int_t m, double &bothtails, double &lefttail, double &righttail)
2411 {
2412  alglib_impl::ae_state _alglib_env_state;
2413  alglib_impl::ae_state_init(&_alglib_env_state);
2414  try
2415  {
2416  alglib_impl::studentttest2(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, const_cast<alglib_impl::ae_vector*>(y.c_ptr()), m, &bothtails, &lefttail, &righttail, &_alglib_env_state);
2417  alglib_impl::ae_state_clear(&_alglib_env_state);
2418  return;
2419  }
2421  {
2422  throw ap_error(_alglib_env_state.error_msg);
2423  }
2424 }
2425 
2426 /*************************************************************************
2427 Two-sample unpooled test
2428 
2429 This test checks three hypotheses about the mean of the given samples. The
2430 following tests are performed:
2431  * two-tailed test (null hypothesis - the means are equal)
2432  * left-tailed test (null hypothesis - the mean of the first sample is
2433  greater than or equal to the mean of the second sample)
2434  * right-tailed test (null hypothesis - the mean of the first sample is
2435  less than or equal to the mean of the second sample).
2436 
2437 Test is based on the following assumptions:
2438  * given samples have normal distributions
2439  * samples are independent.
2440 Equality of variances is NOT required.
2441 
2442 Input parameters:
2443  X - sample 1. Array whose index goes from 0 to N-1.
2444  N - size of the sample.
2445  Y - sample 2. Array whose index goes from 0 to M-1.
2446  M - size of the sample.
2447 
2448 Output parameters:
2449  BothTails - p-value for two-tailed test.
2450  If BothTails is less than the given significance level
2451  the null hypothesis is rejected.
2452  LeftTail - p-value for left-tailed test.
2453  If LeftTail is less than the given significance level,
2454  the null hypothesis is rejected.
2455  RightTail - p-value for right-tailed test.
2456  If RightTail is less than the given significance level
2457  the null hypothesis is rejected.
2458 
2459 NOTE: this function correctly handles degenerate cases:
2460  * when N=0 or M=0, all p-values are set to 1.0
2461  * when both samples has zero variance, p-values are set
2462  to 1.0 or 0.0, depending on difference between means.
2463  * when only one sample has zero variance, test reduces to 1-sample
2464  version.
2465 
2466  -- ALGLIB --
2467  Copyright 18.09.2006 by Bochkanov Sergey
2468 *************************************************************************/
2469 void unequalvariancettest(const real_1d_array &x, const ae_int_t n, const real_1d_array &y, const ae_int_t m, double &bothtails, double &lefttail, double &righttail)
2470 {
2471  alglib_impl::ae_state _alglib_env_state;
2472  alglib_impl::ae_state_init(&_alglib_env_state);
2473  try
2474  {
2475  alglib_impl::unequalvariancettest(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, const_cast<alglib_impl::ae_vector*>(y.c_ptr()), m, &bothtails, &lefttail, &righttail, &_alglib_env_state);
2476  alglib_impl::ae_state_clear(&_alglib_env_state);
2477  return;
2478  }
2480  {
2481  throw ap_error(_alglib_env_state.error_msg);
2482  }
2483 }
2484 
2485 /*************************************************************************
2486 Two-sample F-test
2487 
2488 This test checks three hypotheses about dispersions of the given samples.
2489 The following tests are performed:
2490  * two-tailed test (null hypothesis - the dispersions are equal)
2491  * left-tailed test (null hypothesis - the dispersion of the first
2492  sample is greater than or equal to the dispersion of the second
2493  sample).
2494  * right-tailed test (null hypothesis - the dispersion of the first
2495  sample is less than or equal to the dispersion of the second sample)
2496 
2497 The test is based on the following assumptions:
2498  * the given samples have normal distributions
2499  * the samples are independent.
2500 
2501 Input parameters:
2502  X - sample 1. Array whose index goes from 0 to N-1.
2503  N - sample size.
2504  Y - sample 2. Array whose index goes from 0 to M-1.
2505  M - sample size.
2506 
2507 Output parameters:
2508  BothTails - p-value for two-tailed test.
2509  If BothTails is less than the given significance level
2510  the null hypothesis is rejected.
2511  LeftTail - p-value for left-tailed test.
2512  If LeftTail is less than the given significance level,
2513  the null hypothesis is rejected.
2514  RightTail - p-value for right-tailed test.
2515  If RightTail is less than the given significance level
2516  the null hypothesis is rejected.
2517 
2518  -- ALGLIB --
2519  Copyright 19.09.2006 by Bochkanov Sergey
2520 *************************************************************************/
2521 void ftest(const real_1d_array &x, const ae_int_t n, const real_1d_array &y, const ae_int_t m, double &bothtails, double &lefttail, double &righttail)
2522 {
2523  alglib_impl::ae_state _alglib_env_state;
2524  alglib_impl::ae_state_init(&_alglib_env_state);
2525  try
2526  {
2527  alglib_impl::ftest(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, const_cast<alglib_impl::ae_vector*>(y.c_ptr()), m, &bothtails, &lefttail, &righttail, &_alglib_env_state);
2528  alglib_impl::ae_state_clear(&_alglib_env_state);
2529  return;
2530  }
2532  {
2533  throw ap_error(_alglib_env_state.error_msg);
2534  }
2535 }
2536 
2537 /*************************************************************************
2538 One-sample chi-square test
2539 
2540 This test checks three hypotheses about the dispersion of the given sample
2541 The following tests are performed:
2542  * two-tailed test (null hypothesis - the dispersion equals the given
2543  number)
2544  * left-tailed test (null hypothesis - the dispersion is greater than
2545  or equal to the given number)
2546  * right-tailed test (null hypothesis - dispersion is less than or
2547  equal to the given number).
2548 
2549 Test is based on the following assumptions:
2550  * the given sample has a normal distribution.
2551 
2552 Input parameters:
2553  X - sample 1. Array whose index goes from 0 to N-1.
2554  N - size of the sample.
2555  Variance - dispersion value to compare with.
2556 
2557 Output parameters:
2558  BothTails - p-value for two-tailed test.
2559  If BothTails is less than the given significance level
2560  the null hypothesis is rejected.
2561  LeftTail - p-value for left-tailed test.
2562  If LeftTail is less than the given significance level,
2563  the null hypothesis is rejected.
2564  RightTail - p-value for right-tailed test.
2565  If RightTail is less than the given significance level
2566  the null hypothesis is rejected.
2567 
2568  -- ALGLIB --
2569  Copyright 19.09.2006 by Bochkanov Sergey
2570 *************************************************************************/
2571 void onesamplevariancetest(const real_1d_array &x, const ae_int_t n, const double variance, double &bothtails, double &lefttail, double &righttail)
2572 {
2573  alglib_impl::ae_state _alglib_env_state;
2574  alglib_impl::ae_state_init(&_alglib_env_state);
2575  try
2576  {
2577  alglib_impl::onesamplevariancetest(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, variance, &bothtails, &lefttail, &righttail, &_alglib_env_state);
2578  alglib_impl::ae_state_clear(&_alglib_env_state);
2579  return;
2580  }
2582  {
2583  throw ap_error(_alglib_env_state.error_msg);
2584  }
2585 }
2586 
2587 /*************************************************************************
2588 Wilcoxon signed-rank test
2589 
2590 This test checks three hypotheses about the median of the given sample.
2591 The following tests are performed:
2592  * two-tailed test (null hypothesis - the median is equal to the given
2593  value)
2594  * left-tailed test (null hypothesis - the median is greater than or
2595  equal to the given value)
2596  * right-tailed test (null hypothesis - the median is less than or
2597  equal to the given value)
2598 
2599 Requirements:
2600  * the scale of measurement should be ordinal, interval or ratio (i.e.
2601  the test could not be applied to nominal variables).
2602  * the distribution should be continuous and symmetric relative to its
2603  median.
2604  * number of distinct values in the X array should be greater than 4
2605 
2606 The test is non-parametric and doesn't require distribution X to be normal
2607 
2608 Input parameters:
2609  X - sample. Array whose index goes from 0 to N-1.
2610  N - size of the sample.
2611  Median - assumed median value.
2612 
2613 Output parameters:
2614  BothTails - p-value for two-tailed test.
2615  If BothTails is less than the given significance level
2616  the null hypothesis is rejected.
2617  LeftTail - p-value for left-tailed test.
2618  If LeftTail is less than the given significance level,
2619  the null hypothesis is rejected.
2620  RightTail - p-value for right-tailed test.
2621  If RightTail is less than the given significance level
2622  the null hypothesis is rejected.
2623 
2624 To calculate p-values, special approximation is used. This method lets us
2625 calculate p-values with two decimal places in interval [0.0001, 1].
2626 
2627 "Two decimal places" does not sound very impressive, but in practice the
2628 relative error of less than 1% is enough to make a decision.
2629 
2630 There is no approximation outside the [0.0001, 1] interval. Therefore, if
2631 the significance level outlies this interval, the test returns 0.0001.
2632 
2633  -- ALGLIB --
2634  Copyright 08.09.2006 by Bochkanov Sergey
2635 *************************************************************************/
2636 void wilcoxonsignedranktest(const real_1d_array &x, const ae_int_t n, const double e, double &bothtails, double &lefttail, double &righttail)
2637 {
2638  alglib_impl::ae_state _alglib_env_state;
2639  alglib_impl::ae_state_init(&_alglib_env_state);
2640  try
2641  {
2642  alglib_impl::wilcoxonsignedranktest(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, e, &bothtails, &lefttail, &righttail, &_alglib_env_state);
2643  alglib_impl::ae_state_clear(&_alglib_env_state);
2644  return;
2645  }
2647  {
2648  throw ap_error(_alglib_env_state.error_msg);
2649  }
2650 }
2651 }
2652 
2654 //
2655 // THIS SECTION CONTAINS IMPLEMENTATION OF COMPUTATIONAL CORE
2656 //
2658 namespace alglib_impl
2659 {
2660 static void basestat_rankdatarec(/* Real */ ae_matrix* xy,
2661  ae_int_t i0,
2662  ae_int_t i1,
2663  ae_int_t nfeatures,
2664  ae_bool iscentered,
2665  ae_shared_pool* pool,
2666  ae_int_t basecasecost,
2667  ae_state *_state);
2668 static void basestat_rankdatabasecase(/* Real */ ae_matrix* xy,
2669  ae_int_t i0,
2670  ae_int_t i1,
2671  ae_int_t nfeatures,
2672  ae_bool iscentered,
2673  apbuffers* buf0,
2674  apbuffers* buf1,
2675  ae_state *_state);
2676 
2677 
2678 static double correlationtests_spearmantail5(double s, ae_state *_state);
2679 static double correlationtests_spearmantail6(double s, ae_state *_state);
2680 static double correlationtests_spearmantail7(double s, ae_state *_state);
2681 static double correlationtests_spearmantail8(double s, ae_state *_state);
2682 static double correlationtests_spearmantail9(double s, ae_state *_state);
2683 static double correlationtests_spearmantail(double t,
2684  ae_int_t n,
2685  ae_state *_state);
2686 
2687 
2688 static void jarquebera_jarqueberastatistic(/* Real */ ae_vector* x,
2689  ae_int_t n,
2690  double* s,
2691  ae_state *_state);
2692 static double jarquebera_jarqueberaapprox(ae_int_t n,
2693  double s,
2694  ae_state *_state);
2695 static double jarquebera_jbtbl5(double s, ae_state *_state);
2696 static double jarquebera_jbtbl6(double s, ae_state *_state);
2697 static double jarquebera_jbtbl7(double s, ae_state *_state);
2698 static double jarquebera_jbtbl8(double s, ae_state *_state);
2699 static double jarquebera_jbtbl9(double s, ae_state *_state);
2700 static double jarquebera_jbtbl10(double s, ae_state *_state);
2701 static double jarquebera_jbtbl11(double s, ae_state *_state);
2702 static double jarquebera_jbtbl12(double s, ae_state *_state);
2703 static double jarquebera_jbtbl13(double s, ae_state *_state);
2704 static double jarquebera_jbtbl14(double s, ae_state *_state);
2705 static double jarquebera_jbtbl15(double s, ae_state *_state);
2706 static double jarquebera_jbtbl16(double s, ae_state *_state);
2707 static double jarquebera_jbtbl17(double s, ae_state *_state);
2708 static double jarquebera_jbtbl18(double s, ae_state *_state);
2709 static double jarquebera_jbtbl19(double s, ae_state *_state);
2710 static double jarquebera_jbtbl20(double s, ae_state *_state);
2711 static double jarquebera_jbtbl30(double s, ae_state *_state);
2712 static double jarquebera_jbtbl50(double s, ae_state *_state);
2713 static double jarquebera_jbtbl65(double s, ae_state *_state);
2714 static double jarquebera_jbtbl100(double s, ae_state *_state);
2715 static double jarquebera_jbtbl130(double s, ae_state *_state);
2716 static double jarquebera_jbtbl200(double s, ae_state *_state);
2717 static double jarquebera_jbtbl301(double s, ae_state *_state);
2718 static double jarquebera_jbtbl501(double s, ae_state *_state);
2719 static double jarquebera_jbtbl701(double s, ae_state *_state);
2720 static double jarquebera_jbtbl1401(double s, ae_state *_state);
2721 static void jarquebera_jbcheb(double x,
2722  double c,
2723  double* tj,
2724  double* tj1,
2725  double* r,
2726  ae_state *_state);
2727 
2728 
2729 static void mannwhitneyu_ucheb(double x,
2730  double c,
2731  double* tj,
2732  double* tj1,
2733  double* r,
2734  ae_state *_state);
2735 static double mannwhitneyu_uninterpolate(double p1,
2736  double p2,
2737  double p3,
2738  ae_int_t n,
2739  ae_state *_state);
2740 static double mannwhitneyu_usigma000(ae_int_t n1,
2741  ae_int_t n2,
2742  ae_state *_state);
2743 static double mannwhitneyu_usigma075(ae_int_t n1,
2744  ae_int_t n2,
2745  ae_state *_state);
2746 static double mannwhitneyu_usigma150(ae_int_t n1,
2747  ae_int_t n2,
2748  ae_state *_state);
2749 static double mannwhitneyu_usigma225(ae_int_t n1,
2750  ae_int_t n2,
2751  ae_state *_state);
2752 static double mannwhitneyu_usigma300(ae_int_t n1,
2753  ae_int_t n2,
2754  ae_state *_state);
2755 static double mannwhitneyu_usigma333(ae_int_t n1,
2756  ae_int_t n2,
2757  ae_state *_state);
2758 static double mannwhitneyu_usigma367(ae_int_t n1,
2759  ae_int_t n2,
2760  ae_state *_state);
2761 static double mannwhitneyu_usigma400(ae_int_t n1,
2762  ae_int_t n2,
2763  ae_state *_state);
2764 static double mannwhitneyu_utbln5n5(double s, ae_state *_state);
2765 static double mannwhitneyu_utbln5n6(double s, ae_state *_state);
2766 static double mannwhitneyu_utbln5n7(double s, ae_state *_state);
2767 static double mannwhitneyu_utbln5n8(double s, ae_state *_state);
2768 static double mannwhitneyu_utbln5n9(double s, ae_state *_state);
2769 static double mannwhitneyu_utbln5n10(double s, ae_state *_state);
2770 static double mannwhitneyu_utbln5n11(double s, ae_state *_state);
2771 static double mannwhitneyu_utbln5n12(double s, ae_state *_state);
2772 static double mannwhitneyu_utbln5n13(double s, ae_state *_state);
2773 static double mannwhitneyu_utbln5n14(double s, ae_state *_state);
2774 static double mannwhitneyu_utbln5n15(double s, ae_state *_state);
2775 static double mannwhitneyu_utbln5n16(double s, ae_state *_state);
2776 static double mannwhitneyu_utbln5n17(double s, ae_state *_state);
2777 static double mannwhitneyu_utbln5n18(double s, ae_state *_state);
2778 static double mannwhitneyu_utbln5n19(double s, ae_state *_state);
2779 static double mannwhitneyu_utbln5n20(double s, ae_state *_state);
2780 static double mannwhitneyu_utbln5n21(double s, ae_state *_state);
2781 static double mannwhitneyu_utbln5n22(double s, ae_state *_state);
2782 static double mannwhitneyu_utbln5n23(double s, ae_state *_state);
2783 static double mannwhitneyu_utbln5n24(double s, ae_state *_state);
2784 static double mannwhitneyu_utbln5n25(double s, ae_state *_state);
2785 static double mannwhitneyu_utbln5n26(double s, ae_state *_state);
2786 static double mannwhitneyu_utbln5n27(double s, ae_state *_state);
2787 static double mannwhitneyu_utbln5n28(double s, ae_state *_state);
2788 static double mannwhitneyu_utbln5n29(double s, ae_state *_state);
2789 static double mannwhitneyu_utbln5n30(double s, ae_state *_state);
2790 static double mannwhitneyu_utbln5n100(double s, ae_state *_state);
2791 static double mannwhitneyu_utbln6n6(double s, ae_state *_state);
2792 static double mannwhitneyu_utbln6n7(double s, ae_state *_state);
2793 static double mannwhitneyu_utbln6n8(double s, ae_state *_state);
2794 static double mannwhitneyu_utbln6n9(double s, ae_state *_state);
2795 static double mannwhitneyu_utbln6n10(double s, ae_state *_state);
2796 static double mannwhitneyu_utbln6n11(double s, ae_state *_state);
2797 static double mannwhitneyu_utbln6n12(double s, ae_state *_state);
2798 static double mannwhitneyu_utbln6n13(double s, ae_state *_state);
2799 static double mannwhitneyu_utbln6n14(double s, ae_state *_state);
2800 static double mannwhitneyu_utbln6n15(double s, ae_state *_state);
2801 static double mannwhitneyu_utbln6n30(double s, ae_state *_state);
2802 static double mannwhitneyu_utbln6n100(double s, ae_state *_state);
2803 static double mannwhitneyu_utbln7n7(double s, ae_state *_state);
2804 static double mannwhitneyu_utbln7n8(double s, ae_state *_state);
2805 static double mannwhitneyu_utbln7n9(double s, ae_state *_state);
2806 static double mannwhitneyu_utbln7n10(double s, ae_state *_state);
2807 static double mannwhitneyu_utbln7n11(double s, ae_state *_state);
2808 static double mannwhitneyu_utbln7n12(double s, ae_state *_state);
2809 static double mannwhitneyu_utbln7n13(double s, ae_state *_state);
2810 static double mannwhitneyu_utbln7n14(double s, ae_state *_state);
2811 static double mannwhitneyu_utbln7n15(double s, ae_state *_state);
2812 static double mannwhitneyu_utbln7n30(double s, ae_state *_state);
2813 static double mannwhitneyu_utbln7n100(double s, ae_state *_state);
2814 static double mannwhitneyu_utbln8n8(double s, ae_state *_state);
2815 static double mannwhitneyu_utbln8n9(double s, ae_state *_state);
2816 static double mannwhitneyu_utbln8n10(double s, ae_state *_state);
2817 static double mannwhitneyu_utbln8n11(double s, ae_state *_state);
2818 static double mannwhitneyu_utbln8n12(double s, ae_state *_state);
2819 static double mannwhitneyu_utbln8n13(double s, ae_state *_state);
2820 static double mannwhitneyu_utbln8n14(double s, ae_state *_state);
2821 static double mannwhitneyu_utbln8n15(double s, ae_state *_state);
2822 static double mannwhitneyu_utbln8n30(double s, ae_state *_state);
2823 static double mannwhitneyu_utbln8n100(double s, ae_state *_state);
2824 static double mannwhitneyu_utbln9n9(double s, ae_state *_state);
2825 static double mannwhitneyu_utbln9n10(double s, ae_state *_state);
2826 static double mannwhitneyu_utbln9n11(double s, ae_state *_state);
2827 static double mannwhitneyu_utbln9n12(double s, ae_state *_state);
2828 static double mannwhitneyu_utbln9n13(double s, ae_state *_state);
2829 static double mannwhitneyu_utbln9n14(double s, ae_state *_state);
2830 static double mannwhitneyu_utbln9n15(double s, ae_state *_state);
2831 static double mannwhitneyu_utbln9n30(double s, ae_state *_state);
2832 static double mannwhitneyu_utbln9n100(double s, ae_state *_state);
2833 static double mannwhitneyu_utbln10n10(double s, ae_state *_state);
2834 static double mannwhitneyu_utbln10n11(double s, ae_state *_state);
2835 static double mannwhitneyu_utbln10n12(double s, ae_state *_state);
2836 static double mannwhitneyu_utbln10n13(double s, ae_state *_state);
2837 static double mannwhitneyu_utbln10n14(double s, ae_state *_state);
2838 static double mannwhitneyu_utbln10n15(double s, ae_state *_state);
2839 static double mannwhitneyu_utbln10n30(double s, ae_state *_state);
2840 static double mannwhitneyu_utbln10n100(double s, ae_state *_state);
2841 static double mannwhitneyu_utbln11n11(double s, ae_state *_state);
2842 static double mannwhitneyu_utbln11n12(double s, ae_state *_state);
2843 static double mannwhitneyu_utbln11n13(double s, ae_state *_state);
2844 static double mannwhitneyu_utbln11n14(double s, ae_state *_state);
2845 static double mannwhitneyu_utbln11n15(double s, ae_state *_state);
2846 static double mannwhitneyu_utbln11n30(double s, ae_state *_state);
2847 static double mannwhitneyu_utbln11n100(double s, ae_state *_state);
2848 static double mannwhitneyu_utbln12n12(double s, ae_state *_state);
2849 static double mannwhitneyu_utbln12n13(double s, ae_state *_state);
2850 static double mannwhitneyu_utbln12n14(double s, ae_state *_state);
2851 static double mannwhitneyu_utbln12n15(double s, ae_state *_state);
2852 static double mannwhitneyu_utbln12n30(double s, ae_state *_state);
2853 static double mannwhitneyu_utbln12n100(double s, ae_state *_state);
2854 static double mannwhitneyu_utbln13n13(double s, ae_state *_state);
2855 static double mannwhitneyu_utbln13n14(double s, ae_state *_state);
2856 static double mannwhitneyu_utbln13n15(double s, ae_state *_state);
2857 static double mannwhitneyu_utbln13n30(double s, ae_state *_state);
2858 static double mannwhitneyu_utbln13n100(double s, ae_state *_state);
2859 static double mannwhitneyu_utbln14n14(double s, ae_state *_state);
2860 static double mannwhitneyu_utbln14n15(double s, ae_state *_state);
2861 static double mannwhitneyu_utbln14n30(double s, ae_state *_state);
2862 static double mannwhitneyu_utbln14n100(double s, ae_state *_state);
2863 static double mannwhitneyu_usigma(double s,
2864  ae_int_t n1,
2865  ae_int_t n2,
2866  ae_state *_state);
2867 
2868 
2869 
2870 
2871 
2872 
2873 
2874 
2875 static void wsr_wcheb(double x,
2876  double c,
2877  double* tj,
2878  double* tj1,
2879  double* r,
2880  ae_state *_state);
2881 static double wsr_w5(double s, ae_state *_state);
2882 static double wsr_w6(double s, ae_state *_state);
2883 static double wsr_w7(double s, ae_state *_state);
2884 static double wsr_w8(double s, ae_state *_state);
2885 static double wsr_w9(double s, ae_state *_state);
2886 static double wsr_w10(double s, ae_state *_state);
2887 static double wsr_w11(double s, ae_state *_state);
2888 static double wsr_w12(double s, ae_state *_state);
2889 static double wsr_w13(double s, ae_state *_state);
2890 static double wsr_w14(double s, ae_state *_state);
2891 static double wsr_w15(double s, ae_state *_state);
2892 static double wsr_w16(double s, ae_state *_state);
2893 static double wsr_w17(double s, ae_state *_state);
2894 static double wsr_w18(double s, ae_state *_state);
2895 static double wsr_w19(double s, ae_state *_state);
2896 static double wsr_w20(double s, ae_state *_state);
2897 static double wsr_w21(double s, ae_state *_state);
2898 static double wsr_w22(double s, ae_state *_state);
2899 static double wsr_w23(double s, ae_state *_state);
2900 static double wsr_w24(double s, ae_state *_state);
2901 static double wsr_w25(double s, ae_state *_state);
2902 static double wsr_w26(double s, ae_state *_state);
2903 static double wsr_w27(double s, ae_state *_state);
2904 static double wsr_w28(double s, ae_state *_state);
2905 static double wsr_w29(double s, ae_state *_state);
2906 static double wsr_w30(double s, ae_state *_state);
2907 static double wsr_w40(double s, ae_state *_state);
2908 static double wsr_w60(double s, ae_state *_state);
2909 static double wsr_w120(double s, ae_state *_state);
2910 static double wsr_w200(double s, ae_state *_state);
2911 static double wsr_wsigma(double s, ae_int_t n, ae_state *_state);
2912 
2913 
2914 
2915 
2916 
2917 /*************************************************************************
2918 Calculation of the distribution moments: mean, variance, skewness, kurtosis.
2919 
2920 INPUT PARAMETERS:
2921  X - sample
2922  N - N>=0, sample size:
2923  * if given, only leading N elements of X are processed
2924  * if not given, automatically determined from size of X
2925 
2926 OUTPUT PARAMETERS
2927  Mean - mean.
2928  Variance- variance.
2929  Skewness- skewness (if variance<>0; zero otherwise).
2930  Kurtosis- kurtosis (if variance<>0; zero otherwise).
2931 
2932 
2933  -- ALGLIB --
2934  Copyright 06.09.2006 by Bochkanov Sergey
2935 *************************************************************************/
2936 void samplemoments(/* Real */ ae_vector* x,
2937  ae_int_t n,
2938  double* mean,
2939  double* variance,
2940  double* skewness,
2941  double* kurtosis,
2942  ae_state *_state)
2943 {
2944  ae_int_t i;
2945  double v;
2946  double v1;
2947  double v2;
2948  double stddev;
2949 
2950  *mean = 0;
2951  *variance = 0;
2952  *skewness = 0;
2953  *kurtosis = 0;
2954 
2955  ae_assert(n>=0, "SampleMoments: N<0", _state);
2956  ae_assert(x->cnt>=n, "SampleMoments: Length(X)<N!", _state);
2957  ae_assert(isfinitevector(x, n, _state), "SampleMoments: X is not finite vector", _state);
2958 
2959  /*
2960  * Init, special case 'N=0'
2961  */
2962  *mean = 0;
2963  *variance = 0;
2964  *skewness = 0;
2965  *kurtosis = 0;
2966  stddev = 0;
2967  if( n<=0 )
2968  {
2969  return;
2970  }
2971 
2972  /*
2973  * Mean
2974  */
2975  for(i=0; i<=n-1; i++)
2976  {
2977  *mean = *mean+x->ptr.p_double[i];
2978  }
2979  *mean = *mean/n;
2980 
2981  /*
2982  * Variance (using corrected two-pass algorithm)
2983  */
2984  if( n!=1 )
2985  {
2986  v1 = 0;
2987  for(i=0; i<=n-1; i++)
2988  {
2989  v1 = v1+ae_sqr(x->ptr.p_double[i]-(*mean), _state);
2990  }
2991  v2 = 0;
2992  for(i=0; i<=n-1; i++)
2993  {
2994  v2 = v2+(x->ptr.p_double[i]-(*mean));
2995  }
2996  v2 = ae_sqr(v2, _state)/n;
2997  *variance = (v1-v2)/(n-1);
2998  if( ae_fp_less(*variance,0) )
2999  {
3000  *variance = 0;
3001  }
3002  stddev = ae_sqrt(*variance, _state);
3003  }
3004 
3005  /*
3006  * Skewness and kurtosis
3007  */
3008  if( ae_fp_neq(stddev,0) )
3009  {
3010  for(i=0; i<=n-1; i++)
3011  {
3012  v = (x->ptr.p_double[i]-(*mean))/stddev;
3013  v2 = ae_sqr(v, _state);
3014  *skewness = *skewness+v2*v;
3015  *kurtosis = *kurtosis+ae_sqr(v2, _state);
3016  }
3017  *skewness = *skewness/n;
3018  *kurtosis = *kurtosis/n-3;
3019  }
3020 }
3021 
3022 
3023 /*************************************************************************
3024 Calculation of the mean.
3025 
3026 INPUT PARAMETERS:
3027  X - sample
3028  N - N>=0, sample size:
3029  * if given, only leading N elements of X are processed
3030  * if not given, automatically determined from size of X
3031 
3032 NOTE:
3033 
3034 This function return result which calculated by 'SampleMoments' function
3035 and stored at 'Mean' variable.
3036 
3037 
3038  -- ALGLIB --
3039  Copyright 06.09.2006 by Bochkanov Sergey
3040 *************************************************************************/
3041 double samplemean(/* Real */ ae_vector* x,
3042  ae_int_t n,
3043  ae_state *_state)
3044 {
3045  double mean;
3046  double tmp0;
3047  double tmp1;
3048  double tmp2;
3049  double result;
3050 
3051 
3052  samplemoments(x, n, &mean, &tmp0, &tmp1, &tmp2, _state);
3053  result = mean;
3054  return result;
3055 }
3056 
3057 
3058 /*************************************************************************
3059 Calculation of the variance.
3060 
3061 INPUT PARAMETERS:
3062  X - sample
3063  N - N>=0, sample size:
3064  * if given, only leading N elements of X are processed
3065  * if not given, automatically determined from size of X
3066 
3067 NOTE:
3068 
3069 This function return result which calculated by 'SampleMoments' function
3070 and stored at 'Variance' variable.
3071 
3072 
3073  -- ALGLIB --
3074  Copyright 06.09.2006 by Bochkanov Sergey
3075 *************************************************************************/
3076 double samplevariance(/* Real */ ae_vector* x,
3077  ae_int_t n,
3078  ae_state *_state)
3079 {
3080  double variance;
3081  double tmp0;
3082  double tmp1;
3083  double tmp2;
3084  double result;
3085 
3086 
3087  samplemoments(x, n, &tmp0, &variance, &tmp1, &tmp2, _state);
3088  result = variance;
3089  return result;
3090 }
3091 
3092 
3093 /*************************************************************************
3094 Calculation of the skewness.
3095 
3096 INPUT PARAMETERS:
3097  X - sample
3098  N - N>=0, sample size:
3099  * if given, only leading N elements of X are processed
3100  * if not given, automatically determined from size of X
3101 
3102 NOTE:
3103 
3104 This function return result which calculated by 'SampleMoments' function
3105 and stored at 'Skewness' variable.
3106 
3107 
3108  -- ALGLIB --
3109  Copyright 06.09.2006 by Bochkanov Sergey
3110 *************************************************************************/
3111 double sampleskewness(/* Real */ ae_vector* x,
3112  ae_int_t n,
3113  ae_state *_state)
3114 {
3115  double skewness;
3116  double tmp0;
3117  double tmp1;
3118  double tmp2;
3119  double result;
3120 
3121 
3122  samplemoments(x, n, &tmp0, &tmp1, &skewness, &tmp2, _state);
3123  result = skewness;
3124  return result;
3125 }
3126 
3127 
3128 /*************************************************************************
3129 Calculation of the kurtosis.
3130 
3131 INPUT PARAMETERS:
3132  X - sample
3133  N - N>=0, sample size:
3134  * if given, only leading N elements of X are processed
3135  * if not given, automatically determined from size of X
3136 
3137 NOTE:
3138 
3139 This function return result which calculated by 'SampleMoments' function
3140 and stored at 'Kurtosis' variable.
3141 
3142 
3143  -- ALGLIB --
3144  Copyright 06.09.2006 by Bochkanov Sergey
3145 *************************************************************************/
3146 double samplekurtosis(/* Real */ ae_vector* x,
3147  ae_int_t n,
3148  ae_state *_state)
3149 {
3150  double kurtosis;
3151  double tmp0;
3152  double tmp1;
3153  double tmp2;
3154  double result;
3155 
3156 
3157  samplemoments(x, n, &tmp0, &tmp1, &tmp2, &kurtosis, _state);
3158  result = kurtosis;
3159  return result;
3160 }
3161 
3162 
3163 /*************************************************************************
3164 ADev
3165 
3166 Input parameters:
3167  X - sample
3168  N - N>=0, sample size:
3169  * if given, only leading N elements of X are processed
3170  * if not given, automatically determined from size of X
3171 
3172 Output parameters:
3173  ADev- ADev
3174 
3175  -- ALGLIB --
3176  Copyright 06.09.2006 by Bochkanov Sergey
3177 *************************************************************************/
3178 void sampleadev(/* Real */ ae_vector* x,
3179  ae_int_t n,
3180  double* adev,
3181  ae_state *_state)
3182 {
3183  ae_int_t i;
3184  double mean;
3185 
3186  *adev = 0;
3187 
3188  ae_assert(n>=0, "SampleADev: N<0", _state);
3189  ae_assert(x->cnt>=n, "SampleADev: Length(X)<N!", _state);
3190  ae_assert(isfinitevector(x, n, _state), "SampleADev: X is not finite vector", _state);
3191 
3192  /*
3193  * Init, handle N=0
3194  */
3195  mean = 0;
3196  *adev = 0;
3197  if( n<=0 )
3198  {
3199  return;
3200  }
3201 
3202  /*
3203  * Mean
3204  */
3205  for(i=0; i<=n-1; i++)
3206  {
3207  mean = mean+x->ptr.p_double[i];
3208  }
3209  mean = mean/n;
3210 
3211  /*
3212  * ADev
3213  */
3214  for(i=0; i<=n-1; i++)
3215  {
3216  *adev = *adev+ae_fabs(x->ptr.p_double[i]-mean, _state);
3217  }
3218  *adev = *adev/n;
3219 }
3220 
3221 
3222 /*************************************************************************
3223 Median calculation.
3224 
3225 Input parameters:
3226  X - sample (array indexes: [0..N-1])
3227  N - N>=0, sample size:
3228  * if given, only leading N elements of X are processed
3229  * if not given, automatically determined from size of X
3230 
3231 Output parameters:
3232  Median
3233 
3234  -- ALGLIB --
3235  Copyright 06.09.2006 by Bochkanov Sergey
3236 *************************************************************************/
3237 void samplemedian(/* Real */ ae_vector* x,
3238  ae_int_t n,
3239  double* median,
3240  ae_state *_state)
3241 {
3242  ae_frame _frame_block;
3243  ae_vector _x;
3244  ae_int_t i;
3245  ae_int_t ir;
3246  ae_int_t j;
3247  ae_int_t l;
3248  ae_int_t midp;
3249  ae_int_t k;
3250  double a;
3251  double tval;
3252 
3253  ae_frame_make(_state, &_frame_block);
3254  ae_vector_init_copy(&_x, x, _state, ae_true);
3255  x = &_x;
3256  *median = 0;
3257 
3258  ae_assert(n>=0, "SampleMedian: N<0", _state);
3259  ae_assert(x->cnt>=n, "SampleMedian: Length(X)<N!", _state);
3260  ae_assert(isfinitevector(x, n, _state), "SampleMedian: X is not finite vector", _state);
3261 
3262  /*
3263  * Some degenerate cases
3264  */
3265  *median = 0;
3266  if( n<=0 )
3267  {
3268  ae_frame_leave(_state);
3269  return;
3270  }
3271  if( n==1 )
3272  {
3273  *median = x->ptr.p_double[0];
3274  ae_frame_leave(_state);
3275  return;
3276  }
3277  if( n==2 )
3278  {
3279  *median = 0.5*(x->ptr.p_double[0]+x->ptr.p_double[1]);
3280  ae_frame_leave(_state);
3281  return;
3282  }
3283 
3284  /*
3285  * Common case, N>=3.
3286  * Choose X[(N-1)/2]
3287  */
3288  l = 0;
3289  ir = n-1;
3290  k = (n-1)/2;
3291  for(;;)
3292  {
3293  if( ir<=l+1 )
3294  {
3295 
3296  /*
3297  * 1 or 2 elements in partition
3298  */
3299  if( ir==l+1&&ae_fp_less(x->ptr.p_double[ir],x->ptr.p_double[l]) )
3300  {
3301  tval = x->ptr.p_double[l];
3302  x->ptr.p_double[l] = x->ptr.p_double[ir];
3303  x->ptr.p_double[ir] = tval;
3304  }
3305  break;
3306  }
3307  else
3308  {
3309  midp = (l+ir)/2;
3310  tval = x->ptr.p_double[midp];
3311  x->ptr.p_double[midp] = x->ptr.p_double[l+1];
3312  x->ptr.p_double[l+1] = tval;
3313  if( ae_fp_greater(x->ptr.p_double[l],x->ptr.p_double[ir]) )
3314  {
3315  tval = x->ptr.p_double[l];
3316  x->ptr.p_double[l] = x->ptr.p_double[ir];
3317  x->ptr.p_double[ir] = tval;
3318  }
3319  if( ae_fp_greater(x->ptr.p_double[l+1],x->ptr.p_double[ir]) )
3320  {
3321  tval = x->ptr.p_double[l+1];
3322  x->ptr.p_double[l+1] = x->ptr.p_double[ir];
3323  x->ptr.p_double[ir] = tval;
3324  }
3325  if( ae_fp_greater(x->ptr.p_double[l],x->ptr.p_double[l+1]) )
3326  {
3327  tval = x->ptr.p_double[l];
3328  x->ptr.p_double[l] = x->ptr.p_double[l+1];
3329  x->ptr.p_double[l+1] = tval;
3330  }
3331  i = l+1;
3332  j = ir;
3333  a = x->ptr.p_double[l+1];
3334  for(;;)
3335  {
3336  do
3337  {
3338  i = i+1;
3339  }
3340  while(ae_fp_less(x->ptr.p_double[i],a));
3341  do
3342  {
3343  j = j-1;
3344  }
3345  while(ae_fp_greater(x->ptr.p_double[j],a));
3346  if( j<i )
3347  {
3348  break;
3349  }
3350  tval = x->ptr.p_double[i];
3351  x->ptr.p_double[i] = x->ptr.p_double[j];
3352  x->ptr.p_double[j] = tval;
3353  }
3354  x->ptr.p_double[l+1] = x->ptr.p_double[j];
3355  x->ptr.p_double[j] = a;
3356  if( j>=k )
3357  {
3358  ir = j-1;
3359  }
3360  if( j<=k )
3361  {
3362  l = i;
3363  }
3364  }
3365  }
3366 
3367  /*
3368  * If N is odd, return result
3369  */
3370  if( n%2==1 )
3371  {
3372  *median = x->ptr.p_double[k];
3373  ae_frame_leave(_state);
3374  return;
3375  }
3376  a = x->ptr.p_double[n-1];
3377  for(i=k+1; i<=n-1; i++)
3378  {
3379  if( ae_fp_less(x->ptr.p_double[i],a) )
3380  {
3381  a = x->ptr.p_double[i];
3382  }
3383  }
3384  *median = 0.5*(x->ptr.p_double[k]+a);
3385  ae_frame_leave(_state);
3386 }
3387 
3388 
3389 /*************************************************************************
3390 Percentile calculation.
3391 
3392 Input parameters:
3393  X - sample (array indexes: [0..N-1])
3394  N - N>=0, sample size:
3395  * if given, only leading N elements of X are processed
3396  * if not given, automatically determined from size of X
3397  P - percentile (0<=P<=1)
3398 
3399 Output parameters:
3400  V - percentile
3401 
3402  -- ALGLIB --
3403  Copyright 01.03.2008 by Bochkanov Sergey
3404 *************************************************************************/
3405 void samplepercentile(/* Real */ ae_vector* x,
3406  ae_int_t n,
3407  double p,
3408  double* v,
3409  ae_state *_state)
3410 {
3411  ae_frame _frame_block;
3412  ae_vector _x;
3413  ae_int_t i1;
3414  double t;
3415  ae_vector rbuf;
3416 
3417  ae_frame_make(_state, &_frame_block);
3418  ae_vector_init_copy(&_x, x, _state, ae_true);
3419  x = &_x;
3420  *v = 0;
3421  ae_vector_init(&rbuf, 0, DT_REAL, _state, ae_true);
3422 
3423  ae_assert(n>=0, "SamplePercentile: N<0", _state);
3424  ae_assert(x->cnt>=n, "SamplePercentile: Length(X)<N!", _state);
3425  ae_assert(isfinitevector(x, n, _state), "SamplePercentile: X is not finite vector", _state);
3426  ae_assert(ae_isfinite(p, _state), "SamplePercentile: incorrect P!", _state);
3427  ae_assert(ae_fp_greater_eq(p,0)&&ae_fp_less_eq(p,1), "SamplePercentile: incorrect P!", _state);
3428  tagsortfast(x, &rbuf, n, _state);
3429  if( ae_fp_eq(p,0) )
3430  {
3431  *v = x->ptr.p_double[0];
3432  ae_frame_leave(_state);
3433  return;
3434  }
3435  if( ae_fp_eq(p,1) )
3436  {
3437  *v = x->ptr.p_double[n-1];
3438  ae_frame_leave(_state);
3439  return;
3440  }
3441  t = p*(n-1);
3442  i1 = ae_ifloor(t, _state);
3443  t = t-ae_ifloor(t, _state);
3444  *v = x->ptr.p_double[i1]*(1-t)+x->ptr.p_double[i1+1]*t;
3445  ae_frame_leave(_state);
3446 }
3447 
3448 
3449 /*************************************************************************
3450 2-sample covariance
3451 
3452 Input parameters:
3453  X - sample 1 (array indexes: [0..N-1])
3454  Y - sample 2 (array indexes: [0..N-1])
3455  N - N>=0, sample size:
3456  * if given, only N leading elements of X/Y are processed
3457  * if not given, automatically determined from input sizes
3458 
3459 Result:
3460  covariance (zero for N=0 or N=1)
3461 
3462  -- ALGLIB --
3463  Copyright 28.10.2010 by Bochkanov Sergey
3464 *************************************************************************/
3465 double cov2(/* Real */ ae_vector* x,
3466  /* Real */ ae_vector* y,
3467  ae_int_t n,
3468  ae_state *_state)
3469 {
3470  ae_int_t i;
3471  double xmean;
3472  double ymean;
3473  double v;
3474  double x0;
3475  double y0;
3476  double s;
3477  ae_bool samex;
3478  ae_bool samey;
3479  double result;
3480 
3481 
3482  ae_assert(n>=0, "Cov2: N<0", _state);
3483  ae_assert(x->cnt>=n, "Cov2: Length(X)<N!", _state);
3484  ae_assert(y->cnt>=n, "Cov2: Length(Y)<N!", _state);
3485  ae_assert(isfinitevector(x, n, _state), "Cov2: X is not finite vector", _state);
3486  ae_assert(isfinitevector(y, n, _state), "Cov2: Y is not finite vector", _state);
3487 
3488  /*
3489  * Special case
3490  */
3491  if( n<=1 )
3492  {
3493  result = 0;
3494  return result;
3495  }
3496 
3497  /*
3498  * Calculate mean.
3499  *
3500  *
3501  * Additionally we calculate SameX and SameY -
3502  * flag variables which are set to True when
3503  * all X[] (or Y[]) contain exactly same value.
3504  *
3505  * If at least one of them is True, we return zero
3506  * (othwerwise we risk to get nonzero covariation
3507  * because of roundoff).
3508  */
3509  xmean = 0;
3510  ymean = 0;
3511  samex = ae_true;
3512  samey = ae_true;
3513  x0 = x->ptr.p_double[0];
3514  y0 = y->ptr.p_double[0];
3515  v = (double)1/(double)n;
3516  for(i=0; i<=n-1; i++)
3517  {
3518  s = x->ptr.p_double[i];
3519  samex = samex&&ae_fp_eq(s,x0);
3520  xmean = xmean+s*v;
3521  s = y->ptr.p_double[i];
3522  samey = samey&&ae_fp_eq(s,y0);
3523  ymean = ymean+s*v;
3524  }
3525  if( samex||samey )
3526  {
3527  result = 0;
3528  return result;
3529  }
3530 
3531  /*
3532  * covariance
3533  */
3534  v = (double)1/(double)(n-1);
3535  result = 0;
3536  for(i=0; i<=n-1; i++)
3537  {
3538  result = result+v*(x->ptr.p_double[i]-xmean)*(y->ptr.p_double[i]-ymean);
3539  }
3540  return result;
3541 }
3542 
3543 
3544 /*************************************************************************
3545 Pearson product-moment correlation coefficient
3546 
3547 Input parameters:
3548  X - sample 1 (array indexes: [0..N-1])
3549  Y - sample 2 (array indexes: [0..N-1])
3550  N - N>=0, sample size:
3551  * if given, only N leading elements of X/Y are processed
3552  * if not given, automatically determined from input sizes
3553 
3554 Result:
3555  Pearson product-moment correlation coefficient
3556  (zero for N=0 or N=1)
3557 
3558  -- ALGLIB --
3559  Copyright 28.10.2010 by Bochkanov Sergey
3560 *************************************************************************/
3561 double pearsoncorr2(/* Real */ ae_vector* x,
3562  /* Real */ ae_vector* y,
3563  ae_int_t n,
3564  ae_state *_state)
3565 {
3566  ae_int_t i;
3567  double xmean;
3568  double ymean;
3569  double v;
3570  double x0;
3571  double y0;
3572  double s;
3573  ae_bool samex;
3574  ae_bool samey;
3575  double xv;
3576  double yv;
3577  double t1;
3578  double t2;
3579  double result;
3580 
3581 
3582  ae_assert(n>=0, "PearsonCorr2: N<0", _state);
3583  ae_assert(x->cnt>=n, "PearsonCorr2: Length(X)<N!", _state);
3584  ae_assert(y->cnt>=n, "PearsonCorr2: Length(Y)<N!", _state);
3585  ae_assert(isfinitevector(x, n, _state), "PearsonCorr2: X is not finite vector", _state);
3586  ae_assert(isfinitevector(y, n, _state), "PearsonCorr2: Y is not finite vector", _state);
3587 
3588  /*
3589  * Special case
3590  */
3591  if( n<=1 )
3592  {
3593  result = 0;
3594  return result;
3595  }
3596 
3597  /*
3598  * Calculate mean.
3599  *
3600  *
3601  * Additionally we calculate SameX and SameY -
3602  * flag variables which are set to True when
3603  * all X[] (or Y[]) contain exactly same value.
3604  *
3605  * If at least one of them is True, we return zero
3606  * (othwerwise we risk to get nonzero correlation
3607  * because of roundoff).
3608  */
3609  xmean = 0;
3610  ymean = 0;
3611  samex = ae_true;
3612  samey = ae_true;
3613  x0 = x->ptr.p_double[0];
3614  y0 = y->ptr.p_double[0];
3615  v = (double)1/(double)n;
3616  for(i=0; i<=n-1; i++)
3617  {
3618  s = x->ptr.p_double[i];
3619  samex = samex&&ae_fp_eq(s,x0);
3620  xmean = xmean+s*v;
3621  s = y->ptr.p_double[i];
3622  samey = samey&&ae_fp_eq(s,y0);
3623  ymean = ymean+s*v;
3624  }
3625  if( samex||samey )
3626  {
3627  result = 0;
3628  return result;
3629  }
3630 
3631  /*
3632  * numerator and denominator
3633  */
3634  s = 0;
3635  xv = 0;
3636  yv = 0;
3637  for(i=0; i<=n-1; i++)
3638  {
3639  t1 = x->ptr.p_double[i]-xmean;
3640  t2 = y->ptr.p_double[i]-ymean;
3641  xv = xv+ae_sqr(t1, _state);
3642  yv = yv+ae_sqr(t2, _state);
3643  s = s+t1*t2;
3644  }
3645  if( ae_fp_eq(xv,0)||ae_fp_eq(yv,0) )
3646  {
3647  result = 0;
3648  }
3649  else
3650  {
3651  result = s/(ae_sqrt(xv, _state)*ae_sqrt(yv, _state));
3652  }
3653  return result;
3654 }
3655 
3656 
3657 /*************************************************************************
3658 Spearman's rank correlation coefficient
3659 
3660 Input parameters:
3661  X - sample 1 (array indexes: [0..N-1])
3662  Y - sample 2 (array indexes: [0..N-1])
3663  N - N>=0, sample size:
3664  * if given, only N leading elements of X/Y are processed
3665  * if not given, automatically determined from input sizes
3666 
3667 Result:
3668  Spearman's rank correlation coefficient
3669  (zero for N=0 or N=1)
3670 
3671  -- ALGLIB --
3672  Copyright 09.04.2007 by Bochkanov Sergey
3673 *************************************************************************/
3674 double spearmancorr2(/* Real */ ae_vector* x,
3675  /* Real */ ae_vector* y,
3676  ae_int_t n,
3677  ae_state *_state)
3678 {
3679  ae_frame _frame_block;
3680  ae_vector _x;
3681  ae_vector _y;
3682  apbuffers buf;
3683  double result;
3684 
3685  ae_frame_make(_state, &_frame_block);
3686  ae_vector_init_copy(&_x, x, _state, ae_true);
3687  x = &_x;
3688  ae_vector_init_copy(&_y, y, _state, ae_true);
3689  y = &_y;
3690  _apbuffers_init(&buf, _state, ae_true);
3691 
3692  ae_assert(n>=0, "SpearmanCorr2: N<0", _state);
3693  ae_assert(x->cnt>=n, "SpearmanCorr2: Length(X)<N!", _state);
3694  ae_assert(y->cnt>=n, "SpearmanCorr2: Length(Y)<N!", _state);
3695  ae_assert(isfinitevector(x, n, _state), "SpearmanCorr2: X is not finite vector", _state);
3696  ae_assert(isfinitevector(y, n, _state), "SpearmanCorr2: Y is not finite vector", _state);
3697 
3698  /*
3699  * Special case
3700  */
3701  if( n<=1 )
3702  {
3703  result = 0;
3704  ae_frame_leave(_state);
3705  return result;
3706  }
3707  rankx(x, n, ae_false, &buf, _state);
3708  rankx(y, n, ae_false, &buf, _state);
3709  result = pearsoncorr2(x, y, n, _state);
3710  ae_frame_leave(_state);
3711  return result;
3712 }
3713 
3714 
3715 /*************************************************************************
3716 Covariance matrix
3717 
3718 SMP EDITION OF ALGLIB:
3719 
3720  ! This function can utilize multicore capabilities of your system. In
3721  ! order to do this you have to call version with "smp_" prefix, which
3722  ! indicates that multicore code will be used.
3723  !
3724  ! This note is given for users of SMP edition; if you use GPL edition,
3725  ! or commercial edition of ALGLIB without SMP support, you still will
3726  ! be able to call smp-version of this function, but all computations
3727  ! will be done serially.
3728  !
3729  ! We recommend you to carefully read ALGLIB Reference Manual, section
3730  ! called 'SMP support', before using parallel version of this function.
3731  !
3732  ! You should remember that starting/stopping worker thread always have
3733  ! non-zero cost. Although multicore version is pretty efficient on
3734  ! large problems, we do not recommend you to use it on small problems -
3735  ! with covariance matrices smaller than 128*128.
3736 
3737 INPUT PARAMETERS:
3738  X - array[N,M], sample matrix:
3739  * J-th column corresponds to J-th variable
3740  * I-th row corresponds to I-th observation
3741  N - N>=0, number of observations:
3742  * if given, only leading N rows of X are used
3743  * if not given, automatically determined from input size
3744  M - M>0, number of variables:
3745  * if given, only leading M columns of X are used
3746  * if not given, automatically determined from input size
3747 
3748 OUTPUT PARAMETERS:
3749  C - array[M,M], covariance matrix (zero if N=0 or N=1)
3750 
3751  -- ALGLIB --
3752  Copyright 28.10.2010 by Bochkanov Sergey
3753 *************************************************************************/
3754 void covm(/* Real */ ae_matrix* x,
3755  ae_int_t n,
3756  ae_int_t m,
3757  /* Real */ ae_matrix* c,
3758  ae_state *_state)
3759 {
3760  ae_frame _frame_block;
3761  ae_matrix _x;
3762  ae_int_t i;
3763  ae_int_t j;
3764  double v;
3765  ae_vector t;
3766  ae_vector x0;
3767  ae_vector same;
3768 
3769  ae_frame_make(_state, &_frame_block);
3770  ae_matrix_init_copy(&_x, x, _state, ae_true);
3771  x = &_x;
3772  ae_matrix_clear(c);
3773  ae_vector_init(&t, 0, DT_REAL, _state, ae_true);
3774  ae_vector_init(&x0, 0, DT_REAL, _state, ae_true);
3775  ae_vector_init(&same, 0, DT_BOOL, _state, ae_true);
3776 
3777  ae_assert(n>=0, "CovM: N<0", _state);
3778  ae_assert(m>=1, "CovM: M<1", _state);
3779  ae_assert(x->rows>=n, "CovM: Rows(X)<N!", _state);
3780  ae_assert(x->cols>=m||n==0, "CovM: Cols(X)<M!", _state);
3781  ae_assert(apservisfinitematrix(x, n, m, _state), "CovM: X contains infinite/NAN elements", _state);
3782 
3783  /*
3784  * N<=1, return zero
3785  */
3786  if( n<=1 )
3787  {
3788  ae_matrix_set_length(c, m, m, _state);
3789  for(i=0; i<=m-1; i++)
3790  {
3791  for(j=0; j<=m-1; j++)
3792  {
3793  c->ptr.pp_double[i][j] = 0;
3794  }
3795  }
3796  ae_frame_leave(_state);
3797  return;
3798  }
3799 
3800  /*
3801  * Calculate means,
3802  * check for constant columns
3803  */
3804  ae_vector_set_length(&t, m, _state);
3805  ae_vector_set_length(&x0, m, _state);
3806  ae_vector_set_length(&same, m, _state);
3807  ae_matrix_set_length(c, m, m, _state);
3808  for(i=0; i<=m-1; i++)
3809  {
3810  t.ptr.p_double[i] = 0;
3811  same.ptr.p_bool[i] = ae_true;
3812  }
3813  ae_v_move(&x0.ptr.p_double[0], 1, &x->ptr.pp_double[0][0], 1, ae_v_len(0,m-1));
3814  v = (double)1/(double)n;
3815  for(i=0; i<=n-1; i++)
3816  {
3817  ae_v_addd(&t.ptr.p_double[0], 1, &x->ptr.pp_double[i][0], 1, ae_v_len(0,m-1), v);
3818  for(j=0; j<=m-1; j++)
3819  {
3820  same.ptr.p_bool[j] = same.ptr.p_bool[j]&&ae_fp_eq(x->ptr.pp_double[i][j],x0.ptr.p_double[j]);
3821  }
3822  }
3823 
3824  /*
3825  * * center variables;
3826  * * if we have constant columns, these columns are
3827  * artificially zeroed (they must be zero in exact arithmetics,
3828  * but unfortunately floating point ops are not exact).
3829  * * calculate upper half of symmetric covariance matrix
3830  */
3831  for(i=0; i<=n-1; i++)
3832  {
3833  ae_v_sub(&x->ptr.pp_double[i][0], 1, &t.ptr.p_double[0], 1, ae_v_len(0,m-1));
3834  for(j=0; j<=m-1; j++)
3835  {
3836  if( same.ptr.p_bool[j] )
3837  {
3838  x->ptr.pp_double[i][j] = 0;
3839  }
3840  }
3841  }
3842  rmatrixsyrk(m, n, (double)1/(double)(n-1), x, 0, 0, 1, 0.0, c, 0, 0, ae_true, _state);
3843  rmatrixenforcesymmetricity(c, m, ae_true, _state);
3844  ae_frame_leave(_state);
3845 }
3846 
3847 
3848 /*************************************************************************
3849 Single-threaded stub. HPC ALGLIB replaces it by multithreaded code.
3850 *************************************************************************/
3851 void _pexec_covm(/* Real */ ae_matrix* x,
3852  ae_int_t n,
3853  ae_int_t m,
3854  /* Real */ ae_matrix* c, ae_state *_state)
3855 {
3856  covm(x,n,m,c, _state);
3857 }
3858 
3859 
3860 /*************************************************************************
3861 Pearson product-moment correlation matrix
3862 
3863 SMP EDITION OF ALGLIB:
3864 
3865  ! This function can utilize multicore capabilities of your system. In
3866  ! order to do this you have to call version with "smp_" prefix, which
3867  ! indicates that multicore code will be used.
3868  !
3869  ! This note is given for users of SMP edition; if you use GPL edition,
3870  ! or commercial edition of ALGLIB without SMP support, you still will
3871  ! be able to call smp-version of this function, but all computations
3872  ! will be done serially.
3873  !
3874  ! We recommend you to carefully read ALGLIB Reference Manual, section
3875  ! called 'SMP support', before using parallel version of this function.
3876  !
3877  ! You should remember that starting/stopping worker thread always have
3878  ! non-zero cost. Although multicore version is pretty efficient on
3879  ! large problems, we do not recommend you to use it on small problems -
3880  ! with correlation matrices smaller than 128*128.
3881 
3882 INPUT PARAMETERS:
3883  X - array[N,M], sample matrix:
3884  * J-th column corresponds to J-th variable
3885  * I-th row corresponds to I-th observation
3886  N - N>=0, number of observations:
3887  * if given, only leading N rows of X are used
3888  * if not given, automatically determined from input size
3889  M - M>0, number of variables:
3890  * if given, only leading M columns of X are used
3891  * if not given, automatically determined from input size
3892 
3893 OUTPUT PARAMETERS:
3894  C - array[M,M], correlation matrix (zero if N=0 or N=1)
3895 
3896  -- ALGLIB --
3897  Copyright 28.10.2010 by Bochkanov Sergey
3898 *************************************************************************/
3899 void pearsoncorrm(/* Real */ ae_matrix* x,
3900  ae_int_t n,
3901  ae_int_t m,
3902  /* Real */ ae_matrix* c,
3903  ae_state *_state)
3904 {
3905  ae_frame _frame_block;
3906  ae_vector t;
3907  ae_int_t i;
3908  ae_int_t j;
3909  double v;
3910 
3911  ae_frame_make(_state, &_frame_block);
3912  ae_matrix_clear(c);
3913  ae_vector_init(&t, 0, DT_REAL, _state, ae_true);
3914 
3915  ae_assert(n>=0, "PearsonCorrM: N<0", _state);
3916  ae_assert(m>=1, "PearsonCorrM: M<1", _state);
3917  ae_assert(x->rows>=n, "PearsonCorrM: Rows(X)<N!", _state);
3918  ae_assert(x->cols>=m||n==0, "PearsonCorrM: Cols(X)<M!", _state);
3919  ae_assert(apservisfinitematrix(x, n, m, _state), "PearsonCorrM: X contains infinite/NAN elements", _state);
3920  ae_vector_set_length(&t, m, _state);
3921  covm(x, n, m, c, _state);
3922  for(i=0; i<=m-1; i++)
3923  {
3924  if( ae_fp_greater(c->ptr.pp_double[i][i],0) )
3925  {
3926  t.ptr.p_double[i] = 1/ae_sqrt(c->ptr.pp_double[i][i], _state);
3927  }
3928  else
3929  {
3930  t.ptr.p_double[i] = 0.0;
3931  }
3932  }
3933  for(i=0; i<=m-1; i++)
3934  {
3935  v = t.ptr.p_double[i];
3936  for(j=0; j<=m-1; j++)
3937  {
3938  c->ptr.pp_double[i][j] = c->ptr.pp_double[i][j]*v*t.ptr.p_double[j];
3939  }
3940  }
3941  ae_frame_leave(_state);
3942 }
3943 
3944 
3945 /*************************************************************************
3946 Single-threaded stub. HPC ALGLIB replaces it by multithreaded code.
3947 *************************************************************************/
3948 void _pexec_pearsoncorrm(/* Real */ ae_matrix* x,
3949  ae_int_t n,
3950  ae_int_t m,
3951  /* Real */ ae_matrix* c, ae_state *_state)
3952 {
3953  pearsoncorrm(x,n,m,c, _state);
3954 }
3955 
3956 
3957 /*************************************************************************
3958 Spearman's rank correlation matrix
3959 
3960 SMP EDITION OF ALGLIB:
3961 
3962  ! This function can utilize multicore capabilities of your system. In
3963  ! order to do this you have to call version with "smp_" prefix, which
3964  ! indicates that multicore code will be used.
3965  !
3966  ! This note is given for users of SMP edition; if you use GPL edition,
3967  ! or commercial edition of ALGLIB without SMP support, you still will
3968  ! be able to call smp-version of this function, but all computations
3969  ! will be done serially.
3970  !
3971  ! We recommend you to carefully read ALGLIB Reference Manual, section
3972  ! called 'SMP support', before using parallel version of this function.
3973  !
3974  ! You should remember that starting/stopping worker thread always have
3975  ! non-zero cost. Although multicore version is pretty efficient on
3976  ! large problems, we do not recommend you to use it on small problems -
3977  ! with correlation matrices smaller than 128*128.
3978 
3979 INPUT PARAMETERS:
3980  X - array[N,M], sample matrix:
3981  * J-th column corresponds to J-th variable
3982  * I-th row corresponds to I-th observation
3983  N - N>=0, number of observations:
3984  * if given, only leading N rows of X are used
3985  * if not given, automatically determined from input size
3986  M - M>0, number of variables:
3987  * if given, only leading M columns of X are used
3988  * if not given, automatically determined from input size
3989 
3990 OUTPUT PARAMETERS:
3991  C - array[M,M], correlation matrix (zero if N=0 or N=1)
3992 
3993  -- ALGLIB --
3994  Copyright 28.10.2010 by Bochkanov Sergey
3995 *************************************************************************/
3996 void spearmancorrm(/* Real */ ae_matrix* x,
3997  ae_int_t n,
3998  ae_int_t m,
3999  /* Real */ ae_matrix* c,
4000  ae_state *_state)
4001 {
4002  ae_frame _frame_block;
4003  ae_int_t i;
4004  ae_int_t j;
4005  apbuffers buf;
4006  ae_matrix xc;
4007  ae_vector t;
4008  double v;
4009  double vv;
4010  double x0;
4011  ae_bool b;
4012 
4013  ae_frame_make(_state, &_frame_block);
4014  ae_matrix_clear(c);
4015  _apbuffers_init(&buf, _state, ae_true);
4016  ae_matrix_init(&xc, 0, 0, DT_REAL, _state, ae_true);
4017  ae_vector_init(&t, 0, DT_REAL, _state, ae_true);
4018 
4019  ae_assert(n>=0, "SpearmanCorrM: N<0", _state);
4020  ae_assert(m>=1, "SpearmanCorrM: M<1", _state);
4021  ae_assert(x->rows>=n, "SpearmanCorrM: Rows(X)<N!", _state);
4022  ae_assert(x->cols>=m||n==0, "SpearmanCorrM: Cols(X)<M!", _state);
4023  ae_assert(apservisfinitematrix(x, n, m, _state), "SpearmanCorrM: X contains infinite/NAN elements", _state);
4024 
4025  /*
4026  * N<=1, return zero
4027  */
4028  if( n<=1 )
4029  {
4030  ae_matrix_set_length(c, m, m, _state);
4031  for(i=0; i<=m-1; i++)
4032  {
4033  for(j=0; j<=m-1; j++)
4034  {
4035  c->ptr.pp_double[i][j] = 0;
4036  }
4037  }
4038  ae_frame_leave(_state);
4039  return;
4040  }
4041 
4042  /*
4043  * Allocate
4044  */
4045  ae_vector_set_length(&t, ae_maxint(n, m, _state), _state);
4046  ae_matrix_set_length(c, m, m, _state);
4047 
4048  /*
4049  * Replace data with ranks
4050  */
4051  ae_matrix_set_length(&xc, m, n, _state);
4052  rmatrixtranspose(n, m, x, 0, 0, &xc, 0, 0, _state);
4053  rankdata(&xc, m, n, _state);
4054 
4055  /*
4056  * 1. Calculate means, check for constant columns
4057  * 2. Center variables, constant columns are
4058  * artificialy zeroed (they must be zero in exact arithmetics,
4059  * but unfortunately floating point is not exact).
4060  */
4061  for(i=0; i<=m-1; i++)
4062  {
4063 
4064  /*
4065  * Calculate:
4066  * * V - mean value of I-th variable
4067  * * B - True in case all variable values are same
4068  */
4069  v = 0;
4070  b = ae_true;
4071  x0 = xc.ptr.pp_double[i][0];
4072  for(j=0; j<=n-1; j++)
4073  {
4074  vv = xc.ptr.pp_double[i][j];
4075  v = v+vv;
4076  b = b&&ae_fp_eq(vv,x0);
4077  }
4078  v = v/n;
4079 
4080  /*
4081  * Center/zero I-th variable
4082  */
4083  if( b )
4084  {
4085 
4086  /*
4087  * Zero
4088  */
4089  for(j=0; j<=n-1; j++)
4090  {
4091  xc.ptr.pp_double[i][j] = 0.0;
4092  }
4093  }
4094  else
4095  {
4096 
4097  /*
4098  * Center
4099  */
4100  for(j=0; j<=n-1; j++)
4101  {
4102  xc.ptr.pp_double[i][j] = xc.ptr.pp_double[i][j]-v;
4103  }
4104  }
4105  }
4106 
4107  /*
4108  * Calculate upper half of symmetric covariance matrix
4109  */
4110  rmatrixsyrk(m, n, (double)1/(double)(n-1), &xc, 0, 0, 0, 0.0, c, 0, 0, ae_true, _state);
4111 
4112  /*
4113  * Calculate Pearson coefficients (upper triangle)
4114  */
4115  for(i=0; i<=m-1; i++)
4116  {
4117  if( ae_fp_greater(c->ptr.pp_double[i][i],0) )
4118  {
4119  t.ptr.p_double[i] = 1/ae_sqrt(c->ptr.pp_double[i][i], _state);
4120  }
4121  else
4122  {
4123  t.ptr.p_double[i] = 0.0;
4124  }
4125  }
4126  for(i=0; i<=m-1; i++)
4127  {
4128  v = t.ptr.p_double[i];
4129  for(j=i; j<=m-1; j++)
4130  {
4131  c->ptr.pp_double[i][j] = c->ptr.pp_double[i][j]*v*t.ptr.p_double[j];
4132  }
4133  }
4134 
4135  /*
4136  * force symmetricity
4137  */
4138  rmatrixenforcesymmetricity(c, m, ae_true, _state);
4139  ae_frame_leave(_state);
4140 }
4141 
4142 
4143 /*************************************************************************
4144 Single-threaded stub. HPC ALGLIB replaces it by multithreaded code.
4145 *************************************************************************/
4146 void _pexec_spearmancorrm(/* Real */ ae_matrix* x,
4147  ae_int_t n,
4148  ae_int_t m,
4149  /* Real */ ae_matrix* c, ae_state *_state)
4150 {
4151  spearmancorrm(x,n,m,c, _state);
4152 }
4153 
4154 
4155 /*************************************************************************
4156 Cross-covariance matrix
4157 
4158 SMP EDITION OF ALGLIB:
4159 
4160  ! This function can utilize multicore capabilities of your system. In
4161  ! order to do this you have to call version with "smp_" prefix, which
4162  ! indicates that multicore code will be used.
4163  !
4164  ! This note is given for users of SMP edition; if you use GPL edition,
4165  ! or commercial edition of ALGLIB without SMP support, you still will
4166  ! be able to call smp-version of this function, but all computations
4167  ! will be done serially.
4168  !
4169  ! We recommend you to carefully read ALGLIB Reference Manual, section
4170  ! called 'SMP support', before using parallel version of this function.
4171  !
4172  ! You should remember that starting/stopping worker thread always have
4173  ! non-zero cost. Although multicore version is pretty efficient on
4174  ! large problems, we do not recommend you to use it on small problems -
4175  ! with covariance matrices smaller than 128*128.
4176 
4177 INPUT PARAMETERS:
4178  X - array[N,M1], sample matrix:
4179  * J-th column corresponds to J-th variable
4180  * I-th row corresponds to I-th observation
4181  Y - array[N,M2], sample matrix:
4182  * J-th column corresponds to J-th variable
4183  * I-th row corresponds to I-th observation
4184  N - N>=0, number of observations:
4185  * if given, only leading N rows of X/Y are used
4186  * if not given, automatically determined from input sizes
4187  M1 - M1>0, number of variables in X:
4188  * if given, only leading M1 columns of X are used
4189  * if not given, automatically determined from input size
4190  M2 - M2>0, number of variables in Y:
4191  * if given, only leading M1 columns of X are used
4192  * if not given, automatically determined from input size
4193 
4194 OUTPUT PARAMETERS:
4195  C - array[M1,M2], cross-covariance matrix (zero if N=0 or N=1)
4196 
4197  -- ALGLIB --
4198  Copyright 28.10.2010 by Bochkanov Sergey
4199 *************************************************************************/
4200 void covm2(/* Real */ ae_matrix* x,
4201  /* Real */ ae_matrix* y,
4202  ae_int_t n,
4203  ae_int_t m1,
4204  ae_int_t m2,
4205  /* Real */ ae_matrix* c,
4206  ae_state *_state)
4207 {
4208  ae_frame _frame_block;
4209  ae_matrix _x;
4210  ae_matrix _y;
4211  ae_int_t i;
4212  ae_int_t j;
4213  double v;
4214  ae_vector t;
4215  ae_vector x0;
4216  ae_vector y0;
4217  ae_vector samex;
4218  ae_vector samey;
4219 
4220  ae_frame_make(_state, &_frame_block);
4221  ae_matrix_init_copy(&_x, x, _state, ae_true);
4222  x = &_x;
4223  ae_matrix_init_copy(&_y, y, _state, ae_true);
4224  y = &_y;
4225  ae_matrix_clear(c);
4226  ae_vector_init(&t, 0, DT_REAL, _state, ae_true);
4227  ae_vector_init(&x0, 0, DT_REAL, _state, ae_true);
4228  ae_vector_init(&y0, 0, DT_REAL, _state, ae_true);
4229  ae_vector_init(&samex, 0, DT_BOOL, _state, ae_true);
4230  ae_vector_init(&samey, 0, DT_BOOL, _state, ae_true);
4231 
4232  ae_assert(n>=0, "CovM2: N<0", _state);
4233  ae_assert(m1>=1, "CovM2: M1<1", _state);
4234  ae_assert(m2>=1, "CovM2: M2<1", _state);
4235  ae_assert(x->rows>=n, "CovM2: Rows(X)<N!", _state);
4236  ae_assert(x->cols>=m1||n==0, "CovM2: Cols(X)<M1!", _state);
4237  ae_assert(apservisfinitematrix(x, n, m1, _state), "CovM2: X contains infinite/NAN elements", _state);
4238  ae_assert(y->rows>=n, "CovM2: Rows(Y)<N!", _state);
4239  ae_assert(y->cols>=m2||n==0, "CovM2: Cols(Y)<M2!", _state);
4240  ae_assert(apservisfinitematrix(y, n, m2, _state), "CovM2: X contains infinite/NAN elements", _state);
4241 
4242  /*
4243  * N<=1, return zero
4244  */
4245  if( n<=1 )
4246  {
4247  ae_matrix_set_length(c, m1, m2, _state);
4248  for(i=0; i<=m1-1; i++)
4249  {
4250  for(j=0; j<=m2-1; j++)
4251  {
4252  c->ptr.pp_double[i][j] = 0;
4253  }
4254  }
4255  ae_frame_leave(_state);
4256  return;
4257  }
4258 
4259  /*
4260  * Allocate
4261  */
4262  ae_vector_set_length(&t, ae_maxint(m1, m2, _state), _state);
4263  ae_vector_set_length(&x0, m1, _state);
4264  ae_vector_set_length(&y0, m2, _state);
4265  ae_vector_set_length(&samex, m1, _state);
4266  ae_vector_set_length(&samey, m2, _state);
4267  ae_matrix_set_length(c, m1, m2, _state);
4268 
4269  /*
4270  * * calculate means of X
4271  * * center X
4272  * * if we have constant columns, these columns are
4273  * artificially zeroed (they must be zero in exact arithmetics,
4274  * but unfortunately floating point ops are not exact).
4275  */
4276  for(i=0; i<=m1-1; i++)
4277  {
4278  t.ptr.p_double[i] = 0;
4279  samex.ptr.p_bool[i] = ae_true;
4280  }
4281  ae_v_move(&x0.ptr.p_double[0], 1, &x->ptr.pp_double[0][0], 1, ae_v_len(0,m1-1));
4282  v = (double)1/(double)n;
4283  for(i=0; i<=n-1; i++)
4284  {
4285  ae_v_addd(&t.ptr.p_double[0], 1, &x->ptr.pp_double[i][0], 1, ae_v_len(0,m1-1), v);
4286  for(j=0; j<=m1-1; j++)
4287  {
4288  samex.ptr.p_bool[j] = samex.ptr.p_bool[j]&&ae_fp_eq(x->ptr.pp_double[i][j],x0.ptr.p_double[j]);
4289  }
4290  }
4291  for(i=0; i<=n-1; i++)
4292  {
4293  ae_v_sub(&x->ptr.pp_double[i][0], 1, &t.ptr.p_double[0], 1, ae_v_len(0,m1-1));
4294  for(j=0; j<=m1-1; j++)
4295  {
4296  if( samex.ptr.p_bool[j] )
4297  {
4298  x->ptr.pp_double[i][j] = 0;
4299  }
4300  }
4301  }
4302 
4303  /*
4304  * Repeat same steps for Y
4305  */
4306  for(i=0; i<=m2-1; i++)
4307  {
4308  t.ptr.p_double[i] = 0;
4309  samey.ptr.p_bool[i] = ae_true;
4310  }
4311  ae_v_move(&y0.ptr.p_double[0], 1, &y->ptr.pp_double[0][0], 1, ae_v_len(0,m2-1));
4312  v = (double)1/(double)n;
4313  for(i=0; i<=n-1; i++)
4314  {
4315  ae_v_addd(&t.ptr.p_double[0], 1, &y->ptr.pp_double[i][0], 1, ae_v_len(0,m2-1), v);
4316  for(j=0; j<=m2-1; j++)
4317  {
4318  samey.ptr.p_bool[j] = samey.ptr.p_bool[j]&&ae_fp_eq(y->ptr.pp_double[i][j],y0.ptr.p_double[j]);
4319  }
4320  }
4321  for(i=0; i<=n-1; i++)
4322  {
4323  ae_v_sub(&y->ptr.pp_double[i][0], 1, &t.ptr.p_double[0], 1, ae_v_len(0,m2-1));
4324  for(j=0; j<=m2-1; j++)
4325  {
4326  if( samey.ptr.p_bool[j] )
4327  {
4328  y->ptr.pp_double[i][j] = 0;
4329  }
4330  }
4331  }
4332 
4333  /*
4334  * calculate cross-covariance matrix
4335  */
4336  rmatrixgemm(m1, m2, n, (double)1/(double)(n-1), x, 0, 0, 1, y, 0, 0, 0, 0.0, c, 0, 0, _state);
4337  ae_frame_leave(_state);
4338 }
4339 
4340 
4341 /*************************************************************************
4342 Single-threaded stub. HPC ALGLIB replaces it by multithreaded code.
4343 *************************************************************************/
4344 void _pexec_covm2(/* Real */ ae_matrix* x,
4345  /* Real */ ae_matrix* y,
4346  ae_int_t n,
4347  ae_int_t m1,
4348  ae_int_t m2,
4349  /* Real */ ae_matrix* c, ae_state *_state)
4350 {
4351  covm2(x,y,n,m1,m2,c, _state);
4352 }
4353 
4354 
4355 /*************************************************************************
4356 Pearson product-moment cross-correlation matrix
4357 
4358 SMP EDITION OF ALGLIB:
4359 
4360  ! This function can utilize multicore capabilities of your system. In
4361  ! order to do this you have to call version with "smp_" prefix, which
4362  ! indicates that multicore code will be used.
4363  !
4364  ! This note is given for users of SMP edition; if you use GPL edition,
4365  ! or commercial edition of ALGLIB without SMP support, you still will
4366  ! be able to call smp-version of this function, but all computations
4367  ! will be done serially.
4368  !
4369  ! We recommend you to carefully read ALGLIB Reference Manual, section
4370  ! called 'SMP support', before using parallel version of this function.
4371  !
4372  ! You should remember that starting/stopping worker thread always have
4373  ! non-zero cost. Although multicore version is pretty efficient on
4374  ! large problems, we do not recommend you to use it on small problems -
4375  ! with correlation matrices smaller than 128*128.
4376 
4377 INPUT PARAMETERS:
4378  X - array[N,M1], sample matrix:
4379  * J-th column corresponds to J-th variable
4380  * I-th row corresponds to I-th observation
4381  Y - array[N,M2], sample matrix:
4382  * J-th column corresponds to J-th variable
4383  * I-th row corresponds to I-th observation
4384  N - N>=0, number of observations:
4385  * if given, only leading N rows of X/Y are used
4386  * if not given, automatically determined from input sizes
4387  M1 - M1>0, number of variables in X:
4388  * if given, only leading M1 columns of X are used
4389  * if not given, automatically determined from input size
4390  M2 - M2>0, number of variables in Y:
4391  * if given, only leading M1 columns of X are used
4392  * if not given, automatically determined from input size
4393 
4394 OUTPUT PARAMETERS:
4395  C - array[M1,M2], cross-correlation matrix (zero if N=0 or N=1)
4396 
4397  -- ALGLIB --
4398  Copyright 28.10.2010 by Bochkanov Sergey
4399 *************************************************************************/
4400 void pearsoncorrm2(/* Real */ ae_matrix* x,
4401  /* Real */ ae_matrix* y,
4402  ae_int_t n,
4403  ae_int_t m1,
4404  ae_int_t m2,
4405  /* Real */ ae_matrix* c,
4406  ae_state *_state)
4407 {
4408  ae_frame _frame_block;
4409  ae_matrix _x;
4410  ae_matrix _y;
4411  ae_int_t i;
4412  ae_int_t j;
4413  double v;
4414  ae_vector t;
4415  ae_vector x0;
4416  ae_vector y0;
4417  ae_vector sx;
4418  ae_vector sy;
4419  ae_vector samex;
4420  ae_vector samey;
4421 
4422  ae_frame_make(_state, &_frame_block);
4423  ae_matrix_init_copy(&_x, x, _state, ae_true);
4424  x = &_x;
4425  ae_matrix_init_copy(&_y, y, _state, ae_true);
4426  y = &_y;
4427  ae_matrix_clear(c);
4428  ae_vector_init(&t, 0, DT_REAL, _state, ae_true);
4429  ae_vector_init(&x0, 0, DT_REAL, _state, ae_true);
4430  ae_vector_init(&y0, 0, DT_REAL, _state, ae_true);
4431  ae_vector_init(&sx, 0, DT_REAL, _state, ae_true);
4432  ae_vector_init(&sy, 0, DT_REAL, _state, ae_true);
4433  ae_vector_init(&samex, 0, DT_BOOL, _state, ae_true);
4434  ae_vector_init(&samey, 0, DT_BOOL, _state, ae_true);
4435 
4436  ae_assert(n>=0, "PearsonCorrM2: N<0", _state);
4437  ae_assert(m1>=1, "PearsonCorrM2: M1<1", _state);
4438  ae_assert(m2>=1, "PearsonCorrM2: M2<1", _state);
4439  ae_assert(x->rows>=n, "PearsonCorrM2: Rows(X)<N!", _state);
4440  ae_assert(x->cols>=m1||n==0, "PearsonCorrM2: Cols(X)<M1!", _state);
4441  ae_assert(apservisfinitematrix(x, n, m1, _state), "PearsonCorrM2: X contains infinite/NAN elements", _state);
4442  ae_assert(y->rows>=n, "PearsonCorrM2: Rows(Y)<N!", _state);
4443  ae_assert(y->cols>=m2||n==0, "PearsonCorrM2: Cols(Y)<M2!", _state);
4444  ae_assert(apservisfinitematrix(y, n, m2, _state), "PearsonCorrM2: X contains infinite/NAN elements", _state);
4445 
4446  /*
4447  * N<=1, return zero
4448  */
4449  if( n<=1 )
4450  {
4451  ae_matrix_set_length(c, m1, m2, _state);
4452  for(i=0; i<=m1-1; i++)
4453  {
4454  for(j=0; j<=m2-1; j++)
4455  {
4456  c->ptr.pp_double[i][j] = 0;
4457  }
4458  }
4459  ae_frame_leave(_state);
4460  return;
4461  }
4462 
4463  /*
4464  * Allocate
4465  */
4466  ae_vector_set_length(&t, ae_maxint(m1, m2, _state), _state);
4467  ae_vector_set_length(&x0, m1, _state);
4468  ae_vector_set_length(&y0, m2, _state);
4469  ae_vector_set_length(&sx, m1, _state);
4470  ae_vector_set_length(&sy, m2, _state);
4471  ae_vector_set_length(&samex, m1, _state);
4472  ae_vector_set_length(&samey, m2, _state);
4473  ae_matrix_set_length(c, m1, m2, _state);
4474 
4475  /*
4476  * * calculate means of X
4477  * * center X
4478  * * if we have constant columns, these columns are
4479  * artificially zeroed (they must be zero in exact arithmetics,
4480  * but unfortunately floating point ops are not exact).
4481  * * calculate column variances
4482  */
4483  for(i=0; i<=m1-1; i++)
4484  {
4485  t.ptr.p_double[i] = 0;
4486  samex.ptr.p_bool[i] = ae_true;
4487  sx.ptr.p_double[i] = 0;
4488  }
4489  ae_v_move(&x0.ptr.p_double[0], 1, &x->ptr.pp_double[0][0], 1, ae_v_len(0,m1-1));
4490  v = (double)1/(double)n;
4491  for(i=0; i<=n-1; i++)
4492  {
4493  ae_v_addd(&t.ptr.p_double[0], 1, &x->ptr.pp_double[i][0], 1, ae_v_len(0,m1-1), v);
4494  for(j=0; j<=m1-1; j++)
4495  {
4496  samex.ptr.p_bool[j] = samex.ptr.p_bool[j]&&ae_fp_eq(x->ptr.pp_double[i][j],x0.ptr.p_double[j]);
4497  }
4498  }
4499  for(i=0; i<=n-1; i++)
4500  {
4501  ae_v_sub(&x->ptr.pp_double[i][0], 1, &t.ptr.p_double[0], 1, ae_v_len(0,m1-1));
4502  for(j=0; j<=m1-1; j++)
4503  {
4504  if( samex.ptr.p_bool[j] )
4505  {
4506  x->ptr.pp_double[i][j] = 0;
4507  }
4508  sx.ptr.p_double[j] = sx.ptr.p_double[j]+x->ptr.pp_double[i][j]*x->ptr.pp_double[i][j];
4509  }
4510  }
4511  for(j=0; j<=m1-1; j++)
4512  {
4513  sx.ptr.p_double[j] = ae_sqrt(sx.ptr.p_double[j]/(n-1), _state);
4514  }
4515 
4516  /*
4517  * Repeat same steps for Y
4518  */
4519  for(i=0; i<=m2-1; i++)
4520  {
4521  t.ptr.p_double[i] = 0;
4522  samey.ptr.p_bool[i] = ae_true;
4523  sy.ptr.p_double[i] = 0;
4524  }
4525  ae_v_move(&y0.ptr.p_double[0], 1, &y->ptr.pp_double[0][0], 1, ae_v_len(0,m2-1));
4526  v = (double)1/(double)n;
4527  for(i=0; i<=n-1; i++)
4528  {
4529  ae_v_addd(&t.ptr.p_double[0], 1, &y->ptr.pp_double[i][0], 1, ae_v_len(0,m2-1), v);
4530  for(j=0; j<=m2-1; j++)
4531  {
4532  samey.ptr.p_bool[j] = samey.ptr.p_bool[j]&&ae_fp_eq(y->ptr.pp_double[i][j],y0.ptr.p_double[j]);
4533  }
4534  }
4535  for(i=0; i<=n-1; i++)
4536  {
4537  ae_v_sub(&y->ptr.pp_double[i][0], 1, &t.ptr.p_double[0], 1, ae_v_len(0,m2-1));
4538  for(j=0; j<=m2-1; j++)
4539  {
4540  if( samey.ptr.p_bool[j] )
4541  {
4542  y->ptr.pp_double[i][j] = 0;
4543  }
4544  sy.ptr.p_double[j] = sy.ptr.p_double[j]+y->ptr.pp_double[i][j]*y->ptr.pp_double[i][j];
4545  }
4546  }
4547  for(j=0; j<=m2-1; j++)
4548  {
4549  sy.ptr.p_double[j] = ae_sqrt(sy.ptr.p_double[j]/(n-1), _state);
4550  }
4551 
4552  /*
4553  * calculate cross-covariance matrix
4554  */
4555  rmatrixgemm(m1, m2, n, (double)1/(double)(n-1), x, 0, 0, 1, y, 0, 0, 0, 0.0, c, 0, 0, _state);
4556 
4557  /*
4558  * Divide by standard deviations
4559  */
4560  for(i=0; i<=m1-1; i++)
4561  {
4562  if( ae_fp_neq(sx.ptr.p_double[i],0) )
4563  {
4564  sx.ptr.p_double[i] = 1/sx.ptr.p_double[i];
4565  }
4566  else
4567  {
4568  sx.ptr.p_double[i] = 0.0;
4569  }
4570  }
4571  for(i=0; i<=m2-1; i++)
4572  {
4573  if( ae_fp_neq(sy.ptr.p_double[i],0) )
4574  {
4575  sy.ptr.p_double[i] = 1/sy.ptr.p_double[i];
4576  }
4577  else
4578  {
4579  sy.ptr.p_double[i] = 0.0;
4580  }
4581  }
4582  for(i=0; i<=m1-1; i++)
4583  {
4584  v = sx.ptr.p_double[i];
4585  for(j=0; j<=m2-1; j++)
4586  {
4587  c->ptr.pp_double[i][j] = c->ptr.pp_double[i][j]*v*sy.ptr.p_double[j];
4588  }
4589  }
4590  ae_frame_leave(_state);
4591 }
4592 
4593 
4594 /*************************************************************************
4595 Single-threaded stub. HPC ALGLIB replaces it by multithreaded code.
4596 *************************************************************************/
4597 void _pexec_pearsoncorrm2(/* Real */ ae_matrix* x,
4598  /* Real */ ae_matrix* y,
4599  ae_int_t n,
4600  ae_int_t m1,
4601  ae_int_t m2,
4602  /* Real */ ae_matrix* c, ae_state *_state)
4603 {
4604  pearsoncorrm2(x,y,n,m1,m2,c, _state);
4605 }
4606 
4607 
4608 /*************************************************************************
4609 Spearman's rank cross-correlation matrix
4610 
4611 SMP EDITION OF ALGLIB:
4612 
4613  ! This function can utilize multicore capabilities of your system. In
4614  ! order to do this you have to call version with "smp_" prefix, which
4615  ! indicates that multicore code will be used.
4616  !
4617  ! This note is given for users of SMP edition; if you use GPL edition,
4618  ! or commercial edition of ALGLIB without SMP support, you still will
4619  ! be able to call smp-version of this function, but all computations
4620  ! will be done serially.
4621  !
4622  ! We recommend you to carefully read ALGLIB Reference Manual, section
4623  ! called 'SMP support', before using parallel version of this function.
4624  !
4625  ! You should remember that starting/stopping worker thread always have
4626  ! non-zero cost. Although multicore version is pretty efficient on
4627  ! large problems, we do not recommend you to use it on small problems -
4628  ! with correlation matrices smaller than 128*128.
4629 
4630 INPUT PARAMETERS:
4631  X - array[N,M1], sample matrix:
4632  * J-th column corresponds to J-th variable
4633  * I-th row corresponds to I-th observation
4634  Y - array[N,M2], sample matrix:
4635  * J-th column corresponds to J-th variable
4636  * I-th row corresponds to I-th observation
4637  N - N>=0, number of observations:
4638  * if given, only leading N rows of X/Y are used
4639  * if not given, automatically determined from input sizes
4640  M1 - M1>0, number of variables in X:
4641  * if given, only leading M1 columns of X are used
4642  * if not given, automatically determined from input size
4643  M2 - M2>0, number of variables in Y:
4644  * if given, only leading M1 columns of X are used
4645  * if not given, automatically determined from input size
4646 
4647 OUTPUT PARAMETERS:
4648  C - array[M1,M2], cross-correlation matrix (zero if N=0 or N=1)
4649 
4650  -- ALGLIB --
4651  Copyright 28.10.2010 by Bochkanov Sergey
4652 *************************************************************************/
4653 void spearmancorrm2(/* Real */ ae_matrix* x,
4654  /* Real */ ae_matrix* y,
4655  ae_int_t n,
4656  ae_int_t m1,
4657  ae_int_t m2,
4658  /* Real */ ae_matrix* c,
4659  ae_state *_state)
4660 {
4661  ae_frame _frame_block;
4662  ae_int_t i;
4663  ae_int_t j;
4664  double v;
4665  double v2;
4666  double vv;
4667  ae_bool b;
4668  ae_vector t;
4669  double x0;
4670  double y0;
4671  ae_vector sx;
4672  ae_vector sy;
4673  ae_matrix xc;
4674  ae_matrix yc;
4675  apbuffers buf;
4676 
4677  ae_frame_make(_state, &_frame_block);
4678  ae_matrix_clear(c);
4679  ae_vector_init(&t, 0, DT_REAL, _state, ae_true);
4680  ae_vector_init(&sx, 0, DT_REAL, _state, ae_true);
4681  ae_vector_init(&sy, 0, DT_REAL, _state, ae_true);
4682  ae_matrix_init(&xc, 0, 0, DT_REAL, _state, ae_true);
4683  ae_matrix_init(&yc, 0, 0, DT_REAL, _state, ae_true);
4684  _apbuffers_init(&buf, _state, ae_true);
4685 
4686  ae_assert(n>=0, "SpearmanCorrM2: N<0", _state);
4687  ae_assert(m1>=1, "SpearmanCorrM2: M1<1", _state);
4688  ae_assert(m2>=1, "SpearmanCorrM2: M2<1", _state);
4689  ae_assert(x->rows>=n, "SpearmanCorrM2: Rows(X)<N!", _state);
4690  ae_assert(x->cols>=m1||n==0, "SpearmanCorrM2: Cols(X)<M1!", _state);
4691  ae_assert(apservisfinitematrix(x, n, m1, _state), "SpearmanCorrM2: X contains infinite/NAN elements", _state);
4692  ae_assert(y->rows>=n, "SpearmanCorrM2: Rows(Y)<N!", _state);
4693  ae_assert(y->cols>=m2||n==0, "SpearmanCorrM2: Cols(Y)<M2!", _state);
4694  ae_assert(apservisfinitematrix(y, n, m2, _state), "SpearmanCorrM2: X contains infinite/NAN elements", _state);
4695 
4696  /*
4697  * N<=1, return zero
4698  */
4699  if( n<=1 )
4700  {
4701  ae_matrix_set_length(c, m1, m2, _state);
4702  for(i=0; i<=m1-1; i++)
4703  {
4704  for(j=0; j<=m2-1; j++)
4705  {
4706  c->ptr.pp_double[i][j] = 0;
4707  }
4708  }
4709  ae_frame_leave(_state);
4710  return;
4711  }
4712 
4713  /*
4714  * Allocate
4715  */
4716  ae_vector_set_length(&t, ae_maxint(ae_maxint(m1, m2, _state), n, _state), _state);
4717  ae_vector_set_length(&sx, m1, _state);
4718  ae_vector_set_length(&sy, m2, _state);
4719  ae_matrix_set_length(c, m1, m2, _state);
4720 
4721  /*
4722  * Replace data with ranks
4723  */
4724  ae_matrix_set_length(&xc, m1, n, _state);
4725  ae_matrix_set_length(&yc, m2, n, _state);
4726  rmatrixtranspose(n, m1, x, 0, 0, &xc, 0, 0, _state);
4727  rmatrixtranspose(n, m2, y, 0, 0, &yc, 0, 0, _state);
4728  rankdata(&xc, m1, n, _state);
4729  rankdata(&yc, m2, n, _state);
4730 
4731  /*
4732  * 1. Calculate means, variances, check for constant columns
4733  * 2. Center variables, constant columns are
4734  * artificialy zeroed (they must be zero in exact arithmetics,
4735  * but unfortunately floating point is not exact).
4736  *
4737  * Description of variables:
4738  * * V - mean value of I-th variable
4739  * * V2- variance
4740  * * VV-temporary
4741  * * B - True in case all variable values are same
4742  */
4743  for(i=0; i<=m1-1; i++)
4744  {
4745  v = 0;
4746  v2 = 0.0;
4747  b = ae_true;
4748  x0 = xc.ptr.pp_double[i][0];
4749  for(j=0; j<=n-1; j++)
4750  {
4751  vv = xc.ptr.pp_double[i][j];
4752  v = v+vv;
4753  b = b&&ae_fp_eq(vv,x0);
4754  }
4755  v = v/n;
4756  if( b )
4757  {
4758  for(j=0; j<=n-1; j++)
4759  {
4760  xc.ptr.pp_double[i][j] = 0.0;
4761  }
4762  }
4763  else
4764  {
4765  for(j=0; j<=n-1; j++)
4766  {
4767  vv = xc.ptr.pp_double[i][j];
4768  xc.ptr.pp_double[i][j] = vv-v;
4769  v2 = v2+(vv-v)*(vv-v);
4770  }
4771  }
4772  sx.ptr.p_double[i] = ae_sqrt(v2/(n-1), _state);
4773  }
4774  for(i=0; i<=m2-1; i++)
4775  {
4776  v = 0;
4777  v2 = 0.0;
4778  b = ae_true;
4779  y0 = yc.ptr.pp_double[i][0];
4780  for(j=0; j<=n-1; j++)
4781  {
4782  vv = yc.ptr.pp_double[i][j];
4783  v = v+vv;
4784  b = b&&ae_fp_eq(vv,y0);
4785  }
4786  v = v/n;
4787  if( b )
4788  {
4789  for(j=0; j<=n-1; j++)
4790  {
4791  yc.ptr.pp_double[i][j] = 0.0;
4792  }
4793  }
4794  else
4795  {
4796  for(j=0; j<=n-1; j++)
4797  {
4798  vv = yc.ptr.pp_double[i][j];
4799  yc.ptr.pp_double[i][j] = vv-v;
4800  v2 = v2+(vv-v)*(vv-v);
4801  }
4802  }
4803  sy.ptr.p_double[i] = ae_sqrt(v2/(n-1), _state);
4804  }
4805 
4806  /*
4807  * calculate cross-covariance matrix
4808  */
4809  rmatrixgemm(m1, m2, n, (double)1/(double)(n-1), &xc, 0, 0, 0, &yc, 0, 0, 1, 0.0, c, 0, 0, _state);
4810 
4811  /*
4812  * Divide by standard deviations
4813  */
4814  for(i=0; i<=m1-1; i++)
4815  {
4816  if( ae_fp_neq(sx.ptr.p_double[i],0) )
4817  {
4818  sx.ptr.p_double[i] = 1/sx.ptr.p_double[i];
4819  }
4820  else
4821  {
4822  sx.ptr.p_double[i] = 0.0;
4823  }
4824  }
4825  for(i=0; i<=m2-1; i++)
4826  {
4827  if( ae_fp_neq(sy.ptr.p_double[i],0) )
4828  {
4829  sy.ptr.p_double[i] = 1/sy.ptr.p_double[i];
4830  }
4831  else
4832  {
4833  sy.ptr.p_double[i] = 0.0;
4834  }
4835  }
4836  for(i=0; i<=m1-1; i++)
4837  {
4838  v = sx.ptr.p_double[i];
4839  for(j=0; j<=m2-1; j++)
4840  {
4841  c->ptr.pp_double[i][j] = c->ptr.pp_double[i][j]*v*sy.ptr.p_double[j];
4842  }
4843  }
4844  ae_frame_leave(_state);
4845 }
4846 
4847 
4848 /*************************************************************************
4849 Single-threaded stub. HPC ALGLIB replaces it by multithreaded code.
4850 *************************************************************************/
4852  /* Real */ ae_matrix* y,
4853  ae_int_t n,
4854  ae_int_t m1,
4855  ae_int_t m2,
4856  /* Real */ ae_matrix* c, ae_state *_state)
4857 {
4858  spearmancorrm2(x,y,n,m1,m2,c, _state);
4859 }
4860 
4861 
4862 void rankdata(/* Real */ ae_matrix* xy,
4863  ae_int_t npoints,
4864  ae_int_t nfeatures,
4865  ae_state *_state)
4866 {
4867  ae_frame _frame_block;
4868  apbuffers buf0;
4869  apbuffers buf1;
4870  ae_int_t basecasecost;
4871  ae_shared_pool pool;
4872 
4873  ae_frame_make(_state, &_frame_block);
4874  _apbuffers_init(&buf0, _state, ae_true);
4875  _apbuffers_init(&buf1, _state, ae_true);
4876  ae_shared_pool_init(&pool, _state, ae_true);
4877 
4878  ae_assert(npoints>=0, "RankData: NPoints<0", _state);
4879  ae_assert(nfeatures>=1, "RankData: NFeatures<1", _state);
4880  ae_assert(xy->rows>=npoints, "RankData: Rows(XY)<NPoints", _state);
4881  ae_assert(xy->cols>=nfeatures||npoints==0, "RankData: Cols(XY)<NFeatures", _state);
4882  ae_assert(apservisfinitematrix(xy, npoints, nfeatures, _state), "RankData: XY contains infinite/NAN elements", _state);
4883 
4884  /*
4885  * Basecase cost is a maximum cost of basecase problems.
4886  * Problems harded than that cost will be split.
4887  *
4888  * Problem cost is assumed to be NPoints*NFeatures*log2(NFeatures),
4889  * which is proportional, but NOT equal to number of FLOPs required
4890  * to solve problem.
4891  */
4892  basecasecost = 10000;
4893 
4894  /*
4895  * Try to use serial code, no SMP functionality, no shared pools.
4896  */
4897  if( ae_fp_less(inttoreal(npoints, _state)*inttoreal(nfeatures, _state)*log2(nfeatures, _state),basecasecost) )
4898  {
4899  basestat_rankdatabasecase(xy, 0, npoints, nfeatures, ae_false, &buf0, &buf1, _state);
4900  ae_frame_leave(_state);
4901  return;
4902  }
4903 
4904  /*
4905  * Parallel code
4906  */
4907  ae_shared_pool_set_seed(&pool, &buf0, sizeof(buf0), _apbuffers_init, _apbuffers_init_copy, _apbuffers_destroy, _state);
4908  basestat_rankdatarec(xy, 0, npoints, nfeatures, ae_false, &pool, basecasecost, _state);
4909  ae_frame_leave(_state);
4910 }
4911 
4912 
4913 /*************************************************************************
4914 Single-threaded stub. HPC ALGLIB replaces it by multithreaded code.
4915 *************************************************************************/
4916 void _pexec_rankdata(/* Real */ ae_matrix* xy,
4917  ae_int_t npoints,
4918  ae_int_t nfeatures, ae_state *_state)
4919 {
4920  rankdata(xy,npoints,nfeatures, _state);
4921 }
4922 
4923 
4924 void rankdatacentered(/* Real */ ae_matrix* xy,
4925  ae_int_t npoints,
4926  ae_int_t nfeatures,
4927  ae_state *_state)
4928 {
4929  ae_frame _frame_block;
4930  apbuffers buf0;
4931  apbuffers buf1;
4932  ae_int_t basecasecost;
4933  ae_shared_pool pool;
4934 
4935  ae_frame_make(_state, &_frame_block);
4936  _apbuffers_init(&buf0, _state, ae_true);
4937  _apbuffers_init(&buf1, _state, ae_true);
4938  ae_shared_pool_init(&pool, _state, ae_true);
4939 
4940  ae_assert(npoints>=0, "RankData: NPoints<0", _state);
4941  ae_assert(nfeatures>=1, "RankData: NFeatures<1", _state);
4942  ae_assert(xy->rows>=npoints, "RankData: Rows(XY)<NPoints", _state);
4943  ae_assert(xy->cols>=nfeatures||npoints==0, "RankData: Cols(XY)<NFeatures", _state);
4944  ae_assert(apservisfinitematrix(xy, npoints, nfeatures, _state), "RankData: XY contains infinite/NAN elements", _state);
4945 
4946  /*
4947  * Basecase cost is a maximum cost of basecase problems.
4948  * Problems harded than that cost will be split.
4949  *
4950  * Problem cost is assumed to be NPoints*NFeatures*log2(NFeatures),
4951  * which is proportional, but NOT equal to number of FLOPs required
4952  * to solve problem.
4953  */
4954  basecasecost = 10000;
4955 
4956  /*
4957  * Try to use serial code, no SMP functionality, no shared pools.
4958  */
4959  if( ae_fp_less(inttoreal(npoints, _state)*inttoreal(nfeatures, _state)*log2(nfeatures, _state),basecasecost) )
4960  {
4961  basestat_rankdatabasecase(xy, 0, npoints, nfeatures, ae_true, &buf0, &buf1, _state);
4962  ae_frame_leave(_state);
4963  return;
4964  }
4965 
4966  /*
4967  * Parallel code
4968  */
4969  ae_shared_pool_set_seed(&pool, &buf0, sizeof(buf0), _apbuffers_init, _apbuffers_init_copy, _apbuffers_destroy, _state);
4970  basestat_rankdatarec(xy, 0, npoints, nfeatures, ae_true, &pool, basecasecost, _state);
4971  ae_frame_leave(_state);
4972 }
4973 
4974 
4975 /*************************************************************************
4976 Single-threaded stub. HPC ALGLIB replaces it by multithreaded code.
4977 *************************************************************************/
4979  ae_int_t npoints,
4980  ae_int_t nfeatures, ae_state *_state)
4981 {
4982  rankdatacentered(xy,npoints,nfeatures, _state);
4983 }
4984 
4985 
4986 /*************************************************************************
4987 Obsolete function, we recommend to use PearsonCorr2().
4988 
4989  -- ALGLIB --
4990  Copyright 09.04.2007 by Bochkanov Sergey
4991 *************************************************************************/
4992 double pearsoncorrelation(/* Real */ ae_vector* x,
4993  /* Real */ ae_vector* y,
4994  ae_int_t n,
4995  ae_state *_state)
4996 {
4997  double result;
4998 
4999 
5000  result = pearsoncorr2(x, y, n, _state);
5001  return result;
5002 }
5003 
5004 
5005 /*************************************************************************
5006 Obsolete function, we recommend to use SpearmanCorr2().
5007 
5008  -- ALGLIB --
5009  Copyright 09.04.2007 by Bochkanov Sergey
5010 *************************************************************************/
5011 double spearmanrankcorrelation(/* Real */ ae_vector* x,
5012  /* Real */ ae_vector* y,
5013  ae_int_t n,
5014  ae_state *_state)
5015 {
5016  double result;
5017 
5018 
5019  result = spearmancorr2(x, y, n, _state);
5020  return result;
5021 }
5022 
5023 
5024 static void basestat_rankdatarec(/* Real */ ae_matrix* xy,
5025  ae_int_t i0,
5026  ae_int_t i1,
5027  ae_int_t nfeatures,
5028  ae_bool iscentered,
5029  ae_shared_pool* pool,
5030  ae_int_t basecasecost,
5031  ae_state *_state)
5032 {
5033  ae_frame _frame_block;
5034  apbuffers *buf0;
5035  ae_smart_ptr _buf0;
5036  apbuffers *buf1;
5037  ae_smart_ptr _buf1;
5038  double problemcost;
5039  ae_int_t im;
5040 
5041  ae_frame_make(_state, &_frame_block);
5042  ae_smart_ptr_init(&_buf0, (void**)&buf0, _state, ae_true);
5043  ae_smart_ptr_init(&_buf1, (void**)&buf1, _state, ae_true);
5044 
5045  ae_assert(i1>=i0, "RankDataRec: internal error", _state);
5046 
5047  /*
5048  * Recursively split problem, if it is too large
5049  */
5050  problemcost = inttoreal(i1-i0, _state)*inttoreal(nfeatures, _state)*log2(nfeatures, _state);
5051  if( i1-i0>=2&&ae_fp_greater(problemcost,basecasecost) )
5052  {
5053  im = (i1+i0)/2;
5054  basestat_rankdatarec(xy, i0, im, nfeatures, iscentered, pool, basecasecost, _state);
5055  basestat_rankdatarec(xy, im, i1, nfeatures, iscentered, pool, basecasecost, _state);
5056  ae_frame_leave(_state);
5057  return;
5058  }
5059 
5060  /*
5061  * Retrieve buffers from pool, call serial code, return buffers to pool
5062  */
5063  ae_shared_pool_retrieve(pool, &_buf0, _state);
5064  ae_shared_pool_retrieve(pool, &_buf1, _state);
5065  basestat_rankdatabasecase(xy, i0, i1, nfeatures, iscentered, buf0, buf1, _state);
5066  ae_shared_pool_recycle(pool, &_buf0, _state);
5067  ae_shared_pool_recycle(pool, &_buf1, _state);
5068  ae_frame_leave(_state);
5069 }
5070 
5071 
5072 static void basestat_rankdatabasecase(/* Real */ ae_matrix* xy,
5073  ae_int_t i0,
5074  ae_int_t i1,
5075  ae_int_t nfeatures,
5076  ae_bool iscentered,
5077  apbuffers* buf0,
5078  apbuffers* buf1,
5079  ae_state *_state)
5080 {
5081  ae_int_t i;
5082 
5083 
5084  ae_assert(i1>=i0, "RankDataBasecase: internal error", _state);
5085  if( buf1->ra0.cnt<nfeatures )
5086  {
5087  ae_vector_set_length(&buf1->ra0, nfeatures, _state);
5088  }
5089  for(i=i0; i<=i1-1; i++)
5090  {
5091  ae_v_move(&buf1->ra0.ptr.p_double[0], 1, &xy->ptr.pp_double[i][0], 1, ae_v_len(0,nfeatures-1));
5092  rankx(&buf1->ra0, nfeatures, iscentered, buf0, _state);
5093  ae_v_move(&xy->ptr.pp_double[i][0], 1, &buf1->ra0.ptr.p_double[0], 1, ae_v_len(0,nfeatures-1));
5094  }
5095 }
5096 
5097 
5098 
5099 
5100 /*************************************************************************
5101 Pearson's correlation coefficient significance test
5102 
5103 This test checks hypotheses about whether X and Y are samples of two
5104 continuous distributions having zero correlation or whether their
5105 correlation is non-zero.
5106 
5107 The following tests are performed:
5108  * two-tailed test (null hypothesis - X and Y have zero correlation)
5109  * left-tailed test (null hypothesis - the correlation coefficient is
5110  greater than or equal to 0)
5111  * right-tailed test (null hypothesis - the correlation coefficient is
5112  less than or equal to 0).
5113 
5114 Requirements:
5115  * the number of elements in each sample is not less than 5
5116  * normality of distributions of X and Y.
5117 
5118 Input parameters:
5119  R - Pearson's correlation coefficient for X and Y
5120  N - number of elements in samples, N>=5.
5121 
5122 Output parameters:
5123  BothTails - p-value for two-tailed test.
5124  If BothTails is less than the given significance level
5125  the null hypothesis is rejected.
5126  LeftTail - p-value for left-tailed test.
5127  If LeftTail is less than the given significance level,
5128  the null hypothesis is rejected.
5129  RightTail - p-value for right-tailed test.
5130  If RightTail is less than the given significance level
5131  the null hypothesis is rejected.
5132 
5133  -- ALGLIB --
5134  Copyright 09.04.2007 by Bochkanov Sergey
5135 *************************************************************************/
5137  ae_int_t n,
5138  double* bothtails,
5139  double* lefttail,
5140  double* righttail,
5141  ae_state *_state)
5142 {
5143  double t;
5144  double p;
5145 
5146  *bothtails = 0;
5147  *lefttail = 0;
5148  *righttail = 0;
5149 
5150 
5151  /*
5152  * Some special cases
5153  */
5154  if( ae_fp_greater_eq(r,1) )
5155  {
5156  *bothtails = 0.0;
5157  *lefttail = 1.0;
5158  *righttail = 0.0;
5159  return;
5160  }
5161  if( ae_fp_less_eq(r,-1) )
5162  {
5163  *bothtails = 0.0;
5164  *lefttail = 0.0;
5165  *righttail = 1.0;
5166  return;
5167  }
5168  if( n<5 )
5169  {
5170  *bothtails = 1.0;
5171  *lefttail = 1.0;
5172  *righttail = 1.0;
5173  return;
5174  }
5175 
5176  /*
5177  * General case
5178  */
5179  t = r*ae_sqrt((n-2)/(1-ae_sqr(r, _state)), _state);
5180  p = studenttdistribution(n-2, t, _state);
5181  *bothtails = 2*ae_minreal(p, 1-p, _state);
5182  *lefttail = p;
5183  *righttail = 1-p;
5184 }
5185 
5186 
5187 /*************************************************************************
5188 Spearman's rank correlation coefficient significance test
5189 
5190 This test checks hypotheses about whether X and Y are samples of two
5191 continuous distributions having zero correlation or whether their
5192 correlation is non-zero.
5193 
5194 The following tests are performed:
5195  * two-tailed test (null hypothesis - X and Y have zero correlation)
5196  * left-tailed test (null hypothesis - the correlation coefficient is
5197  greater than or equal to 0)
5198  * right-tailed test (null hypothesis - the correlation coefficient is
5199  less than or equal to 0).
5200 
5201 Requirements:
5202  * the number of elements in each sample is not less than 5.
5203 
5204 The test is non-parametric and doesn't require distributions X and Y to be
5205 normal.
5206 
5207 Input parameters:
5208  R - Spearman's rank correlation coefficient for X and Y
5209  N - number of elements in samples, N>=5.
5210 
5211 Output parameters:
5212  BothTails - p-value for two-tailed test.
5213  If BothTails is less than the given significance level
5214  the null hypothesis is rejected.
5215  LeftTail - p-value for left-tailed test.
5216  If LeftTail is less than the given significance level,
5217  the null hypothesis is rejected.
5218  RightTail - p-value for right-tailed test.
5219  If RightTail is less than the given significance level
5220  the null hypothesis is rejected.
5221 
5222  -- ALGLIB --
5223  Copyright 09.04.2007 by Bochkanov Sergey
5224 *************************************************************************/
5226  ae_int_t n,
5227  double* bothtails,
5228  double* lefttail,
5229  double* righttail,
5230  ae_state *_state)
5231 {
5232  double t;
5233  double p;
5234 
5235  *bothtails = 0;
5236  *lefttail = 0;
5237  *righttail = 0;
5238 
5239 
5240  /*
5241  * Special case
5242  */
5243  if( n<5 )
5244  {
5245  *bothtails = 1.0;
5246  *lefttail = 1.0;
5247  *righttail = 1.0;
5248  return;
5249  }
5250 
5251  /*
5252  * General case
5253  */
5254  if( ae_fp_greater_eq(r,1) )
5255  {
5256  t = 1.0E10;
5257  }
5258  else
5259  {
5260  if( ae_fp_less_eq(r,-1) )
5261  {
5262  t = -1.0E10;
5263  }
5264  else
5265  {
5266  t = r*ae_sqrt((n-2)/(1-ae_sqr(r, _state)), _state);
5267  }
5268  }
5269  if( ae_fp_less(t,0) )
5270  {
5271  p = correlationtests_spearmantail(t, n, _state);
5272  *bothtails = 2*p;
5273  *lefttail = p;
5274  *righttail = 1-p;
5275  }
5276  else
5277  {
5278  p = correlationtests_spearmantail(-t, n, _state);
5279  *bothtails = 2*p;
5280  *lefttail = 1-p;
5281  *righttail = p;
5282  }
5283 }
5284 
5285 
5286 /*************************************************************************
5287 Tail(S, 5)
5288 *************************************************************************/
5289 static double correlationtests_spearmantail5(double s, ae_state *_state)
5290 {
5291  double result;
5292 
5293 
5294  if( ae_fp_less(s,0.000e+00) )
5295  {
5296  result = studenttdistribution(3, -s, _state);
5297  return result;
5298  }
5299  if( ae_fp_greater_eq(s,3.580e+00) )
5300  {
5301  result = 8.304e-03;
5302  return result;
5303  }
5304  if( ae_fp_greater_eq(s,2.322e+00) )
5305  {
5306  result = 4.163e-02;
5307  return result;
5308  }
5309  if( ae_fp_greater_eq(s,1.704e+00) )
5310  {
5311  result = 6.641e-02;
5312  return result;
5313  }
5314  if( ae_fp_greater_eq(s,1.303e+00) )
5315  {
5316  result = 1.164e-01;
5317  return result;
5318  }
5319  if( ae_fp_greater_eq(s,1.003e+00) )
5320  {
5321  result = 1.748e-01;
5322  return result;
5323  }
5324  if( ae_fp_greater_eq(s,7.584e-01) )
5325  {
5326  result = 2.249e-01;
5327  return result;
5328  }
5329  if( ae_fp_greater_eq(s,5.468e-01) )
5330  {
5331  result = 2.581e-01;
5332  return result;
5333  }
5334  if( ae_fp_greater_eq(s,3.555e-01) )
5335  {
5336  result = 3.413e-01;
5337  return result;
5338  }
5339  if( ae_fp_greater_eq(s,1.759e-01) )
5340  {
5341  result = 3.911e-01;
5342  return result;
5343  }
5344  if( ae_fp_greater_eq(s,1.741e-03) )
5345  {
5346  result = 4.747e-01;
5347  return result;
5348  }
5349  if( ae_fp_greater_eq(s,0.000e+00) )
5350  {
5351  result = 5.248e-01;
5352  return result;
5353  }
5354  result = 0;
5355  return result;
5356 }
5357 
5358 
5359 /*************************************************************************
5360 Tail(S, 6)
5361 *************************************************************************/
5362 static double correlationtests_spearmantail6(double s, ae_state *_state)
5363 {
5364  double result;
5365 
5366 
5367  if( ae_fp_less(s,1.001e+00) )
5368  {
5369  result = studenttdistribution(4, -s, _state);
5370  return result;
5371  }
5372  if( ae_fp_greater_eq(s,5.663e+00) )
5373  {
5374  result = 1.366e-03;
5375  return result;
5376  }
5377  if( ae_fp_greater_eq(s,3.834e+00) )
5378  {
5379  result = 8.350e-03;
5380  return result;
5381  }
5382  if( ae_fp_greater_eq(s,2.968e+00) )
5383  {
5384  result = 1.668e-02;
5385  return result;
5386  }
5387  if( ae_fp_greater_eq(s,2.430e+00) )
5388  {
5389  result = 2.921e-02;
5390  return result;
5391  }
5392  if( ae_fp_greater_eq(s,2.045e+00) )
5393  {
5394  result = 5.144e-02;
5395  return result;
5396  }
5397  if( ae_fp_greater_eq(s,1.747e+00) )
5398  {
5399  result = 6.797e-02;
5400  return result;
5401  }
5402  if( ae_fp_greater_eq(s,1.502e+00) )
5403  {
5404  result = 8.752e-02;
5405  return result;
5406  }
5407  if( ae_fp_greater_eq(s,1.295e+00) )
5408  {
5409  result = 1.210e-01;
5410  return result;
5411  }
5412  if( ae_fp_greater_eq(s,1.113e+00) )
5413  {
5414  result = 1.487e-01;
5415  return result;
5416  }
5417  if( ae_fp_greater_eq(s,1.001e+00) )
5418  {
5419  result = 1.780e-01;
5420  return result;
5421  }
5422  result = 0;
5423  return result;
5424 }
5425 
5426 
5427 /*************************************************************************
5428 Tail(S, 7)
5429 *************************************************************************/
5430 static double correlationtests_spearmantail7(double s, ae_state *_state)
5431 {
5432  double result;
5433 
5434 
5435  if( ae_fp_less(s,1.001e+00) )
5436  {
5437  result = studenttdistribution(5, -s, _state);
5438  return result;
5439  }
5440  if( ae_fp_greater_eq(s,8.159e+00) )
5441  {
5442  result = 2.081e-04;
5443  return result;
5444  }
5445  if( ae_fp_greater_eq(s,5.620e+00) )
5446  {
5447  result = 1.393e-03;
5448  return result;
5449  }
5450  if( ae_fp_greater_eq(s,4.445e+00) )
5451  {
5452  result = 3.398e-03;
5453  return result;
5454  }
5455  if( ae_fp_greater_eq(s,3.728e+00) )
5456  {
5457  result = 6.187e-03;
5458  return result;
5459  }
5460  if( ae_fp_greater_eq(s,3.226e+00) )
5461  {
5462  result = 1.200e-02;
5463  return result;
5464  }
5465  if( ae_fp_greater_eq(s,2.844e+00) )
5466  {
5467  result = 1.712e-02;
5468  return result;
5469  }
5470  if( ae_fp_greater_eq(s,2.539e+00) )
5471  {
5472  result = 2.408e-02;
5473  return result;
5474  }
5475  if( ae_fp_greater_eq(s,2.285e+00) )
5476  {
5477  result = 3.320e-02;
5478  return result;
5479  }
5480  if( ae_fp_greater_eq(s,2.068e+00) )
5481  {
5482  result = 4.406e-02;
5483  return result;
5484  }
5485  if( ae_fp_greater_eq(s,1.879e+00) )
5486  {
5487  result = 5.478e-02;
5488  return result;
5489  }
5490  if( ae_fp_greater_eq(s,1.710e+00) )
5491  {
5492  result = 6.946e-02;
5493  return result;
5494  }
5495  if( ae_fp_greater_eq(s,1.559e+00) )
5496  {
5497  result = 8.331e-02;
5498  return result;
5499  }
5500  if( ae_fp_greater_eq(s,1.420e+00) )
5501  {
5502  result = 1.001e-01;
5503  return result;
5504  }
5505  if( ae_fp_greater_eq(s,1.292e+00) )
5506  {
5507  result = 1.180e-01;
5508  return result;
5509  }
5510  if( ae_fp_greater_eq(s,1.173e+00) )
5511  {
5512  result = 1.335e-01;
5513  return result;
5514  }
5515  if( ae_fp_greater_eq(s,1.062e+00) )
5516  {
5517  result = 1.513e-01;
5518  return result;
5519  }
5520  if( ae_fp_greater_eq(s,1.001e+00) )
5521  {
5522  result = 1.770e-01;
5523  return result;
5524  }
5525  result = 0;
5526  return result;
5527 }
5528 
5529 
5530 /*************************************************************************
5531 Tail(S, 8)
5532 *************************************************************************/
5533 static double correlationtests_spearmantail8(double s, ae_state *_state)
5534 {
5535  double result;
5536 
5537 
5538  if( ae_fp_less(s,2.001e+00) )
5539  {
5540  result = studenttdistribution(6, -s, _state);
5541  return result;
5542  }
5543  if( ae_fp_greater_eq(s,1.103e+01) )
5544  {
5545  result = 2.194e-05;
5546  return result;
5547  }
5548  if( ae_fp_greater_eq(s,7.685e+00) )
5549  {
5550  result = 2.008e-04;
5551  return result;
5552  }
5553  if( ae_fp_greater_eq(s,6.143e+00) )
5554  {
5555  result = 5.686e-04;
5556  return result;
5557  }
5558  if( ae_fp_greater_eq(s,5.213e+00) )
5559  {
5560  result = 1.138e-03;
5561  return result;
5562  }
5563  if( ae_fp_greater_eq(s,4.567e+00) )
5564  {
5565  result = 2.310e-03;
5566  return result;
5567  }
5568  if( ae_fp_greater_eq(s,4.081e+00) )
5569  {
5570  result = 3.634e-03;
5571  return result;
5572  }
5573  if( ae_fp_greater_eq(s,3.697e+00) )
5574  {
5575  result = 5.369e-03;
5576  return result;
5577  }
5578  if( ae_fp_greater_eq(s,3.381e+00) )
5579  {
5580  result = 7.708e-03;
5581  return result;
5582  }
5583  if( ae_fp_greater_eq(s,3.114e+00) )
5584  {
5585  result = 1.087e-02;
5586  return result;
5587  }
5588  if( ae_fp_greater_eq(s,2.884e+00) )
5589  {
5590  result = 1.397e-02;
5591  return result;
5592  }
5593  if( ae_fp_greater_eq(s,2.682e+00) )
5594  {
5595  result = 1.838e-02;
5596  return result;
5597  }
5598  if( ae_fp_greater_eq(s,2.502e+00) )
5599  {
5600  result = 2.288e-02;
5601  return result;
5602  }
5603  if( ae_fp_greater_eq(s,2.340e+00) )
5604  {
5605  result = 2.883e-02;
5606  return result;
5607  }
5608  if( ae_fp_greater_eq(s,2.192e+00) )
5609  {
5610  result = 3.469e-02;
5611  return result;
5612  }
5613  if( ae_fp_greater_eq(s,2.057e+00) )
5614  {
5615  result = 4.144e-02;
5616  return result;
5617  }
5618  if( ae_fp_greater_eq(s,2.001e+00) )
5619  {
5620  result = 4.804e-02;
5621  return result;
5622  }
5623  result = 0;
5624  return result;
5625 }
5626 
5627 
5628 /*************************************************************************
5629 Tail(S, 9)
5630 *************************************************************************/
5631 static double correlationtests_spearmantail9(double s, ae_state *_state)
5632 {
5633  double result;
5634 
5635 
5636  if( ae_fp_less(s,2.001e+00) )
5637  {
5638  result = studenttdistribution(7, -s, _state);
5639  return result;
5640  }
5641  if( ae_fp_greater_eq(s,9.989e+00) )
5642  {
5643  result = 2.306e-05;
5644  return result;
5645  }
5646  if( ae_fp_greater_eq(s,8.069e+00) )
5647  {
5648  result = 8.167e-05;
5649  return result;
5650  }
5651  if( ae_fp_greater_eq(s,6.890e+00) )
5652  {
5653  result = 1.744e-04;
5654  return result;
5655  }
5656  if( ae_fp_greater_eq(s,6.077e+00) )
5657  {
5658  result = 3.625e-04;
5659  return result;
5660  }
5661  if( ae_fp_greater_eq(s,5.469e+00) )
5662  {
5663  result = 6.450e-04;
5664  return result;
5665  }
5666  if( ae_fp_greater_eq(s,4.991e+00) )
5667  {
5668  result = 1.001e-03;
5669  return result;
5670  }
5671  if( ae_fp_greater_eq(s,4.600e+00) )
5672  {
5673  result = 1.514e-03;
5674  return result;
5675  }
5676  if( ae_fp_greater_eq(s,4.272e+00) )
5677  {
5678  result = 2.213e-03;
5679  return result;
5680  }
5681  if( ae_fp_greater_eq(s,3.991e+00) )
5682  {
5683  result = 2.990e-03;
5684  return result;
5685  }
5686  if( ae_fp_greater_eq(s,3.746e+00) )
5687  {
5688  result = 4.101e-03;
5689  return result;
5690  }
5691  if( ae_fp_greater_eq(s,3.530e+00) )
5692  {
5693  result = 5.355e-03;
5694  return result;
5695  }
5696  if( ae_fp_greater_eq(s,3.336e+00) )
5697  {
5698  result = 6.887e-03;
5699  return result;
5700  }
5701  if( ae_fp_greater_eq(s,3.161e+00) )
5702  {
5703  result = 8.598e-03;
5704  return result;
5705  }
5706  if( ae_fp_greater_eq(s,3.002e+00) )
5707  {
5708  result = 1.065e-02;
5709  return result;
5710  }
5711  if( ae_fp_greater_eq(s,2.855e+00) )
5712  {
5713  result = 1.268e-02;
5714  return result;
5715  }
5716  if( ae_fp_greater_eq(s,2.720e+00) )
5717  {
5718  result = 1.552e-02;
5719  return result;
5720  }
5721  if( ae_fp_greater_eq(s,2.595e+00) )
5722  {
5723  result = 1.836e-02;
5724  return result;
5725  }
5726  if( ae_fp_greater_eq(s,2.477e+00) )
5727  {
5728  result = 2.158e-02;
5729  return result;
5730  }
5731  if( ae_fp_greater_eq(s,2.368e+00) )
5732  {
5733  result = 2.512e-02;
5734  return result;
5735  }
5736  if( ae_fp_greater_eq(s,2.264e+00) )
5737  {
5738  result = 2.942e-02;
5739  return result;
5740  }
5741  if( ae_fp_greater_eq(s,2.166e+00) )
5742  {
5743  result = 3.325e-02;
5744  return result;
5745  }
5746  if( ae_fp_greater_eq(s,2.073e+00) )
5747  {
5748  result = 3.800e-02;
5749  return result;
5750  }
5751  if( ae_fp_greater_eq(s,2.001e+00) )
5752  {
5753  result = 4.285e-02;
5754  return result;
5755  }
5756  result = 0;
5757  return result;
5758 }
5759 
5760 
5761 /*************************************************************************
5762 Tail(T,N), accepts T<0
5763 *************************************************************************/
5764 static double correlationtests_spearmantail(double t,
5765  ae_int_t n,
5766  ae_state *_state)
5767 {
5768  double result;
5769 
5770 
5771  if( n==5 )
5772  {
5773  result = correlationtests_spearmantail5(-t, _state);
5774  return result;
5775  }
5776  if( n==6 )
5777  {
5778  result = correlationtests_spearmantail6(-t, _state);
5779  return result;
5780  }
5781  if( n==7 )
5782  {
5783  result = correlationtests_spearmantail7(-t, _state);
5784  return result;
5785  }
5786  if( n==8 )
5787  {
5788  result = correlationtests_spearmantail8(-t, _state);
5789  return result;
5790  }
5791  if( n==9 )
5792  {
5793  result = correlationtests_spearmantail9(-t, _state);
5794  return result;
5795  }
5796  result = studenttdistribution(n-2, t, _state);
5797  return result;
5798 }
5799 
5800 
5801 
5802 
5803 /*************************************************************************
5804 Jarque-Bera test
5805 
5806 This test checks hypotheses about the fact that a given sample X is a
5807 sample of normal random variable.
5808 
5809 Requirements:
5810  * the number of elements in the sample is not less than 5.
5811 
5812 Input parameters:
5813  X - sample. Array whose index goes from 0 to N-1.
5814  N - size of the sample. N>=5
5815 
5816 Output parameters:
5817  BothTails - p-value for two-tailed test.
5818  If BothTails is less than the given significance level
5819  the null hypothesis is rejected.
5820  LeftTail - p-value for left-tailed test.
5821  If LeftTail is less than the given significance level,
5822  the null hypothesis is rejected.
5823  RightTail - p-value for right-tailed test.
5824  If RightTail is less than the given significance level
5825  the null hypothesis is rejected.
5826 
5827 Accuracy of the approximation used (5<=N<=1951):
5828 
5829 p-value relative error (5<=N<=1951)
5830 [1, 0.1] < 1%
5831 [0.1, 0.01] < 2%
5832 [0.01, 0.001] < 6%
5833 [0.001, 0] wasn't measured
5834 
5835 For N>1951 accuracy wasn't measured but it shouldn't be sharply different
5836 from table values.
5837 
5838  -- ALGLIB --
5839  Copyright 09.04.2007 by Bochkanov Sergey
5840 *************************************************************************/
5841 void jarqueberatest(/* Real */ ae_vector* x,
5842  ae_int_t n,
5843  double* p,
5844  ae_state *_state)
5845 {
5846  double s;
5847 
5848  *p = 0;
5849 
5850 
5851  /*
5852  * N is too small
5853  */
5854  if( n<5 )
5855  {
5856  *p = 1.0;
5857  return;
5858  }
5859 
5860  /*
5861  * N is large enough
5862  */
5863  jarquebera_jarqueberastatistic(x, n, &s, _state);
5864  *p = jarquebera_jarqueberaapprox(n, s, _state);
5865 }
5866 
5867 
5868 static void jarquebera_jarqueberastatistic(/* Real */ ae_vector* x,
5869  ae_int_t n,
5870  double* s,
5871  ae_state *_state)
5872 {
5873  ae_int_t i;
5874  double v;
5875  double v1;
5876  double v2;
5877  double stddev;
5878  double mean;
5879  double variance;
5880  double skewness;
5881  double kurtosis;
5882 
5883  *s = 0;
5884 
5885  mean = 0;
5886  variance = 0;
5887  skewness = 0;
5888  kurtosis = 0;
5889  stddev = 0;
5890  ae_assert(n>1, "Assertion failed", _state);
5891 
5892  /*
5893  * Mean
5894  */
5895  for(i=0; i<=n-1; i++)
5896  {
5897  mean = mean+x->ptr.p_double[i];
5898  }
5899  mean = mean/n;
5900 
5901  /*
5902  * Variance (using corrected two-pass algorithm)
5903  */
5904  if( n!=1 )
5905  {
5906  v1 = 0;
5907  for(i=0; i<=n-1; i++)
5908  {
5909  v1 = v1+ae_sqr(x->ptr.p_double[i]-mean, _state);
5910  }
5911  v2 = 0;
5912  for(i=0; i<=n-1; i++)
5913  {
5914  v2 = v2+(x->ptr.p_double[i]-mean);
5915  }
5916  v2 = ae_sqr(v2, _state)/n;
5917  variance = (v1-v2)/(n-1);
5918  if( ae_fp_less(variance,0) )
5919  {
5920  variance = 0;
5921  }
5922  stddev = ae_sqrt(variance, _state);
5923  }
5924 
5925  /*
5926  * Skewness and kurtosis
5927  */
5928  if( ae_fp_neq(stddev,0) )
5929  {
5930  for(i=0; i<=n-1; i++)
5931  {
5932  v = (x->ptr.p_double[i]-mean)/stddev;
5933  v2 = ae_sqr(v, _state);
5934  skewness = skewness+v2*v;
5935  kurtosis = kurtosis+ae_sqr(v2, _state);
5936  }
5937  skewness = skewness/n;
5938  kurtosis = kurtosis/n-3;
5939  }
5940 
5941  /*
5942  * Statistic
5943  */
5944  *s = (double)n/(double)6*(ae_sqr(skewness, _state)+ae_sqr(kurtosis, _state)/4);
5945 }
5946 
5947 
5948 static double jarquebera_jarqueberaapprox(ae_int_t n,
5949  double s,
5950  ae_state *_state)
5951 {
5952  ae_frame _frame_block;
5953  ae_vector vx;
5954  ae_vector vy;
5955  ae_matrix ctbl;
5956  double t1;
5957  double t2;
5958  double t3;
5959  double t;
5960  double f1;
5961  double f2;
5962  double f3;
5963  double f12;
5964  double f23;
5965  double x;
5966  double result;
5967 
5968  ae_frame_make(_state, &_frame_block);
5969  ae_vector_init(&vx, 0, DT_REAL, _state, ae_true);
5970  ae_vector_init(&vy, 0, DT_REAL, _state, ae_true);
5971  ae_matrix_init(&ctbl, 0, 0, DT_REAL, _state, ae_true);
5972 
5973  result = 1;
5974  x = s;
5975  if( n<5 )
5976  {
5977  ae_frame_leave(_state);
5978  return result;
5979  }
5980 
5981  /*
5982  * N = 5..20 are tabulated
5983  */
5984  if( n>=5&&n<=20 )
5985  {
5986  if( n==5 )
5987  {
5988  result = ae_exp(jarquebera_jbtbl5(x, _state), _state);
5989  }
5990  if( n==6 )
5991  {
5992  result = ae_exp(jarquebera_jbtbl6(x, _state), _state);
5993  }
5994  if( n==7 )
5995  {
5996  result = ae_exp(jarquebera_jbtbl7(x, _state), _state);
5997  }
5998  if( n==8 )
5999  {
6000  result = ae_exp(jarquebera_jbtbl8(x, _state), _state);
6001  }
6002  if( n==9 )
6003  {
6004  result = ae_exp(jarquebera_jbtbl9(x, _state), _state);
6005  }
6006  if( n==10 )
6007  {
6008  result = ae_exp(jarquebera_jbtbl10(x, _state), _state);
6009  }
6010  if( n==11 )
6011  {
6012  result = ae_exp(jarquebera_jbtbl11(x, _state), _state);
6013  }
6014  if( n==12 )
6015  {
6016  result = ae_exp(jarquebera_jbtbl12(x, _state), _state);
6017  }
6018  if( n==13 )
6019  {
6020  result = ae_exp(jarquebera_jbtbl13(x, _state), _state);
6021  }
6022  if( n==14 )
6023  {
6024  result = ae_exp(jarquebera_jbtbl14(x, _state), _state);
6025  }
6026  if( n==15 )
6027  {
6028  result = ae_exp(jarquebera_jbtbl15(x, _state), _state);
6029  }
6030  if( n==16 )
6031  {
6032  result = ae_exp(jarquebera_jbtbl16(x, _state), _state);
6033  }
6034  if( n==17 )
6035  {
6036  result = ae_exp(jarquebera_jbtbl17(x, _state), _state);
6037  }
6038  if( n==18 )
6039  {
6040  result = ae_exp(jarquebera_jbtbl18(x, _state), _state);
6041  }
6042  if( n==19 )
6043  {
6044  result = ae_exp(jarquebera_jbtbl19(x, _state), _state);
6045  }
6046  if( n==20 )
6047  {
6048  result = ae_exp(jarquebera_jbtbl20(x, _state), _state);
6049  }
6050  ae_frame_leave(_state);
6051  return result;
6052  }
6053 
6054  /*
6055  * N = 20, 30, 50 are tabulated.
6056  * In-between values are interpolated
6057  * using interpolating polynomial of the second degree.
6058  */
6059  if( n>20&&n<=50 )
6060  {
6061  t1 = -1.0/20.0;
6062  t2 = -1.0/30.0;
6063  t3 = -1.0/50.0;
6064  t = -1.0/n;
6065  f1 = jarquebera_jbtbl20(x, _state);
6066  f2 = jarquebera_jbtbl30(x, _state);
6067  f3 = jarquebera_jbtbl50(x, _state);
6068  f12 = ((t-t2)*f1+(t1-t)*f2)/(t1-t2);
6069  f23 = ((t-t3)*f2+(t2-t)*f3)/(t2-t3);
6070  result = ((t-t3)*f12+(t1-t)*f23)/(t1-t3);
6071  if( ae_fp_greater(result,0) )
6072  {
6073  result = 0;
6074  }
6075  result = ae_exp(result, _state);
6076  ae_frame_leave(_state);
6077  return result;
6078  }
6079 
6080  /*
6081  * N = 50, 65, 100 are tabulated.
6082  * In-between values are interpolated
6083  * using interpolating polynomial of the second degree.
6084  */
6085  if( n>50&&n<=100 )
6086  {
6087  t1 = -1.0/50.0;
6088  t2 = -1.0/65.0;
6089  t3 = -1.0/100.0;
6090  t = -1.0/n;
6091  f1 = jarquebera_jbtbl50(x, _state);
6092  f2 = jarquebera_jbtbl65(x, _state);
6093  f3 = jarquebera_jbtbl100(x, _state);
6094  f12 = ((t-t2)*f1+(t1-t)*f2)/(t1-t2);
6095  f23 = ((t-t3)*f2+(t2-t)*f3)/(t2-t3);
6096  result = ((t-t3)*f12+(t1-t)*f23)/(t1-t3);
6097  if( ae_fp_greater(result,0) )
6098  {
6099  result = 0;
6100  }
6101  result = ae_exp(result, _state);
6102  ae_frame_leave(_state);
6103  return result;
6104  }
6105 
6106  /*
6107  * N = 100, 130, 200 are tabulated.
6108  * In-between values are interpolated
6109  * using interpolating polynomial of the second degree.
6110  */
6111  if( n>100&&n<=200 )
6112  {
6113  t1 = -1.0/100.0;
6114  t2 = -1.0/130.0;
6115  t3 = -1.0/200.0;
6116  t = -1.0/n;
6117  f1 = jarquebera_jbtbl100(x, _state);
6118  f2 = jarquebera_jbtbl130(x, _state);
6119  f3 = jarquebera_jbtbl200(x, _state);
6120  f12 = ((t-t2)*f1+(t1-t)*f2)/(t1-t2);
6121  f23 = ((t-t3)*f2+(t2-t)*f3)/(t2-t3);
6122  result = ((t-t3)*f12+(t1-t)*f23)/(t1-t3);
6123  if( ae_fp_greater(result,0) )
6124  {
6125  result = 0;
6126  }
6127  result = ae_exp(result, _state);
6128  ae_frame_leave(_state);
6129  return result;
6130  }
6131 
6132  /*
6133  * N = 200, 301, 501 are tabulated.
6134  * In-between values are interpolated
6135  * using interpolating polynomial of the second degree.
6136  */
6137  if( n>200&&n<=501 )
6138  {
6139  t1 = -1.0/200.0;
6140  t2 = -1.0/301.0;
6141  t3 = -1.0/501.0;
6142  t = -1.0/n;
6143  f1 = jarquebera_jbtbl200(x, _state);
6144  f2 = jarquebera_jbtbl301(x, _state);
6145  f3 = jarquebera_jbtbl501(x, _state);
6146  f12 = ((t-t2)*f1+(t1-t)*f2)/(t1-t2);
6147  f23 = ((t-t3)*f2+(t2-t)*f3)/(t2-t3);
6148  result = ((t-t3)*f12+(t1-t)*f23)/(t1-t3);
6149  if( ae_fp_greater(result,0) )
6150  {
6151  result = 0;
6152  }
6153  result = ae_exp(result, _state);
6154  ae_frame_leave(_state);
6155  return result;
6156  }
6157 
6158  /*
6159  * N = 501, 701, 1401 are tabulated.
6160  * In-between values are interpolated
6161  * using interpolating polynomial of the second degree.
6162  */
6163  if( n>501&&n<=1401 )
6164  {
6165  t1 = -1.0/501.0;
6166  t2 = -1.0/701.0;
6167  t3 = -1.0/1401.0;
6168  t = -1.0/n;
6169  f1 = jarquebera_jbtbl501(x, _state);
6170  f2 = jarquebera_jbtbl701(x, _state);
6171  f3 = jarquebera_jbtbl1401(x, _state);
6172  f12 = ((t-t2)*f1+(t1-t)*f2)/(t1-t2);
6173  f23 = ((t-t3)*f2+(t2-t)*f3)/(t2-t3);
6174  result = ((t-t3)*f12+(t1-t)*f23)/(t1-t3);
6175  if( ae_fp_greater(result,0) )
6176  {
6177  result = 0;
6178  }
6179  result = ae_exp(result, _state);
6180  ae_frame_leave(_state);
6181  return result;
6182  }
6183 
6184  /*
6185  * Asymptotic expansion
6186  */
6187  if( n>1401 )
6188  {
6189  result = -0.5*x+(jarquebera_jbtbl1401(x, _state)+0.5*x)*ae_sqrt((double)1401/(double)n, _state);
6190  if( ae_fp_greater(result,0) )
6191  {
6192  result = 0;
6193  }
6194  result = ae_exp(result, _state);
6195  ae_frame_leave(_state);
6196  return result;
6197  }
6198  ae_frame_leave(_state);
6199  return result;
6200 }
6201 
6202 
6203 static double jarquebera_jbtbl5(double s, ae_state *_state)
6204 {
6205  double x;
6206  double tj;
6207  double tj1;
6208  double result;
6209 
6210 
6211  result = 0;
6212  if( ae_fp_less_eq(s,0.4000) )
6213  {
6214  x = 2*(s-0.000000)/0.400000-1;
6215  tj = 1;
6216  tj1 = x;
6217  jarquebera_jbcheb(x, -1.097885e-20, &tj, &tj1, &result, _state);
6218  jarquebera_jbcheb(x, -2.854501e-20, &tj, &tj1, &result, _state);
6219  jarquebera_jbcheb(x, -1.756616e-20, &tj, &tj1, &result, _state);
6220  if( ae_fp_greater(result,0) )
6221  {
6222  result = 0;
6223  }
6224  return result;
6225  }
6226  if( ae_fp_less_eq(s,1.1000) )
6227  {
6228  x = 2*(s-0.400000)/0.700000-1;
6229  tj = 1;
6230  tj1 = x;
6231  jarquebera_jbcheb(x, -1.324545e+00, &tj, &tj1, &result, _state);
6232  jarquebera_jbcheb(x, -1.075941e+00, &tj, &tj1, &result, _state);
6233  jarquebera_jbcheb(x, -9.772272e-01, &tj, &tj1, &result, _state);
6234  jarquebera_jbcheb(x, 3.175686e-01, &tj, &tj1, &result, _state);
6235  jarquebera_jbcheb(x, -1.576162e-01, &tj, &tj1, &result, _state);
6236  jarquebera_jbcheb(x, 1.126861e-01, &tj, &tj1, &result, _state);
6237  jarquebera_jbcheb(x, -3.434425e-02, &tj, &tj1, &result, _state);
6238  jarquebera_jbcheb(x, -2.790359e-01, &tj, &tj1, &result, _state);
6239  jarquebera_jbcheb(x, 2.809178e-02, &tj, &tj1, &result, _state);
6240  jarquebera_jbcheb(x, -5.479704e-01, &tj, &tj1, &result, _state);
6241  jarquebera_jbcheb(x, 3.717040e-02, &tj, &tj1, &result, _state);
6242  jarquebera_jbcheb(x, -5.294170e-01, &tj, &tj1, &result, _state);
6243  jarquebera_jbcheb(x, 2.880632e-02, &tj, &tj1, &result, _state);
6244  jarquebera_jbcheb(x, -3.023344e-01, &tj, &tj1, &result, _state);
6245  jarquebera_jbcheb(x, 1.601531e-02, &tj, &tj1, &result, _state);
6246  jarquebera_jbcheb(x, -7.920403e-02, &tj, &tj1, &result, _state);
6247  if( ae_fp_greater(result,0) )
6248  {
6249  result = 0;
6250  }
6251  return result;
6252  }
6253  result = -5.188419e+02*(s-1.100000e+00)-4.767297e+00;
6254  return result;
6255 }
6256 
6257 
6258 static double jarquebera_jbtbl6(double s, ae_state *_state)
6259 {
6260  double x;
6261  double tj;
6262  double tj1;
6263  double result;
6264 
6265 
6266  result = 0;
6267  if( ae_fp_less_eq(s,0.2500) )
6268  {
6269  x = 2*(s-0.000000)/0.250000-1;
6270  tj = 1;
6271  tj1 = x;
6272  jarquebera_jbcheb(x, -2.274707e-04, &tj, &tj1, &result, _state);
6273  jarquebera_jbcheb(x, -5.700471e-04, &tj, &tj1, &result, _state);
6274  jarquebera_jbcheb(x, -3.425764e-04, &tj, &tj1, &result, _state);
6275  if( ae_fp_greater(result,0) )
6276  {
6277  result = 0;
6278  }
6279  return result;
6280  }
6281  if( ae_fp_less_eq(s,1.3000) )
6282  {
6283  x = 2*(s-0.250000)/1.050000-1;
6284  tj = 1;
6285  tj1 = x;
6286  jarquebera_jbcheb(x, -1.339000e+00, &tj, &tj1, &result, _state);
6287  jarquebera_jbcheb(x, -2.011104e+00, &tj, &tj1, &result, _state);
6288  jarquebera_jbcheb(x, -8.168177e-01, &tj, &tj1, &result, _state);
6289  jarquebera_jbcheb(x, -1.085666e-01, &tj, &tj1, &result, _state);
6290  jarquebera_jbcheb(x, 7.738606e-02, &tj, &tj1, &result, _state);
6291  jarquebera_jbcheb(x, 7.022876e-02, &tj, &tj1, &result, _state);
6292  jarquebera_jbcheb(x, 3.462402e-02, &tj, &tj1, &result, _state);
6293  jarquebera_jbcheb(x, 6.908270e-03, &tj, &tj1, &result, _state);
6294  jarquebera_jbcheb(x, -8.230772e-03, &tj, &tj1, &result, _state);
6295  jarquebera_jbcheb(x, -1.006996e-02, &tj, &tj1, &result, _state);
6296  jarquebera_jbcheb(x, -5.410222e-03, &tj, &tj1, &result, _state);
6297  jarquebera_jbcheb(x, -2.893768e-03, &tj, &tj1, &result, _state);
6298  jarquebera_jbcheb(x, 8.114564e-04, &tj, &tj1, &result, _state);
6299  if( ae_fp_greater(result,0) )
6300  {
6301  result = 0;
6302  }
6303  return result;
6304  }
6305  if( ae_fp_less_eq(s,1.8500) )
6306  {
6307  x = 2*(s-1.300000)/0.550000-1;
6308  tj = 1;
6309  tj1 = x;
6310  jarquebera_jbcheb(x, -6.794311e+00, &tj, &tj1, &result, _state);
6311  jarquebera_jbcheb(x, -3.578700e+00, &tj, &tj1, &result, _state);
6312  jarquebera_jbcheb(x, -1.394664e+00, &tj, &tj1, &result, _state);
6313  jarquebera_jbcheb(x, -7.928290e-01, &tj, &tj1, &result, _state);
6314  jarquebera_jbcheb(x, -4.813273e-01, &tj, &tj1, &result, _state);
6315  jarquebera_jbcheb(x, -3.076063e-01, &tj, &tj1, &result, _state);
6316  jarquebera_jbcheb(x, -1.835380e-01, &tj, &tj1, &result, _state);
6317  jarquebera_jbcheb(x, -1.013013e-01, &tj, &tj1, &result, _state);
6318  jarquebera_jbcheb(x, -5.058903e-02, &tj, &tj1, &result, _state);
6319  jarquebera_jbcheb(x, -1.856915e-02, &tj, &tj1, &result, _state);
6320  jarquebera_jbcheb(x, -6.710887e-03, &tj, &tj1, &result, _state);
6321  if( ae_fp_greater(result,0) )
6322  {
6323  result = 0;
6324  }
6325  return result;
6326  }
6327  result = -1.770029e+02*(s-1.850000e+00)-1.371015e+01;
6328  return result;
6329 }
6330 
6331 
6332 static double jarquebera_jbtbl7(double s, ae_state *_state)
6333 {
6334  double x;
6335  double tj;
6336  double tj1;
6337  double result;
6338 
6339 
6340  result = 0;
6341  if( ae_fp_less_eq(s,1.4000) )
6342  {
6343  x = 2*(s-0.000000)/1.400000-1;
6344  tj = 1;
6345  tj1 = x;
6346  jarquebera_jbcheb(x, -1.093681e+00, &tj, &tj1, &result, _state);
6347  jarquebera_jbcheb(x, -1.695911e+00, &tj, &tj1, &result, _state);
6348  jarquebera_jbcheb(x, -7.473192e-01, &tj, &tj1, &result, _state);
6349  jarquebera_jbcheb(x, -1.203236e-01, &tj, &tj1, &result, _state);
6350  jarquebera_jbcheb(x, 6.590379e-02, &tj, &tj1, &result, _state);
6351  jarquebera_jbcheb(x, 6.291876e-02, &tj, &tj1, &result, _state);
6352  jarquebera_jbcheb(x, 3.132007e-02, &tj, &tj1, &result, _state);
6353  jarquebera_jbcheb(x, 9.411147e-03, &tj, &tj1, &result, _state);
6354  jarquebera_jbcheb(x, -1.180067e-03, &tj, &tj1, &result, _state);
6355  jarquebera_jbcheb(x, -3.487610e-03, &tj, &tj1, &result, _state);
6356  jarquebera_jbcheb(x, -2.436561e-03, &tj, &tj1, &result, _state);
6357  if( ae_fp_greater(result,0) )
6358  {
6359  result = 0;
6360  }
6361  return result;
6362  }
6363  if( ae_fp_less_eq(s,3.0000) )
6364  {
6365  x = 2*(s-1.400000)/1.600000-1;
6366  tj = 1;
6367  tj1 = x;
6368  jarquebera_jbcheb(x, -5.947854e+00, &tj, &tj1, &result, _state);
6369  jarquebera_jbcheb(x, -2.772675e+00, &tj, &tj1, &result, _state);
6370  jarquebera_jbcheb(x, -4.707912e-01, &tj, &tj1, &result, _state);
6371  jarquebera_jbcheb(x, -1.691171e-01, &tj, &tj1, &result, _state);
6372  jarquebera_jbcheb(x, -4.132795e-02, &tj, &tj1, &result, _state);
6373  jarquebera_jbcheb(x, -1.481310e-02, &tj, &tj1, &result, _state);
6374  jarquebera_jbcheb(x, 2.867536e-03, &tj, &tj1, &result, _state);
6375  jarquebera_jbcheb(x, 8.772327e-04, &tj, &tj1, &result, _state);
6376  jarquebera_jbcheb(x, 5.033387e-03, &tj, &tj1, &result, _state);
6377  jarquebera_jbcheb(x, -1.378277e-03, &tj, &tj1, &result, _state);
6378  jarquebera_jbcheb(x, -2.497964e-03, &tj, &tj1, &result, _state);
6379  jarquebera_jbcheb(x, -3.636814e-03, &tj, &tj1, &result, _state);
6380  jarquebera_jbcheb(x, -9.581640e-04, &tj, &tj1, &result, _state);
6381  if( ae_fp_greater(result,0) )
6382  {
6383  result = 0;
6384  }
6385  return result;
6386  }
6387  if( ae_fp_less_eq(s,3.2000) )
6388  {
6389  x = 2*(s-3.000000)/0.200000-1;
6390  tj = 1;
6391  tj1 = x;
6392  jarquebera_jbcheb(x, -7.511008e+00, &tj, &tj1, &result, _state);
6393  jarquebera_jbcheb(x, -8.140472e-01, &tj, &tj1, &result, _state);
6394  jarquebera_jbcheb(x, 1.682053e+00, &tj, &tj1, &result, _state);
6395  jarquebera_jbcheb(x, -2.568561e-02, &tj, &tj1, &result, _state);
6396  jarquebera_jbcheb(x, -1.933930e+00, &tj, &tj1, &result, _state);
6397  jarquebera_jbcheb(x, -8.140472e-01, &tj, &tj1, &result, _state);
6398  jarquebera_jbcheb(x, -3.895025e+00, &tj, &tj1, &result, _state);
6399  jarquebera_jbcheb(x, -8.140472e-01, &tj, &tj1, &result, _state);
6400  jarquebera_jbcheb(x, -1.933930e+00, &tj, &tj1, &result, _state);
6401  jarquebera_jbcheb(x, -2.568561e-02, &tj, &tj1, &result, _state);
6402  jarquebera_jbcheb(x, 1.682053e+00, &tj, &tj1, &result, _state);
6403  if( ae_fp_greater(result,0) )
6404  {
6405  result = 0;
6406  }
6407  return result;
6408  }
6409  result = -1.824116e+03*(s-3.200000e+00)-1.440330e+01;
6410  return result;
6411 }
6412 
6413 
6414 static double jarquebera_jbtbl8(double s, ae_state *_state)
6415 {
6416  double x;
6417  double tj;
6418  double tj1;
6419  double result;
6420 
6421 
6422  result = 0;
6423  if( ae_fp_less_eq(s,1.3000) )
6424  {
6425  x = 2*(s-0.000000)/1.300000-1;
6426  tj = 1;
6427  tj1 = x;
6428  jarquebera_jbcheb(x, -7.199015e-01, &tj, &tj1, &result, _state);
6429  jarquebera_jbcheb(x, -1.095921e+00, &tj, &tj1, &result, _state);
6430  jarquebera_jbcheb(x, -4.736828e-01, &tj, &tj1, &result, _state);
6431  jarquebera_jbcheb(x, -1.047438e-01, &tj, &tj1, &result, _state);
6432  jarquebera_jbcheb(x, -2.484320e-03, &tj, &tj1, &result, _state);
6433  jarquebera_jbcheb(x, 7.937923e-03, &tj, &tj1, &result, _state);
6434  jarquebera_jbcheb(x, 4.810470e-03, &tj, &tj1, &result, _state);
6435  jarquebera_jbcheb(x, 2.139780e-03, &tj, &tj1, &result, _state);
6436  jarquebera_jbcheb(x, 6.708443e-04, &tj, &tj1, &result, _state);
6437  if( ae_fp_greater(result,0) )
6438  {
6439  result = 0;
6440  }
6441  return result;
6442  }
6443  if( ae_fp_less_eq(s,2.0000) )
6444  {
6445  x = 2*(s-1.300000)/0.700000-1;
6446  tj = 1;
6447  tj1 = x;
6448  jarquebera_jbcheb(x, -3.378966e+00, &tj, &tj1, &result, _state);
6449  jarquebera_jbcheb(x, -7.802461e-01, &tj, &tj1, &result, _state);
6450  jarquebera_jbcheb(x, 1.547593e-01, &tj, &tj1, &result, _state);
6451  jarquebera_jbcheb(x, -6.241042e-02, &tj, &tj1, &result, _state);
6452  jarquebera_jbcheb(x, 1.203274e-02, &tj, &tj1, &result, _state);
6453  jarquebera_jbcheb(x, 5.201990e-03, &tj, &tj1, &result, _state);
6454  jarquebera_jbcheb(x, -5.125597e-03, &tj, &tj1, &result, _state);
6455  jarquebera_jbcheb(x, 1.584426e-03, &tj, &tj1, &result, _state);
6456  jarquebera_jbcheb(x, 2.546069e-04, &tj, &tj1, &result, _state);
6457  if( ae_fp_greater(result,0) )
6458  {
6459  result = 0;
6460  }
6461  return result;
6462  }
6463  if( ae_fp_less_eq(s,5.0000) )
6464  {
6465  x = 2*(s-2.000000)/3.000000-1;
6466  tj = 1;
6467  tj1 = x;
6468  jarquebera_jbcheb(x, -6.828366e+00, &tj, &tj1, &result, _state);
6469  jarquebera_jbcheb(x, -3.137533e+00, &tj, &tj1, &result, _state);
6470  jarquebera_jbcheb(x, -5.016671e-01, &tj, &tj1, &result, _state);
6471  jarquebera_jbcheb(x, -1.745637e-01, &tj, &tj1, &result, _state);
6472  jarquebera_jbcheb(x, -5.189801e-02, &tj, &tj1, &result, _state);
6473  jarquebera_jbcheb(x, -1.621610e-02, &tj, &tj1, &result, _state);
6474  jarquebera_jbcheb(x, -6.741122e-03, &tj, &tj1, &result, _state);
6475  jarquebera_jbcheb(x, -4.516368e-03, &tj, &tj1, &result, _state);
6476  jarquebera_jbcheb(x, 3.552085e-04, &tj, &tj1, &result, _state);
6477  jarquebera_jbcheb(x, 2.787029e-03, &tj, &tj1, &result, _state);
6478  jarquebera_jbcheb(x, 5.359774e-03, &tj, &tj1, &result, _state);
6479  if( ae_fp_greater(result,0) )
6480  {
6481  result = 0;
6482  }
6483  return result;
6484  }
6485  result = -5.087028e+00*(s-5.000000e+00)-1.071300e+01;
6486  return result;
6487 }
6488 
6489 
6490 static double jarquebera_jbtbl9(double s, ae_state *_state)
6491 {
6492  double x;
6493  double tj;
6494  double tj1;
6495  double result;
6496 
6497 
6498  result = 0;
6499  if( ae_fp_less_eq(s,1.3000) )
6500  {
6501  x = 2*(s-0.000000)/1.300000-1;
6502  tj = 1;
6503  tj1 = x;
6504  jarquebera_jbcheb(x, -6.279320e-01, &tj, &tj1, &result, _state);
6505  jarquebera_jbcheb(x, -9.277151e-01, &tj, &tj1, &result, _state);
6506  jarquebera_jbcheb(x, -3.669339e-01, &tj, &tj1, &result, _state);
6507  jarquebera_jbcheb(x, -7.086149e-02, &tj, &tj1, &result, _state);
6508  jarquebera_jbcheb(x, -1.333816e-03, &tj, &tj1, &result, _state);
6509  jarquebera_jbcheb(x, 3.871249e-03, &tj, &tj1, &result, _state);
6510  jarquebera_jbcheb(x, 2.007048e-03, &tj, &tj1, &result, _state);
6511  jarquebera_jbcheb(x, 7.482245e-04, &tj, &tj1, &result, _state);
6512  jarquebera_jbcheb(x, 2.355615e-04, &tj, &tj1, &result, _state);
6513  if( ae_fp_greater(result,0) )
6514  {
6515  result = 0;
6516  }
6517  return result;
6518  }
6519  if( ae_fp_less_eq(s,2.0000) )
6520  {
6521  x = 2*(s-1.300000)/0.700000-1;
6522  tj = 1;
6523  tj1 = x;
6524  jarquebera_jbcheb(x, -2.981430e+00, &tj, &tj1, &result, _state);
6525  jarquebera_jbcheb(x, -7.972248e-01, &tj, &tj1, &result, _state);
6526  jarquebera_jbcheb(x, 1.747737e-01, &tj, &tj1, &result, _state);
6527  jarquebera_jbcheb(x, -3.808530e-02, &tj, &tj1, &result, _state);
6528  jarquebera_jbcheb(x, -7.888305e-03, &tj, &tj1, &result, _state);
6529  jarquebera_jbcheb(x, 9.001302e-03, &tj, &tj1, &result, _state);
6530  jarquebera_jbcheb(x, -1.378767e-03, &tj, &tj1, &result, _state);
6531  jarquebera_jbcheb(x, -1.108510e-03, &tj, &tj1, &result, _state);
6532  jarquebera_jbcheb(x, 5.915372e-04, &tj, &tj1, &result, _state);
6533  if( ae_fp_greater(result,0) )
6534  {
6535  result = 0;
6536  }
6537  return result;
6538  }
6539  if( ae_fp_less_eq(s,7.0000) )
6540  {
6541  x = 2*(s-2.000000)/5.000000-1;
6542  tj = 1;
6543  tj1 = x;
6544  jarquebera_jbcheb(x, -6.387463e+00, &tj, &tj1, &result, _state);
6545  jarquebera_jbcheb(x, -2.845231e+00, &tj, &tj1, &result, _state);
6546  jarquebera_jbcheb(x, -1.809956e-01, &tj, &tj1, &result, _state);
6547  jarquebera_jbcheb(x, -7.543461e-02, &tj, &tj1, &result, _state);
6548  jarquebera_jbcheb(x, -4.880397e-03, &tj, &tj1, &result, _state);
6549  jarquebera_jbcheb(x, -1.160074e-02, &tj, &tj1, &result, _state);
6550  jarquebera_jbcheb(x, -7.356527e-03, &tj, &tj1, &result, _state);
6551  jarquebera_jbcheb(x, -4.394428e-03, &tj, &tj1, &result, _state);
6552  jarquebera_jbcheb(x, 9.619892e-04, &tj, &tj1, &result, _state);
6553  jarquebera_jbcheb(x, -2.758763e-04, &tj, &tj1, &result, _state);
6554  jarquebera_jbcheb(x, 4.790977e-05, &tj, &tj1, &result, _state);
6555  if( ae_fp_greater(result,0) )
6556  {
6557  result = 0;
6558  }
6559  return result;
6560  }
6561  result = -2.020952e+00*(s-7.000000e+00)-9.516623e+00;
6562  return result;
6563 }
6564 
6565 
6566 static double jarquebera_jbtbl10(double s, ae_state *_state)
6567 {
6568  double x;
6569  double tj;
6570  double tj1;
6571  double result;
6572 
6573 
6574  result = 0;
6575  if( ae_fp_less_eq(s,1.2000) )
6576  {
6577  x = 2*(s-0.000000)/1.200000-1;
6578  tj = 1;
6579  tj1 = x;
6580  jarquebera_jbcheb(x, -4.590993e-01, &tj, &tj1, &result, _state);
6581  jarquebera_jbcheb(x, -6.562730e-01, &tj, &tj1, &result, _state);
6582  jarquebera_jbcheb(x, -2.353934e-01, &tj, &tj1, &result, _state);
6583  jarquebera_jbcheb(x, -4.069933e-02, &tj, &tj1, &result, _state);
6584  jarquebera_jbcheb(x, -1.849151e-03, &tj, &tj1, &result, _state);
6585  jarquebera_jbcheb(x, 8.931406e-04, &tj, &tj1, &result, _state);
6586  jarquebera_jbcheb(x, 3.636295e-04, &tj, &tj1, &result, _state);
6587  jarquebera_jbcheb(x, 1.178340e-05, &tj, &tj1, &result, _state);
6588  jarquebera_jbcheb(x, -8.917749e-05, &tj, &tj1, &result, _state);
6589  if( ae_fp_greater(result,0) )
6590  {
6591  result = 0;
6592  }
6593  return result;
6594  }
6595  if( ae_fp_less_eq(s,2.0000) )
6596  {
6597  x = 2*(s-1.200000)/0.800000-1;
6598  tj = 1;
6599  tj1 = x;
6600  jarquebera_jbcheb(x, -2.537658e+00, &tj, &tj1, &result, _state);
6601  jarquebera_jbcheb(x, -9.962401e-01, &tj, &tj1, &result, _state);
6602  jarquebera_jbcheb(x, 1.838715e-01, &tj, &tj1, &result, _state);
6603  jarquebera_jbcheb(x, 1.055792e-02, &tj, &tj1, &result, _state);
6604  jarquebera_jbcheb(x, -2.580316e-02, &tj, &tj1, &result, _state);
6605  jarquebera_jbcheb(x, 1.781701e-03, &tj, &tj1, &result, _state);
6606  jarquebera_jbcheb(x, 3.770362e-03, &tj, &tj1, &result, _state);
6607  jarquebera_jbcheb(x, -4.838983e-04, &tj, &tj1, &result, _state);
6608  jarquebera_jbcheb(x, -6.999052e-04, &tj, &tj1, &result, _state);
6609  if( ae_fp_greater(result,0) )
6610  {
6611  result = 0;
6612  }
6613  return result;
6614  }
6615  if( ae_fp_less_eq(s,7.0000) )
6616  {
6617  x = 2*(s-2.000000)/5.000000-1;
6618  tj = 1;
6619  tj1 = x;
6620  jarquebera_jbcheb(x, -5.337524e+00, &tj, &tj1, &result, _state);
6621  jarquebera_jbcheb(x, -1.877029e+00, &tj, &tj1, &result, _state);
6622  jarquebera_jbcheb(x, 4.734650e-02, &tj, &tj1, &result, _state);
6623  jarquebera_jbcheb(x, -4.249254e-02, &tj, &tj1, &result, _state);
6624  jarquebera_jbcheb(x, 3.320250e-03, &tj, &tj1, &result, _state);
6625  jarquebera_jbcheb(x, -6.432266e-03, &tj, &tj1, &result, _state);
6626  if( ae_fp_greater(result,0) )
6627  {
6628  result = 0;
6629  }
6630  return result;
6631  }
6632  result = -8.711035e-01*(s-7.000000e+00)-7.212811e+00;
6633  return result;
6634 }
6635 
6636 
6637 static double jarquebera_jbtbl11(double s, ae_state *_state)
6638 {
6639  double x;
6640  double tj;
6641  double tj1;
6642  double result;
6643 
6644 
6645  result = 0;
6646  if( ae_fp_less_eq(s,1.2000) )
6647  {
6648  x = 2*(s-0.000000)/1.200000-1;
6649  tj = 1;
6650  tj1 = x;
6651  jarquebera_jbcheb(x, -4.339517e-01, &tj, &tj1, &result, _state);
6652  jarquebera_jbcheb(x, -6.051558e-01, &tj, &tj1, &result, _state);
6653  jarquebera_jbcheb(x, -2.000992e-01, &tj, &tj1, &result, _state);
6654  jarquebera_jbcheb(x, -3.022547e-02, &tj, &tj1, &result, _state);
6655  jarquebera_jbcheb(x, -9.808401e-04, &tj, &tj1, &result, _state);
6656  jarquebera_jbcheb(x, 5.592870e-04, &tj, &tj1, &result, _state);
6657  jarquebera_jbcheb(x, 3.575081e-04, &tj, &tj1, &result, _state);
6658  jarquebera_jbcheb(x, 2.086173e-04, &tj, &tj1, &result, _state);
6659  jarquebera_jbcheb(x, 6.089011e-05, &tj, &tj1, &result, _state);
6660  if( ae_fp_greater(result,0) )
6661  {
6662  result = 0;
6663  }
6664  return result;
6665  }
6666  if( ae_fp_less_eq(s,2.2500) )
6667  {
6668  x = 2*(s-1.200000)/1.050000-1;
6669  tj = 1;
6670  tj1 = x;
6671  jarquebera_jbcheb(x, -2.523221e+00, &tj, &tj1, &result, _state);
6672  jarquebera_jbcheb(x, -1.068388e+00, &tj, &tj1, &result, _state);
6673  jarquebera_jbcheb(x, 2.179661e-01, &tj, &tj1, &result, _state);
6674  jarquebera_jbcheb(x, -1.555524e-03, &tj, &tj1, &result, _state);
6675  jarquebera_jbcheb(x, -3.238964e-02, &tj, &tj1, &result, _state);
6676  jarquebera_jbcheb(x, 7.364320e-03, &tj, &tj1, &result, _state);
6677  jarquebera_jbcheb(x, 4.895771e-03, &tj, &tj1, &result, _state);
6678  jarquebera_jbcheb(x, -1.762774e-03, &tj, &tj1, &result, _state);
6679  jarquebera_jbcheb(x, -8.201340e-04, &tj, &tj1, &result, _state);
6680  if( ae_fp_greater(result,0) )
6681  {
6682  result = 0;
6683  }
6684  return result;
6685  }
6686  if( ae_fp_less_eq(s,8.0000) )
6687  {
6688  x = 2*(s-2.250000)/5.750000-1;
6689  tj = 1;
6690  tj1 = x;
6691  jarquebera_jbcheb(x, -5.212179e+00, &tj, &tj1, &result, _state);
6692  jarquebera_jbcheb(x, -1.684579e+00, &tj, &tj1, &result, _state);
6693  jarquebera_jbcheb(x, 8.299519e-02, &tj, &tj1, &result, _state);
6694  jarquebera_jbcheb(x, -3.606261e-02, &tj, &tj1, &result, _state);
6695  jarquebera_jbcheb(x, 7.310869e-03, &tj, &tj1, &result, _state);
6696  jarquebera_jbcheb(x, -3.320115e-03, &tj, &tj1, &result, _state);
6697  if( ae_fp_greater(result,0) )
6698  {
6699  result = 0;
6700  }
6701  return result;
6702  }
6703  result = -5.715445e-01*(s-8.000000e+00)-6.845834e+00;
6704  return result;
6705 }
6706 
6707 
6708 static double jarquebera_jbtbl12(double s, ae_state *_state)
6709 {
6710  double x;
6711  double tj;
6712  double tj1;
6713  double result;
6714 
6715 
6716  result = 0;
6717  if( ae_fp_less_eq(s,1.0000) )
6718  {
6719  x = 2*(s-0.000000)/1.000000-1;
6720  tj = 1;
6721  tj1 = x;
6722  jarquebera_jbcheb(x, -2.736742e-01, &tj, &tj1, &result, _state);
6723  jarquebera_jbcheb(x, -3.657836e-01, &tj, &tj1, &result, _state);
6724  jarquebera_jbcheb(x, -1.047209e-01, &tj, &tj1, &result, _state);
6725  jarquebera_jbcheb(x, -1.319599e-02, &tj, &tj1, &result, _state);
6726  jarquebera_jbcheb(x, -5.545631e-04, &tj, &tj1, &result, _state);
6727  jarquebera_jbcheb(x, 9.280445e-05, &tj, &tj1, &result, _state);
6728  jarquebera_jbcheb(x, 2.815679e-05, &tj, &tj1, &result, _state);
6729  jarquebera_jbcheb(x, -2.213519e-05, &tj, &tj1, &result, _state);
6730  jarquebera_jbcheb(x, 1.256838e-05, &tj, &tj1, &result, _state);
6731  if( ae_fp_greater(result,0) )
6732  {
6733  result = 0;
6734  }
6735  return result;
6736  }
6737  if( ae_fp_less_eq(s,3.0000) )
6738  {
6739  x = 2*(s-1.000000)/2.000000-1;
6740  tj = 1;
6741  tj1 = x;
6742  jarquebera_jbcheb(x, -2.573947e+00, &tj, &tj1, &result, _state);
6743  jarquebera_jbcheb(x, -1.515287e+00, &tj, &tj1, &result, _state);
6744  jarquebera_jbcheb(x, 3.611880e-01, &tj, &tj1, &result, _state);
6745  jarquebera_jbcheb(x, -3.271311e-02, &tj, &tj1, &result, _state);
6746  jarquebera_jbcheb(x, -6.495815e-02, &tj, &tj1, &result, _state);
6747  jarquebera_jbcheb(x, 4.141186e-02, &tj, &tj1, &result, _state);
6748  jarquebera_jbcheb(x, 7.180886e-04, &tj, &tj1, &result, _state);
6749  jarquebera_jbcheb(x, -1.388211e-02, &tj, &tj1, &result, _state);
6750  jarquebera_jbcheb(x, 4.890761e-03, &tj, &tj1, &result, _state);
6751  jarquebera_jbcheb(x, 3.233175e-03, &tj, &tj1, &result, _state);
6752  jarquebera_jbcheb(x, -2.946156e-03, &tj, &tj1, &result, _state);
6753  if( ae_fp_greater(result,0) )
6754  {
6755  result = 0;
6756  }
6757  return result;
6758  }
6759  if( ae_fp_less_eq(s,12.0000) )
6760  {
6761  x = 2*(s-3.000000)/9.000000-1;
6762  tj = 1;
6763  tj1 = x;
6764  jarquebera_jbcheb(x, -5.947819e+00, &tj, &tj1, &result, _state);
6765  jarquebera_jbcheb(x, -2.034157e+00, &tj, &tj1, &result, _state);
6766  jarquebera_jbcheb(x, 6.878986e-02, &tj, &tj1, &result, _state);
6767  jarquebera_jbcheb(x, -4.078603e-02, &tj, &tj1, &result, _state);
6768  jarquebera_jbcheb(x, 6.990977e-03, &tj, &tj1, &result, _state);
6769  jarquebera_jbcheb(x, -2.866215e-03, &tj, &tj1, &result, _state);
6770  jarquebera_jbcheb(x, 3.897866e-03, &tj, &tj1, &result, _state);
6771  jarquebera_jbcheb(x, 2.512252e-03, &tj, &tj1, &result, _state);
6772  jarquebera_jbcheb(x, 2.073743e-03, &tj, &tj1, &result, _state);
6773  jarquebera_jbcheb(x, 3.022621e-03, &tj, &tj1, &result, _state);
6774  jarquebera_jbcheb(x, 1.501343e-03, &tj, &tj1, &result, _state);
6775  if( ae_fp_greater(result,0) )
6776  {
6777  result = 0;
6778  }
6779  return result;
6780  }
6781  result = -2.877243e-01*(s-1.200000e+01)-7.936839e+00;
6782  return result;
6783 }
6784 
6785 
6786 static double jarquebera_jbtbl13(double s, ae_state *_state)
6787 {
6788  double x;
6789  double tj;
6790  double tj1;
6791  double result;
6792 
6793 
6794  result = 0;
6795  if( ae_fp_less_eq(s,1.0000) )
6796  {
6797  x = 2*(s-0.000000)/1.000000-1;
6798  tj = 1;
6799  tj1 = x;
6800  jarquebera_jbcheb(x, -2.713276e-01, &tj, &tj1, &result, _state);
6801  jarquebera_jbcheb(x, -3.557541e-01, &tj, &tj1, &result, _state);
6802  jarquebera_jbcheb(x, -9.459092e-02, &tj, &tj1, &result, _state);
6803  jarquebera_jbcheb(x, -1.044145e-02, &tj, &tj1, &result, _state);
6804  jarquebera_jbcheb(x, -2.546132e-04, &tj, &tj1, &result, _state);
6805  jarquebera_jbcheb(x, 1.002374e-04, &tj, &tj1, &result, _state);
6806  jarquebera_jbcheb(x, 2.349456e-05, &tj, &tj1, &result, _state);
6807  jarquebera_jbcheb(x, -7.025669e-05, &tj, &tj1, &result, _state);
6808  jarquebera_jbcheb(x, -1.590242e-05, &tj, &tj1, &result, _state);
6809  if( ae_fp_greater(result,0) )
6810  {
6811  result = 0;
6812  }
6813  return result;
6814  }
6815  if( ae_fp_less_eq(s,3.0000) )
6816  {
6817  x = 2*(s-1.000000)/2.000000-1;
6818  tj = 1;
6819  tj1 = x;
6820  jarquebera_jbcheb(x, -2.454383e+00, &tj, &tj1, &result, _state);
6821  jarquebera_jbcheb(x, -1.467539e+00, &tj, &tj1, &result, _state);
6822  jarquebera_jbcheb(x, 3.270774e-01, &tj, &tj1, &result, _state);
6823  jarquebera_jbcheb(x, -8.075763e-03, &tj, &tj1, &result, _state);
6824  jarquebera_jbcheb(x, -6.611647e-02, &tj, &tj1, &result, _state);
6825  jarquebera_jbcheb(x, 2.990785e-02, &tj, &tj1, &result, _state);
6826  jarquebera_jbcheb(x, 8.109212e-03, &tj, &tj1, &result, _state);
6827  jarquebera_jbcheb(x, -1.135031e-02, &tj, &tj1, &result, _state);
6828  jarquebera_jbcheb(x, 5.915919e-04, &tj, &tj1, &result, _state);
6829  jarquebera_jbcheb(x, 3.522390e-03, &tj, &tj1, &result, _state);
6830  jarquebera_jbcheb(x, -1.144701e-03, &tj, &tj1, &result, _state);
6831  if( ae_fp_greater(result,0) )
6832  {
6833  result = 0;
6834  }
6835  return result;
6836  }
6837  if( ae_fp_less_eq(s,13.0000) )
6838  {
6839  x = 2*(s-3.000000)/10.000000-1;
6840  tj = 1;
6841  tj1 = x;
6842  jarquebera_jbcheb(x, -5.736127e+00, &tj, &tj1, &result, _state);
6843  jarquebera_jbcheb(x, -1.920809e+00, &tj, &tj1, &result, _state);
6844  jarquebera_jbcheb(x, 1.175858e-01, &tj, &tj1, &result, _state);
6845  jarquebera_jbcheb(x, -4.002049e-02, &tj, &tj1, &result, _state);
6846  jarquebera_jbcheb(x, 1.158966e-02, &tj, &tj1, &result, _state);
6847  jarquebera_jbcheb(x, -3.157781e-03, &tj, &tj1, &result, _state);
6848  jarquebera_jbcheb(x, 2.762172e-03, &tj, &tj1, &result, _state);
6849  jarquebera_jbcheb(x, 5.780347e-04, &tj, &tj1, &result, _state);
6850  jarquebera_jbcheb(x, -1.193310e-03, &tj, &tj1, &result, _state);
6851  jarquebera_jbcheb(x, -2.442421e-05, &tj, &tj1, &result, _state);
6852  jarquebera_jbcheb(x, 2.547756e-03, &tj, &tj1, &result, _state);
6853  if( ae_fp_greater(result,0) )
6854  {
6855  result = 0;
6856  }
6857  return result;
6858  }
6859  result = -2.799944e-01*(s-1.300000e+01)-7.566269e+00;
6860  return result;
6861 }
6862 
6863 
6864 static double jarquebera_jbtbl14(double s, ae_state *_state)
6865 {
6866  double x;
6867  double tj;
6868  double tj1;
6869  double result;
6870 
6871 
6872  result = 0;
6873  if( ae_fp_less_eq(s,1.0000) )
6874  {
6875  x = 2*(s-0.000000)/1.000000-1;
6876  tj = 1;
6877  tj1 = x;
6878  jarquebera_jbcheb(x, -2.698527e-01, &tj, &tj1, &result, _state);
6879  jarquebera_jbcheb(x, -3.479081e-01, &tj, &tj1, &result, _state);
6880  jarquebera_jbcheb(x, -8.640733e-02, &tj, &tj1, &result, _state);
6881  jarquebera_jbcheb(x, -8.466899e-03, &tj, &tj1, &result, _state);
6882  jarquebera_jbcheb(x, -1.469485e-04, &tj, &tj1, &result, _state);
6883  jarquebera_jbcheb(x, 2.150009e-05, &tj, &tj1, &result, _state);
6884  jarquebera_jbcheb(x, 1.965975e-05, &tj, &tj1, &result, _state);
6885  jarquebera_jbcheb(x, -4.710210e-05, &tj, &tj1, &result, _state);
6886  jarquebera_jbcheb(x, -1.327808e-05, &tj, &tj1, &result, _state);
6887  if( ae_fp_greater(result,0) )
6888  {
6889  result = 0;
6890  }
6891  return result;
6892  }
6893  if( ae_fp_less_eq(s,3.0000) )
6894  {
6895  x = 2*(s-1.000000)/2.000000-1;
6896  tj = 1;
6897  tj1 = x;
6898  jarquebera_jbcheb(x, -2.350359e+00, &tj, &tj1, &result, _state);
6899  jarquebera_jbcheb(x, -1.421365e+00, &tj, &tj1, &result, _state);
6900  jarquebera_jbcheb(x, 2.960468e-01, &tj, &tj1, &result, _state);
6901  jarquebera_jbcheb(x, 1.149167e-02, &tj, &tj1, &result, _state);
6902  jarquebera_jbcheb(x, -6.361109e-02, &tj, &tj1, &result, _state);
6903  jarquebera_jbcheb(x, 1.976022e-02, &tj, &tj1, &result, _state);
6904  jarquebera_jbcheb(x, 1.082700e-02, &tj, &tj1, &result, _state);
6905  jarquebera_jbcheb(x, -8.563328e-03, &tj, &tj1, &result, _state);
6906  jarquebera_jbcheb(x, -1.453123e-03, &tj, &tj1, &result, _state);
6907  jarquebera_jbcheb(x, 2.917559e-03, &tj, &tj1, &result, _state);
6908  jarquebera_jbcheb(x, -1.151067e-05, &tj, &tj1, &result, _state);
6909  if( ae_fp_greater(result,0) )
6910  {
6911  result = 0;
6912  }
6913  return result;
6914  }
6915  if( ae_fp_less_eq(s,15.0000) )
6916  {
6917  x = 2*(s-3.000000)/12.000000-1;
6918  tj = 1;
6919  tj1 = x;
6920  jarquebera_jbcheb(x, -5.746892e+00, &tj, &tj1, &result, _state);
6921  jarquebera_jbcheb(x, -2.010441e+00, &tj, &tj1, &result, _state);
6922  jarquebera_jbcheb(x, 1.566146e-01, &tj, &tj1, &result, _state);
6923  jarquebera_jbcheb(x, -5.129690e-02, &tj, &tj1, &result, _state);
6924  jarquebera_jbcheb(x, 1.929724e-02, &tj, &tj1, &result, _state);
6925  jarquebera_jbcheb(x, -2.524227e-03, &tj, &tj1, &result, _state);
6926  jarquebera_jbcheb(x, 3.192933e-03, &tj, &tj1, &result, _state);
6927  jarquebera_jbcheb(x, -4.254730e-04, &tj, &tj1, &result, _state);
6928  jarquebera_jbcheb(x, 1.620685e-03, &tj, &tj1, &result, _state);
6929  jarquebera_jbcheb(x, 7.289618e-04, &tj, &tj1, &result, _state);
6930  jarquebera_jbcheb(x, -2.112350e-03, &tj, &tj1, &result, _state);
6931  if( ae_fp_greater(result,0) )
6932  {
6933  result = 0;
6934  }
6935  return result;
6936  }
6937  result = -2.590621e-01*(s-1.500000e+01)-7.632238e+00;
6938  return result;
6939 }
6940 
6941 
6942 static double jarquebera_jbtbl15(double s, ae_state *_state)
6943 {
6944  double x;
6945  double tj;
6946  double tj1;
6947  double result;
6948 
6949 
6950  result = 0;
6951  if( ae_fp_less_eq(s,2.0000) )
6952  {
6953  x = 2*(s-0.000000)/2.000000-1;
6954  tj = 1;
6955  tj1 = x;
6956  jarquebera_jbcheb(x, -1.043660e+00, &tj, &tj1, &result, _state);
6957  jarquebera_jbcheb(x, -1.361653e+00, &tj, &tj1, &result, _state);
6958  jarquebera_jbcheb(x, -3.009497e-01, &tj, &tj1, &result, _state);
6959  jarquebera_jbcheb(x, 4.951784e-02, &tj, &tj1, &result, _state);
6960  jarquebera_jbcheb(x, 4.377903e-02, &tj, &tj1, &result, _state);
6961  jarquebera_jbcheb(x, 1.003253e-02, &tj, &tj1, &result, _state);
6962  jarquebera_jbcheb(x, -1.271309e-03, &tj, &tj1, &result, _state);
6963  if( ae_fp_greater(result,0) )
6964  {
6965  result = 0;
6966  }
6967  return result;
6968  }
6969  if( ae_fp_less_eq(s,5.0000) )
6970  {
6971  x = 2*(s-2.000000)/3.000000-1;
6972  tj = 1;
6973  tj1 = x;
6974  jarquebera_jbcheb(x, -3.582778e+00, &tj, &tj1, &result, _state);
6975  jarquebera_jbcheb(x, -8.349578e-01, &tj, &tj1, &result, _state);
6976  jarquebera_jbcheb(x, 9.476514e-02, &tj, &tj1, &result, _state);
6977  jarquebera_jbcheb(x, -2.717385e-02, &tj, &tj1, &result, _state);
6978  jarquebera_jbcheb(x, 1.222591e-02, &tj, &tj1, &result, _state);
6979  jarquebera_jbcheb(x, -6.635124e-03, &tj, &tj1, &result, _state);
6980  jarquebera_jbcheb(x, 2.815993e-03, &tj, &tj1, &result, _state);
6981  if( ae_fp_greater(result,0) )
6982  {
6983  result = 0;
6984  }
6985  return result;
6986  }
6987  if( ae_fp_less_eq(s,17.0000) )
6988  {
6989  x = 2*(s-5.000000)/12.000000-1;
6990  tj = 1;
6991  tj1 = x;
6992  jarquebera_jbcheb(x, -6.115476e+00, &tj, &tj1, &result, _state);
6993  jarquebera_jbcheb(x, -1.655936e+00, &tj, &tj1, &result, _state);
6994  jarquebera_jbcheb(x, 8.404310e-02, &tj, &tj1, &result, _state);
6995  jarquebera_jbcheb(x, -2.663794e-02, &tj, &tj1, &result, _state);
6996  jarquebera_jbcheb(x, 8.868618e-03, &tj, &tj1, &result, _state);
6997  jarquebera_jbcheb(x, 1.381447e-03, &tj, &tj1, &result, _state);
6998  jarquebera_jbcheb(x, 9.444801e-04, &tj, &tj1, &result, _state);
6999  jarquebera_jbcheb(x, -1.581503e-04, &tj, &tj1, &result, _state);
7000  jarquebera_jbcheb(x, -9.468696e-04, &tj, &tj1, &result, _state);
7001  jarquebera_jbcheb(x, 1.728509e-03, &tj, &tj1, &result, _state);
7002  jarquebera_jbcheb(x, 1.206470e-03, &tj, &tj1, &result, _state);
7003  if( ae_fp_greater(result,0) )
7004  {
7005  result = 0;
7006  }
7007  return result;
7008  }
7009  result = -1.927937e-01*(s-1.700000e+01)-7.700983e+00;
7010  return result;
7011 }
7012 
7013 
7014 static double jarquebera_jbtbl16(double s, ae_state *_state)
7015 {
7016  double x;
7017  double tj;
7018  double tj1;
7019  double result;
7020 
7021 
7022  result = 0;
7023  if( ae_fp_less_eq(s,2.0000) )
7024  {
7025  x = 2*(s-0.000000)/2.000000-1;
7026  tj = 1;
7027  tj1 = x;
7028  jarquebera_jbcheb(x, -1.002570e+00, &tj, &tj1, &result, _state);
7029  jarquebera_jbcheb(x, -1.298141e+00, &tj, &tj1, &result, _state);
7030  jarquebera_jbcheb(x, -2.832803e-01, &tj, &tj1, &result, _state);
7031  jarquebera_jbcheb(x, 3.877026e-02, &tj, &tj1, &result, _state);
7032  jarquebera_jbcheb(x, 3.539436e-02, &tj, &tj1, &result, _state);
7033  jarquebera_jbcheb(x, 8.439658e-03, &tj, &tj1, &result, _state);
7034  jarquebera_jbcheb(x, -4.756911e-04, &tj, &tj1, &result, _state);
7035  if( ae_fp_greater(result,0) )
7036  {
7037  result = 0;
7038  }
7039  return result;
7040  }
7041  if( ae_fp_less_eq(s,5.0000) )
7042  {
7043  x = 2*(s-2.000000)/3.000000-1;
7044  tj = 1;
7045  tj1 = x;
7046  jarquebera_jbcheb(x, -3.486198e+00, &tj, &tj1, &result, _state);
7047  jarquebera_jbcheb(x, -8.242944e-01, &tj, &tj1, &result, _state);
7048  jarquebera_jbcheb(x, 1.020002e-01, &tj, &tj1, &result, _state);
7049  jarquebera_jbcheb(x, -3.130531e-02, &tj, &tj1, &result, _state);
7050  jarquebera_jbcheb(x, 1.512373e-02, &tj, &tj1, &result, _state);
7051  jarquebera_jbcheb(x, -8.054876e-03, &tj, &tj1, &result, _state);
7052  jarquebera_jbcheb(x, 3.556839e-03, &tj, &tj1, &result, _state);
7053  if( ae_fp_greater(result,0) )
7054  {
7055  result = 0;
7056  }
7057  return result;
7058  }
7059  if( ae_fp_less_eq(s,20.0000) )
7060  {
7061  x = 2*(s-5.000000)/15.000000-1;
7062  tj = 1;
7063  tj1 = x;
7064  jarquebera_jbcheb(x, -6.241608e+00, &tj, &tj1, &result, _state);
7065  jarquebera_jbcheb(x, -1.832655e+00, &tj, &tj1, &result, _state);
7066  jarquebera_jbcheb(x, 1.340545e-01, &tj, &tj1, &result, _state);
7067  jarquebera_jbcheb(x, -3.361143e-02, &tj, &tj1, &result, _state);
7068  jarquebera_jbcheb(x, 1.283219e-02, &tj, &tj1, &result, _state);
7069  jarquebera_jbcheb(x, 3.484549e-03, &tj, &tj1, &result, _state);
7070  jarquebera_jbcheb(x, 1.805968e-03, &tj, &tj1, &result, _state);
7071  jarquebera_jbcheb(x, -2.057243e-03, &tj, &tj1, &result, _state);
7072  jarquebera_jbcheb(x, -1.454439e-03, &tj, &tj1, &result, _state);
7073  jarquebera_jbcheb(x, -2.177513e-03, &tj, &tj1, &result, _state);
7074  jarquebera_jbcheb(x, -1.819209e-03, &tj, &tj1, &result, _state);
7075  if( ae_fp_greater(result,0) )
7076  {
7077  result = 0;
7078  }
7079  return result;
7080  }
7081  result = -2.391580e-01*(s-2.000000e+01)-7.963205e+00;
7082  return result;
7083 }
7084 
7085 
7086 static double jarquebera_jbtbl17(double s, ae_state *_state)
7087 {
7088  double x;
7089  double tj;
7090  double tj1;
7091  double result;
7092 
7093 
7094  result = 0;
7095  if( ae_fp_less_eq(s,3.0000) )
7096  {
7097  x = 2*(s-0.000000)/3.000000-1;
7098  tj = 1;
7099  tj1 = x;
7100  jarquebera_jbcheb(x, -1.566973e+00, &tj, &tj1, &result, _state);
7101  jarquebera_jbcheb(x, -1.810330e+00, &tj, &tj1, &result, _state);
7102  jarquebera_jbcheb(x, -4.840039e-02, &tj, &tj1, &result, _state);
7103  jarquebera_jbcheb(x, 2.337294e-01, &tj, &tj1, &result, _state);
7104  jarquebera_jbcheb(x, -5.383549e-04, &tj, &tj1, &result, _state);
7105  jarquebera_jbcheb(x, -5.556515e-02, &tj, &tj1, &result, _state);
7106  jarquebera_jbcheb(x, -8.656965e-03, &tj, &tj1, &result, _state);
7107  jarquebera_jbcheb(x, 1.404569e-02, &tj, &tj1, &result, _state);
7108  jarquebera_jbcheb(x, 6.447867e-03, &tj, &tj1, &result, _state);
7109  if( ae_fp_greater(result,0) )
7110  {
7111  result = 0;
7112  }
7113  return result;
7114  }
7115  if( ae_fp_less_eq(s,6.0000) )
7116  {
7117  x = 2*(s-3.000000)/3.000000-1;
7118  tj = 1;
7119  tj1 = x;
7120  jarquebera_jbcheb(x, -3.905684e+00, &tj, &tj1, &result, _state);
7121  jarquebera_jbcheb(x, -6.222920e-01, &tj, &tj1, &result, _state);
7122  jarquebera_jbcheb(x, 4.146667e-02, &tj, &tj1, &result, _state);
7123  jarquebera_jbcheb(x, -4.809176e-03, &tj, &tj1, &result, _state);
7124  jarquebera_jbcheb(x, 1.057028e-03, &tj, &tj1, &result, _state);
7125  jarquebera_jbcheb(x, -1.211838e-04, &tj, &tj1, &result, _state);
7126  jarquebera_jbcheb(x, -4.099683e-04, &tj, &tj1, &result, _state);
7127  jarquebera_jbcheb(x, 1.161105e-04, &tj, &tj1, &result, _state);
7128  jarquebera_jbcheb(x, 2.225465e-04, &tj, &tj1, &result, _state);
7129  if( ae_fp_greater(result,0) )
7130  {
7131  result = 0;
7132  }
7133  return result;
7134  }
7135  if( ae_fp_less_eq(s,24.0000) )
7136  {
7137  x = 2*(s-6.000000)/18.000000-1;
7138  tj = 1;
7139  tj1 = x;
7140  jarquebera_jbcheb(x, -6.594282e+00, &tj, &tj1, &result, _state);
7141  jarquebera_jbcheb(x, -1.917838e+00, &tj, &tj1, &result, _state);
7142  jarquebera_jbcheb(x, 1.455980e-01, &tj, &tj1, &result, _state);
7143  jarquebera_jbcheb(x, -2.999589e-02, &tj, &tj1, &result, _state);
7144  jarquebera_jbcheb(x, 5.604263e-03, &tj, &tj1, &result, _state);
7145  jarquebera_jbcheb(x, -3.484445e-03, &tj, &tj1, &result, _state);
7146  jarquebera_jbcheb(x, -1.819937e-03, &tj, &tj1, &result, _state);
7147  jarquebera_jbcheb(x, -2.930390e-03, &tj, &tj1, &result, _state);
7148  jarquebera_jbcheb(x, 2.771761e-04, &tj, &tj1, &result, _state);
7149  jarquebera_jbcheb(x, -6.232581e-04, &tj, &tj1, &result, _state);
7150  jarquebera_jbcheb(x, -7.029083e-04, &tj, &tj1, &result, _state);
7151  if( ae_fp_greater(result,0) )
7152  {
7153  result = 0;
7154  }
7155  return result;
7156  }
7157  result = -2.127771e-01*(s-2.400000e+01)-8.400197e+00;
7158  return result;
7159 }
7160 
7161 
7162 static double jarquebera_jbtbl18(double s, ae_state *_state)
7163 {
7164  double x;
7165  double tj;
7166  double tj1;
7167  double result;
7168 
7169 
7170  result = 0;
7171  if( ae_fp_less_eq(s,3.0000) )
7172  {
7173  x = 2*(s-0.000000)/3.000000-1;
7174  tj = 1;
7175  tj1 = x;
7176  jarquebera_jbcheb(x, -1.526802e+00, &tj, &tj1, &result, _state);
7177  jarquebera_jbcheb(x, -1.762373e+00, &tj, &tj1, &result, _state);
7178  jarquebera_jbcheb(x, -5.598890e-02, &tj, &tj1, &result, _state);
7179  jarquebera_jbcheb(x, 2.189437e-01, &tj, &tj1, &result, _state);
7180  jarquebera_jbcheb(x, 5.971721e-03, &tj, &tj1, &result, _state);
7181  jarquebera_jbcheb(x, -4.823067e-02, &tj, &tj1, &result, _state);
7182  jarquebera_jbcheb(x, -1.064501e-02, &tj, &tj1, &result, _state);
7183  jarquebera_jbcheb(x, 1.014932e-02, &tj, &tj1, &result, _state);
7184  jarquebera_jbcheb(x, 5.953513e-03, &tj, &tj1, &result, _state);
7185  if( ae_fp_greater(result,0) )
7186  {
7187  result = 0;
7188  }
7189  return result;
7190  }
7191  if( ae_fp_less_eq(s,6.0000) )
7192  {
7193  x = 2*(s-3.000000)/3.000000-1;
7194  tj = 1;
7195  tj1 = x;
7196  jarquebera_jbcheb(x, -3.818669e+00, &tj, &tj1, &result, _state);
7197  jarquebera_jbcheb(x, -6.070918e-01, &tj, &tj1, &result, _state);
7198  jarquebera_jbcheb(x, 4.277196e-02, &tj, &tj1, &result, _state);
7199  jarquebera_jbcheb(x, -4.879817e-03, &tj, &tj1, &result, _state);
7200  jarquebera_jbcheb(x, 6.887357e-04, &tj, &tj1, &result, _state);
7201  jarquebera_jbcheb(x, 1.638451e-05, &tj, &tj1, &result, _state);
7202  jarquebera_jbcheb(x, 1.502800e-04, &tj, &tj1, &result, _state);
7203  jarquebera_jbcheb(x, -3.165796e-05, &tj, &tj1, &result, _state);
7204  jarquebera_jbcheb(x, 5.034960e-05, &tj, &tj1, &result, _state);
7205  if( ae_fp_greater(result,0) )
7206  {
7207  result = 0;
7208  }
7209  return result;
7210  }
7211  if( ae_fp_less_eq(s,20.0000) )
7212  {
7213  x = 2*(s-6.000000)/14.000000-1;
7214  tj = 1;
7215  tj1 = x;
7216  jarquebera_jbcheb(x, -6.010656e+00, &tj, &tj1, &result, _state);
7217  jarquebera_jbcheb(x, -1.496296e+00, &tj, &tj1, &result, _state);
7218  jarquebera_jbcheb(x, 1.002227e-01, &tj, &tj1, &result, _state);
7219  jarquebera_jbcheb(x, -2.338250e-02, &tj, &tj1, &result, _state);
7220  jarquebera_jbcheb(x, 4.137036e-03, &tj, &tj1, &result, _state);
7221  jarquebera_jbcheb(x, -2.586202e-03, &tj, &tj1, &result, _state);
7222  jarquebera_jbcheb(x, -9.736384e-04, &tj, &tj1, &result, _state);
7223  jarquebera_jbcheb(x, 1.332251e-03, &tj, &tj1, &result, _state);
7224  jarquebera_jbcheb(x, 1.877982e-03, &tj, &tj1, &result, _state);
7225  jarquebera_jbcheb(x, -1.160963e-05, &tj, &tj1, &result, _state);
7226  jarquebera_jbcheb(x, -2.547247e-03, &tj, &tj1, &result, _state);
7227  if( ae_fp_greater(result,0) )
7228  {
7229  result = 0;
7230  }
7231  return result;
7232  }
7233  result = -1.684623e-01*(s-2.000000e+01)-7.428883e+00;
7234  return result;
7235 }
7236 
7237 
7238 static double jarquebera_jbtbl19(double s, ae_state *_state)
7239 {
7240  double x;
7241  double tj;
7242  double tj1;
7243  double result;
7244 
7245 
7246  result = 0;
7247  if( ae_fp_less_eq(s,3.0000) )
7248  {
7249  x = 2*(s-0.000000)/3.000000-1;
7250  tj = 1;
7251  tj1 = x;
7252  jarquebera_jbcheb(x, -1.490213e+00, &tj, &tj1, &result, _state);
7253  jarquebera_jbcheb(x, -1.719633e+00, &tj, &tj1, &result, _state);
7254  jarquebera_jbcheb(x, -6.459123e-02, &tj, &tj1, &result, _state);
7255  jarquebera_jbcheb(x, 2.034878e-01, &tj, &tj1, &result, _state);
7256  jarquebera_jbcheb(x, 1.113868e-02, &tj, &tj1, &result, _state);
7257  jarquebera_jbcheb(x, -4.030922e-02, &tj, &tj1, &result, _state);
7258  jarquebera_jbcheb(x, -1.054022e-02, &tj, &tj1, &result, _state);
7259  jarquebera_jbcheb(x, 7.525623e-03, &tj, &tj1, &result, _state);
7260  jarquebera_jbcheb(x, 5.277360e-03, &tj, &tj1, &result, _state);
7261  if( ae_fp_greater(result,0) )
7262  {
7263  result = 0;
7264  }
7265  return result;
7266  }
7267  if( ae_fp_less_eq(s,6.0000) )
7268  {
7269  x = 2*(s-3.000000)/3.000000-1;
7270  tj = 1;
7271  tj1 = x;
7272  jarquebera_jbcheb(x, -3.744750e+00, &tj, &tj1, &result, _state);
7273  jarquebera_jbcheb(x, -5.977749e-01, &tj, &tj1, &result, _state);
7274  jarquebera_jbcheb(x, 4.223716e-02, &tj, &tj1, &result, _state);
7275  jarquebera_jbcheb(x, -5.363889e-03, &tj, &tj1, &result, _state);
7276  jarquebera_jbcheb(x, 5.711774e-04, &tj, &tj1, &result, _state);
7277  jarquebera_jbcheb(x, -5.557257e-04, &tj, &tj1, &result, _state);
7278  jarquebera_jbcheb(x, 4.254794e-04, &tj, &tj1, &result, _state);
7279  jarquebera_jbcheb(x, 9.034207e-05, &tj, &tj1, &result, _state);
7280  jarquebera_jbcheb(x, 5.498107e-05, &tj, &tj1, &result, _state);
7281  if( ae_fp_greater(result,0) )
7282  {
7283  result = 0;
7284  }
7285  return result;
7286  }
7287  if( ae_fp_less_eq(s,20.0000) )
7288  {
7289  x = 2*(s-6.000000)/14.000000-1;
7290  tj = 1;
7291  tj1 = x;
7292  jarquebera_jbcheb(x, -5.872768e+00, &tj, &tj1, &result, _state);
7293  jarquebera_jbcheb(x, -1.430689e+00, &tj, &tj1, &result, _state);
7294  jarquebera_jbcheb(x, 1.136575e-01, &tj, &tj1, &result, _state);
7295  jarquebera_jbcheb(x, -1.726627e-02, &tj, &tj1, &result, _state);
7296  jarquebera_jbcheb(x, 3.421110e-03, &tj, &tj1, &result, _state);
7297  jarquebera_jbcheb(x, -1.581510e-03, &tj, &tj1, &result, _state);
7298  jarquebera_jbcheb(x, -5.559520e-04, &tj, &tj1, &result, _state);
7299  jarquebera_jbcheb(x, -6.838208e-04, &tj, &tj1, &result, _state);
7300  jarquebera_jbcheb(x, 8.428839e-04, &tj, &tj1, &result, _state);
7301  jarquebera_jbcheb(x, -7.170682e-04, &tj, &tj1, &result, _state);
7302  jarquebera_jbcheb(x, -6.006647e-04, &tj, &tj1, &result, _state);
7303  if( ae_fp_greater(result,0) )
7304  {
7305  result = 0;
7306  }
7307  return result;
7308  }
7309  result = -1.539373e-01*(s-2.000000e+01)-7.206941e+00;
7310  return result;
7311 }
7312 
7313 
7314 static double jarquebera_jbtbl20(double s, ae_state *_state)
7315 {
7316  double x;
7317  double tj;
7318  double tj1;
7319  double result;
7320 
7321 
7322  result = 0;
7323  if( ae_fp_less_eq(s,4.0000) )
7324  {
7325  x = 2*(s-0.000000)/4.000000-1;
7326  tj = 1;
7327  tj1 = x;
7328  jarquebera_jbcheb(x, -1.854794e+00, &tj, &tj1, &result, _state);
7329  jarquebera_jbcheb(x, -1.948947e+00, &tj, &tj1, &result, _state);
7330  jarquebera_jbcheb(x, 1.632184e-01, &tj, &tj1, &result, _state);
7331  jarquebera_jbcheb(x, 2.139397e-01, &tj, &tj1, &result, _state);
7332  jarquebera_jbcheb(x, -1.006237e-01, &tj, &tj1, &result, _state);
7333  jarquebera_jbcheb(x, -3.810031e-02, &tj, &tj1, &result, _state);
7334  jarquebera_jbcheb(x, 3.573620e-02, &tj, &tj1, &result, _state);
7335  jarquebera_jbcheb(x, 9.951242e-03, &tj, &tj1, &result, _state);
7336  jarquebera_jbcheb(x, -1.274092e-02, &tj, &tj1, &result, _state);
7337  jarquebera_jbcheb(x, -3.464196e-03, &tj, &tj1, &result, _state);
7338  jarquebera_jbcheb(x, 4.882139e-03, &tj, &tj1, &result, _state);
7339  jarquebera_jbcheb(x, 1.575144e-03, &tj, &tj1, &result, _state);
7340  jarquebera_jbcheb(x, -1.822804e-03, &tj, &tj1, &result, _state);
7341  jarquebera_jbcheb(x, -7.061348e-04, &tj, &tj1, &result, _state);
7342  jarquebera_jbcheb(x, 5.908404e-04, &tj, &tj1, &result, _state);
7343  jarquebera_jbcheb(x, 1.978353e-04, &tj, &tj1, &result, _state);
7344  if( ae_fp_greater(result,0) )
7345  {
7346  result = 0;
7347  }
7348  return result;
7349  }
7350  if( ae_fp_less_eq(s,15.0000) )
7351  {
7352  x = 2*(s-4.000000)/11.000000-1;
7353  tj = 1;
7354  tj1 = x;
7355  jarquebera_jbcheb(x, -5.030989e+00, &tj, &tj1, &result, _state);
7356  jarquebera_jbcheb(x, -1.327151e+00, &tj, &tj1, &result, _state);
7357  jarquebera_jbcheb(x, 1.346404e-01, &tj, &tj1, &result, _state);
7358  jarquebera_jbcheb(x, -2.840051e-02, &tj, &tj1, &result, _state);
7359  jarquebera_jbcheb(x, 7.578551e-03, &tj, &tj1, &result, _state);
7360  jarquebera_jbcheb(x, -9.813886e-04, &tj, &tj1, &result, _state);
7361  jarquebera_jbcheb(x, 5.905973e-05, &tj, &tj1, &result, _state);
7362  jarquebera_jbcheb(x, -5.358489e-04, &tj, &tj1, &result, _state);
7363  jarquebera_jbcheb(x, -3.450795e-04, &tj, &tj1, &result, _state);
7364  jarquebera_jbcheb(x, -6.941157e-04, &tj, &tj1, &result, _state);
7365  jarquebera_jbcheb(x, -7.432418e-04, &tj, &tj1, &result, _state);
7366  jarquebera_jbcheb(x, -2.070537e-04, &tj, &tj1, &result, _state);
7367  jarquebera_jbcheb(x, 9.375654e-04, &tj, &tj1, &result, _state);
7368  jarquebera_jbcheb(x, 5.367378e-04, &tj, &tj1, &result, _state);
7369  jarquebera_jbcheb(x, 9.890859e-04, &tj, &tj1, &result, _state);
7370  jarquebera_jbcheb(x, 6.679782e-04, &tj, &tj1, &result, _state);
7371  if( ae_fp_greater(result,0) )
7372  {
7373  result = 0;
7374  }
7375  return result;
7376  }
7377  if( ae_fp_less_eq(s,25.0000) )
7378  {
7379  x = 2*(s-15.000000)/10.000000-1;
7380  tj = 1;
7381  tj1 = x;
7382  jarquebera_jbcheb(x, -7.015854e+00, &tj, &tj1, &result, _state);
7383  jarquebera_jbcheb(x, -7.487737e-01, &tj, &tj1, &result, _state);
7384  jarquebera_jbcheb(x, 2.244254e-02, &tj, &tj1, &result, _state);
7385  if( ae_fp_greater(result,0) )
7386  {
7387  result = 0;
7388  }
7389  return result;
7390  }
7391  result = -1.318007e-01*(s-2.500000e+01)-7.742185e+00;
7392  return result;
7393 }
7394 
7395 
7396 static double jarquebera_jbtbl30(double s, ae_state *_state)
7397 {
7398  double x;
7399  double tj;
7400  double tj1;
7401  double result;
7402 
7403 
7404  result = 0;
7405  if( ae_fp_less_eq(s,4.0000) )
7406  {
7407  x = 2*(s-0.000000)/4.000000-1;
7408  tj = 1;
7409  tj1 = x;
7410  jarquebera_jbcheb(x, -1.630822e+00, &tj, &tj1, &result, _state);
7411  jarquebera_jbcheb(x, -1.724298e+00, &tj, &tj1, &result, _state);
7412  jarquebera_jbcheb(x, 7.872756e-02, &tj, &tj1, &result, _state);
7413  jarquebera_jbcheb(x, 1.658268e-01, &tj, &tj1, &result, _state);
7414  jarquebera_jbcheb(x, -3.573597e-02, &tj, &tj1, &result, _state);
7415  jarquebera_jbcheb(x, -2.994157e-02, &tj, &tj1, &result, _state);
7416  jarquebera_jbcheb(x, 5.994825e-03, &tj, &tj1, &result, _state);
7417  jarquebera_jbcheb(x, 7.394303e-03, &tj, &tj1, &result, _state);
7418  jarquebera_jbcheb(x, -5.785029e-04, &tj, &tj1, &result, _state);
7419  jarquebera_jbcheb(x, -1.990264e-03, &tj, &tj1, &result, _state);
7420  jarquebera_jbcheb(x, -1.037838e-04, &tj, &tj1, &result, _state);
7421  jarquebera_jbcheb(x, 6.755546e-04, &tj, &tj1, &result, _state);
7422  jarquebera_jbcheb(x, 1.774473e-04, &tj, &tj1, &result, _state);
7423  jarquebera_jbcheb(x, -2.821395e-04, &tj, &tj1, &result, _state);
7424  jarquebera_jbcheb(x, -1.392603e-04, &tj, &tj1, &result, _state);
7425  jarquebera_jbcheb(x, 1.353313e-04, &tj, &tj1, &result, _state);
7426  if( ae_fp_greater(result,0) )
7427  {
7428  result = 0;
7429  }
7430  return result;
7431  }
7432  if( ae_fp_less_eq(s,15.0000) )
7433  {
7434  x = 2*(s-4.000000)/11.000000-1;
7435  tj = 1;
7436  tj1 = x;
7437  jarquebera_jbcheb(x, -4.539322e+00, &tj, &tj1, &result, _state);
7438  jarquebera_jbcheb(x, -1.197018e+00, &tj, &tj1, &result, _state);
7439  jarquebera_jbcheb(x, 1.396848e-01, &tj, &tj1, &result, _state);
7440  jarquebera_jbcheb(x, -2.804293e-02, &tj, &tj1, &result, _state);
7441  jarquebera_jbcheb(x, 6.867928e-03, &tj, &tj1, &result, _state);
7442  jarquebera_jbcheb(x, -2.768758e-03, &tj, &tj1, &result, _state);
7443  jarquebera_jbcheb(x, 5.211792e-04, &tj, &tj1, &result, _state);
7444  jarquebera_jbcheb(x, 4.925799e-04, &tj, &tj1, &result, _state);
7445  jarquebera_jbcheb(x, 5.046235e-04, &tj, &tj1, &result, _state);
7446  jarquebera_jbcheb(x, -9.536469e-05, &tj, &tj1, &result, _state);
7447  jarquebera_jbcheb(x, -6.489642e-04, &tj, &tj1, &result, _state);
7448  if( ae_fp_greater(result,0) )
7449  {
7450  result = 0;
7451  }
7452  return result;
7453  }
7454  if( ae_fp_less_eq(s,25.0000) )
7455  {
7456  x = 2*(s-15.000000)/10.000000-1;
7457  tj = 1;
7458  tj1 = x;
7459  jarquebera_jbcheb(x, -6.263462e+00, &tj, &tj1, &result, _state);
7460  jarquebera_jbcheb(x, -6.177316e-01, &tj, &tj1, &result, _state);
7461  jarquebera_jbcheb(x, 2.590637e-02, &tj, &tj1, &result, _state);
7462  if( ae_fp_greater(result,0) )
7463  {
7464  result = 0;
7465  }
7466  return result;
7467  }
7468  result = -1.028212e-01*(s-2.500000e+01)-6.855288e+00;
7469  return result;
7470 }
7471 
7472 
7473 static double jarquebera_jbtbl50(double s, ae_state *_state)
7474 {
7475  double x;
7476  double tj;
7477  double tj1;
7478  double result;
7479 
7480 
7481  result = 0;
7482  if( ae_fp_less_eq(s,4.0000) )
7483  {
7484  x = 2*(s-0.000000)/4.000000-1;
7485  tj = 1;
7486  tj1 = x;
7487  jarquebera_jbcheb(x, -1.436279e+00, &tj, &tj1, &result, _state);
7488  jarquebera_jbcheb(x, -1.519711e+00, &tj, &tj1, &result, _state);
7489  jarquebera_jbcheb(x, 1.148699e-02, &tj, &tj1, &result, _state);
7490  jarquebera_jbcheb(x, 1.001204e-01, &tj, &tj1, &result, _state);
7491  jarquebera_jbcheb(x, -3.207620e-03, &tj, &tj1, &result, _state);
7492  jarquebera_jbcheb(x, -1.034778e-02, &tj, &tj1, &result, _state);
7493  jarquebera_jbcheb(x, -1.220322e-03, &tj, &tj1, &result, _state);
7494  jarquebera_jbcheb(x, 1.033260e-03, &tj, &tj1, &result, _state);
7495  jarquebera_jbcheb(x, 2.588280e-04, &tj, &tj1, &result, _state);
7496  jarquebera_jbcheb(x, -1.851653e-04, &tj, &tj1, &result, _state);
7497  jarquebera_jbcheb(x, -1.287733e-04, &tj, &tj1, &result, _state);
7498  if( ae_fp_greater(result,0) )
7499  {
7500  result = 0;
7501  }
7502  return result;
7503  }
7504  if( ae_fp_less_eq(s,15.0000) )
7505  {
7506  x = 2*(s-4.000000)/11.000000-1;
7507  tj = 1;
7508  tj1 = x;
7509  jarquebera_jbcheb(x, -4.234645e+00, &tj, &tj1, &result, _state);
7510  jarquebera_jbcheb(x, -1.189127e+00, &tj, &tj1, &result, _state);
7511  jarquebera_jbcheb(x, 1.429738e-01, &tj, &tj1, &result, _state);
7512  jarquebera_jbcheb(x, -3.058822e-02, &tj, &tj1, &result, _state);
7513  jarquebera_jbcheb(x, 9.086776e-03, &tj, &tj1, &result, _state);
7514  jarquebera_jbcheb(x, -1.445783e-03, &tj, &tj1, &result, _state);
7515  jarquebera_jbcheb(x, 1.311671e-03, &tj, &tj1, &result, _state);
7516  jarquebera_jbcheb(x, -7.261298e-04, &tj, &tj1, &result, _state);
7517  jarquebera_jbcheb(x, 6.496987e-04, &tj, &tj1, &result, _state);
7518  jarquebera_jbcheb(x, 2.605249e-04, &tj, &tj1, &result, _state);
7519  jarquebera_jbcheb(x, 8.162282e-04, &tj, &tj1, &result, _state);
7520  if( ae_fp_greater(result,0) )
7521  {
7522  result = 0;
7523  }
7524  return result;
7525  }
7526  if( ae_fp_less_eq(s,25.0000) )
7527  {
7528  x = 2*(s-15.000000)/10.000000-1;
7529  tj = 1;
7530  tj1 = x;
7531  jarquebera_jbcheb(x, -5.921095e+00, &tj, &tj1, &result, _state);
7532  jarquebera_jbcheb(x, -5.888603e-01, &tj, &tj1, &result, _state);
7533  jarquebera_jbcheb(x, 3.080113e-02, &tj, &tj1, &result, _state);
7534  if( ae_fp_greater(result,0) )
7535  {
7536  result = 0;
7537  }
7538  return result;
7539  }
7540  result = -9.313116e-02*(s-2.500000e+01)-6.479154e+00;
7541  return result;
7542 }
7543 
7544 
7545 static double jarquebera_jbtbl65(double s, ae_state *_state)
7546 {
7547  double x;
7548  double tj;
7549  double tj1;
7550  double result;
7551 
7552 
7553  result = 0;
7554  if( ae_fp_less_eq(s,4.0000) )
7555  {
7556  x = 2*(s-0.000000)/4.000000-1;
7557  tj = 1;
7558  tj1 = x;
7559  jarquebera_jbcheb(x, -1.360024e+00, &tj, &tj1, &result, _state);
7560  jarquebera_jbcheb(x, -1.434631e+00, &tj, &tj1, &result, _state);
7561  jarquebera_jbcheb(x, -6.514580e-03, &tj, &tj1, &result, _state);
7562  jarquebera_jbcheb(x, 7.332038e-02, &tj, &tj1, &result, _state);
7563  jarquebera_jbcheb(x, 1.158197e-03, &tj, &tj1, &result, _state);
7564  jarquebera_jbcheb(x, -5.121233e-03, &tj, &tj1, &result, _state);
7565  jarquebera_jbcheb(x, -1.051056e-03, &tj, &tj1, &result, _state);
7566  if( ae_fp_greater(result,0) )
7567  {
7568  result = 0;
7569  }
7570  return result;
7571  }
7572  if( ae_fp_less_eq(s,15.0000) )
7573  {
7574  x = 2*(s-4.000000)/11.000000-1;
7575  tj = 1;
7576  tj1 = x;
7577  jarquebera_jbcheb(x, -4.148601e+00, &tj, &tj1, &result, _state);
7578  jarquebera_jbcheb(x, -1.214233e+00, &tj, &tj1, &result, _state);
7579  jarquebera_jbcheb(x, 1.487977e-01, &tj, &tj1, &result, _state);
7580  jarquebera_jbcheb(x, -3.424720e-02, &tj, &tj1, &result, _state);
7581  jarquebera_jbcheb(x, 1.116715e-02, &tj, &tj1, &result, _state);
7582  jarquebera_jbcheb(x, -4.043152e-03, &tj, &tj1, &result, _state);
7583  jarquebera_jbcheb(x, 1.718149e-03, &tj, &tj1, &result, _state);
7584  jarquebera_jbcheb(x, -1.313701e-03, &tj, &tj1, &result, _state);
7585  jarquebera_jbcheb(x, 3.097305e-04, &tj, &tj1, &result, _state);
7586  jarquebera_jbcheb(x, 2.181031e-04, &tj, &tj1, &result, _state);
7587  jarquebera_jbcheb(x, 1.256975e-04, &tj, &tj1, &result, _state);
7588  if( ae_fp_greater(result,0) )
7589  {
7590  result = 0;
7591  }
7592  return result;
7593  }
7594  if( ae_fp_less_eq(s,25.0000) )
7595  {
7596  x = 2*(s-15.000000)/10.000000-1;
7597  tj = 1;
7598  tj1 = x;
7599  jarquebera_jbcheb(x, -5.858951e+00, &tj, &tj1, &result, _state);
7600  jarquebera_jbcheb(x, -5.895179e-01, &tj, &tj1, &result, _state);
7601  jarquebera_jbcheb(x, 2.933237e-02, &tj, &tj1, &result, _state);
7602  if( ae_fp_greater(result,0) )
7603  {
7604  result = 0;
7605  }
7606  return result;
7607  }
7608  result = -9.443768e-02*(s-2.500000e+01)-6.419137e+00;
7609  return result;
7610 }
7611 
7612 
7613 static double jarquebera_jbtbl100(double s, ae_state *_state)
7614 {
7615  double x;
7616  double tj;
7617  double tj1;
7618  double result;
7619 
7620 
7621  result = 0;
7622  if( ae_fp_less_eq(s,4.0000) )
7623  {
7624  x = 2*(s-0.000000)/4.000000-1;
7625  tj = 1;
7626  tj1 = x;
7627  jarquebera_jbcheb(x, -1.257021e+00, &tj, &tj1, &result, _state);
7628  jarquebera_jbcheb(x, -1.313418e+00, &tj, &tj1, &result, _state);
7629  jarquebera_jbcheb(x, -1.628931e-02, &tj, &tj1, &result, _state);
7630  jarquebera_jbcheb(x, 4.264287e-02, &tj, &tj1, &result, _state);
7631  jarquebera_jbcheb(x, 1.518487e-03, &tj, &tj1, &result, _state);
7632  jarquebera_jbcheb(x, -1.499826e-03, &tj, &tj1, &result, _state);
7633  jarquebera_jbcheb(x, -4.836044e-04, &tj, &tj1, &result, _state);
7634  if( ae_fp_greater(result,0) )
7635  {
7636  result = 0;
7637  }
7638  return result;
7639  }
7640  if( ae_fp_less_eq(s,15.0000) )
7641  {
7642  x = 2*(s-4.000000)/11.000000-1;
7643  tj = 1;
7644  tj1 = x;
7645  jarquebera_jbcheb(x, -4.056508e+00, &tj, &tj1, &result, _state);
7646  jarquebera_jbcheb(x, -1.279690e+00, &tj, &tj1, &result, _state);
7647  jarquebera_jbcheb(x, 1.665746e-01, &tj, &tj1, &result, _state);
7648  jarquebera_jbcheb(x, -4.290012e-02, &tj, &tj1, &result, _state);
7649  jarquebera_jbcheb(x, 1.487632e-02, &tj, &tj1, &result, _state);
7650  jarquebera_jbcheb(x, -5.704465e-03, &tj, &tj1, &result, _state);
7651  jarquebera_jbcheb(x, 2.211669e-03, &tj, &tj1, &result, _state);
7652  if( ae_fp_greater(result,0) )
7653  {
7654  result = 0;
7655  }
7656  return result;
7657  }
7658  if( ae_fp_less_eq(s,25.0000) )
7659  {
7660  x = 2*(s-15.000000)/10.000000-1;
7661  tj = 1;
7662  tj1 = x;
7663  jarquebera_jbcheb(x, -5.866099e+00, &tj, &tj1, &result, _state);
7664  jarquebera_jbcheb(x, -6.399767e-01, &tj, &tj1, &result, _state);
7665  jarquebera_jbcheb(x, 2.498208e-02, &tj, &tj1, &result, _state);
7666  if( ae_fp_greater(result,0) )
7667  {
7668  result = 0;
7669  }
7670  return result;
7671  }
7672  result = -1.080097e-01*(s-2.500000e+01)-6.481094e+00;
7673  return result;
7674 }
7675 
7676 
7677 static double jarquebera_jbtbl130(double s, ae_state *_state)
7678 {
7679  double x;
7680  double tj;
7681  double tj1;
7682  double result;
7683 
7684 
7685  result = 0;
7686  if( ae_fp_less_eq(s,4.0000) )
7687  {
7688  x = 2*(s-0.000000)/4.000000-1;
7689  tj = 1;
7690  tj1 = x;
7691  jarquebera_jbcheb(x, -1.207999e+00, &tj, &tj1, &result, _state);
7692  jarquebera_jbcheb(x, -1.253864e+00, &tj, &tj1, &result, _state);
7693  jarquebera_jbcheb(x, -1.618032e-02, &tj, &tj1, &result, _state);
7694  jarquebera_jbcheb(x, 3.112729e-02, &tj, &tj1, &result, _state);
7695  jarquebera_jbcheb(x, 1.210546e-03, &tj, &tj1, &result, _state);
7696  jarquebera_jbcheb(x, -4.732602e-04, &tj, &tj1, &result, _state);
7697  jarquebera_jbcheb(x, -2.410527e-04, &tj, &tj1, &result, _state);
7698  if( ae_fp_greater(result,0) )
7699  {
7700  result = 0;
7701  }
7702  return result;
7703  }
7704  if( ae_fp_less_eq(s,15.0000) )
7705  {
7706  x = 2*(s-4.000000)/11.000000-1;
7707  tj = 1;
7708  tj1 = x;
7709  jarquebera_jbcheb(x, -4.026324e+00, &tj, &tj1, &result, _state);
7710  jarquebera_jbcheb(x, -1.331990e+00, &tj, &tj1, &result, _state);
7711  jarquebera_jbcheb(x, 1.779129e-01, &tj, &tj1, &result, _state);
7712  jarquebera_jbcheb(x, -4.674749e-02, &tj, &tj1, &result, _state);
7713  jarquebera_jbcheb(x, 1.669077e-02, &tj, &tj1, &result, _state);
7714  jarquebera_jbcheb(x, -5.679136e-03, &tj, &tj1, &result, _state);
7715  jarquebera_jbcheb(x, 8.833221e-04, &tj, &tj1, &result, _state);
7716  if( ae_fp_greater(result,0) )
7717  {
7718  result = 0;
7719  }
7720  return result;
7721  }
7722  if( ae_fp_less_eq(s,25.0000) )
7723  {
7724  x = 2*(s-15.000000)/10.000000-1;
7725  tj = 1;
7726  tj1 = x;
7727  jarquebera_jbcheb(x, -5.893951e+00, &tj, &tj1, &result, _state);
7728  jarquebera_jbcheb(x, -6.475304e-01, &tj, &tj1, &result, _state);
7729  jarquebera_jbcheb(x, 3.116734e-02, &tj, &tj1, &result, _state);
7730  if( ae_fp_greater(result,0) )
7731  {
7732  result = 0;
7733  }
7734  return result;
7735  }
7736  result = -1.045722e-01*(s-2.500000e+01)-6.510314e+00;
7737  return result;
7738 }
7739 
7740 
7741 static double jarquebera_jbtbl200(double s, ae_state *_state)
7742 {
7743  double x;
7744  double tj;
7745  double tj1;
7746  double result;
7747 
7748 
7749  result = 0;
7750  if( ae_fp_less_eq(s,4.0000) )
7751  {
7752  x = 2*(s-0.000000)/4.000000-1;
7753  tj = 1;
7754  tj1 = x;
7755  jarquebera_jbcheb(x, -1.146155e+00, &tj, &tj1, &result, _state);
7756  jarquebera_jbcheb(x, -1.177398e+00, &tj, &tj1, &result, _state);
7757  jarquebera_jbcheb(x, -1.297970e-02, &tj, &tj1, &result, _state);
7758  jarquebera_jbcheb(x, 1.869745e-02, &tj, &tj1, &result, _state);
7759  jarquebera_jbcheb(x, 1.717288e-04, &tj, &tj1, &result, _state);
7760  jarquebera_jbcheb(x, -1.982108e-04, &tj, &tj1, &result, _state);
7761  jarquebera_jbcheb(x, 6.427636e-05, &tj, &tj1, &result, _state);
7762  if( ae_fp_greater(result,0) )
7763  {
7764  result = 0;
7765  }
7766  return result;
7767  }
7768  if( ae_fp_less_eq(s,15.0000) )
7769  {
7770  x = 2*(s-4.000000)/11.000000-1;
7771  tj = 1;
7772  tj1 = x;
7773  jarquebera_jbcheb(x, -4.034235e+00, &tj, &tj1, &result, _state);
7774  jarquebera_jbcheb(x, -1.455006e+00, &tj, &tj1, &result, _state);
7775  jarquebera_jbcheb(x, 1.942996e-01, &tj, &tj1, &result, _state);
7776  jarquebera_jbcheb(x, -4.973795e-02, &tj, &tj1, &result, _state);
7777  jarquebera_jbcheb(x, 1.418812e-02, &tj, &tj1, &result, _state);
7778  jarquebera_jbcheb(x, -3.156778e-03, &tj, &tj1, &result, _state);
7779  jarquebera_jbcheb(x, 4.896705e-05, &tj, &tj1, &result, _state);
7780  if( ae_fp_greater(result,0) )
7781  {
7782  result = 0;
7783  }
7784  return result;
7785  }
7786  if( ae_fp_less_eq(s,25.0000) )
7787  {
7788  x = 2*(s-15.000000)/10.000000-1;
7789  tj = 1;
7790  tj1 = x;
7791  jarquebera_jbcheb(x, -6.086071e+00, &tj, &tj1, &result, _state);
7792  jarquebera_jbcheb(x, -7.152176e-01, &tj, &tj1, &result, _state);
7793  jarquebera_jbcheb(x, 3.725393e-02, &tj, &tj1, &result, _state);
7794  if( ae_fp_greater(result,0) )
7795  {
7796  result = 0;
7797  }
7798  return result;
7799  }
7800  result = -1.132404e-01*(s-2.500000e+01)-6.764034e+00;
7801  return result;
7802 }
7803 
7804 
7805 static double jarquebera_jbtbl301(double s, ae_state *_state)
7806 {
7807  double x;
7808  double tj;
7809  double tj1;
7810  double result;
7811 
7812 
7813  result = 0;
7814  if( ae_fp_less_eq(s,4.0000) )
7815  {
7816  x = 2*(s-0.000000)/4.000000-1;
7817  tj = 1;
7818  tj1 = x;
7819  jarquebera_jbcheb(x, -1.104290e+00, &tj, &tj1, &result, _state);
7820  jarquebera_jbcheb(x, -1.125800e+00, &tj, &tj1, &result, _state);
7821  jarquebera_jbcheb(x, -9.595847e-03, &tj, &tj1, &result, _state);
7822  jarquebera_jbcheb(x, 1.219666e-02, &tj, &tj1, &result, _state);
7823  jarquebera_jbcheb(x, 1.502210e-04, &tj, &tj1, &result, _state);
7824  jarquebera_jbcheb(x, -6.414543e-05, &tj, &tj1, &result, _state);
7825  jarquebera_jbcheb(x, 6.754115e-05, &tj, &tj1, &result, _state);
7826  if( ae_fp_greater(result,0) )
7827  {
7828  result = 0;
7829  }
7830  return result;
7831  }
7832  if( ae_fp_less_eq(s,15.0000) )
7833  {
7834  x = 2*(s-4.000000)/11.000000-1;
7835  tj = 1;
7836  tj1 = x;
7837  jarquebera_jbcheb(x, -4.065955e+00, &tj, &tj1, &result, _state);
7838  jarquebera_jbcheb(x, -1.582060e+00, &tj, &tj1, &result, _state);
7839  jarquebera_jbcheb(x, 2.004472e-01, &tj, &tj1, &result, _state);
7840  jarquebera_jbcheb(x, -4.709092e-02, &tj, &tj1, &result, _state);
7841  jarquebera_jbcheb(x, 1.105779e-02, &tj, &tj1, &result, _state);
7842  jarquebera_jbcheb(x, 1.197391e-03, &tj, &tj1, &result, _state);
7843  jarquebera_jbcheb(x, -8.386780e-04, &tj, &tj1, &result, _state);
7844  if( ae_fp_greater(result,0) )
7845  {
7846  result = 0;
7847  }
7848  return result;
7849  }
7850  if( ae_fp_less_eq(s,25.0000) )
7851  {
7852  x = 2*(s-15.000000)/10.000000-1;
7853  tj = 1;
7854  tj1 = x;
7855  jarquebera_jbcheb(x, -6.311384e+00, &tj, &tj1, &result, _state);
7856  jarquebera_jbcheb(x, -7.918763e-01, &tj, &tj1, &result, _state);
7857  jarquebera_jbcheb(x, 3.626584e-02, &tj, &tj1, &result, _state);
7858  if( ae_fp_greater(result,0) )
7859  {
7860  result = 0;
7861  }
7862  return result;
7863  }
7864  result = -1.293626e-01*(s-2.500000e+01)-7.066995e+00;
7865  return result;
7866 }
7867 
7868 
7869 static double jarquebera_jbtbl501(double s, ae_state *_state)
7870 {
7871  double x;
7872  double tj;
7873  double tj1;
7874  double result;
7875 
7876 
7877  result = 0;
7878  if( ae_fp_less_eq(s,4.0000) )
7879  {
7880  x = 2*(s-0.000000)/4.000000-1;
7881  tj = 1;
7882  tj1 = x;
7883  jarquebera_jbcheb(x, -1.067426e+00, &tj, &tj1, &result, _state);
7884  jarquebera_jbcheb(x, -1.079765e+00, &tj, &tj1, &result, _state);
7885  jarquebera_jbcheb(x, -5.463005e-03, &tj, &tj1, &result, _state);
7886  jarquebera_jbcheb(x, 6.875659e-03, &tj, &tj1, &result, _state);
7887  if( ae_fp_greater(result,0) )
7888  {
7889  result = 0;
7890  }
7891  return result;
7892  }
7893  if( ae_fp_less_eq(s,15.0000) )
7894  {
7895  x = 2*(s-4.000000)/11.000000-1;
7896  tj = 1;
7897  tj1 = x;
7898  jarquebera_jbcheb(x, -4.127574e+00, &tj, &tj1, &result, _state);
7899  jarquebera_jbcheb(x, -1.740694e+00, &tj, &tj1, &result, _state);
7900  jarquebera_jbcheb(x, 2.044502e-01, &tj, &tj1, &result, _state);
7901  jarquebera_jbcheb(x, -3.746714e-02, &tj, &tj1, &result, _state);
7902  jarquebera_jbcheb(x, 3.810594e-04, &tj, &tj1, &result, _state);
7903  jarquebera_jbcheb(x, 1.197111e-03, &tj, &tj1, &result, _state);
7904  if( ae_fp_greater(result,0) )
7905  {
7906  result = 0;
7907  }
7908  return result;
7909  }
7910  if( ae_fp_less_eq(s,25.0000) )
7911  {
7912  x = 2*(s-15.000000)/10.000000-1;
7913  tj = 1;
7914  tj1 = x;
7915  jarquebera_jbcheb(x, -6.628194e+00, &tj, &tj1, &result, _state);
7916  jarquebera_jbcheb(x, -8.846221e-01, &tj, &tj1, &result, _state);
7917  jarquebera_jbcheb(x, 4.386405e-02, &tj, &tj1, &result, _state);
7918  if( ae_fp_greater(result,0) )
7919  {
7920  result = 0;
7921  }
7922  return result;
7923  }
7924  result = -1.418332e-01*(s-2.500000e+01)-7.468952e+00;
7925  return result;
7926 }
7927 
7928 
7929 static double jarquebera_jbtbl701(double s, ae_state *_state)
7930 {
7931  double x;
7932  double tj;
7933  double tj1;
7934  double result;
7935 
7936 
7937  result = 0;
7938  if( ae_fp_less_eq(s,4.0000) )
7939  {
7940  x = 2*(s-0.000000)/4.000000-1;
7941  tj = 1;
7942  tj1 = x;
7943  jarquebera_jbcheb(x, -1.050999e+00, &tj, &tj1, &result, _state);
7944  jarquebera_jbcheb(x, -1.059769e+00, &tj, &tj1, &result, _state);
7945  jarquebera_jbcheb(x, -3.922680e-03, &tj, &tj1, &result, _state);
7946  jarquebera_jbcheb(x, 4.847054e-03, &tj, &tj1, &result, _state);
7947  if( ae_fp_greater(result,0) )
7948  {
7949  result = 0;
7950  }
7951  return result;
7952  }
7953  if( ae_fp_less_eq(s,15.0000) )
7954  {
7955  x = 2*(s-4.000000)/11.000000-1;
7956  tj = 1;
7957  tj1 = x;
7958  jarquebera_jbcheb(x, -4.192182e+00, &tj, &tj1, &result, _state);
7959  jarquebera_jbcheb(x, -1.860007e+00, &tj, &tj1, &result, _state);
7960  jarquebera_jbcheb(x, 1.963942e-01, &tj, &tj1, &result, _state);
7961  jarquebera_jbcheb(x, -2.838711e-02, &tj, &tj1, &result, _state);
7962  jarquebera_jbcheb(x, -2.893112e-04, &tj, &tj1, &result, _state);
7963  jarquebera_jbcheb(x, 2.159788e-03, &tj, &tj1, &result, _state);
7964  if( ae_fp_greater(result,0) )
7965  {
7966  result = 0;
7967  }
7968  return result;
7969  }
7970  if( ae_fp_less_eq(s,25.0000) )
7971  {
7972  x = 2*(s-15.000000)/10.000000-1;
7973  tj = 1;
7974  tj1 = x;
7975  jarquebera_jbcheb(x, -6.917851e+00, &tj, &tj1, &result, _state);
7976  jarquebera_jbcheb(x, -9.817020e-01, &tj, &tj1, &result, _state);
7977  jarquebera_jbcheb(x, 5.383727e-02, &tj, &tj1, &result, _state);
7978  if( ae_fp_greater(result,0) )
7979  {
7980  result = 0;
7981  }
7982  return result;
7983  }
7984  result = -1.532706e-01*(s-2.500000e+01)-7.845715e+00;
7985  return result;
7986 }
7987 
7988 
7989 static double jarquebera_jbtbl1401(double s, ae_state *_state)
7990 {
7991  double x;
7992  double tj;
7993  double tj1;
7994  double result;
7995 
7996 
7997  result = 0;
7998  if( ae_fp_less_eq(s,4.0000) )
7999  {
8000  x = 2*(s-0.000000)/4.000000-1;
8001  tj = 1;
8002  tj1 = x;
8003  jarquebera_jbcheb(x, -1.026266e+00, &tj, &tj1, &result, _state);
8004  jarquebera_jbcheb(x, -1.030061e+00, &tj, &tj1, &result, _state);
8005  jarquebera_jbcheb(x, -1.259222e-03, &tj, &tj1, &result, _state);
8006  jarquebera_jbcheb(x, 2.536254e-03, &tj, &tj1, &result, _state);
8007  if( ae_fp_greater(result,0) )
8008  {
8009  result = 0;
8010  }
8011  return result;
8012  }
8013  if( ae_fp_less_eq(s,15.0000) )
8014  {
8015  x = 2*(s-4.000000)/11.000000-1;
8016  tj = 1;
8017  tj1 = x;
8018  jarquebera_jbcheb(x, -4.329849e+00, &tj, &tj1, &result, _state);
8019  jarquebera_jbcheb(x, -2.095443e+00, &tj, &tj1, &result, _state);
8020  jarquebera_jbcheb(x, 1.759363e-01, &tj, &tj1, &result, _state);
8021  jarquebera_jbcheb(x, -7.751359e-03, &tj, &tj1, &result, _state);
8022  jarquebera_jbcheb(x, -6.124368e-03, &tj, &tj1, &result, _state);
8023  jarquebera_jbcheb(x, -1.793114e-03, &tj, &tj1, &result, _state);
8024  if( ae_fp_greater(result,0) )
8025  {
8026  result = 0;
8027  }
8028  return result;
8029  }
8030  if( ae_fp_less_eq(s,25.0000) )
8031  {
8032  x = 2*(s-15.000000)/10.000000-1;
8033  tj = 1;
8034  tj1 = x;
8035  jarquebera_jbcheb(x, -7.544330e+00, &tj, &tj1, &result, _state);
8036  jarquebera_jbcheb(x, -1.225382e+00, &tj, &tj1, &result, _state);
8037  jarquebera_jbcheb(x, 5.392349e-02, &tj, &tj1, &result, _state);
8038  if( ae_fp_greater(result,0) )
8039  {
8040  result = 0;
8041  }
8042  return result;
8043  }
8044  result = -2.019375e-01*(s-2.500000e+01)-8.715788e+00;
8045  return result;
8046 }
8047 
8048 
8049 static void jarquebera_jbcheb(double x,
8050  double c,
8051  double* tj,
8052  double* tj1,
8053  double* r,
8054  ae_state *_state)
8055 {
8056  double t;
8057 
8058 
8059  *r = *r+c*(*tj);
8060  t = 2*x*(*tj1)-(*tj);
8061  *tj = *tj1;
8062  *tj1 = t;
8063 }
8064 
8065 
8066 
8067 
8068 /*************************************************************************
8069 Mann-Whitney U-test
8070 
8071 This test checks hypotheses about whether X and Y are samples of two
8072 continuous distributions of the same shape and same median or whether
8073 their medians are different.
8074 
8075 The following tests are performed:
8076  * two-tailed test (null hypothesis - the medians are equal)
8077  * left-tailed test (null hypothesis - the median of the first sample
8078  is greater than or equal to the median of the second sample)
8079  * right-tailed test (null hypothesis - the median of the first sample
8080  is less than or equal to the median of the second sample).
8081 
8082 Requirements:
8083  * the samples are independent
8084  * X and Y are continuous distributions (or discrete distributions well-
8085  approximating continuous distributions)
8086  * distributions of X and Y have the same shape. The only possible
8087  difference is their position (i.e. the value of the median)
8088  * the number of elements in each sample is not less than 5
8089  * the scale of measurement should be ordinal, interval or ratio (i.e.
8090  the test could not be applied to nominal variables).
8091 
8092 The test is non-parametric and doesn't require distributions to be normal.
8093 
8094 Input parameters:
8095  X - sample 1. Array whose index goes from 0 to N-1.
8096  N - size of the sample. N>=5
8097  Y - sample 2. Array whose index goes from 0 to M-1.
8098  M - size of the sample. M>=5
8099 
8100 Output parameters:
8101  BothTails - p-value for two-tailed test.
8102  If BothTails is less than the given significance level
8103  the null hypothesis is rejected.
8104  LeftTail - p-value for left-tailed test.
8105  If LeftTail is less than the given significance level,
8106  the null hypothesis is rejected.
8107  RightTail - p-value for right-tailed test.
8108  If RightTail is less than the given significance level
8109  the null hypothesis is rejected.
8110 
8111 To calculate p-values, special approximation is used. This method lets us
8112 calculate p-values with satisfactory accuracy in interval [0.0001, 1].
8113 There is no approximation outside the [0.0001, 1] interval. Therefore, if
8114 the significance level outlies this interval, the test returns 0.0001.
8115 
8116 Relative precision of approximation of p-value:
8117 
8118 N M Max.err. Rms.err.
8119 5..10 N..10 1.4e-02 6.0e-04
8120 5..10 N..100 2.2e-02 5.3e-06
8121 10..15 N..15 1.0e-02 3.2e-04
8122 10..15 N..100 1.0e-02 2.2e-05
8123 15..100 N..100 6.1e-03 2.7e-06
8124 
8125 For N,M>100 accuracy checks weren't put into practice, but taking into
8126 account characteristics of asymptotic approximation used, precision should
8127 not be sharply different from the values for interval [5, 100].
8128 
8129  -- ALGLIB --
8130  Copyright 09.04.2007 by Bochkanov Sergey
8131 *************************************************************************/
8132 void mannwhitneyutest(/* Real */ ae_vector* x,
8133  ae_int_t n,
8134  /* Real */ ae_vector* y,
8135  ae_int_t m,
8136  double* bothtails,
8137  double* lefttail,
8138  double* righttail,
8139  ae_state *_state)
8140 {
8141  ae_frame _frame_block;
8142  ae_int_t i;
8143  ae_int_t j;
8144  ae_int_t k;
8145  ae_int_t t;
8146  double tmp;
8147  ae_int_t tmpi;
8148  ae_int_t ns;
8149  ae_vector r;
8150  ae_vector c;
8151  double u;
8152  double p;
8153  double mp;
8154  double s;
8155  double sigma;
8156  double mu;
8157  ae_int_t tiecount;
8158  ae_vector tiesize;
8159 
8160  ae_frame_make(_state, &_frame_block);
8161  *bothtails = 0;
8162  *lefttail = 0;
8163  *righttail = 0;
8164  ae_vector_init(&r, 0, DT_REAL, _state, ae_true);
8165  ae_vector_init(&c, 0, DT_INT, _state, ae_true);
8166  ae_vector_init(&tiesize, 0, DT_INT, _state, ae_true);
8167 
8168 
8169  /*
8170  * Prepare
8171  */
8172  if( n<=4||m<=4 )
8173  {
8174  *bothtails = 1.0;
8175  *lefttail = 1.0;
8176  *righttail = 1.0;
8177  ae_frame_leave(_state);
8178  return;
8179  }
8180  ns = n+m;
8181  ae_vector_set_length(&r, ns-1+1, _state);
8182  ae_vector_set_length(&c, ns-1+1, _state);
8183  for(i=0; i<=n-1; i++)
8184  {
8185  r.ptr.p_double[i] = x->ptr.p_double[i];
8186  c.ptr.p_int[i] = 0;
8187  }
8188  for(i=0; i<=m-1; i++)
8189  {
8190  r.ptr.p_double[n+i] = y->ptr.p_double[i];
8191  c.ptr.p_int[n+i] = 1;
8192  }
8193 
8194  /*
8195  * sort {R, C}
8196  */
8197  if( ns!=1 )
8198  {
8199  i = 2;
8200  do
8201  {
8202  t = i;
8203  while(t!=1)
8204  {
8205  k = t/2;
8206  if( ae_fp_greater_eq(r.ptr.p_double[k-1],r.ptr.p_double[t-1]) )
8207  {
8208  t = 1;
8209  }
8210  else
8211  {
8212  tmp = r.ptr.p_double[k-1];
8213  r.ptr.p_double[k-1] = r.ptr.p_double[t-1];
8214  r.ptr.p_double[t-1] = tmp;
8215  tmpi = c.ptr.p_int[k-1];
8216  c.ptr.p_int[k-1] = c.ptr.p_int[t-1];
8217  c.ptr.p_int[t-1] = tmpi;
8218  t = k;
8219  }
8220  }
8221  i = i+1;
8222  }
8223  while(i<=ns);
8224  i = ns-1;
8225  do
8226  {
8227  tmp = r.ptr.p_double[i];
8228  r.ptr.p_double[i] = r.ptr.p_double[0];
8229  r.ptr.p_double[0] = tmp;
8230  tmpi = c.ptr.p_int[i];
8231  c.ptr.p_int[i] = c.ptr.p_int[0];
8232  c.ptr.p_int[0] = tmpi;
8233  t = 1;
8234  while(t!=0)
8235  {
8236  k = 2*t;
8237  if( k>i )
8238  {
8239  t = 0;
8240  }
8241  else
8242  {
8243  if( k<i )
8244  {
8245  if( ae_fp_greater(r.ptr.p_double[k],r.ptr.p_double[k-1]) )
8246  {
8247  k = k+1;
8248  }
8249  }
8250  if( ae_fp_greater_eq(r.ptr.p_double[t-1],r.ptr.p_double[k-1]) )
8251  {
8252  t = 0;
8253  }
8254  else
8255  {
8256  tmp = r.ptr.p_double[k-1];
8257  r.ptr.p_double[k-1] = r.ptr.p_double[t-1];
8258  r.ptr.p_double[t-1] = tmp;
8259  tmpi = c.ptr.p_int[k-1];
8260  c.ptr.p_int[k-1] = c.ptr.p_int[t-1];
8261  c.ptr.p_int[t-1] = tmpi;
8262  t = k;
8263  }
8264  }
8265  }
8266  i = i-1;
8267  }
8268  while(i>=1);
8269  }
8270 
8271  /*
8272  * compute tied ranks
8273  */
8274  i = 0;
8275  tiecount = 0;
8276  ae_vector_set_length(&tiesize, ns-1+1, _state);
8277  while(i<=ns-1)
8278  {
8279  j = i+1;
8280  while(j<=ns-1)
8281  {
8282  if( ae_fp_neq(r.ptr.p_double[j],r.ptr.p_double[i]) )
8283  {
8284  break;
8285  }
8286  j = j+1;
8287  }
8288  for(k=i; k<=j-1; k++)
8289  {
8290  r.ptr.p_double[k] = 1+(double)(i+j-1)/(double)2;
8291  }
8292  tiesize.ptr.p_int[tiecount] = j-i;
8293  tiecount = tiecount+1;
8294  i = j;
8295  }
8296 
8297  /*
8298  * Compute U
8299  */
8300  u = 0;
8301  for(i=0; i<=ns-1; i++)
8302  {
8303  if( c.ptr.p_int[i]==0 )
8304  {
8305  u = u+r.ptr.p_double[i];
8306  }
8307  }
8308  u = n*m+n*(n+1)/2-u;
8309 
8310  /*
8311  * Result
8312  */
8313  mu = (double)(n*m)/(double)2;
8314  tmp = ns*(ae_sqr(ns, _state)-1)/12;
8315  for(i=0; i<=tiecount-1; i++)
8316  {
8317  tmp = tmp-tiesize.ptr.p_int[i]*(ae_sqr(tiesize.ptr.p_int[i], _state)-1)/12;
8318  }
8319  sigma = ae_sqrt((double)(m*n)/(double)ns/(ns-1)*tmp, _state);
8320  s = (u-mu)/sigma;
8321  if( ae_fp_less_eq(s,0) )
8322  {
8323  p = ae_exp(mannwhitneyu_usigma(-(u-mu)/sigma, n, m, _state), _state);
8324  mp = 1-ae_exp(mannwhitneyu_usigma(-(u-1-mu)/sigma, n, m, _state), _state);
8325  }
8326  else
8327  {
8328  mp = ae_exp(mannwhitneyu_usigma((u-mu)/sigma, n, m, _state), _state);
8329  p = 1-ae_exp(mannwhitneyu_usigma((u+1-mu)/sigma, n, m, _state), _state);
8330  }
8331  *bothtails = ae_maxreal(2*ae_minreal(p, mp, _state), 1.0E-4, _state);
8332  *lefttail = ae_maxreal(mp, 1.0E-4, _state);
8333  *righttail = ae_maxreal(p, 1.0E-4, _state);
8334  ae_frame_leave(_state);
8335 }
8336 
8337 
8338 /*************************************************************************
8339 Sequential Chebyshev interpolation.
8340 *************************************************************************/
8341 static void mannwhitneyu_ucheb(double x,
8342  double c,
8343  double* tj,
8344  double* tj1,
8345  double* r,
8346  ae_state *_state)
8347 {
8348  double t;
8349 
8350 
8351  *r = *r+c*(*tj);
8352  t = 2*x*(*tj1)-(*tj);
8353  *tj = *tj1;
8354  *tj1 = t;
8355 }
8356 
8357 
8358 /*************************************************************************
8359 Three-point polynomial interpolation.
8360 *************************************************************************/
8361 static double mannwhitneyu_uninterpolate(double p1,
8362  double p2,
8363  double p3,
8364  ae_int_t n,
8365  ae_state *_state)
8366 {
8367  double t1;
8368  double t2;
8369  double t3;
8370  double t;
8371  double p12;
8372  double p23;
8373  double result;
8374 
8375 
8376  t1 = 1.0/15.0;
8377  t2 = 1.0/30.0;
8378  t3 = 1.0/100.0;
8379  t = 1.0/n;
8380  p12 = ((t-t2)*p1+(t1-t)*p2)/(t1-t2);
8381  p23 = ((t-t3)*p2+(t2-t)*p3)/(t2-t3);
8382  result = ((t-t3)*p12+(t1-t)*p23)/(t1-t3);
8383  return result;
8384 }
8385 
8386 
8387 /*************************************************************************
8388 Tail(0, N1, N2)
8389 *************************************************************************/
8390 static double mannwhitneyu_usigma000(ae_int_t n1,
8391  ae_int_t n2,
8392  ae_state *_state)
8393 {
8394  double p1;
8395  double p2;
8396  double p3;
8397  double result;
8398 
8399 
8400  p1 = mannwhitneyu_uninterpolate(-6.76984e-01, -6.83700e-01, -6.89873e-01, n2, _state);
8401  p2 = mannwhitneyu_uninterpolate(-6.83700e-01, -6.87311e-01, -6.90957e-01, n2, _state);
8402  p3 = mannwhitneyu_uninterpolate(-6.89873e-01, -6.90957e-01, -6.92175e-01, n2, _state);
8403  result = mannwhitneyu_uninterpolate(p1, p2, p3, n1, _state);
8404  return result;
8405 }
8406 
8407 
8408 /*************************************************************************
8409 Tail(0.75, N1, N2)
8410 *************************************************************************/
8411 static double mannwhitneyu_usigma075(ae_int_t n1,
8412  ae_int_t n2,
8413  ae_state *_state)
8414 {
8415  double p1;
8416  double p2;
8417  double p3;
8418  double result;
8419 
8420 
8421  p1 = mannwhitneyu_uninterpolate(-1.44500e+00, -1.45906e+00, -1.47063e+00, n2, _state);
8422  p2 = mannwhitneyu_uninterpolate(-1.45906e+00, -1.46856e+00, -1.47644e+00, n2, _state);
8423  p3 = mannwhitneyu_uninterpolate(-1.47063e+00, -1.47644e+00, -1.48100e+00, n2, _state);
8424  result = mannwhitneyu_uninterpolate(p1, p2, p3, n1, _state);
8425  return result;
8426 }
8427 
8428 
8429 /*************************************************************************
8430 Tail(1.5, N1, N2)
8431 *************************************************************************/
8432 static double mannwhitneyu_usigma150(ae_int_t n1,
8433  ae_int_t n2,
8434  ae_state *_state)
8435 {
8436  double p1;
8437  double p2;
8438  double p3;
8439  double result;
8440 
8441 
8442  p1 = mannwhitneyu_uninterpolate(-2.65380e+00, -2.67352e+00, -2.69011e+00, n2, _state);
8443  p2 = mannwhitneyu_uninterpolate(-2.67352e+00, -2.68591e+00, -2.69659e+00, n2, _state);
8444  p3 = mannwhitneyu_uninterpolate(-2.69011e+00, -2.69659e+00, -2.70192e+00, n2, _state);
8445  result = mannwhitneyu_uninterpolate(p1, p2, p3, n1, _state);
8446  return result;
8447 }
8448 
8449 
8450 /*************************************************************************
8451 Tail(2.25, N1, N2)
8452 *************************************************************************/
8453 static double mannwhitneyu_usigma225(ae_int_t n1,
8454  ae_int_t n2,
8455  ae_state *_state)
8456 {
8457  double p1;
8458  double p2;
8459  double p3;
8460  double result;
8461 
8462 
8463  p1 = mannwhitneyu_uninterpolate(-4.41465e+00, -4.42260e+00, -4.43702e+00, n2, _state);
8464  p2 = mannwhitneyu_uninterpolate(-4.42260e+00, -4.41639e+00, -4.41928e+00, n2, _state);
8465  p3 = mannwhitneyu_uninterpolate(-4.43702e+00, -4.41928e+00, -4.41030e+00, n2, _state);
8466  result = mannwhitneyu_uninterpolate(p1, p2, p3, n1, _state);
8467  return result;
8468 }
8469 
8470 
8471 /*************************************************************************
8472 Tail(3.0, N1, N2)
8473 *************************************************************************/
8474 static double mannwhitneyu_usigma300(ae_int_t n1,
8475  ae_int_t n2,
8476  ae_state *_state)
8477 {
8478  double p1;
8479  double p2;
8480  double p3;
8481  double result;
8482 
8483 
8484  p1 = mannwhitneyu_uninterpolate(-6.89839e+00, -6.83477e+00, -6.82340e+00, n2, _state);
8485  p2 = mannwhitneyu_uninterpolate(-6.83477e+00, -6.74559e+00, -6.71117e+00, n2, _state);
8486  p3 = mannwhitneyu_uninterpolate(-6.82340e+00, -6.71117e+00, -6.64929e+00, n2, _state);
8487  result = mannwhitneyu_uninterpolate(p1, p2, p3, n1, _state);
8488  return result;
8489 }
8490 
8491 
8492 /*************************************************************************
8493 Tail(3.33, N1, N2)
8494 *************************************************************************/
8495 static double mannwhitneyu_usigma333(ae_int_t n1,
8496  ae_int_t n2,
8497  ae_state *_state)
8498 {
8499  double p1;
8500  double p2;
8501  double p3;
8502  double result;
8503 
8504 
8505  p1 = mannwhitneyu_uninterpolate(-8.31272e+00, -8.17096e+00, -8.13125e+00, n2, _state);
8506  p2 = mannwhitneyu_uninterpolate(-8.17096e+00, -8.00156e+00, -7.93245e+00, n2, _state);
8507  p3 = mannwhitneyu_uninterpolate(-8.13125e+00, -7.93245e+00, -7.82502e+00, n2, _state);
8508  result = mannwhitneyu_uninterpolate(p1, p2, p3, n1, _state);
8509  return result;
8510 }
8511 
8512 
8513 /*************************************************************************
8514 Tail(3.66, N1, N2)
8515 *************************************************************************/
8516 static double mannwhitneyu_usigma367(ae_int_t n1,
8517  ae_int_t n2,
8518  ae_state *_state)
8519 {
8520  double p1;
8521  double p2;
8522  double p3;
8523  double result;
8524 
8525 
8526  p1 = mannwhitneyu_uninterpolate(-9.98837e+00, -9.70844e+00, -9.62087e+00, n2, _state);
8527  p2 = mannwhitneyu_uninterpolate(-9.70844e+00, -9.41156e+00, -9.28998e+00, n2, _state);
8528  p3 = mannwhitneyu_uninterpolate(-9.62087e+00, -9.28998e+00, -9.11686e+00, n2, _state);
8529  result = mannwhitneyu_uninterpolate(p1, p2, p3, n1, _state);
8530  return result;
8531 }
8532 
8533 
8534 /*************************************************************************
8535 Tail(4.0, N1, N2)
8536 *************************************************************************/
8537 static double mannwhitneyu_usigma400(ae_int_t n1,
8538  ae_int_t n2,
8539  ae_state *_state)
8540 {
8541  double p1;
8542  double p2;
8543  double p3;
8544  double result;
8545 
8546 
8547  p1 = mannwhitneyu_uninterpolate(-1.20250e+01, -1.14911e+01, -1.13231e+01, n2, _state);
8548  p2 = mannwhitneyu_uninterpolate(-1.14911e+01, -1.09927e+01, -1.07937e+01, n2, _state);
8549  p3 = mannwhitneyu_uninterpolate(-1.13231e+01, -1.07937e+01, -1.05285e+01, n2, _state);
8550  result = mannwhitneyu_uninterpolate(p1, p2, p3, n1, _state);
8551  return result;
8552 }
8553 
8554 
8555 /*************************************************************************
8556 Tail(S, 5, 5)
8557 *************************************************************************/
8558 static double mannwhitneyu_utbln5n5(double s, ae_state *_state)
8559 {
8560  double x;
8561  double tj;
8562  double tj1;
8563  double result;
8564 
8565 
8566  result = 0;
8567  x = ae_minreal(2*(s-0.000000e+00)/2.611165e+00-1, 1.0, _state);
8568  tj = 1;
8569  tj1 = x;
8570  mannwhitneyu_ucheb(x, -2.596264e+00, &tj, &tj1, &result, _state);
8571  mannwhitneyu_ucheb(x, -2.412086e+00, &tj, &tj1, &result, _state);
8572  mannwhitneyu_ucheb(x, -4.858542e-01, &tj, &tj1, &result, _state);
8573  mannwhitneyu_ucheb(x, -5.614282e-02, &tj, &tj1, &result, _state);
8574  mannwhitneyu_ucheb(x, 3.372686e-03, &tj, &tj1, &result, _state);
8575  mannwhitneyu_ucheb(x, 8.524731e-03, &tj, &tj1, &result, _state);
8576  mannwhitneyu_ucheb(x, 4.435331e-03, &tj, &tj1, &result, _state);
8577  mannwhitneyu_ucheb(x, 1.284665e-03, &tj, &tj1, &result, _state);
8578  mannwhitneyu_ucheb(x, 4.184141e-03, &tj, &tj1, &result, _state);
8579  mannwhitneyu_ucheb(x, 5.298360e-03, &tj, &tj1, &result, _state);
8580  mannwhitneyu_ucheb(x, 7.447272e-04, &tj, &tj1, &result, _state);
8581  mannwhitneyu_ucheb(x, -3.938769e-03, &tj, &tj1, &result, _state);
8582  mannwhitneyu_ucheb(x, -4.276205e-03, &tj, &tj1, &result, _state);
8583  mannwhitneyu_ucheb(x, -1.138481e-03, &tj, &tj1, &result, _state);
8584  mannwhitneyu_ucheb(x, 8.684625e-04, &tj, &tj1, &result, _state);
8585  mannwhitneyu_ucheb(x, 1.558104e-03, &tj, &tj1, &result, _state);
8586  return result;
8587 }
8588 
8589 
8590 /*************************************************************************
8591 Tail(S, 5, 6)
8592 *************************************************************************/
8593 static double mannwhitneyu_utbln5n6(double s, ae_state *_state)
8594 {
8595  double x;
8596  double tj;
8597  double tj1;
8598  double result;
8599 
8600 
8601  result = 0;
8602  x = ae_minreal(2*(s-0.000000e+00)/2.738613e+00-1, 1.0, _state);
8603  tj = 1;
8604  tj1 = x;
8605  mannwhitneyu_ucheb(x, -2.810459e+00, &tj, &tj1, &result, _state);
8606  mannwhitneyu_ucheb(x, -2.684429e+00, &tj, &tj1, &result, _state);
8607  mannwhitneyu_ucheb(x, -5.712858e-01, &tj, &tj1, &result, _state);
8608  mannwhitneyu_ucheb(x, -8.009324e-02, &tj, &tj1, &result, _state);
8609  mannwhitneyu_ucheb(x, -6.644391e-03, &tj, &tj1, &result, _state);
8610  mannwhitneyu_ucheb(x, 6.034173e-03, &tj, &tj1, &result, _state);
8611  mannwhitneyu_ucheb(x, 4.953498e-03, &tj, &tj1, &result, _state);
8612  mannwhitneyu_ucheb(x, 3.279293e-03, &tj, &tj1, &result, _state);
8613  mannwhitneyu_ucheb(x, 3.563485e-03, &tj, &tj1, &result, _state);
8614  mannwhitneyu_ucheb(x, 4.971952e-03, &tj, &tj1, &result, _state);
8615  mannwhitneyu_ucheb(x, 3.506309e-03, &tj, &tj1, &result, _state);
8616  mannwhitneyu_ucheb(x, -1.541406e-04, &tj, &tj1, &result, _state);
8617  mannwhitneyu_ucheb(x, -3.283205e-03, &tj, &tj1, &result, _state);
8618  mannwhitneyu_ucheb(x, -3.016347e-03, &tj, &tj1, &result, _state);
8619  mannwhitneyu_ucheb(x, -1.221626e-03, &tj, &tj1, &result, _state);
8620  mannwhitneyu_ucheb(x, -1.286752e-03, &tj, &tj1, &result, _state);
8621  return result;
8622 }
8623 
8624 
8625 /*************************************************************************
8626 Tail(S, 5, 7)
8627 *************************************************************************/
8628 static double mannwhitneyu_utbln5n7(double s, ae_state *_state)
8629 {
8630  double x;
8631  double tj;
8632  double tj1;
8633  double result;
8634 
8635 
8636  result = 0;
8637  x = ae_minreal(2*(s-0.000000e+00)/2.841993e+00-1, 1.0, _state);
8638  tj = 1;
8639  tj1 = x;
8640  mannwhitneyu_ucheb(x, -2.994677e+00, &tj, &tj1, &result, _state);
8641  mannwhitneyu_ucheb(x, -2.923264e+00, &tj, &tj1, &result, _state);
8642  mannwhitneyu_ucheb(x, -6.506190e-01, &tj, &tj1, &result, _state);
8643  mannwhitneyu_ucheb(x, -1.054280e-01, &tj, &tj1, &result, _state);
8644  mannwhitneyu_ucheb(x, -1.794587e-02, &tj, &tj1, &result, _state);
8645  mannwhitneyu_ucheb(x, 1.726290e-03, &tj, &tj1, &result, _state);
8646  mannwhitneyu_ucheb(x, 4.534180e-03, &tj, &tj1, &result, _state);
8647  mannwhitneyu_ucheb(x, 4.517845e-03, &tj, &tj1, &result, _state);
8648  mannwhitneyu_ucheb(x, 3.904428e-03, &tj, &tj1, &result, _state);
8649  mannwhitneyu_ucheb(x, 3.882443e-03, &tj, &tj1, &result, _state);
8650  mannwhitneyu_ucheb(x, 3.482988e-03, &tj, &tj1, &result, _state);
8651  mannwhitneyu_ucheb(x, 2.114875e-03, &tj, &tj1, &result, _state);
8652  mannwhitneyu_ucheb(x, -1.515082e-04, &tj, &tj1, &result, _state);
8653  mannwhitneyu_ucheb(x, -1.996056e-03, &tj, &tj1, &result, _state);
8654  mannwhitneyu_ucheb(x, -2.293581e-03, &tj, &tj1, &result, _state);
8655  mannwhitneyu_ucheb(x, -2.349444e-03, &tj, &tj1, &result, _state);
8656  return result;
8657 }
8658 
8659 
8660 /*************************************************************************
8661 Tail(S, 5, 8)
8662 *************************************************************************/
8663 static double mannwhitneyu_utbln5n8(double s, ae_state *_state)
8664 {
8665  double x;
8666  double tj;
8667  double tj1;
8668  double result;
8669 
8670 
8671  result = 0;
8672  x = ae_minreal(2*(s-0.000000e+00)/2.927700e+00-1, 1.0, _state);
8673  tj = 1;
8674  tj1 = x;
8675  mannwhitneyu_ucheb(x, -3.155727e+00, &tj, &tj1, &result, _state);
8676  mannwhitneyu_ucheb(x, -3.135078e+00, &tj, &tj1, &result, _state);
8677  mannwhitneyu_ucheb(x, -7.247203e-01, &tj, &tj1, &result, _state);
8678  mannwhitneyu_ucheb(x, -1.309697e-01, &tj, &tj1, &result, _state);
8679  mannwhitneyu_ucheb(x, -2.993725e-02, &tj, &tj1, &result, _state);
8680  mannwhitneyu_ucheb(x, -3.567219e-03, &tj, &tj1, &result, _state);
8681  mannwhitneyu_ucheb(x, 3.383704e-03, &tj, &tj1, &result, _state);
8682  mannwhitneyu_ucheb(x, 5.002188e-03, &tj, &tj1, &result, _state);
8683  mannwhitneyu_ucheb(x, 4.487322e-03, &tj, &tj1, &result, _state);
8684  mannwhitneyu_ucheb(x, 3.443899e-03, &tj, &tj1, &result, _state);
8685  mannwhitneyu_ucheb(x, 2.688270e-03, &tj, &tj1, &result, _state);
8686  mannwhitneyu_ucheb(x, 2.600339e-03, &tj, &tj1, &result, _state);
8687  mannwhitneyu_ucheb(x, 1.874948e-03, &tj, &tj1, &result, _state);
8688  mannwhitneyu_ucheb(x, 1.811593e-04, &tj, &tj1, &result, _state);
8689  mannwhitneyu_ucheb(x, -1.072353e-03, &tj, &tj1, &result, _state);
8690  mannwhitneyu_ucheb(x, -2.659457e-03, &tj, &tj1, &result, _state);
8691  return result;
8692 }
8693 
8694 
8695 /*************************************************************************
8696 Tail(S, 5, 9)
8697 *************************************************************************/
8698 static double mannwhitneyu_utbln5n9(double s, ae_state *_state)
8699 {
8700  double x;
8701  double tj;
8702  double tj1;
8703  double result;
8704 
8705 
8706  result = 0;
8707  x = ae_minreal(2*(s-0.000000e+00)/3.000000e+00-1, 1.0, _state);
8708  tj = 1;
8709  tj1 = x;
8710  mannwhitneyu_ucheb(x, -3.298162e+00, &tj, &tj1, &result, _state);
8711  mannwhitneyu_ucheb(x, -3.325016e+00, &tj, &tj1, &result, _state);
8712  mannwhitneyu_ucheb(x, -7.939852e-01, &tj, &tj1, &result, _state);
8713  mannwhitneyu_ucheb(x, -1.563029e-01, &tj, &tj1, &result, _state);
8714  mannwhitneyu_ucheb(x, -4.222652e-02, &tj, &tj1, &result, _state);
8715  mannwhitneyu_ucheb(x, -9.195200e-03, &tj, &tj1, &result, _state);
8716  mannwhitneyu_ucheb(x, 1.445665e-03, &tj, &tj1, &result, _state);
8717  mannwhitneyu_ucheb(x, 5.204792e-03, &tj, &tj1, &result, _state);
8718  mannwhitneyu_ucheb(x, 4.775217e-03, &tj, &tj1, &result, _state);
8719  mannwhitneyu_ucheb(x, 3.527781e-03, &tj, &tj1, &result, _state);
8720  mannwhitneyu_ucheb(x, 2.221948e-03, &tj, &tj1, &result, _state);
8721  mannwhitneyu_ucheb(x, 2.242968e-03, &tj, &tj1, &result, _state);
8722  mannwhitneyu_ucheb(x, 2.607959e-03, &tj, &tj1, &result, _state);
8723  mannwhitneyu_ucheb(x, 1.771285e-03, &tj, &tj1, &result, _state);
8724  mannwhitneyu_ucheb(x, 6.694026e-04, &tj, &tj1, &result, _state);
8725  mannwhitneyu_ucheb(x, -1.481190e-03, &tj, &tj1, &result, _state);
8726  return result;
8727 }
8728 
8729 
8730 /*************************************************************************
8731 Tail(S, 5, 10)
8732 *************************************************************************/
8733 static double mannwhitneyu_utbln5n10(double s, ae_state *_state)
8734 {
8735  double x;
8736  double tj;
8737  double tj1;
8738  double result;
8739 
8740 
8741  result = 0;
8742  x = ae_minreal(2*(s-0.000000e+00)/3.061862e+00-1, 1.0, _state);
8743  tj = 1;
8744  tj1 = x;
8745  mannwhitneyu_ucheb(x, -3.425360e+00, &tj, &tj1, &result, _state);
8746  mannwhitneyu_ucheb(x, -3.496710e+00, &tj, &tj1, &result, _state);
8747  mannwhitneyu_ucheb(x, -8.587658e-01, &tj, &tj1, &result, _state);
8748  mannwhitneyu_ucheb(x, -1.812005e-01, &tj, &tj1, &result, _state);
8749  mannwhitneyu_ucheb(x, -5.427637e-02, &tj, &tj1, &result, _state);
8750  mannwhitneyu_ucheb(x, -1.515702e-02, &tj, &tj1, &result, _state);
8751  mannwhitneyu_ucheb(x, -5.406867e-04, &tj, &tj1, &result, _state);
8752  mannwhitneyu_ucheb(x, 4.796295e-03, &tj, &tj1, &result, _state);
8753  mannwhitneyu_ucheb(x, 5.237591e-03, &tj, &tj1, &result, _state);
8754  mannwhitneyu_ucheb(x, 3.654249e-03, &tj, &tj1, &result, _state);
8755  mannwhitneyu_ucheb(x, 2.181165e-03, &tj, &tj1, &result, _state);
8756  mannwhitneyu_ucheb(x, 2.011665e-03, &tj, &tj1, &result, _state);
8757  mannwhitneyu_ucheb(x, 2.417927e-03, &tj, &tj1, &result, _state);
8758  mannwhitneyu_ucheb(x, 2.534880e-03, &tj, &tj1, &result, _state);
8759  mannwhitneyu_ucheb(x, 1.791255e-03, &tj, &tj1, &result, _state);
8760  mannwhitneyu_ucheb(x, 1.871512e-05, &tj, &tj1, &result, _state);
8761  return result;
8762 }
8763 
8764 
8765 /*************************************************************************
8766 Tail(S, 5, 11)
8767 *************************************************************************/
8768 static double mannwhitneyu_utbln5n11(double s, ae_state *_state)
8769 {
8770  double x;
8771  double tj;
8772  double tj1;
8773  double result;
8774 
8775 
8776  result = 0;
8777  x = ae_minreal(2*(s-0.000000e+00)/3.115427e+00-1, 1.0, _state);
8778  tj = 1;
8779  tj1 = x;
8780  mannwhitneyu_ucheb(x, -3.539959e+00, &tj, &tj1, &result, _state);
8781  mannwhitneyu_ucheb(x, -3.652998e+00, &tj, &tj1, &result, _state);
8782  mannwhitneyu_ucheb(x, -9.196503e-01, &tj, &tj1, &result, _state);
8783  mannwhitneyu_ucheb(x, -2.054363e-01, &tj, &tj1, &result, _state);
8784  mannwhitneyu_ucheb(x, -6.618848e-02, &tj, &tj1, &result, _state);
8785  mannwhitneyu_ucheb(x, -2.109411e-02, &tj, &tj1, &result, _state);
8786  mannwhitneyu_ucheb(x, -2.786668e-03, &tj, &tj1, &result, _state);
8787  mannwhitneyu_ucheb(x, 4.215648e-03, &tj, &tj1, &result, _state);
8788  mannwhitneyu_ucheb(x, 5.484220e-03, &tj, &tj1, &result, _state);
8789  mannwhitneyu_ucheb(x, 3.935991e-03, &tj, &tj1, &result, _state);
8790  mannwhitneyu_ucheb(x, 2.396191e-03, &tj, &tj1, &result, _state);
8791  mannwhitneyu_ucheb(x, 1.894177e-03, &tj, &tj1, &result, _state);
8792  mannwhitneyu_ucheb(x, 2.206979e-03, &tj, &tj1, &result, _state);
8793  mannwhitneyu_ucheb(x, 2.519055e-03, &tj, &tj1, &result, _state);
8794  mannwhitneyu_ucheb(x, 2.210326e-03, &tj, &tj1, &result, _state);
8795  mannwhitneyu_ucheb(x, 1.189679e-03, &tj, &tj1, &result, _state);
8796  return result;
8797 }
8798 
8799 
8800 /*************************************************************************
8801 Tail(S, 5, 12)
8802 *************************************************************************/
8803 static double mannwhitneyu_utbln5n12(double s, ae_state *_state)
8804 {
8805  double x;
8806  double tj;
8807  double tj1;
8808  double result;
8809 
8810 
8811  result = 0;
8812  x = ae_minreal(2*(s-0.000000e+00)/3.162278e+00-1, 1.0, _state);
8813  tj = 1;
8814  tj1 = x;
8815  mannwhitneyu_ucheb(x, -3.644007e+00, &tj, &tj1, &result, _state);
8816  mannwhitneyu_ucheb(x, -3.796173e+00, &tj, &tj1, &result, _state);
8817  mannwhitneyu_ucheb(x, -9.771177e-01, &tj, &tj1, &result, _state);
8818  mannwhitneyu_ucheb(x, -2.290043e-01, &tj, &tj1, &result, _state);
8819  mannwhitneyu_ucheb(x, -7.794686e-02, &tj, &tj1, &result, _state);
8820  mannwhitneyu_ucheb(x, -2.702110e-02, &tj, &tj1, &result, _state);
8821  mannwhitneyu_ucheb(x, -5.185959e-03, &tj, &tj1, &result, _state);
8822  mannwhitneyu_ucheb(x, 3.416259e-03, &tj, &tj1, &result, _state);
8823  mannwhitneyu_ucheb(x, 5.592056e-03, &tj, &tj1, &result, _state);
8824  mannwhitneyu_ucheb(x, 4.201530e-03, &tj, &tj1, &result, _state);
8825  mannwhitneyu_ucheb(x, 2.754365e-03, &tj, &tj1, &result, _state);
8826  mannwhitneyu_ucheb(x, 1.978945e-03, &tj, &tj1, &result, _state);
8827  mannwhitneyu_ucheb(x, 2.012032e-03, &tj, &tj1, &result, _state);
8828  mannwhitneyu_ucheb(x, 2.304579e-03, &tj, &tj1, &result, _state);
8829  mannwhitneyu_ucheb(x, 2.100378e-03, &tj, &tj1, &result, _state);
8830  mannwhitneyu_ucheb(x, 1.728269e-03, &tj, &tj1, &result, _state);
8831  return result;
8832 }
8833 
8834 
8835 /*************************************************************************
8836 Tail(S, 5, 13)
8837 *************************************************************************/
8838 static double mannwhitneyu_utbln5n13(double s, ae_state *_state)
8839 {
8840  double x;
8841  double tj;
8842  double tj1;
8843  double result;
8844 
8845 
8846  result = 0;
8847  x = ae_minreal(2*(s-0.000000e+00)/3.203616e+00-1, 1.0, _state);
8848  tj = 1;
8849  tj1 = x;
8850  mannwhitneyu_ucheb(x, -3.739120e+00, &tj, &tj1, &result, _state);
8851  mannwhitneyu_ucheb(x, -3.928117e+00, &tj, &tj1, &result, _state);
8852  mannwhitneyu_ucheb(x, -1.031605e+00, &tj, &tj1, &result, _state);
8853  mannwhitneyu_ucheb(x, -2.519403e-01, &tj, &tj1, &result, _state);
8854  mannwhitneyu_ucheb(x, -8.962648e-02, &tj, &tj1, &result, _state);
8855  mannwhitneyu_ucheb(x, -3.292183e-02, &tj, &tj1, &result, _state);
8856  mannwhitneyu_ucheb(x, -7.809293e-03, &tj, &tj1, &result, _state);
8857  mannwhitneyu_ucheb(x, 2.465156e-03, &tj, &tj1, &result, _state);
8858  mannwhitneyu_ucheb(x, 5.456278e-03, &tj, &tj1, &result, _state);
8859  mannwhitneyu_ucheb(x, 4.446055e-03, &tj, &tj1, &result, _state);
8860  mannwhitneyu_ucheb(x, 3.109490e-03, &tj, &tj1, &result, _state);
8861  mannwhitneyu_ucheb(x, 2.218256e-03, &tj, &tj1, &result, _state);
8862  mannwhitneyu_ucheb(x, 1.941479e-03, &tj, &tj1, &result, _state);
8863  mannwhitneyu_ucheb(x, 2.058603e-03, &tj, &tj1, &result, _state);
8864  mannwhitneyu_ucheb(x, 1.824402e-03, &tj, &tj1, &result, _state);
8865  mannwhitneyu_ucheb(x, 1.830947e-03, &tj, &tj1, &result, _state);
8866  return result;
8867 }
8868 
8869 
8870 /*************************************************************************
8871 Tail(S, 5, 14)
8872 *************************************************************************/
8873 static double mannwhitneyu_utbln5n14(double s, ae_state *_state)
8874 {
8875  double x;
8876  double tj;
8877  double tj1;
8878  double result;
8879 
8880 
8881  result = 0;
8882  x = ae_minreal(2*(s-0.000000e+00)/3.240370e+00-1, 1.0, _state);
8883  tj = 1;
8884  tj1 = x;
8885  mannwhitneyu_ucheb(x, -3.826559e+00, &tj, &tj1, &result, _state);
8886  mannwhitneyu_ucheb(x, -4.050370e+00, &tj, &tj1, &result, _state);
8887  mannwhitneyu_ucheb(x, -1.083408e+00, &tj, &tj1, &result, _state);
8888  mannwhitneyu_ucheb(x, -2.743164e-01, &tj, &tj1, &result, _state);
8889  mannwhitneyu_ucheb(x, -1.012030e-01, &tj, &tj1, &result, _state);
8890  mannwhitneyu_ucheb(x, -3.884686e-02, &tj, &tj1, &result, _state);
8891  mannwhitneyu_ucheb(x, -1.059656e-02, &tj, &tj1, &result, _state);
8892  mannwhitneyu_ucheb(x, 1.327521e-03, &tj, &tj1, &result, _state);
8893  mannwhitneyu_ucheb(x, 5.134026e-03, &tj, &tj1, &result, _state);
8894  mannwhitneyu_ucheb(x, 4.584201e-03, &tj, &tj1, &result, _state);
8895  mannwhitneyu_ucheb(x, 3.440618e-03, &tj, &tj1, &result, _state);
8896  mannwhitneyu_ucheb(x, 2.524133e-03, &tj, &tj1, &result, _state);
8897  mannwhitneyu_ucheb(x, 1.990007e-03, &tj, &tj1, &result, _state);
8898  mannwhitneyu_ucheb(x, 1.887334e-03, &tj, &tj1, &result, _state);
8899  mannwhitneyu_ucheb(x, 1.534977e-03, &tj, &tj1, &result, _state);
8900  mannwhitneyu_ucheb(x, 1.705395e-03, &tj, &tj1, &result, _state);
8901  return result;
8902 }
8903 
8904 
8905 /*************************************************************************
8906 Tail(S, 5, 15)
8907 *************************************************************************/
8908 static double mannwhitneyu_utbln5n15(double s, ae_state *_state)
8909 {
8910  double x;
8911  double tj;
8912  double tj1;
8913  double result;
8914 
8915 
8916  result = 0;
8917  x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
8918  tj = 1;
8919  tj1 = x;
8920  mannwhitneyu_ucheb(x, -3.851572e+00, &tj, &tj1, &result, _state);
8921  mannwhitneyu_ucheb(x, -4.082033e+00, &tj, &tj1, &result, _state);
8922  mannwhitneyu_ucheb(x, -1.095983e+00, &tj, &tj1, &result, _state);
8923  mannwhitneyu_ucheb(x, -2.814595e-01, &tj, &tj1, &result, _state);
8924  mannwhitneyu_ucheb(x, -1.073148e-01, &tj, &tj1, &result, _state);
8925  mannwhitneyu_ucheb(x, -4.420213e-02, &tj, &tj1, &result, _state);
8926  mannwhitneyu_ucheb(x, -1.517175e-02, &tj, &tj1, &result, _state);
8927  mannwhitneyu_ucheb(x, -2.344180e-03, &tj, &tj1, &result, _state);
8928  mannwhitneyu_ucheb(x, 2.371393e-03, &tj, &tj1, &result, _state);
8929  mannwhitneyu_ucheb(x, 2.711443e-03, &tj, &tj1, &result, _state);
8930  mannwhitneyu_ucheb(x, 2.228569e-03, &tj, &tj1, &result, _state);
8931  mannwhitneyu_ucheb(x, 1.683483e-03, &tj, &tj1, &result, _state);
8932  mannwhitneyu_ucheb(x, 1.267112e-03, &tj, &tj1, &result, _state);
8933  mannwhitneyu_ucheb(x, 1.156044e-03, &tj, &tj1, &result, _state);
8934  mannwhitneyu_ucheb(x, 9.131316e-04, &tj, &tj1, &result, _state);
8935  mannwhitneyu_ucheb(x, 1.301023e-03, &tj, &tj1, &result, _state);
8936  return result;
8937 }
8938 
8939 
8940 /*************************************************************************
8941 Tail(S, 5, 16)
8942 *************************************************************************/
8943 static double mannwhitneyu_utbln5n16(double s, ae_state *_state)
8944 {
8945  double x;
8946  double tj;
8947  double tj1;
8948  double result;
8949 
8950 
8951  result = 0;
8952  x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
8953  tj = 1;
8954  tj1 = x;
8955  mannwhitneyu_ucheb(x, -3.852210e+00, &tj, &tj1, &result, _state);
8956  mannwhitneyu_ucheb(x, -4.077482e+00, &tj, &tj1, &result, _state);
8957  mannwhitneyu_ucheb(x, -1.091186e+00, &tj, &tj1, &result, _state);
8958  mannwhitneyu_ucheb(x, -2.797282e-01, &tj, &tj1, &result, _state);
8959  mannwhitneyu_ucheb(x, -1.084994e-01, &tj, &tj1, &result, _state);
8960  mannwhitneyu_ucheb(x, -4.667054e-02, &tj, &tj1, &result, _state);
8961  mannwhitneyu_ucheb(x, -1.843909e-02, &tj, &tj1, &result, _state);
8962  mannwhitneyu_ucheb(x, -5.456732e-03, &tj, &tj1, &result, _state);
8963  mannwhitneyu_ucheb(x, -5.039830e-04, &tj, &tj1, &result, _state);
8964  mannwhitneyu_ucheb(x, 4.723508e-04, &tj, &tj1, &result, _state);
8965  mannwhitneyu_ucheb(x, 3.940608e-04, &tj, &tj1, &result, _state);
8966  mannwhitneyu_ucheb(x, 1.478285e-04, &tj, &tj1, &result, _state);
8967  mannwhitneyu_ucheb(x, -1.649144e-04, &tj, &tj1, &result, _state);
8968  mannwhitneyu_ucheb(x, -4.237703e-04, &tj, &tj1, &result, _state);
8969  mannwhitneyu_ucheb(x, -4.707410e-04, &tj, &tj1, &result, _state);
8970  mannwhitneyu_ucheb(x, -1.874293e-04, &tj, &tj1, &result, _state);
8971  return result;
8972 }
8973 
8974 
8975 /*************************************************************************
8976 Tail(S, 5, 17)
8977 *************************************************************************/
8978 static double mannwhitneyu_utbln5n17(double s, ae_state *_state)
8979 {
8980  double x;
8981  double tj;
8982  double tj1;
8983  double result;
8984 
8985 
8986  result = 0;
8987  x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
8988  tj = 1;
8989  tj1 = x;
8990  mannwhitneyu_ucheb(x, -3.851752e+00, &tj, &tj1, &result, _state);
8991  mannwhitneyu_ucheb(x, -4.071259e+00, &tj, &tj1, &result, _state);
8992  mannwhitneyu_ucheb(x, -1.084700e+00, &tj, &tj1, &result, _state);
8993  mannwhitneyu_ucheb(x, -2.758898e-01, &tj, &tj1, &result, _state);
8994  mannwhitneyu_ucheb(x, -1.073846e-01, &tj, &tj1, &result, _state);
8995  mannwhitneyu_ucheb(x, -4.684838e-02, &tj, &tj1, &result, _state);
8996  mannwhitneyu_ucheb(x, -1.964936e-02, &tj, &tj1, &result, _state);
8997  mannwhitneyu_ucheb(x, -6.782442e-03, &tj, &tj1, &result, _state);
8998  mannwhitneyu_ucheb(x, -1.956362e-03, &tj, &tj1, &result, _state);
8999  mannwhitneyu_ucheb(x, -5.984727e-04, &tj, &tj1, &result, _state);
9000  mannwhitneyu_ucheb(x, -5.196936e-04, &tj, &tj1, &result, _state);
9001  mannwhitneyu_ucheb(x, -5.558262e-04, &tj, &tj1, &result, _state);
9002  mannwhitneyu_ucheb(x, -8.690746e-04, &tj, &tj1, &result, _state);
9003  mannwhitneyu_ucheb(x, -1.364855e-03, &tj, &tj1, &result, _state);
9004  mannwhitneyu_ucheb(x, -1.401006e-03, &tj, &tj1, &result, _state);
9005  mannwhitneyu_ucheb(x, -1.546748e-03, &tj, &tj1, &result, _state);
9006  return result;
9007 }
9008 
9009 
9010 /*************************************************************************
9011 Tail(S, 5, 18)
9012 *************************************************************************/
9013 static double mannwhitneyu_utbln5n18(double s, ae_state *_state)
9014 {
9015  double x;
9016  double tj;
9017  double tj1;
9018  double result;
9019 
9020 
9021  result = 0;
9022  x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
9023  tj = 1;
9024  tj1 = x;
9025  mannwhitneyu_ucheb(x, -3.850840e+00, &tj, &tj1, &result, _state);
9026  mannwhitneyu_ucheb(x, -4.064799e+00, &tj, &tj1, &result, _state);
9027  mannwhitneyu_ucheb(x, -1.077651e+00, &tj, &tj1, &result, _state);
9028  mannwhitneyu_ucheb(x, -2.712659e-01, &tj, &tj1, &result, _state);
9029  mannwhitneyu_ucheb(x, -1.049217e-01, &tj, &tj1, &result, _state);
9030  mannwhitneyu_ucheb(x, -4.571333e-02, &tj, &tj1, &result, _state);
9031  mannwhitneyu_ucheb(x, -1.929809e-02, &tj, &tj1, &result, _state);
9032  mannwhitneyu_ucheb(x, -6.752044e-03, &tj, &tj1, &result, _state);
9033  mannwhitneyu_ucheb(x, -1.949464e-03, &tj, &tj1, &result, _state);
9034  mannwhitneyu_ucheb(x, -3.896101e-04, &tj, &tj1, &result, _state);
9035  mannwhitneyu_ucheb(x, -4.614460e-05, &tj, &tj1, &result, _state);
9036  mannwhitneyu_ucheb(x, 1.384357e-04, &tj, &tj1, &result, _state);
9037  mannwhitneyu_ucheb(x, -6.489113e-05, &tj, &tj1, &result, _state);
9038  mannwhitneyu_ucheb(x, -6.445725e-04, &tj, &tj1, &result, _state);
9039  mannwhitneyu_ucheb(x, -8.945636e-04, &tj, &tj1, &result, _state);
9040  mannwhitneyu_ucheb(x, -1.424653e-03, &tj, &tj1, &result, _state);
9041  return result;
9042 }
9043 
9044 
9045 /*************************************************************************
9046 Tail(S, 5, 19)
9047 *************************************************************************/
9048 static double mannwhitneyu_utbln5n19(double s, ae_state *_state)
9049 {
9050  double x;
9051  double tj;
9052  double tj1;
9053  double result;
9054 
9055 
9056  result = 0;
9057  x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
9058  tj = 1;
9059  tj1 = x;
9060  mannwhitneyu_ucheb(x, -3.850027e+00, &tj, &tj1, &result, _state);
9061  mannwhitneyu_ucheb(x, -4.059159e+00, &tj, &tj1, &result, _state);
9062  mannwhitneyu_ucheb(x, -1.071106e+00, &tj, &tj1, &result, _state);
9063  mannwhitneyu_ucheb(x, -2.669960e-01, &tj, &tj1, &result, _state);
9064  mannwhitneyu_ucheb(x, -1.022780e-01, &tj, &tj1, &result, _state);
9065  mannwhitneyu_ucheb(x, -4.442555e-02, &tj, &tj1, &result, _state);
9066  mannwhitneyu_ucheb(x, -1.851335e-02, &tj, &tj1, &result, _state);
9067  mannwhitneyu_ucheb(x, -6.433865e-03, &tj, &tj1, &result, _state);
9068  mannwhitneyu_ucheb(x, -1.514465e-03, &tj, &tj1, &result, _state);
9069  mannwhitneyu_ucheb(x, 1.332989e-04, &tj, &tj1, &result, _state);
9070  mannwhitneyu_ucheb(x, 8.606099e-04, &tj, &tj1, &result, _state);
9071  mannwhitneyu_ucheb(x, 1.341945e-03, &tj, &tj1, &result, _state);
9072  mannwhitneyu_ucheb(x, 1.402164e-03, &tj, &tj1, &result, _state);
9073  mannwhitneyu_ucheb(x, 1.039761e-03, &tj, &tj1, &result, _state);
9074  mannwhitneyu_ucheb(x, 5.512831e-04, &tj, &tj1, &result, _state);
9075  mannwhitneyu_ucheb(x, -3.284427e-05, &tj, &tj1, &result, _state);
9076  return result;
9077 }
9078 
9079 
9080 /*************************************************************************
9081 Tail(S, 5, 20)
9082 *************************************************************************/
9083 static double mannwhitneyu_utbln5n20(double s, ae_state *_state)
9084 {
9085  double x;
9086  double tj;
9087  double tj1;
9088  double result;
9089 
9090 
9091  result = 0;
9092  x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
9093  tj = 1;
9094  tj1 = x;
9095  mannwhitneyu_ucheb(x, -3.849651e+00, &tj, &tj1, &result, _state);
9096  mannwhitneyu_ucheb(x, -4.054729e+00, &tj, &tj1, &result, _state);
9097  mannwhitneyu_ucheb(x, -1.065747e+00, &tj, &tj1, &result, _state);
9098  mannwhitneyu_ucheb(x, -2.636243e-01, &tj, &tj1, &result, _state);
9099  mannwhitneyu_ucheb(x, -1.003234e-01, &tj, &tj1, &result, _state);
9100  mannwhitneyu_ucheb(x, -4.372789e-02, &tj, &tj1, &result, _state);
9101  mannwhitneyu_ucheb(x, -1.831551e-02, &tj, &tj1, &result, _state);
9102  mannwhitneyu_ucheb(x, -6.763090e-03, &tj, &tj1, &result, _state);
9103  mannwhitneyu_ucheb(x, -1.830626e-03, &tj, &tj1, &result, _state);
9104  mannwhitneyu_ucheb(x, -2.122384e-04, &tj, &tj1, &result, _state);
9105  mannwhitneyu_ucheb(x, 8.108328e-04, &tj, &tj1, &result, _state);
9106  mannwhitneyu_ucheb(x, 1.557983e-03, &tj, &tj1, &result, _state);
9107  mannwhitneyu_ucheb(x, 1.945666e-03, &tj, &tj1, &result, _state);
9108  mannwhitneyu_ucheb(x, 1.965696e-03, &tj, &tj1, &result, _state);
9109  mannwhitneyu_ucheb(x, 1.493236e-03, &tj, &tj1, &result, _state);
9110  mannwhitneyu_ucheb(x, 1.162591e-03, &tj, &tj1, &result, _state);
9111  return result;
9112 }
9113 
9114 
9115 /*************************************************************************
9116 Tail(S, 5, 21)
9117 *************************************************************************/
9118 static double mannwhitneyu_utbln5n21(double s, ae_state *_state)
9119 {
9120  double x;
9121  double tj;
9122  double tj1;
9123  double result;
9124 
9125 
9126  result = 0;
9127  x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
9128  tj = 1;
9129  tj1 = x;
9130  mannwhitneyu_ucheb(x, -3.849649e+00, &tj, &tj1, &result, _state);
9131  mannwhitneyu_ucheb(x, -4.051155e+00, &tj, &tj1, &result, _state);
9132  mannwhitneyu_ucheb(x, -1.061430e+00, &tj, &tj1, &result, _state);
9133  mannwhitneyu_ucheb(x, -2.608869e-01, &tj, &tj1, &result, _state);
9134  mannwhitneyu_ucheb(x, -9.902788e-02, &tj, &tj1, &result, _state);
9135  mannwhitneyu_ucheb(x, -4.346562e-02, &tj, &tj1, &result, _state);
9136  mannwhitneyu_ucheb(x, -1.874709e-02, &tj, &tj1, &result, _state);
9137  mannwhitneyu_ucheb(x, -7.682887e-03, &tj, &tj1, &result, _state);
9138  mannwhitneyu_ucheb(x, -3.026206e-03, &tj, &tj1, &result, _state);
9139  mannwhitneyu_ucheb(x, -1.534551e-03, &tj, &tj1, &result, _state);
9140  mannwhitneyu_ucheb(x, -4.990575e-04, &tj, &tj1, &result, _state);
9141  mannwhitneyu_ucheb(x, 3.713334e-04, &tj, &tj1, &result, _state);
9142  mannwhitneyu_ucheb(x, 9.737011e-04, &tj, &tj1, &result, _state);
9143  mannwhitneyu_ucheb(x, 1.304571e-03, &tj, &tj1, &result, _state);
9144  mannwhitneyu_ucheb(x, 1.133110e-03, &tj, &tj1, &result, _state);
9145  mannwhitneyu_ucheb(x, 1.123457e-03, &tj, &tj1, &result, _state);
9146  return result;
9147 }
9148 
9149 
9150 /*************************************************************************
9151 Tail(S, 5, 22)
9152 *************************************************************************/
9153 static double mannwhitneyu_utbln5n22(double s, ae_state *_state)
9154 {
9155  double x;
9156  double tj;
9157  double tj1;
9158  double result;
9159 
9160 
9161  result = 0;
9162  x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
9163  tj = 1;
9164  tj1 = x;
9165  mannwhitneyu_ucheb(x, -3.849598e+00, &tj, &tj1, &result, _state);
9166  mannwhitneyu_ucheb(x, -4.047605e+00, &tj, &tj1, &result, _state);
9167  mannwhitneyu_ucheb(x, -1.057264e+00, &tj, &tj1, &result, _state);
9168  mannwhitneyu_ucheb(x, -2.579513e-01, &tj, &tj1, &result, _state);
9169  mannwhitneyu_ucheb(x, -9.749602e-02, &tj, &tj1, &result, _state);
9170  mannwhitneyu_ucheb(x, -4.275137e-02, &tj, &tj1, &result, _state);
9171  mannwhitneyu_ucheb(x, -1.881768e-02, &tj, &tj1, &result, _state);
9172  mannwhitneyu_ucheb(x, -8.177374e-03, &tj, &tj1, &result, _state);
9173  mannwhitneyu_ucheb(x, -3.981056e-03, &tj, &tj1, &result, _state);
9174  mannwhitneyu_ucheb(x, -2.696290e-03, &tj, &tj1, &result, _state);
9175  mannwhitneyu_ucheb(x, -1.886803e-03, &tj, &tj1, &result, _state);
9176  mannwhitneyu_ucheb(x, -1.085378e-03, &tj, &tj1, &result, _state);
9177  mannwhitneyu_ucheb(x, -4.675242e-04, &tj, &tj1, &result, _state);
9178  mannwhitneyu_ucheb(x, -5.426367e-05, &tj, &tj1, &result, _state);
9179  mannwhitneyu_ucheb(x, 1.039613e-04, &tj, &tj1, &result, _state);
9180  mannwhitneyu_ucheb(x, 2.662378e-04, &tj, &tj1, &result, _state);
9181  return result;
9182 }
9183 
9184 
9185 /*************************************************************************
9186 Tail(S, 5, 23)
9187 *************************************************************************/
9188 static double mannwhitneyu_utbln5n23(double s, ae_state *_state)
9189 {
9190  double x;
9191  double tj;
9192  double tj1;
9193  double result;
9194 
9195 
9196  result = 0;
9197  x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
9198  tj = 1;
9199  tj1 = x;
9200  mannwhitneyu_ucheb(x, -3.849269e+00, &tj, &tj1, &result, _state);
9201  mannwhitneyu_ucheb(x, -4.043761e+00, &tj, &tj1, &result, _state);
9202  mannwhitneyu_ucheb(x, -1.052735e+00, &tj, &tj1, &result, _state);
9203  mannwhitneyu_ucheb(x, -2.544683e-01, &tj, &tj1, &result, _state);
9204  mannwhitneyu_ucheb(x, -9.517503e-02, &tj, &tj1, &result, _state);
9205  mannwhitneyu_ucheb(x, -4.112082e-02, &tj, &tj1, &result, _state);
9206  mannwhitneyu_ucheb(x, -1.782070e-02, &tj, &tj1, &result, _state);
9207  mannwhitneyu_ucheb(x, -7.549483e-03, &tj, &tj1, &result, _state);
9208  mannwhitneyu_ucheb(x, -3.747329e-03, &tj, &tj1, &result, _state);
9209  mannwhitneyu_ucheb(x, -2.694263e-03, &tj, &tj1, &result, _state);
9210  mannwhitneyu_ucheb(x, -2.147141e-03, &tj, &tj1, &result, _state);
9211  mannwhitneyu_ucheb(x, -1.526209e-03, &tj, &tj1, &result, _state);
9212  mannwhitneyu_ucheb(x, -1.039173e-03, &tj, &tj1, &result, _state);
9213  mannwhitneyu_ucheb(x, -7.235615e-04, &tj, &tj1, &result, _state);
9214  mannwhitneyu_ucheb(x, -4.656546e-04, &tj, &tj1, &result, _state);
9215  mannwhitneyu_ucheb(x, -3.014423e-04, &tj, &tj1, &result, _state);
9216  return result;
9217 }
9218 
9219 
9220 /*************************************************************************
9221 Tail(S, 5, 24)
9222 *************************************************************************/
9223 static double mannwhitneyu_utbln5n24(double s, ae_state *_state)
9224 {
9225  double x;
9226  double tj;
9227  double tj1;
9228  double result;
9229 
9230 
9231  result = 0;
9232  x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
9233  tj = 1;
9234  tj1 = x;
9235  mannwhitneyu_ucheb(x, -3.848925e+00, &tj, &tj1, &result, _state);
9236  mannwhitneyu_ucheb(x, -4.040178e+00, &tj, &tj1, &result, _state);
9237  mannwhitneyu_ucheb(x, -1.048355e+00, &tj, &tj1, &result, _state);
9238  mannwhitneyu_ucheb(x, -2.510198e-01, &tj, &tj1, &result, _state);
9239  mannwhitneyu_ucheb(x, -9.261134e-02, &tj, &tj1, &result, _state);
9240  mannwhitneyu_ucheb(x, -3.915864e-02, &tj, &tj1, &result, _state);
9241  mannwhitneyu_ucheb(x, -1.627423e-02, &tj, &tj1, &result, _state);
9242  mannwhitneyu_ucheb(x, -6.307345e-03, &tj, &tj1, &result, _state);
9243  mannwhitneyu_ucheb(x, -2.732992e-03, &tj, &tj1, &result, _state);
9244  mannwhitneyu_ucheb(x, -1.869652e-03, &tj, &tj1, &result, _state);
9245  mannwhitneyu_ucheb(x, -1.494176e-03, &tj, &tj1, &result, _state);
9246  mannwhitneyu_ucheb(x, -1.047533e-03, &tj, &tj1, &result, _state);
9247  mannwhitneyu_ucheb(x, -7.178439e-04, &tj, &tj1, &result, _state);
9248  mannwhitneyu_ucheb(x, -5.424171e-04, &tj, &tj1, &result, _state);
9249  mannwhitneyu_ucheb(x, -3.829195e-04, &tj, &tj1, &result, _state);
9250  mannwhitneyu_ucheb(x, -2.840810e-04, &tj, &tj1, &result, _state);
9251  return result;
9252 }
9253 
9254 
9255 /*************************************************************************
9256 Tail(S, 5, 25)
9257 *************************************************************************/
9258 static double mannwhitneyu_utbln5n25(double s, ae_state *_state)
9259 {
9260  double x;
9261  double tj;
9262  double tj1;
9263  double result;
9264 
9265 
9266  result = 0;
9267  x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
9268  tj = 1;
9269  tj1 = x;
9270  mannwhitneyu_ucheb(x, -3.848937e+00, &tj, &tj1, &result, _state);
9271  mannwhitneyu_ucheb(x, -4.037512e+00, &tj, &tj1, &result, _state);
9272  mannwhitneyu_ucheb(x, -1.044866e+00, &tj, &tj1, &result, _state);
9273  mannwhitneyu_ucheb(x, -2.483269e-01, &tj, &tj1, &result, _state);
9274  mannwhitneyu_ucheb(x, -9.063682e-02, &tj, &tj1, &result, _state);
9275  mannwhitneyu_ucheb(x, -3.767778e-02, &tj, &tj1, &result, _state);
9276  mannwhitneyu_ucheb(x, -1.508540e-02, &tj, &tj1, &result, _state);
9277  mannwhitneyu_ucheb(x, -5.332756e-03, &tj, &tj1, &result, _state);
9278  mannwhitneyu_ucheb(x, -1.881511e-03, &tj, &tj1, &result, _state);
9279  mannwhitneyu_ucheb(x, -1.124041e-03, &tj, &tj1, &result, _state);
9280  mannwhitneyu_ucheb(x, -8.368456e-04, &tj, &tj1, &result, _state);
9281  mannwhitneyu_ucheb(x, -4.930499e-04, &tj, &tj1, &result, _state);
9282  mannwhitneyu_ucheb(x, -2.779630e-04, &tj, &tj1, &result, _state);
9283  mannwhitneyu_ucheb(x, -2.029528e-04, &tj, &tj1, &result, _state);
9284  mannwhitneyu_ucheb(x, -1.658678e-04, &tj, &tj1, &result, _state);
9285  mannwhitneyu_ucheb(x, -1.289695e-04, &tj, &tj1, &result, _state);
9286  return result;
9287 }
9288 
9289 
9290 /*************************************************************************
9291 Tail(S, 5, 26)
9292 *************************************************************************/
9293 static double mannwhitneyu_utbln5n26(double s, ae_state *_state)
9294 {
9295  double x;
9296  double tj;
9297  double tj1;
9298  double result;
9299 
9300 
9301  result = 0;
9302  x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
9303  tj = 1;
9304  tj1 = x;
9305  mannwhitneyu_ucheb(x, -3.849416e+00, &tj, &tj1, &result, _state);
9306  mannwhitneyu_ucheb(x, -4.035915e+00, &tj, &tj1, &result, _state);
9307  mannwhitneyu_ucheb(x, -1.042493e+00, &tj, &tj1, &result, _state);
9308  mannwhitneyu_ucheb(x, -2.466021e-01, &tj, &tj1, &result, _state);
9309  mannwhitneyu_ucheb(x, -8.956432e-02, &tj, &tj1, &result, _state);
9310  mannwhitneyu_ucheb(x, -3.698914e-02, &tj, &tj1, &result, _state);
9311  mannwhitneyu_ucheb(x, -1.465689e-02, &tj, &tj1, &result, _state);
9312  mannwhitneyu_ucheb(x, -5.035254e-03, &tj, &tj1, &result, _state);
9313  mannwhitneyu_ucheb(x, -1.674614e-03, &tj, &tj1, &result, _state);
9314  mannwhitneyu_ucheb(x, -9.492734e-04, &tj, &tj1, &result, _state);
9315  mannwhitneyu_ucheb(x, -7.014021e-04, &tj, &tj1, &result, _state);
9316  mannwhitneyu_ucheb(x, -3.944953e-04, &tj, &tj1, &result, _state);
9317  mannwhitneyu_ucheb(x, -2.255750e-04, &tj, &tj1, &result, _state);
9318  mannwhitneyu_ucheb(x, -2.075841e-04, &tj, &tj1, &result, _state);
9319  mannwhitneyu_ucheb(x, -1.989330e-04, &tj, &tj1, &result, _state);
9320  mannwhitneyu_ucheb(x, -2.134862e-04, &tj, &tj1, &result, _state);
9321  return result;
9322 }
9323 
9324 
9325 /*************************************************************************
9326 Tail(S, 5, 27)
9327 *************************************************************************/
9328 static double mannwhitneyu_utbln5n27(double s, ae_state *_state)
9329 {
9330  double x;
9331  double tj;
9332  double tj1;
9333  double result;
9334 
9335 
9336  result = 0;
9337  x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
9338  tj = 1;
9339  tj1 = x;
9340  mannwhitneyu_ucheb(x, -3.850070e+00, &tj, &tj1, &result, _state);
9341  mannwhitneyu_ucheb(x, -4.034815e+00, &tj, &tj1, &result, _state);
9342  mannwhitneyu_ucheb(x, -1.040650e+00, &tj, &tj1, &result, _state);
9343  mannwhitneyu_ucheb(x, -2.453117e-01, &tj, &tj1, &result, _state);
9344  mannwhitneyu_ucheb(x, -8.886426e-02, &tj, &tj1, &result, _state);
9345  mannwhitneyu_ucheb(x, -3.661702e-02, &tj, &tj1, &result, _state);
9346  mannwhitneyu_ucheb(x, -1.452346e-02, &tj, &tj1, &result, _state);
9347  mannwhitneyu_ucheb(x, -5.002476e-03, &tj, &tj1, &result, _state);
9348  mannwhitneyu_ucheb(x, -1.720126e-03, &tj, &tj1, &result, _state);
9349  mannwhitneyu_ucheb(x, -1.001400e-03, &tj, &tj1, &result, _state);
9350  mannwhitneyu_ucheb(x, -7.729826e-04, &tj, &tj1, &result, _state);
9351  mannwhitneyu_ucheb(x, -4.740640e-04, &tj, &tj1, &result, _state);
9352  mannwhitneyu_ucheb(x, -3.206333e-04, &tj, &tj1, &result, _state);
9353  mannwhitneyu_ucheb(x, -3.366093e-04, &tj, &tj1, &result, _state);
9354  mannwhitneyu_ucheb(x, -3.193471e-04, &tj, &tj1, &result, _state);
9355  mannwhitneyu_ucheb(x, -3.804091e-04, &tj, &tj1, &result, _state);
9356  return result;
9357 }
9358 
9359 
9360 /*************************************************************************
9361 Tail(S, 5, 28)
9362 *************************************************************************/
9363 static double mannwhitneyu_utbln5n28(double s, ae_state *_state)
9364 {
9365  double x;
9366  double tj;
9367  double tj1;
9368  double result;
9369 
9370 
9371  result = 0;
9372  x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
9373  tj = 1;
9374  tj1 = x;
9375  mannwhitneyu_ucheb(x, -3.850668e+00, &tj, &tj1, &result, _state);
9376  mannwhitneyu_ucheb(x, -4.033786e+00, &tj, &tj1, &result, _state);
9377  mannwhitneyu_ucheb(x, -1.038853e+00, &tj, &tj1, &result, _state);
9378  mannwhitneyu_ucheb(x, -2.440281e-01, &tj, &tj1, &result, _state);
9379  mannwhitneyu_ucheb(x, -8.806020e-02, &tj, &tj1, &result, _state);
9380  mannwhitneyu_ucheb(x, -3.612883e-02, &tj, &tj1, &result, _state);
9381  mannwhitneyu_ucheb(x, -1.420436e-02, &tj, &tj1, &result, _state);
9382  mannwhitneyu_ucheb(x, -4.787982e-03, &tj, &tj1, &result, _state);
9383  mannwhitneyu_ucheb(x, -1.535230e-03, &tj, &tj1, &result, _state);
9384  mannwhitneyu_ucheb(x, -8.263121e-04, &tj, &tj1, &result, _state);
9385  mannwhitneyu_ucheb(x, -5.849609e-04, &tj, &tj1, &result, _state);
9386  mannwhitneyu_ucheb(x, -2.863967e-04, &tj, &tj1, &result, _state);
9387  mannwhitneyu_ucheb(x, -1.391610e-04, &tj, &tj1, &result, _state);
9388  mannwhitneyu_ucheb(x, -1.720294e-04, &tj, &tj1, &result, _state);
9389  mannwhitneyu_ucheb(x, -1.952273e-04, &tj, &tj1, &result, _state);
9390  mannwhitneyu_ucheb(x, -2.901413e-04, &tj, &tj1, &result, _state);
9391  return result;
9392 }
9393 
9394 
9395 /*************************************************************************
9396 Tail(S, 5, 29)
9397 *************************************************************************/
9398 static double mannwhitneyu_utbln5n29(double s, ae_state *_state)
9399 {
9400  double x;
9401  double tj;
9402  double tj1;
9403  double result;
9404 
9405 
9406  result = 0;
9407  x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
9408  tj = 1;
9409  tj1 = x;
9410  mannwhitneyu_ucheb(x, -3.851217e+00, &tj, &tj1, &result, _state);
9411  mannwhitneyu_ucheb(x, -4.032834e+00, &tj, &tj1, &result, _state);
9412  mannwhitneyu_ucheb(x, -1.037113e+00, &tj, &tj1, &result, _state);
9413  mannwhitneyu_ucheb(x, -2.427762e-01, &tj, &tj1, &result, _state);
9414  mannwhitneyu_ucheb(x, -8.719146e-02, &tj, &tj1, &result, _state);
9415  mannwhitneyu_ucheb(x, -3.557172e-02, &tj, &tj1, &result, _state);
9416  mannwhitneyu_ucheb(x, -1.375498e-02, &tj, &tj1, &result, _state);
9417  mannwhitneyu_ucheb(x, -4.452033e-03, &tj, &tj1, &result, _state);
9418  mannwhitneyu_ucheb(x, -1.187516e-03, &tj, &tj1, &result, _state);
9419  mannwhitneyu_ucheb(x, -4.916936e-04, &tj, &tj1, &result, _state);
9420  mannwhitneyu_ucheb(x, -2.065533e-04, &tj, &tj1, &result, _state);
9421  mannwhitneyu_ucheb(x, 1.067301e-04, &tj, &tj1, &result, _state);
9422  mannwhitneyu_ucheb(x, 2.615824e-04, &tj, &tj1, &result, _state);
9423  mannwhitneyu_ucheb(x, 2.432244e-04, &tj, &tj1, &result, _state);
9424  mannwhitneyu_ucheb(x, 1.417795e-04, &tj, &tj1, &result, _state);
9425  mannwhitneyu_ucheb(x, 4.710038e-05, &tj, &tj1, &result, _state);
9426  return result;
9427 }
9428 
9429 
9430 /*************************************************************************
9431 Tail(S, 5, 30)
9432 *************************************************************************/
9433 static double mannwhitneyu_utbln5n30(double s, ae_state *_state)
9434 {
9435  double x;
9436  double tj;
9437  double tj1;
9438  double result;
9439 
9440 
9441  result = 0;
9442  x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
9443  tj = 1;
9444  tj1 = x;
9445  mannwhitneyu_ucheb(x, -3.851845e+00, &tj, &tj1, &result, _state);
9446  mannwhitneyu_ucheb(x, -4.032148e+00, &tj, &tj1, &result, _state);
9447  mannwhitneyu_ucheb(x, -1.035679e+00, &tj, &tj1, &result, _state);
9448  mannwhitneyu_ucheb(x, -2.417758e-01, &tj, &tj1, &result, _state);
9449  mannwhitneyu_ucheb(x, -8.655330e-02, &tj, &tj1, &result, _state);
9450  mannwhitneyu_ucheb(x, -3.522132e-02, &tj, &tj1, &result, _state);
9451  mannwhitneyu_ucheb(x, -1.352106e-02, &tj, &tj1, &result, _state);
9452  mannwhitneyu_ucheb(x, -4.326911e-03, &tj, &tj1, &result, _state);
9453  mannwhitneyu_ucheb(x, -1.064969e-03, &tj, &tj1, &result, _state);
9454  mannwhitneyu_ucheb(x, -3.813321e-04, &tj, &tj1, &result, _state);
9455  mannwhitneyu_ucheb(x, -5.683881e-05, &tj, &tj1, &result, _state);
9456  mannwhitneyu_ucheb(x, 2.813346e-04, &tj, &tj1, &result, _state);
9457  mannwhitneyu_ucheb(x, 4.627085e-04, &tj, &tj1, &result, _state);
9458  mannwhitneyu_ucheb(x, 4.832107e-04, &tj, &tj1, &result, _state);
9459  mannwhitneyu_ucheb(x, 3.519336e-04, &tj, &tj1, &result, _state);
9460  mannwhitneyu_ucheb(x, 2.888530e-04, &tj, &tj1, &result, _state);
9461  return result;
9462 }
9463 
9464 
9465 /*************************************************************************
9466 Tail(S, 5, 100)
9467 *************************************************************************/
9468 static double mannwhitneyu_utbln5n100(double s, ae_state *_state)
9469 {
9470  double x;
9471  double tj;
9472  double tj1;
9473  double result;
9474 
9475 
9476  result = 0;
9477  x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
9478  tj = 1;
9479  tj1 = x;
9480  mannwhitneyu_ucheb(x, -3.877940e+00, &tj, &tj1, &result, _state);
9481  mannwhitneyu_ucheb(x, -4.039324e+00, &tj, &tj1, &result, _state);
9482  mannwhitneyu_ucheb(x, -1.022243e+00, &tj, &tj1, &result, _state);
9483  mannwhitneyu_ucheb(x, -2.305825e-01, &tj, &tj1, &result, _state);
9484  mannwhitneyu_ucheb(x, -7.960119e-02, &tj, &tj1, &result, _state);
9485  mannwhitneyu_ucheb(x, -3.112000e-02, &tj, &tj1, &result, _state);
9486  mannwhitneyu_ucheb(x, -1.138868e-02, &tj, &tj1, &result, _state);
9487  mannwhitneyu_ucheb(x, -3.418164e-03, &tj, &tj1, &result, _state);
9488  mannwhitneyu_ucheb(x, -9.174520e-04, &tj, &tj1, &result, _state);
9489  mannwhitneyu_ucheb(x, -5.489617e-04, &tj, &tj1, &result, _state);
9490  mannwhitneyu_ucheb(x, -3.878301e-04, &tj, &tj1, &result, _state);
9491  mannwhitneyu_ucheb(x, -1.302233e-04, &tj, &tj1, &result, _state);
9492  mannwhitneyu_ucheb(x, 1.054113e-05, &tj, &tj1, &result, _state);
9493  mannwhitneyu_ucheb(x, 2.458862e-05, &tj, &tj1, &result, _state);
9494  mannwhitneyu_ucheb(x, -4.186591e-06, &tj, &tj1, &result, _state);
9495  mannwhitneyu_ucheb(x, -2.623412e-05, &tj, &tj1, &result, _state);
9496  return result;
9497 }
9498 
9499 
9500 /*************************************************************************
9501 Tail(S, 6, 6)
9502 *************************************************************************/
9503 static double mannwhitneyu_utbln6n6(double s, ae_state *_state)
9504 {
9505  double x;
9506  double tj;
9507  double tj1;
9508  double result;
9509 
9510 
9511  result = 0;
9512  x = ae_minreal(2*(s-0.000000e+00)/2.882307e+00-1, 1.0, _state);
9513  tj = 1;
9514  tj1 = x;
9515  mannwhitneyu_ucheb(x, -3.054075e+00, &tj, &tj1, &result, _state);
9516  mannwhitneyu_ucheb(x, -2.998804e+00, &tj, &tj1, &result, _state);
9517  mannwhitneyu_ucheb(x, -6.681518e-01, &tj, &tj1, &result, _state);
9518  mannwhitneyu_ucheb(x, -1.067578e-01, &tj, &tj1, &result, _state);
9519  mannwhitneyu_ucheb(x, -1.709435e-02, &tj, &tj1, &result, _state);
9520  mannwhitneyu_ucheb(x, 9.952661e-04, &tj, &tj1, &result, _state);
9521  mannwhitneyu_ucheb(x, 3.641700e-03, &tj, &tj1, &result, _state);
9522  mannwhitneyu_ucheb(x, 2.304572e-03, &tj, &tj1, &result, _state);
9523  mannwhitneyu_ucheb(x, 3.336275e-03, &tj, &tj1, &result, _state);
9524  mannwhitneyu_ucheb(x, 4.770385e-03, &tj, &tj1, &result, _state);
9525  mannwhitneyu_ucheb(x, 5.401891e-03, &tj, &tj1, &result, _state);
9526  mannwhitneyu_ucheb(x, 2.246148e-03, &tj, &tj1, &result, _state);
9527  mannwhitneyu_ucheb(x, -1.442663e-03, &tj, &tj1, &result, _state);
9528  mannwhitneyu_ucheb(x, -2.502866e-03, &tj, &tj1, &result, _state);
9529  mannwhitneyu_ucheb(x, -2.105855e-03, &tj, &tj1, &result, _state);
9530  mannwhitneyu_ucheb(x, -4.739371e-04, &tj, &tj1, &result, _state);
9531  return result;
9532 }
9533 
9534 
9535 /*************************************************************************
9536 Tail(S, 6, 7)
9537 *************************************************************************/
9538 static double mannwhitneyu_utbln6n7(double s, ae_state *_state)
9539 {
9540  double x;
9541  double tj;
9542  double tj1;
9543  double result;
9544 
9545 
9546  result = 0;
9547  x = ae_minreal(2*(s-0.000000e+00)/3.000000e+00-1, 1.0, _state);
9548  tj = 1;
9549  tj1 = x;
9550  mannwhitneyu_ucheb(x, -3.265287e+00, &tj, &tj1, &result, _state);
9551  mannwhitneyu_ucheb(x, -3.274613e+00, &tj, &tj1, &result, _state);
9552  mannwhitneyu_ucheb(x, -7.582352e-01, &tj, &tj1, &result, _state);
9553  mannwhitneyu_ucheb(x, -1.334293e-01, &tj, &tj1, &result, _state);
9554  mannwhitneyu_ucheb(x, -2.915502e-02, &tj, &tj1, &result, _state);
9555  mannwhitneyu_ucheb(x, -4.108091e-03, &tj, &tj1, &result, _state);
9556  mannwhitneyu_ucheb(x, 1.546701e-03, &tj, &tj1, &result, _state);
9557  mannwhitneyu_ucheb(x, 2.298827e-03, &tj, &tj1, &result, _state);
9558  mannwhitneyu_ucheb(x, 2.891501e-03, &tj, &tj1, &result, _state);
9559  mannwhitneyu_ucheb(x, 4.313717e-03, &tj, &tj1, &result, _state);
9560  mannwhitneyu_ucheb(x, 4.989501e-03, &tj, &tj1, &result, _state);
9561  mannwhitneyu_ucheb(x, 3.914594e-03, &tj, &tj1, &result, _state);
9562  mannwhitneyu_ucheb(x, 1.062372e-03, &tj, &tj1, &result, _state);
9563  mannwhitneyu_ucheb(x, -1.158841e-03, &tj, &tj1, &result, _state);
9564  mannwhitneyu_ucheb(x, -1.596443e-03, &tj, &tj1, &result, _state);
9565  mannwhitneyu_ucheb(x, -1.185662e-03, &tj, &tj1, &result, _state);
9566  return result;
9567 }
9568 
9569 
9570 /*************************************************************************
9571 Tail(S, 6, 8)
9572 *************************************************************************/
9573 static double mannwhitneyu_utbln6n8(double s, ae_state *_state)
9574 {
9575  double x;
9576  double tj;
9577  double tj1;
9578  double result;
9579 
9580 
9581  result = 0;
9582  x = ae_minreal(2*(s-0.000000e+00)/3.098387e+00-1, 1.0, _state);
9583  tj = 1;
9584  tj1 = x;
9585  mannwhitneyu_ucheb(x, -3.450954e+00, &tj, &tj1, &result, _state);
9586  mannwhitneyu_ucheb(x, -3.520462e+00, &tj, &tj1, &result, _state);
9587  mannwhitneyu_ucheb(x, -8.420299e-01, &tj, &tj1, &result, _state);
9588  mannwhitneyu_ucheb(x, -1.604853e-01, &tj, &tj1, &result, _state);
9589  mannwhitneyu_ucheb(x, -4.165840e-02, &tj, &tj1, &result, _state);
9590  mannwhitneyu_ucheb(x, -1.008756e-02, &tj, &tj1, &result, _state);
9591  mannwhitneyu_ucheb(x, -6.723402e-04, &tj, &tj1, &result, _state);
9592  mannwhitneyu_ucheb(x, 1.843521e-03, &tj, &tj1, &result, _state);
9593  mannwhitneyu_ucheb(x, 2.883405e-03, &tj, &tj1, &result, _state);
9594  mannwhitneyu_ucheb(x, 3.720980e-03, &tj, &tj1, &result, _state);
9595  mannwhitneyu_ucheb(x, 4.301709e-03, &tj, &tj1, &result, _state);
9596  mannwhitneyu_ucheb(x, 3.948034e-03, &tj, &tj1, &result, _state);
9597  mannwhitneyu_ucheb(x, 2.776243e-03, &tj, &tj1, &result, _state);
9598  mannwhitneyu_ucheb(x, 8.623736e-04, &tj, &tj1, &result, _state);
9599  mannwhitneyu_ucheb(x, -3.742068e-04, &tj, &tj1, &result, _state);
9600  mannwhitneyu_ucheb(x, -9.796927e-04, &tj, &tj1, &result, _state);
9601  return result;
9602 }
9603 
9604 
9605 /*************************************************************************
9606 Tail(S, 6, 9)
9607 *************************************************************************/
9608 static double mannwhitneyu_utbln6n9(double s, ae_state *_state)
9609 {
9610  double x;
9611  double tj;
9612  double tj1;
9613  double result;
9614 
9615 
9616  result = 0;
9617  x = ae_minreal(2*(s-0.000000e+00)/3.181981e+00-1, 1.0, _state);
9618  tj = 1;
9619  tj1 = x;
9620  mannwhitneyu_ucheb(x, -3.616113e+00, &tj, &tj1, &result, _state);
9621  mannwhitneyu_ucheb(x, -3.741650e+00, &tj, &tj1, &result, _state);
9622  mannwhitneyu_ucheb(x, -9.204487e-01, &tj, &tj1, &result, _state);
9623  mannwhitneyu_ucheb(x, -1.873068e-01, &tj, &tj1, &result, _state);
9624  mannwhitneyu_ucheb(x, -5.446794e-02, &tj, &tj1, &result, _state);
9625  mannwhitneyu_ucheb(x, -1.632286e-02, &tj, &tj1, &result, _state);
9626  mannwhitneyu_ucheb(x, -3.266481e-03, &tj, &tj1, &result, _state);
9627  mannwhitneyu_ucheb(x, 1.280067e-03, &tj, &tj1, &result, _state);
9628  mannwhitneyu_ucheb(x, 2.780687e-03, &tj, &tj1, &result, _state);
9629  mannwhitneyu_ucheb(x, 3.480242e-03, &tj, &tj1, &result, _state);
9630  mannwhitneyu_ucheb(x, 3.592200e-03, &tj, &tj1, &result, _state);
9631  mannwhitneyu_ucheb(x, 3.581019e-03, &tj, &tj1, &result, _state);
9632  mannwhitneyu_ucheb(x, 3.264231e-03, &tj, &tj1, &result, _state);
9633  mannwhitneyu_ucheb(x, 2.347174e-03, &tj, &tj1, &result, _state);
9634  mannwhitneyu_ucheb(x, 1.167535e-03, &tj, &tj1, &result, _state);
9635  mannwhitneyu_ucheb(x, -1.092185e-04, &tj, &tj1, &result, _state);
9636  return result;
9637 }
9638 
9639 
9640 /*************************************************************************
9641 Tail(S, 6, 10)
9642 *************************************************************************/
9643 static double mannwhitneyu_utbln6n10(double s, ae_state *_state)
9644 {
9645  double x;
9646  double tj;
9647  double tj1;
9648  double result;
9649 
9650 
9651  result = 0;
9652  x = ae_minreal(2*(s-0.000000e+00)/3.253957e+00-1, 1.0, _state);
9653  tj = 1;
9654  tj1 = x;
9655  mannwhitneyu_ucheb(x, -3.764382e+00, &tj, &tj1, &result, _state);
9656  mannwhitneyu_ucheb(x, -3.942366e+00, &tj, &tj1, &result, _state);
9657  mannwhitneyu_ucheb(x, -9.939896e-01, &tj, &tj1, &result, _state);
9658  mannwhitneyu_ucheb(x, -2.137812e-01, &tj, &tj1, &result, _state);
9659  mannwhitneyu_ucheb(x, -6.720270e-02, &tj, &tj1, &result, _state);
9660  mannwhitneyu_ucheb(x, -2.281070e-02, &tj, &tj1, &result, _state);
9661  mannwhitneyu_ucheb(x, -5.901060e-03, &tj, &tj1, &result, _state);
9662  mannwhitneyu_ucheb(x, 3.824937e-04, &tj, &tj1, &result, _state);
9663  mannwhitneyu_ucheb(x, 2.802812e-03, &tj, &tj1, &result, _state);
9664  mannwhitneyu_ucheb(x, 3.258132e-03, &tj, &tj1, &result, _state);
9665  mannwhitneyu_ucheb(x, 3.233536e-03, &tj, &tj1, &result, _state);
9666  mannwhitneyu_ucheb(x, 3.085530e-03, &tj, &tj1, &result, _state);
9667  mannwhitneyu_ucheb(x, 3.212151e-03, &tj, &tj1, &result, _state);
9668  mannwhitneyu_ucheb(x, 3.001329e-03, &tj, &tj1, &result, _state);
9669  mannwhitneyu_ucheb(x, 2.226048e-03, &tj, &tj1, &result, _state);
9670  mannwhitneyu_ucheb(x, 1.035298e-03, &tj, &tj1, &result, _state);
9671  return result;
9672 }
9673 
9674 
9675 /*************************************************************************
9676 Tail(S, 6, 11)
9677 *************************************************************************/
9678 static double mannwhitneyu_utbln6n11(double s, ae_state *_state)
9679 {
9680  double x;
9681  double tj;
9682  double tj1;
9683  double result;
9684 
9685 
9686  result = 0;
9687  x = ae_minreal(2*(s-0.000000e+00)/3.316625e+00-1, 1.0, _state);
9688  tj = 1;
9689  tj1 = x;
9690  mannwhitneyu_ucheb(x, -3.898597e+00, &tj, &tj1, &result, _state);
9691  mannwhitneyu_ucheb(x, -4.125710e+00, &tj, &tj1, &result, _state);
9692  mannwhitneyu_ucheb(x, -1.063297e+00, &tj, &tj1, &result, _state);
9693  mannwhitneyu_ucheb(x, -2.396852e-01, &tj, &tj1, &result, _state);
9694  mannwhitneyu_ucheb(x, -7.990126e-02, &tj, &tj1, &result, _state);
9695  mannwhitneyu_ucheb(x, -2.927977e-02, &tj, &tj1, &result, _state);
9696  mannwhitneyu_ucheb(x, -8.726500e-03, &tj, &tj1, &result, _state);
9697  mannwhitneyu_ucheb(x, -5.858745e-04, &tj, &tj1, &result, _state);
9698  mannwhitneyu_ucheb(x, 2.654590e-03, &tj, &tj1, &result, _state);
9699  mannwhitneyu_ucheb(x, 3.217736e-03, &tj, &tj1, &result, _state);
9700  mannwhitneyu_ucheb(x, 2.989770e-03, &tj, &tj1, &result, _state);
9701  mannwhitneyu_ucheb(x, 2.768493e-03, &tj, &tj1, &result, _state);
9702  mannwhitneyu_ucheb(x, 2.924364e-03, &tj, &tj1, &result, _state);
9703  mannwhitneyu_ucheb(x, 3.140215e-03, &tj, &tj1, &result, _state);
9704  mannwhitneyu_ucheb(x, 2.647914e-03, &tj, &tj1, &result, _state);
9705  mannwhitneyu_ucheb(x, 1.924802e-03, &tj, &tj1, &result, _state);
9706  return result;
9707 }
9708 
9709 
9710 /*************************************************************************
9711 Tail(S, 6, 12)
9712 *************************************************************************/
9713 static double mannwhitneyu_utbln6n12(double s, ae_state *_state)
9714 {
9715  double x;
9716  double tj;
9717  double tj1;
9718  double result;
9719 
9720 
9721  result = 0;
9722  x = ae_minreal(2*(s-0.000000e+00)/3.371709e+00-1, 1.0, _state);
9723  tj = 1;
9724  tj1 = x;
9725  mannwhitneyu_ucheb(x, -4.020941e+00, &tj, &tj1, &result, _state);
9726  mannwhitneyu_ucheb(x, -4.294250e+00, &tj, &tj1, &result, _state);
9727  mannwhitneyu_ucheb(x, -1.128842e+00, &tj, &tj1, &result, _state);
9728  mannwhitneyu_ucheb(x, -2.650389e-01, &tj, &tj1, &result, _state);
9729  mannwhitneyu_ucheb(x, -9.248611e-02, &tj, &tj1, &result, _state);
9730  mannwhitneyu_ucheb(x, -3.578510e-02, &tj, &tj1, &result, _state);
9731  mannwhitneyu_ucheb(x, -1.162852e-02, &tj, &tj1, &result, _state);
9732  mannwhitneyu_ucheb(x, -1.746982e-03, &tj, &tj1, &result, _state);
9733  mannwhitneyu_ucheb(x, 2.454209e-03, &tj, &tj1, &result, _state);
9734  mannwhitneyu_ucheb(x, 3.128042e-03, &tj, &tj1, &result, _state);
9735  mannwhitneyu_ucheb(x, 2.936650e-03, &tj, &tj1, &result, _state);
9736  mannwhitneyu_ucheb(x, 2.530794e-03, &tj, &tj1, &result, _state);
9737  mannwhitneyu_ucheb(x, 2.665192e-03, &tj, &tj1, &result, _state);
9738  mannwhitneyu_ucheb(x, 2.994144e-03, &tj, &tj1, &result, _state);
9739  mannwhitneyu_ucheb(x, 2.662249e-03, &tj, &tj1, &result, _state);
9740  mannwhitneyu_ucheb(x, 2.368541e-03, &tj, &tj1, &result, _state);
9741  return result;
9742 }
9743 
9744 
9745 /*************************************************************************
9746 Tail(S, 6, 13)
9747 *************************************************************************/
9748 static double mannwhitneyu_utbln6n13(double s, ae_state *_state)
9749 {
9750  double x;
9751  double tj;
9752  double tj1;
9753  double result;
9754 
9755 
9756  result = 0;
9757  x = ae_minreal(2*(s-0.000000e+00)/3.420526e+00-1, 1.0, _state);
9758  tj = 1;
9759  tj1 = x;
9760  mannwhitneyu_ucheb(x, -4.133167e+00, &tj, &tj1, &result, _state);
9761  mannwhitneyu_ucheb(x, -4.450016e+00, &tj, &tj1, &result, _state);
9762  mannwhitneyu_ucheb(x, -1.191088e+00, &tj, &tj1, &result, _state);
9763  mannwhitneyu_ucheb(x, -2.898220e-01, &tj, &tj1, &result, _state);
9764  mannwhitneyu_ucheb(x, -1.050249e-01, &tj, &tj1, &result, _state);
9765  mannwhitneyu_ucheb(x, -4.226901e-02, &tj, &tj1, &result, _state);
9766  mannwhitneyu_ucheb(x, -1.471113e-02, &tj, &tj1, &result, _state);
9767  mannwhitneyu_ucheb(x, -3.007470e-03, &tj, &tj1, &result, _state);
9768  mannwhitneyu_ucheb(x, 2.049420e-03, &tj, &tj1, &result, _state);
9769  mannwhitneyu_ucheb(x, 3.059074e-03, &tj, &tj1, &result, _state);
9770  mannwhitneyu_ucheb(x, 2.881249e-03, &tj, &tj1, &result, _state);
9771  mannwhitneyu_ucheb(x, 2.452780e-03, &tj, &tj1, &result, _state);
9772  mannwhitneyu_ucheb(x, 2.441805e-03, &tj, &tj1, &result, _state);
9773  mannwhitneyu_ucheb(x, 2.787493e-03, &tj, &tj1, &result, _state);
9774  mannwhitneyu_ucheb(x, 2.483957e-03, &tj, &tj1, &result, _state);
9775  mannwhitneyu_ucheb(x, 2.481590e-03, &tj, &tj1, &result, _state);
9776  return result;
9777 }
9778 
9779 
9780 /*************************************************************************
9781 Tail(S, 6, 14)
9782 *************************************************************************/
9783 static double mannwhitneyu_utbln6n14(double s, ae_state *_state)
9784 {
9785  double x;
9786  double tj;
9787  double tj1;
9788  double result;
9789 
9790 
9791  result = 0;
9792  x = ae_minreal(2*(s-0.000000e+00)/3.450000e+00-1, 1.0, _state);
9793  tj = 1;
9794  tj1 = x;
9795  mannwhitneyu_ucheb(x, -4.201268e+00, &tj, &tj1, &result, _state);
9796  mannwhitneyu_ucheb(x, -4.542568e+00, &tj, &tj1, &result, _state);
9797  mannwhitneyu_ucheb(x, -1.226965e+00, &tj, &tj1, &result, _state);
9798  mannwhitneyu_ucheb(x, -3.046029e-01, &tj, &tj1, &result, _state);
9799  mannwhitneyu_ucheb(x, -1.136657e-01, &tj, &tj1, &result, _state);
9800  mannwhitneyu_ucheb(x, -4.786757e-02, &tj, &tj1, &result, _state);
9801  mannwhitneyu_ucheb(x, -1.843748e-02, &tj, &tj1, &result, _state);
9802  mannwhitneyu_ucheb(x, -5.588022e-03, &tj, &tj1, &result, _state);
9803  mannwhitneyu_ucheb(x, 2.253029e-04, &tj, &tj1, &result, _state);
9804  mannwhitneyu_ucheb(x, 1.667188e-03, &tj, &tj1, &result, _state);
9805  mannwhitneyu_ucheb(x, 1.788330e-03, &tj, &tj1, &result, _state);
9806  mannwhitneyu_ucheb(x, 1.474545e-03, &tj, &tj1, &result, _state);
9807  mannwhitneyu_ucheb(x, 1.540494e-03, &tj, &tj1, &result, _state);
9808  mannwhitneyu_ucheb(x, 1.951188e-03, &tj, &tj1, &result, _state);
9809  mannwhitneyu_ucheb(x, 1.863323e-03, &tj, &tj1, &result, _state);
9810  mannwhitneyu_ucheb(x, 2.220904e-03, &tj, &tj1, &result, _state);
9811  return result;
9812 }
9813 
9814 
9815 /*************************************************************************
9816 Tail(S, 6, 15)
9817 *************************************************************************/
9818 static double mannwhitneyu_utbln6n15(double s, ae_state *_state)
9819 {
9820  double x;
9821  double tj;
9822  double tj1;
9823  double result;
9824 
9825 
9826  result = 0;
9827  x = ae_minreal(2*(s-0.000000e+00)/3.450000e+00-1, 1.0, _state);
9828  tj = 1;
9829  tj1 = x;
9830  mannwhitneyu_ucheb(x, -4.195689e+00, &tj, &tj1, &result, _state);
9831  mannwhitneyu_ucheb(x, -4.526567e+00, &tj, &tj1, &result, _state);
9832  mannwhitneyu_ucheb(x, -1.213617e+00, &tj, &tj1, &result, _state);
9833  mannwhitneyu_ucheb(x, -2.975035e-01, &tj, &tj1, &result, _state);
9834  mannwhitneyu_ucheb(x, -1.118480e-01, &tj, &tj1, &result, _state);
9835  mannwhitneyu_ucheb(x, -4.859142e-02, &tj, &tj1, &result, _state);
9836  mannwhitneyu_ucheb(x, -2.083312e-02, &tj, &tj1, &result, _state);
9837  mannwhitneyu_ucheb(x, -8.298720e-03, &tj, &tj1, &result, _state);
9838  mannwhitneyu_ucheb(x, -2.766708e-03, &tj, &tj1, &result, _state);
9839  mannwhitneyu_ucheb(x, -1.026356e-03, &tj, &tj1, &result, _state);
9840  mannwhitneyu_ucheb(x, -9.093113e-04, &tj, &tj1, &result, _state);
9841  mannwhitneyu_ucheb(x, -1.135168e-03, &tj, &tj1, &result, _state);
9842  mannwhitneyu_ucheb(x, -1.136376e-03, &tj, &tj1, &result, _state);
9843  mannwhitneyu_ucheb(x, -8.190870e-04, &tj, &tj1, &result, _state);
9844  mannwhitneyu_ucheb(x, -4.435972e-04, &tj, &tj1, &result, _state);
9845  mannwhitneyu_ucheb(x, 1.413129e-04, &tj, &tj1, &result, _state);
9846  return result;
9847 }
9848 
9849 
9850 /*************************************************************************
9851 Tail(S, 6, 30)
9852 *************************************************************************/
9853 static double mannwhitneyu_utbln6n30(double s, ae_state *_state)
9854 {
9855  double x;
9856  double tj;
9857  double tj1;
9858  double result;
9859 
9860 
9861  result = 0;
9862  x = ae_minreal(2*(s-0.000000e+00)/3.450000e+00-1, 1.0, _state);
9863  tj = 1;
9864  tj1 = x;
9865  mannwhitneyu_ucheb(x, -4.166269e+00, &tj, &tj1, &result, _state);
9866  mannwhitneyu_ucheb(x, -4.427399e+00, &tj, &tj1, &result, _state);
9867  mannwhitneyu_ucheb(x, -1.118239e+00, &tj, &tj1, &result, _state);
9868  mannwhitneyu_ucheb(x, -2.360847e-01, &tj, &tj1, &result, _state);
9869  mannwhitneyu_ucheb(x, -7.745885e-02, &tj, &tj1, &result, _state);
9870  mannwhitneyu_ucheb(x, -3.025041e-02, &tj, &tj1, &result, _state);
9871  mannwhitneyu_ucheb(x, -1.187179e-02, &tj, &tj1, &result, _state);
9872  mannwhitneyu_ucheb(x, -4.432089e-03, &tj, &tj1, &result, _state);
9873  mannwhitneyu_ucheb(x, -1.408451e-03, &tj, &tj1, &result, _state);
9874  mannwhitneyu_ucheb(x, -4.388774e-04, &tj, &tj1, &result, _state);
9875  mannwhitneyu_ucheb(x, -2.795560e-04, &tj, &tj1, &result, _state);
9876  mannwhitneyu_ucheb(x, -2.304136e-04, &tj, &tj1, &result, _state);
9877  mannwhitneyu_ucheb(x, -1.258516e-04, &tj, &tj1, &result, _state);
9878  mannwhitneyu_ucheb(x, -4.180236e-05, &tj, &tj1, &result, _state);
9879  mannwhitneyu_ucheb(x, -4.388679e-06, &tj, &tj1, &result, _state);
9880  mannwhitneyu_ucheb(x, 4.836027e-06, &tj, &tj1, &result, _state);
9881  return result;
9882 }
9883 
9884 
9885 /*************************************************************************
9886 Tail(S, 6, 100)
9887 *************************************************************************/
9888 static double mannwhitneyu_utbln6n100(double s, ae_state *_state)
9889 {
9890  double x;
9891  double tj;
9892  double tj1;
9893  double result;
9894 
9895 
9896  result = 0;
9897  x = ae_minreal(2*(s-0.000000e+00)/3.450000e+00-1, 1.0, _state);
9898  tj = 1;
9899  tj1 = x;
9900  mannwhitneyu_ucheb(x, -4.181350e+00, &tj, &tj1, &result, _state);
9901  mannwhitneyu_ucheb(x, -4.417919e+00, &tj, &tj1, &result, _state);
9902  mannwhitneyu_ucheb(x, -1.094201e+00, &tj, &tj1, &result, _state);
9903  mannwhitneyu_ucheb(x, -2.195883e-01, &tj, &tj1, &result, _state);
9904  mannwhitneyu_ucheb(x, -6.818937e-02, &tj, &tj1, &result, _state);
9905  mannwhitneyu_ucheb(x, -2.514202e-02, &tj, &tj1, &result, _state);
9906  mannwhitneyu_ucheb(x, -9.125047e-03, &tj, &tj1, &result, _state);
9907  mannwhitneyu_ucheb(x, -3.022148e-03, &tj, &tj1, &result, _state);
9908  mannwhitneyu_ucheb(x, -7.284181e-04, &tj, &tj1, &result, _state);
9909  mannwhitneyu_ucheb(x, -1.157766e-04, &tj, &tj1, &result, _state);
9910  mannwhitneyu_ucheb(x, -1.023752e-04, &tj, &tj1, &result, _state);
9911  mannwhitneyu_ucheb(x, -1.127985e-04, &tj, &tj1, &result, _state);
9912  mannwhitneyu_ucheb(x, -5.221690e-05, &tj, &tj1, &result, _state);
9913  mannwhitneyu_ucheb(x, -3.516179e-06, &tj, &tj1, &result, _state);
9914  mannwhitneyu_ucheb(x, 9.501398e-06, &tj, &tj1, &result, _state);
9915  mannwhitneyu_ucheb(x, 9.380220e-06, &tj, &tj1, &result, _state);
9916  return result;
9917 }
9918 
9919 
9920 /*************************************************************************
9921 Tail(S, 7, 7)
9922 *************************************************************************/
9923 static double mannwhitneyu_utbln7n7(double s, ae_state *_state)
9924 {
9925  double x;
9926  double tj;
9927  double tj1;
9928  double result;
9929 
9930 
9931  result = 0;
9932  x = ae_minreal(2*(s-0.000000e+00)/3.130495e+00-1, 1.0, _state);
9933  tj = 1;
9934  tj1 = x;
9935  mannwhitneyu_ucheb(x, -3.501264e+00, &tj, &tj1, &result, _state);
9936  mannwhitneyu_ucheb(x, -3.584790e+00, &tj, &tj1, &result, _state);
9937  mannwhitneyu_ucheb(x, -8.577311e-01, &tj, &tj1, &result, _state);
9938  mannwhitneyu_ucheb(x, -1.617002e-01, &tj, &tj1, &result, _state);
9939  mannwhitneyu_ucheb(x, -4.145186e-02, &tj, &tj1, &result, _state);
9940  mannwhitneyu_ucheb(x, -1.023462e-02, &tj, &tj1, &result, _state);
9941  mannwhitneyu_ucheb(x, -1.408251e-03, &tj, &tj1, &result, _state);
9942  mannwhitneyu_ucheb(x, 8.626515e-04, &tj, &tj1, &result, _state);
9943  mannwhitneyu_ucheb(x, 2.072492e-03, &tj, &tj1, &result, _state);
9944  mannwhitneyu_ucheb(x, 3.722926e-03, &tj, &tj1, &result, _state);
9945  mannwhitneyu_ucheb(x, 5.095445e-03, &tj, &tj1, &result, _state);
9946  mannwhitneyu_ucheb(x, 4.842602e-03, &tj, &tj1, &result, _state);
9947  mannwhitneyu_ucheb(x, 2.751427e-03, &tj, &tj1, &result, _state);
9948  mannwhitneyu_ucheb(x, 2.008927e-04, &tj, &tj1, &result, _state);
9949  mannwhitneyu_ucheb(x, -9.892431e-04, &tj, &tj1, &result, _state);
9950  mannwhitneyu_ucheb(x, -8.772386e-04, &tj, &tj1, &result, _state);
9951  return result;
9952 }
9953 
9954 
9955 /*************************************************************************
9956 Tail(S, 7, 8)
9957 *************************************************************************/
9958 static double mannwhitneyu_utbln7n8(double s, ae_state *_state)
9959 {
9960  double x;
9961  double tj;
9962  double tj1;
9963  double result;
9964 
9965 
9966  result = 0;
9967  x = ae_minreal(2*(s-0.000000e+00)/3.240370e+00-1, 1.0, _state);
9968  tj = 1;
9969  tj1 = x;
9970  mannwhitneyu_ucheb(x, -3.709965e+00, &tj, &tj1, &result, _state);
9971  mannwhitneyu_ucheb(x, -3.862154e+00, &tj, &tj1, &result, _state);
9972  mannwhitneyu_ucheb(x, -9.504541e-01, &tj, &tj1, &result, _state);
9973  mannwhitneyu_ucheb(x, -1.900195e-01, &tj, &tj1, &result, _state);
9974  mannwhitneyu_ucheb(x, -5.439995e-02, &tj, &tj1, &result, _state);
9975  mannwhitneyu_ucheb(x, -1.678028e-02, &tj, &tj1, &result, _state);
9976  mannwhitneyu_ucheb(x, -4.485540e-03, &tj, &tj1, &result, _state);
9977  mannwhitneyu_ucheb(x, -4.437047e-04, &tj, &tj1, &result, _state);
9978  mannwhitneyu_ucheb(x, 1.440092e-03, &tj, &tj1, &result, _state);
9979  mannwhitneyu_ucheb(x, 3.114227e-03, &tj, &tj1, &result, _state);
9980  mannwhitneyu_ucheb(x, 4.516569e-03, &tj, &tj1, &result, _state);
9981  mannwhitneyu_ucheb(x, 4.829457e-03, &tj, &tj1, &result, _state);
9982  mannwhitneyu_ucheb(x, 3.787550e-03, &tj, &tj1, &result, _state);
9983  mannwhitneyu_ucheb(x, 1.761866e-03, &tj, &tj1, &result, _state);
9984  mannwhitneyu_ucheb(x, 1.991911e-04, &tj, &tj1, &result, _state);
9985  mannwhitneyu_ucheb(x, -4.533481e-04, &tj, &tj1, &result, _state);
9986  return result;
9987 }
9988 
9989 
9990 /*************************************************************************
9991 Tail(S, 7, 9)
9992 *************************************************************************/
9993 static double mannwhitneyu_utbln7n9(double s, ae_state *_state)
9994 {
9995  double x;
9996  double tj;
9997  double tj1;
9998  double result;
9999 
10000 
10001  result = 0;
10002  x = ae_minreal(2*(s-0.000000e+00)/3.334314e+00-1, 1.0, _state);
10003  tj = 1;
10004  tj1 = x;
10005  mannwhitneyu_ucheb(x, -3.896550e+00, &tj, &tj1, &result, _state);
10006  mannwhitneyu_ucheb(x, -4.112671e+00, &tj, &tj1, &result, _state);
10007  mannwhitneyu_ucheb(x, -1.037277e+00, &tj, &tj1, &result, _state);
10008  mannwhitneyu_ucheb(x, -2.181695e-01, &tj, &tj1, &result, _state);
10009  mannwhitneyu_ucheb(x, -6.765190e-02, &tj, &tj1, &result, _state);
10010  mannwhitneyu_ucheb(x, -2.360116e-02, &tj, &tj1, &result, _state);
10011  mannwhitneyu_ucheb(x, -7.695960e-03, &tj, &tj1, &result, _state);
10012  mannwhitneyu_ucheb(x, -1.780578e-03, &tj, &tj1, &result, _state);
10013  mannwhitneyu_ucheb(x, 8.963843e-04, &tj, &tj1, &result, _state);
10014  mannwhitneyu_ucheb(x, 2.616148e-03, &tj, &tj1, &result, _state);
10015  mannwhitneyu_ucheb(x, 3.852104e-03, &tj, &tj1, &result, _state);
10016  mannwhitneyu_ucheb(x, 4.390744e-03, &tj, &tj1, &result, _state);
10017  mannwhitneyu_ucheb(x, 4.014041e-03, &tj, &tj1, &result, _state);
10018  mannwhitneyu_ucheb(x, 2.888101e-03, &tj, &tj1, &result, _state);
10019  mannwhitneyu_ucheb(x, 1.467474e-03, &tj, &tj1, &result, _state);
10020  mannwhitneyu_ucheb(x, 4.004611e-04, &tj, &tj1, &result, _state);
10021  return result;
10022 }
10023 
10024 
10025 /*************************************************************************
10026 Tail(S, 7, 10)
10027 *************************************************************************/
10028 static double mannwhitneyu_utbln7n10(double s, ae_state *_state)
10029 {
10030  double x;
10031  double tj;
10032  double tj1;
10033  double result;
10034 
10035 
10036  result = 0;
10037  x = ae_minreal(2*(s-0.000000e+00)/3.415650e+00-1, 1.0, _state);
10038  tj = 1;
10039  tj1 = x;
10040  mannwhitneyu_ucheb(x, -4.064844e+00, &tj, &tj1, &result, _state);
10041  mannwhitneyu_ucheb(x, -4.340749e+00, &tj, &tj1, &result, _state);
10042  mannwhitneyu_ucheb(x, -1.118888e+00, &tj, &tj1, &result, _state);
10043  mannwhitneyu_ucheb(x, -2.459730e-01, &tj, &tj1, &result, _state);
10044  mannwhitneyu_ucheb(x, -8.097781e-02, &tj, &tj1, &result, _state);
10045  mannwhitneyu_ucheb(x, -3.057688e-02, &tj, &tj1, &result, _state);
10046  mannwhitneyu_ucheb(x, -1.097406e-02, &tj, &tj1, &result, _state);
10047  mannwhitneyu_ucheb(x, -3.209262e-03, &tj, &tj1, &result, _state);
10048  mannwhitneyu_ucheb(x, 4.065641e-04, &tj, &tj1, &result, _state);
10049  mannwhitneyu_ucheb(x, 2.196677e-03, &tj, &tj1, &result, _state);
10050  mannwhitneyu_ucheb(x, 3.313994e-03, &tj, &tj1, &result, _state);
10051  mannwhitneyu_ucheb(x, 3.827157e-03, &tj, &tj1, &result, _state);
10052  mannwhitneyu_ucheb(x, 3.822284e-03, &tj, &tj1, &result, _state);
10053  mannwhitneyu_ucheb(x, 3.389090e-03, &tj, &tj1, &result, _state);
10054  mannwhitneyu_ucheb(x, 2.340850e-03, &tj, &tj1, &result, _state);
10055  mannwhitneyu_ucheb(x, 1.395172e-03, &tj, &tj1, &result, _state);
10056  return result;
10057 }
10058 
10059 
10060 /*************************************************************************
10061 Tail(S, 7, 11)
10062 *************************************************************************/
10063 static double mannwhitneyu_utbln7n11(double s, ae_state *_state)
10064 {
10065  double x;
10066  double tj;
10067  double tj1;
10068  double result;
10069 
10070 
10071  result = 0;
10072  x = ae_minreal(2*(s-0.000000e+00)/3.486817e+00-1, 1.0, _state);
10073  tj = 1;
10074  tj1 = x;
10075  mannwhitneyu_ucheb(x, -4.217795e+00, &tj, &tj1, &result, _state);
10076  mannwhitneyu_ucheb(x, -4.549783e+00, &tj, &tj1, &result, _state);
10077  mannwhitneyu_ucheb(x, -1.195905e+00, &tj, &tj1, &result, _state);
10078  mannwhitneyu_ucheb(x, -2.733093e-01, &tj, &tj1, &result, _state);
10079  mannwhitneyu_ucheb(x, -9.428447e-02, &tj, &tj1, &result, _state);
10080  mannwhitneyu_ucheb(x, -3.760093e-02, &tj, &tj1, &result, _state);
10081  mannwhitneyu_ucheb(x, -1.431676e-02, &tj, &tj1, &result, _state);
10082  mannwhitneyu_ucheb(x, -4.717152e-03, &tj, &tj1, &result, _state);
10083  mannwhitneyu_ucheb(x, -1.032199e-04, &tj, &tj1, &result, _state);
10084  mannwhitneyu_ucheb(x, 1.832423e-03, &tj, &tj1, &result, _state);
10085  mannwhitneyu_ucheb(x, 2.905979e-03, &tj, &tj1, &result, _state);
10086  mannwhitneyu_ucheb(x, 3.302799e-03, &tj, &tj1, &result, _state);
10087  mannwhitneyu_ucheb(x, 3.464371e-03, &tj, &tj1, &result, _state);
10088  mannwhitneyu_ucheb(x, 3.456211e-03, &tj, &tj1, &result, _state);
10089  mannwhitneyu_ucheb(x, 2.736244e-03, &tj, &tj1, &result, _state);
10090  mannwhitneyu_ucheb(x, 2.140712e-03, &tj, &tj1, &result, _state);
10091  return result;
10092 }
10093 
10094 
10095 /*************************************************************************
10096 Tail(S, 7, 12)
10097 *************************************************************************/
10098 static double mannwhitneyu_utbln7n12(double s, ae_state *_state)
10099 {
10100  double x;
10101  double tj;
10102  double tj1;
10103  double result;
10104 
10105 
10106  result = 0;
10107  x = ae_minreal(2*(s-0.000000e+00)/3.500000e+00-1, 1.0, _state);
10108  tj = 1;
10109  tj1 = x;
10110  mannwhitneyu_ucheb(x, -4.235822e+00, &tj, &tj1, &result, _state);
10111  mannwhitneyu_ucheb(x, -4.564100e+00, &tj, &tj1, &result, _state);
10112  mannwhitneyu_ucheb(x, -1.190813e+00, &tj, &tj1, &result, _state);
10113  mannwhitneyu_ucheb(x, -2.686546e-01, &tj, &tj1, &result, _state);
10114  mannwhitneyu_ucheb(x, -9.395083e-02, &tj, &tj1, &result, _state);
10115  mannwhitneyu_ucheb(x, -3.967359e-02, &tj, &tj1, &result, _state);
10116  mannwhitneyu_ucheb(x, -1.747096e-02, &tj, &tj1, &result, _state);
10117  mannwhitneyu_ucheb(x, -8.304144e-03, &tj, &tj1, &result, _state);
10118  mannwhitneyu_ucheb(x, -3.903198e-03, &tj, &tj1, &result, _state);
10119  mannwhitneyu_ucheb(x, -2.134906e-03, &tj, &tj1, &result, _state);
10120  mannwhitneyu_ucheb(x, -1.175035e-03, &tj, &tj1, &result, _state);
10121  mannwhitneyu_ucheb(x, -7.266224e-04, &tj, &tj1, &result, _state);
10122  mannwhitneyu_ucheb(x, -1.892931e-04, &tj, &tj1, &result, _state);
10123  mannwhitneyu_ucheb(x, 5.604706e-04, &tj, &tj1, &result, _state);
10124  mannwhitneyu_ucheb(x, 9.070459e-04, &tj, &tj1, &result, _state);
10125  mannwhitneyu_ucheb(x, 1.427010e-03, &tj, &tj1, &result, _state);
10126  return result;
10127 }
10128 
10129 
10130 /*************************************************************************
10131 Tail(S, 7, 13)
10132 *************************************************************************/
10133 static double mannwhitneyu_utbln7n13(double s, ae_state *_state)
10134 {
10135  double x;
10136  double tj;
10137  double tj1;
10138  double result;
10139 
10140 
10141  result = 0;
10142  x = ae_minreal(2*(s-0.000000e+00)/3.500000e+00-1, 1.0, _state);
10143  tj = 1;
10144  tj1 = x;
10145  mannwhitneyu_ucheb(x, -4.222204e+00, &tj, &tj1, &result, _state);
10146  mannwhitneyu_ucheb(x, -4.532300e+00, &tj, &tj1, &result, _state);
10147  mannwhitneyu_ucheb(x, -1.164642e+00, &tj, &tj1, &result, _state);
10148  mannwhitneyu_ucheb(x, -2.523768e-01, &tj, &tj1, &result, _state);
10149  mannwhitneyu_ucheb(x, -8.531984e-02, &tj, &tj1, &result, _state);
10150  mannwhitneyu_ucheb(x, -3.467857e-02, &tj, &tj1, &result, _state);
10151  mannwhitneyu_ucheb(x, -1.483804e-02, &tj, &tj1, &result, _state);
10152  mannwhitneyu_ucheb(x, -6.524136e-03, &tj, &tj1, &result, _state);
10153  mannwhitneyu_ucheb(x, -3.077740e-03, &tj, &tj1, &result, _state);
10154  mannwhitneyu_ucheb(x, -1.745218e-03, &tj, &tj1, &result, _state);
10155  mannwhitneyu_ucheb(x, -1.602085e-03, &tj, &tj1, &result, _state);
10156  mannwhitneyu_ucheb(x, -1.828831e-03, &tj, &tj1, &result, _state);
10157  mannwhitneyu_ucheb(x, -1.994070e-03, &tj, &tj1, &result, _state);
10158  mannwhitneyu_ucheb(x, -1.873879e-03, &tj, &tj1, &result, _state);
10159  mannwhitneyu_ucheb(x, -1.341937e-03, &tj, &tj1, &result, _state);
10160  mannwhitneyu_ucheb(x, -8.706444e-04, &tj, &tj1, &result, _state);
10161  return result;
10162 }
10163 
10164 
10165 /*************************************************************************
10166 Tail(S, 7, 14)
10167 *************************************************************************/
10168 static double mannwhitneyu_utbln7n14(double s, ae_state *_state)
10169 {
10170  double x;
10171  double tj;
10172  double tj1;
10173  double result;
10174 
10175 
10176  result = 0;
10177  x = ae_minreal(2*(s-0.000000e+00)/3.500000e+00-1, 1.0, _state);
10178  tj = 1;
10179  tj1 = x;
10180  mannwhitneyu_ucheb(x, -4.211763e+00, &tj, &tj1, &result, _state);
10181  mannwhitneyu_ucheb(x, -4.507542e+00, &tj, &tj1, &result, _state);
10182  mannwhitneyu_ucheb(x, -1.143640e+00, &tj, &tj1, &result, _state);
10183  mannwhitneyu_ucheb(x, -2.395755e-01, &tj, &tj1, &result, _state);
10184  mannwhitneyu_ucheb(x, -7.808020e-02, &tj, &tj1, &result, _state);
10185  mannwhitneyu_ucheb(x, -3.044259e-02, &tj, &tj1, &result, _state);
10186  mannwhitneyu_ucheb(x, -1.182308e-02, &tj, &tj1, &result, _state);
10187  mannwhitneyu_ucheb(x, -4.057325e-03, &tj, &tj1, &result, _state);
10188  mannwhitneyu_ucheb(x, -5.724255e-04, &tj, &tj1, &result, _state);
10189  mannwhitneyu_ucheb(x, 8.303900e-04, &tj, &tj1, &result, _state);
10190  mannwhitneyu_ucheb(x, 1.113148e-03, &tj, &tj1, &result, _state);
10191  mannwhitneyu_ucheb(x, 8.102514e-04, &tj, &tj1, &result, _state);
10192  mannwhitneyu_ucheb(x, 3.559442e-04, &tj, &tj1, &result, _state);
10193  mannwhitneyu_ucheb(x, 4.634986e-05, &tj, &tj1, &result, _state);
10194  mannwhitneyu_ucheb(x, -8.776476e-05, &tj, &tj1, &result, _state);
10195  mannwhitneyu_ucheb(x, 1.054489e-05, &tj, &tj1, &result, _state);
10196  return result;
10197 }
10198 
10199 
10200 /*************************************************************************
10201 Tail(S, 7, 15)
10202 *************************************************************************/
10203 static double mannwhitneyu_utbln7n15(double s, ae_state *_state)
10204 {
10205  double x;
10206  double tj;
10207  double tj1;
10208  double result;
10209 
10210 
10211  result = 0;
10212  x = ae_minreal(2*(s-0.000000e+00)/3.500000e+00-1, 1.0, _state);
10213  tj = 1;
10214  tj1 = x;
10215  mannwhitneyu_ucheb(x, -4.204898e+00, &tj, &tj1, &result, _state);
10216  mannwhitneyu_ucheb(x, -4.489960e+00, &tj, &tj1, &result, _state);
10217  mannwhitneyu_ucheb(x, -1.129172e+00, &tj, &tj1, &result, _state);
10218  mannwhitneyu_ucheb(x, -2.316741e-01, &tj, &tj1, &result, _state);
10219  mannwhitneyu_ucheb(x, -7.506107e-02, &tj, &tj1, &result, _state);
10220  mannwhitneyu_ucheb(x, -2.983676e-02, &tj, &tj1, &result, _state);
10221  mannwhitneyu_ucheb(x, -1.258013e-02, &tj, &tj1, &result, _state);
10222  mannwhitneyu_ucheb(x, -5.262515e-03, &tj, &tj1, &result, _state);
10223  mannwhitneyu_ucheb(x, -1.984156e-03, &tj, &tj1, &result, _state);
10224  mannwhitneyu_ucheb(x, -3.912108e-04, &tj, &tj1, &result, _state);
10225  mannwhitneyu_ucheb(x, 8.974023e-05, &tj, &tj1, &result, _state);
10226  mannwhitneyu_ucheb(x, 6.056195e-05, &tj, &tj1, &result, _state);
10227  mannwhitneyu_ucheb(x, -2.090842e-04, &tj, &tj1, &result, _state);
10228  mannwhitneyu_ucheb(x, -5.232620e-04, &tj, &tj1, &result, _state);
10229  mannwhitneyu_ucheb(x, -5.816339e-04, &tj, &tj1, &result, _state);
10230  mannwhitneyu_ucheb(x, -7.020421e-04, &tj, &tj1, &result, _state);
10231  return result;
10232 }
10233 
10234 
10235 /*************************************************************************
10236 Tail(S, 7, 30)
10237 *************************************************************************/
10238 static double mannwhitneyu_utbln7n30(double s, ae_state *_state)
10239 {
10240  double x;
10241  double tj;
10242  double tj1;
10243  double result;
10244 
10245 
10246  result = 0;
10247  x = ae_minreal(2*(s-0.000000e+00)/3.500000e+00-1, 1.0, _state);
10248  tj = 1;
10249  tj1 = x;
10250  mannwhitneyu_ucheb(x, -4.176536e+00, &tj, &tj1, &result, _state);
10251  mannwhitneyu_ucheb(x, -4.398705e+00, &tj, &tj1, &result, _state);
10252  mannwhitneyu_ucheb(x, -1.045481e+00, &tj, &tj1, &result, _state);
10253  mannwhitneyu_ucheb(x, -1.821982e-01, &tj, &tj1, &result, _state);
10254  mannwhitneyu_ucheb(x, -4.962304e-02, &tj, &tj1, &result, _state);
10255  mannwhitneyu_ucheb(x, -1.698132e-02, &tj, &tj1, &result, _state);
10256  mannwhitneyu_ucheb(x, -6.062667e-03, &tj, &tj1, &result, _state);
10257  mannwhitneyu_ucheb(x, -2.282353e-03, &tj, &tj1, &result, _state);
10258  mannwhitneyu_ucheb(x, -8.014836e-04, &tj, &tj1, &result, _state);
10259  mannwhitneyu_ucheb(x, -2.035683e-04, &tj, &tj1, &result, _state);
10260  mannwhitneyu_ucheb(x, -1.004137e-05, &tj, &tj1, &result, _state);
10261  mannwhitneyu_ucheb(x, 3.801453e-06, &tj, &tj1, &result, _state);
10262  mannwhitneyu_ucheb(x, -1.920705e-05, &tj, &tj1, &result, _state);
10263  mannwhitneyu_ucheb(x, -2.518735e-05, &tj, &tj1, &result, _state);
10264  mannwhitneyu_ucheb(x, -1.821501e-05, &tj, &tj1, &result, _state);
10265  mannwhitneyu_ucheb(x, -1.801008e-05, &tj, &tj1, &result, _state);
10266  return result;
10267 }
10268 
10269 
10270 /*************************************************************************
10271 Tail(S, 7, 100)
10272 *************************************************************************/
10273 static double mannwhitneyu_utbln7n100(double s, ae_state *_state)
10274 {
10275  double x;
10276  double tj;
10277  double tj1;
10278  double result;
10279 
10280 
10281  result = 0;
10282  x = ae_minreal(2*(s-0.000000e+00)/3.500000e+00-1, 1.0, _state);
10283  tj = 1;
10284  tj1 = x;
10285  mannwhitneyu_ucheb(x, -4.188337e+00, &tj, &tj1, &result, _state);
10286  mannwhitneyu_ucheb(x, -4.386949e+00, &tj, &tj1, &result, _state);
10287  mannwhitneyu_ucheb(x, -1.022834e+00, &tj, &tj1, &result, _state);
10288  mannwhitneyu_ucheb(x, -1.686517e-01, &tj, &tj1, &result, _state);
10289  mannwhitneyu_ucheb(x, -4.323516e-02, &tj, &tj1, &result, _state);
10290  mannwhitneyu_ucheb(x, -1.399392e-02, &tj, &tj1, &result, _state);
10291  mannwhitneyu_ucheb(x, -4.644333e-03, &tj, &tj1, &result, _state);
10292  mannwhitneyu_ucheb(x, -1.617044e-03, &tj, &tj1, &result, _state);
10293  mannwhitneyu_ucheb(x, -5.031396e-04, &tj, &tj1, &result, _state);
10294  mannwhitneyu_ucheb(x, -8.792066e-05, &tj, &tj1, &result, _state);
10295  mannwhitneyu_ucheb(x, 2.675457e-05, &tj, &tj1, &result, _state);
10296  mannwhitneyu_ucheb(x, 1.673416e-05, &tj, &tj1, &result, _state);
10297  mannwhitneyu_ucheb(x, -6.258552e-06, &tj, &tj1, &result, _state);
10298  mannwhitneyu_ucheb(x, -8.174214e-06, &tj, &tj1, &result, _state);
10299  mannwhitneyu_ucheb(x, -3.073644e-06, &tj, &tj1, &result, _state);
10300  mannwhitneyu_ucheb(x, -1.349958e-06, &tj, &tj1, &result, _state);
10301  return result;
10302 }
10303 
10304 
10305 /*************************************************************************
10306 Tail(S, 8, 8)
10307 *************************************************************************/
10308 static double mannwhitneyu_utbln8n8(double s, ae_state *_state)
10309 {
10310  double x;
10311  double tj;
10312  double tj1;
10313  double result;
10314 
10315 
10316  result = 0;
10317  x = ae_minreal(2*(s-0.000000e+00)/3.360672e+00-1, 1.0, _state);
10318  tj = 1;
10319  tj1 = x;
10320  mannwhitneyu_ucheb(x, -3.940217e+00, &tj, &tj1, &result, _state);
10321  mannwhitneyu_ucheb(x, -4.168913e+00, &tj, &tj1, &result, _state);
10322  mannwhitneyu_ucheb(x, -1.051485e+00, &tj, &tj1, &result, _state);
10323  mannwhitneyu_ucheb(x, -2.195325e-01, &tj, &tj1, &result, _state);
10324  mannwhitneyu_ucheb(x, -6.775196e-02, &tj, &tj1, &result, _state);
10325  mannwhitneyu_ucheb(x, -2.385506e-02, &tj, &tj1, &result, _state);
10326  mannwhitneyu_ucheb(x, -8.244902e-03, &tj, &tj1, &result, _state);
10327  mannwhitneyu_ucheb(x, -2.525632e-03, &tj, &tj1, &result, _state);
10328  mannwhitneyu_ucheb(x, 2.771275e-04, &tj, &tj1, &result, _state);
10329  mannwhitneyu_ucheb(x, 2.332874e-03, &tj, &tj1, &result, _state);
10330  mannwhitneyu_ucheb(x, 4.079599e-03, &tj, &tj1, &result, _state);
10331  mannwhitneyu_ucheb(x, 4.882551e-03, &tj, &tj1, &result, _state);
10332  mannwhitneyu_ucheb(x, 4.407944e-03, &tj, &tj1, &result, _state);
10333  mannwhitneyu_ucheb(x, 2.769844e-03, &tj, &tj1, &result, _state);
10334  mannwhitneyu_ucheb(x, 1.062433e-03, &tj, &tj1, &result, _state);
10335  mannwhitneyu_ucheb(x, 5.872535e-05, &tj, &tj1, &result, _state);
10336  return result;
10337 }
10338 
10339 
10340 /*************************************************************************
10341 Tail(S, 8, 9)
10342 *************************************************************************/
10343 static double mannwhitneyu_utbln8n9(double s, ae_state *_state)
10344 {
10345  double x;
10346  double tj;
10347  double tj1;
10348  double result;
10349 
10350 
10351  result = 0;
10352  x = ae_minreal(2*(s-0.000000e+00)/3.464102e+00-1, 1.0, _state);
10353  tj = 1;
10354  tj1 = x;
10355  mannwhitneyu_ucheb(x, -4.147004e+00, &tj, &tj1, &result, _state);
10356  mannwhitneyu_ucheb(x, -4.446939e+00, &tj, &tj1, &result, _state);
10357  mannwhitneyu_ucheb(x, -1.146155e+00, &tj, &tj1, &result, _state);
10358  mannwhitneyu_ucheb(x, -2.488561e-01, &tj, &tj1, &result, _state);
10359  mannwhitneyu_ucheb(x, -8.144561e-02, &tj, &tj1, &result, _state);
10360  mannwhitneyu_ucheb(x, -3.116917e-02, &tj, &tj1, &result, _state);
10361  mannwhitneyu_ucheb(x, -1.205667e-02, &tj, &tj1, &result, _state);
10362  mannwhitneyu_ucheb(x, -4.515661e-03, &tj, &tj1, &result, _state);
10363  mannwhitneyu_ucheb(x, -7.618616e-04, &tj, &tj1, &result, _state);
10364  mannwhitneyu_ucheb(x, 1.599011e-03, &tj, &tj1, &result, _state);
10365  mannwhitneyu_ucheb(x, 3.457324e-03, &tj, &tj1, &result, _state);
10366  mannwhitneyu_ucheb(x, 4.482917e-03, &tj, &tj1, &result, _state);
10367  mannwhitneyu_ucheb(x, 4.488267e-03, &tj, &tj1, &result, _state);
10368  mannwhitneyu_ucheb(x, 3.469823e-03, &tj, &tj1, &result, _state);
10369  mannwhitneyu_ucheb(x, 1.957591e-03, &tj, &tj1, &result, _state);
10370  mannwhitneyu_ucheb(x, 8.058326e-04, &tj, &tj1, &result, _state);
10371  return result;
10372 }
10373 
10374 
10375 /*************************************************************************
10376 Tail(S, 8, 10)
10377 *************************************************************************/
10378 static double mannwhitneyu_utbln8n10(double s, ae_state *_state)
10379 {
10380  double x;
10381  double tj;
10382  double tj1;
10383  double result;
10384 
10385 
10386  result = 0;
10387  x = ae_minreal(2*(s-0.000000e+00)/3.554093e+00-1, 1.0, _state);
10388  tj = 1;
10389  tj1 = x;
10390  mannwhitneyu_ucheb(x, -4.334282e+00, &tj, &tj1, &result, _state);
10391  mannwhitneyu_ucheb(x, -4.700860e+00, &tj, &tj1, &result, _state);
10392  mannwhitneyu_ucheb(x, -1.235253e+00, &tj, &tj1, &result, _state);
10393  mannwhitneyu_ucheb(x, -2.778489e-01, &tj, &tj1, &result, _state);
10394  mannwhitneyu_ucheb(x, -9.527324e-02, &tj, &tj1, &result, _state);
10395  mannwhitneyu_ucheb(x, -3.862885e-02, &tj, &tj1, &result, _state);
10396  mannwhitneyu_ucheb(x, -1.589781e-02, &tj, &tj1, &result, _state);
10397  mannwhitneyu_ucheb(x, -6.507355e-03, &tj, &tj1, &result, _state);
10398  mannwhitneyu_ucheb(x, -1.717526e-03, &tj, &tj1, &result, _state);
10399  mannwhitneyu_ucheb(x, 9.215726e-04, &tj, &tj1, &result, _state);
10400  mannwhitneyu_ucheb(x, 2.848696e-03, &tj, &tj1, &result, _state);
10401  mannwhitneyu_ucheb(x, 3.918854e-03, &tj, &tj1, &result, _state);
10402  mannwhitneyu_ucheb(x, 4.219614e-03, &tj, &tj1, &result, _state);
10403  mannwhitneyu_ucheb(x, 3.753761e-03, &tj, &tj1, &result, _state);
10404  mannwhitneyu_ucheb(x, 2.573688e-03, &tj, &tj1, &result, _state);
10405  mannwhitneyu_ucheb(x, 1.602177e-03, &tj, &tj1, &result, _state);
10406  return result;
10407 }
10408 
10409 
10410 /*************************************************************************
10411 Tail(S, 8, 11)
10412 *************************************************************************/
10413 static double mannwhitneyu_utbln8n11(double s, ae_state *_state)
10414 {
10415  double x;
10416  double tj;
10417  double tj1;
10418  double result;
10419 
10420 
10421  result = 0;
10422  x = ae_minreal(2*(s-0.000000e+00)/3.600000e+00-1, 1.0, _state);
10423  tj = 1;
10424  tj1 = x;
10425  mannwhitneyu_ucheb(x, -4.421882e+00, &tj, &tj1, &result, _state);
10426  mannwhitneyu_ucheb(x, -4.812457e+00, &tj, &tj1, &result, _state);
10427  mannwhitneyu_ucheb(x, -1.266153e+00, &tj, &tj1, &result, _state);
10428  mannwhitneyu_ucheb(x, -2.849344e-01, &tj, &tj1, &result, _state);
10429  mannwhitneyu_ucheb(x, -9.971527e-02, &tj, &tj1, &result, _state);
10430  mannwhitneyu_ucheb(x, -4.258944e-02, &tj, &tj1, &result, _state);
10431  mannwhitneyu_ucheb(x, -1.944820e-02, &tj, &tj1, &result, _state);
10432  mannwhitneyu_ucheb(x, -9.894685e-03, &tj, &tj1, &result, _state);
10433  mannwhitneyu_ucheb(x, -5.031836e-03, &tj, &tj1, &result, _state);
10434  mannwhitneyu_ucheb(x, -2.514330e-03, &tj, &tj1, &result, _state);
10435  mannwhitneyu_ucheb(x, -6.351660e-04, &tj, &tj1, &result, _state);
10436  mannwhitneyu_ucheb(x, 6.206748e-04, &tj, &tj1, &result, _state);
10437  mannwhitneyu_ucheb(x, 1.492600e-03, &tj, &tj1, &result, _state);
10438  mannwhitneyu_ucheb(x, 2.005338e-03, &tj, &tj1, &result, _state);
10439  mannwhitneyu_ucheb(x, 1.780099e-03, &tj, &tj1, &result, _state);
10440  mannwhitneyu_ucheb(x, 1.673599e-03, &tj, &tj1, &result, _state);
10441  return result;
10442 }
10443 
10444 
10445 /*************************************************************************
10446 Tail(S, 8, 12)
10447 *************************************************************************/
10448 static double mannwhitneyu_utbln8n12(double s, ae_state *_state)
10449 {
10450  double x;
10451  double tj;
10452  double tj1;
10453  double result;
10454 
10455 
10456  result = 0;
10457  x = ae_minreal(2*(s-0.000000e+00)/3.600000e+00-1, 1.0, _state);
10458  tj = 1;
10459  tj1 = x;
10460  mannwhitneyu_ucheb(x, -4.398211e+00, &tj, &tj1, &result, _state);
10461  mannwhitneyu_ucheb(x, -4.762214e+00, &tj, &tj1, &result, _state);
10462  mannwhitneyu_ucheb(x, -1.226296e+00, &tj, &tj1, &result, _state);
10463  mannwhitneyu_ucheb(x, -2.603837e-01, &tj, &tj1, &result, _state);
10464  mannwhitneyu_ucheb(x, -8.643223e-02, &tj, &tj1, &result, _state);
10465  mannwhitneyu_ucheb(x, -3.502438e-02, &tj, &tj1, &result, _state);
10466  mannwhitneyu_ucheb(x, -1.544574e-02, &tj, &tj1, &result, _state);
10467  mannwhitneyu_ucheb(x, -7.647734e-03, &tj, &tj1, &result, _state);
10468  mannwhitneyu_ucheb(x, -4.442259e-03, &tj, &tj1, &result, _state);
10469  mannwhitneyu_ucheb(x, -3.011484e-03, &tj, &tj1, &result, _state);
10470  mannwhitneyu_ucheb(x, -2.384758e-03, &tj, &tj1, &result, _state);
10471  mannwhitneyu_ucheb(x, -1.998259e-03, &tj, &tj1, &result, _state);
10472  mannwhitneyu_ucheb(x, -1.659985e-03, &tj, &tj1, &result, _state);
10473  mannwhitneyu_ucheb(x, -1.331046e-03, &tj, &tj1, &result, _state);
10474  mannwhitneyu_ucheb(x, -8.638478e-04, &tj, &tj1, &result, _state);
10475  mannwhitneyu_ucheb(x, -6.056785e-04, &tj, &tj1, &result, _state);
10476  return result;
10477 }
10478 
10479 
10480 /*************************************************************************
10481 Tail(S, 8, 13)
10482 *************************************************************************/
10483 static double mannwhitneyu_utbln8n13(double s, ae_state *_state)
10484 {
10485  double x;
10486  double tj;
10487  double tj1;
10488  double result;
10489 
10490 
10491  result = 0;
10492  x = ae_minreal(2*(s-0.000000e+00)/3.600000e+00-1, 1.0, _state);
10493  tj = 1;
10494  tj1 = x;
10495  mannwhitneyu_ucheb(x, -4.380670e+00, &tj, &tj1, &result, _state);
10496  mannwhitneyu_ucheb(x, -4.724511e+00, &tj, &tj1, &result, _state);
10497  mannwhitneyu_ucheb(x, -1.195851e+00, &tj, &tj1, &result, _state);
10498  mannwhitneyu_ucheb(x, -2.420511e-01, &tj, &tj1, &result, _state);
10499  mannwhitneyu_ucheb(x, -7.609928e-02, &tj, &tj1, &result, _state);
10500  mannwhitneyu_ucheb(x, -2.893999e-02, &tj, &tj1, &result, _state);
10501  mannwhitneyu_ucheb(x, -1.115919e-02, &tj, &tj1, &result, _state);
10502  mannwhitneyu_ucheb(x, -4.291410e-03, &tj, &tj1, &result, _state);
10503  mannwhitneyu_ucheb(x, -1.339664e-03, &tj, &tj1, &result, _state);
10504  mannwhitneyu_ucheb(x, -1.801548e-04, &tj, &tj1, &result, _state);
10505  mannwhitneyu_ucheb(x, 2.534710e-04, &tj, &tj1, &result, _state);
10506  mannwhitneyu_ucheb(x, 2.793250e-04, &tj, &tj1, &result, _state);
10507  mannwhitneyu_ucheb(x, 1.806718e-04, &tj, &tj1, &result, _state);
10508  mannwhitneyu_ucheb(x, 1.384624e-04, &tj, &tj1, &result, _state);
10509  mannwhitneyu_ucheb(x, 1.120582e-04, &tj, &tj1, &result, _state);
10510  mannwhitneyu_ucheb(x, 2.936453e-04, &tj, &tj1, &result, _state);
10511  return result;
10512 }
10513 
10514 
10515 /*************************************************************************
10516 Tail(S, 8, 14)
10517 *************************************************************************/
10518 static double mannwhitneyu_utbln8n14(double s, ae_state *_state)
10519 {
10520  double x;
10521  double tj;
10522  double tj1;
10523  double result;
10524 
10525 
10526  result = 0;
10527  x = ae_minreal(2*(s-0.000000e+00)/3.600000e+00-1, 1.0, _state);
10528  tj = 1;
10529  tj1 = x;
10530  mannwhitneyu_ucheb(x, -4.368494e+00, &tj, &tj1, &result, _state);
10531  mannwhitneyu_ucheb(x, -4.697171e+00, &tj, &tj1, &result, _state);
10532  mannwhitneyu_ucheb(x, -1.174440e+00, &tj, &tj1, &result, _state);
10533  mannwhitneyu_ucheb(x, -2.300621e-01, &tj, &tj1, &result, _state);
10534  mannwhitneyu_ucheb(x, -7.087393e-02, &tj, &tj1, &result, _state);
10535  mannwhitneyu_ucheb(x, -2.685826e-02, &tj, &tj1, &result, _state);
10536  mannwhitneyu_ucheb(x, -1.085254e-02, &tj, &tj1, &result, _state);
10537  mannwhitneyu_ucheb(x, -4.525658e-03, &tj, &tj1, &result, _state);
10538  mannwhitneyu_ucheb(x, -1.966647e-03, &tj, &tj1, &result, _state);
10539  mannwhitneyu_ucheb(x, -7.453388e-04, &tj, &tj1, &result, _state);
10540  mannwhitneyu_ucheb(x, -3.826066e-04, &tj, &tj1, &result, _state);
10541  mannwhitneyu_ucheb(x, -3.501958e-04, &tj, &tj1, &result, _state);
10542  mannwhitneyu_ucheb(x, -5.336297e-04, &tj, &tj1, &result, _state);
10543  mannwhitneyu_ucheb(x, -8.251972e-04, &tj, &tj1, &result, _state);
10544  mannwhitneyu_ucheb(x, -8.118456e-04, &tj, &tj1, &result, _state);
10545  mannwhitneyu_ucheb(x, -9.415959e-04, &tj, &tj1, &result, _state);
10546  return result;
10547 }
10548 
10549 
10550 /*************************************************************************
10551 Tail(S, 8, 15)
10552 *************************************************************************/
10553 static double mannwhitneyu_utbln8n15(double s, ae_state *_state)
10554 {
10555  double x;
10556  double tj;
10557  double tj1;
10558  double result;
10559 
10560 
10561  result = 0;
10562  x = ae_minreal(2*(s-0.000000e+00)/3.600000e+00-1, 1.0, _state);
10563  tj = 1;
10564  tj1 = x;
10565  mannwhitneyu_ucheb(x, -4.358397e+00, &tj, &tj1, &result, _state);
10566  mannwhitneyu_ucheb(x, -4.674485e+00, &tj, &tj1, &result, _state);
10567  mannwhitneyu_ucheb(x, -1.155941e+00, &tj, &tj1, &result, _state);
10568  mannwhitneyu_ucheb(x, -2.195780e-01, &tj, &tj1, &result, _state);
10569  mannwhitneyu_ucheb(x, -6.544830e-02, &tj, &tj1, &result, _state);
10570  mannwhitneyu_ucheb(x, -2.426183e-02, &tj, &tj1, &result, _state);
10571  mannwhitneyu_ucheb(x, -9.309902e-03, &tj, &tj1, &result, _state);
10572  mannwhitneyu_ucheb(x, -3.650956e-03, &tj, &tj1, &result, _state);
10573  mannwhitneyu_ucheb(x, -1.068874e-03, &tj, &tj1, &result, _state);
10574  mannwhitneyu_ucheb(x, 1.538544e-04, &tj, &tj1, &result, _state);
10575  mannwhitneyu_ucheb(x, 8.192525e-04, &tj, &tj1, &result, _state);
10576  mannwhitneyu_ucheb(x, 1.073905e-03, &tj, &tj1, &result, _state);
10577  mannwhitneyu_ucheb(x, 1.079673e-03, &tj, &tj1, &result, _state);
10578  mannwhitneyu_ucheb(x, 9.423572e-04, &tj, &tj1, &result, _state);
10579  mannwhitneyu_ucheb(x, 6.579647e-04, &tj, &tj1, &result, _state);
10580  mannwhitneyu_ucheb(x, 4.765904e-04, &tj, &tj1, &result, _state);
10581  return result;
10582 }
10583 
10584 
10585 /*************************************************************************
10586 Tail(S, 8, 30)
10587 *************************************************************************/
10588 static double mannwhitneyu_utbln8n30(double s, ae_state *_state)
10589 {
10590  double x;
10591  double tj;
10592  double tj1;
10593  double result;
10594 
10595 
10596  result = 0;
10597  x = ae_minreal(2*(s-0.000000e+00)/3.600000e+00-1, 1.0, _state);
10598  tj = 1;
10599  tj1 = x;
10600  mannwhitneyu_ucheb(x, -4.318823e+00, &tj, &tj1, &result, _state);
10601  mannwhitneyu_ucheb(x, -4.567159e+00, &tj, &tj1, &result, _state);
10602  mannwhitneyu_ucheb(x, -1.064864e+00, &tj, &tj1, &result, _state);
10603  mannwhitneyu_ucheb(x, -1.688413e-01, &tj, &tj1, &result, _state);
10604  mannwhitneyu_ucheb(x, -4.153712e-02, &tj, &tj1, &result, _state);
10605  mannwhitneyu_ucheb(x, -1.309389e-02, &tj, &tj1, &result, _state);
10606  mannwhitneyu_ucheb(x, -4.226861e-03, &tj, &tj1, &result, _state);
10607  mannwhitneyu_ucheb(x, -1.523815e-03, &tj, &tj1, &result, _state);
10608  mannwhitneyu_ucheb(x, -5.780987e-04, &tj, &tj1, &result, _state);
10609  mannwhitneyu_ucheb(x, -2.166866e-04, &tj, &tj1, &result, _state);
10610  mannwhitneyu_ucheb(x, -6.922431e-05, &tj, &tj1, &result, _state);
10611  mannwhitneyu_ucheb(x, -1.466397e-05, &tj, &tj1, &result, _state);
10612  mannwhitneyu_ucheb(x, -5.690036e-06, &tj, &tj1, &result, _state);
10613  mannwhitneyu_ucheb(x, -1.008185e-05, &tj, &tj1, &result, _state);
10614  mannwhitneyu_ucheb(x, -9.271903e-06, &tj, &tj1, &result, _state);
10615  mannwhitneyu_ucheb(x, -7.534751e-06, &tj, &tj1, &result, _state);
10616  return result;
10617 }
10618 
10619 
10620 /*************************************************************************
10621 Tail(S, 8, 100)
10622 *************************************************************************/
10623 static double mannwhitneyu_utbln8n100(double s, ae_state *_state)
10624 {
10625  double x;
10626  double tj;
10627  double tj1;
10628  double result;
10629 
10630 
10631  result = 0;
10632  x = ae_minreal(2*(s-0.000000e+00)/3.600000e+00-1, 1.0, _state);
10633  tj = 1;
10634  tj1 = x;
10635  mannwhitneyu_ucheb(x, -4.324531e+00, &tj, &tj1, &result, _state);
10636  mannwhitneyu_ucheb(x, -4.547071e+00, &tj, &tj1, &result, _state);
10637  mannwhitneyu_ucheb(x, -1.038129e+00, &tj, &tj1, &result, _state);
10638  mannwhitneyu_ucheb(x, -1.541549e-01, &tj, &tj1, &result, _state);
10639  mannwhitneyu_ucheb(x, -3.525605e-02, &tj, &tj1, &result, _state);
10640  mannwhitneyu_ucheb(x, -1.044992e-02, &tj, &tj1, &result, _state);
10641  mannwhitneyu_ucheb(x, -3.085713e-03, &tj, &tj1, &result, _state);
10642  mannwhitneyu_ucheb(x, -1.017871e-03, &tj, &tj1, &result, _state);
10643  mannwhitneyu_ucheb(x, -3.459226e-04, &tj, &tj1, &result, _state);
10644  mannwhitneyu_ucheb(x, -1.092064e-04, &tj, &tj1, &result, _state);
10645  mannwhitneyu_ucheb(x, -2.024349e-05, &tj, &tj1, &result, _state);
10646  mannwhitneyu_ucheb(x, 7.366347e-06, &tj, &tj1, &result, _state);
10647  mannwhitneyu_ucheb(x, 6.385637e-06, &tj, &tj1, &result, _state);
10648  mannwhitneyu_ucheb(x, 8.321722e-08, &tj, &tj1, &result, _state);
10649  mannwhitneyu_ucheb(x, -1.439286e-06, &tj, &tj1, &result, _state);
10650  mannwhitneyu_ucheb(x, -3.058079e-07, &tj, &tj1, &result, _state);
10651  return result;
10652 }
10653 
10654 
10655 /*************************************************************************
10656 Tail(S, 9, 9)
10657 *************************************************************************/
10658 static double mannwhitneyu_utbln9n9(double s, ae_state *_state)
10659 {
10660  double x;
10661  double tj;
10662  double tj1;
10663  double result;
10664 
10665 
10666  result = 0;
10667  x = ae_minreal(2*(s-0.000000e+00)/3.576237e+00-1, 1.0, _state);
10668  tj = 1;
10669  tj1 = x;
10670  mannwhitneyu_ucheb(x, -4.372857e+00, &tj, &tj1, &result, _state);
10671  mannwhitneyu_ucheb(x, -4.750859e+00, &tj, &tj1, &result, _state);
10672  mannwhitneyu_ucheb(x, -1.248233e+00, &tj, &tj1, &result, _state);
10673  mannwhitneyu_ucheb(x, -2.792868e-01, &tj, &tj1, &result, _state);
10674  mannwhitneyu_ucheb(x, -9.559372e-02, &tj, &tj1, &result, _state);
10675  mannwhitneyu_ucheb(x, -3.894941e-02, &tj, &tj1, &result, _state);
10676  mannwhitneyu_ucheb(x, -1.643256e-02, &tj, &tj1, &result, _state);
10677  mannwhitneyu_ucheb(x, -7.091370e-03, &tj, &tj1, &result, _state);
10678  mannwhitneyu_ucheb(x, -2.285034e-03, &tj, &tj1, &result, _state);
10679  mannwhitneyu_ucheb(x, 6.112997e-04, &tj, &tj1, &result, _state);
10680  mannwhitneyu_ucheb(x, 2.806229e-03, &tj, &tj1, &result, _state);
10681  mannwhitneyu_ucheb(x, 4.150741e-03, &tj, &tj1, &result, _state);
10682  mannwhitneyu_ucheb(x, 4.509825e-03, &tj, &tj1, &result, _state);
10683  mannwhitneyu_ucheb(x, 3.891051e-03, &tj, &tj1, &result, _state);
10684  mannwhitneyu_ucheb(x, 2.485013e-03, &tj, &tj1, &result, _state);
10685  mannwhitneyu_ucheb(x, 1.343653e-03, &tj, &tj1, &result, _state);
10686  return result;
10687 }
10688 
10689 
10690 /*************************************************************************
10691 Tail(S, 9, 10)
10692 *************************************************************************/
10693 static double mannwhitneyu_utbln9n10(double s, ae_state *_state)
10694 {
10695  double x;
10696  double tj;
10697  double tj1;
10698  double result;
10699 
10700 
10701  result = 0;
10702  x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
10703  tj = 1;
10704  tj1 = x;
10705  mannwhitneyu_ucheb(x, -4.516726e+00, &tj, &tj1, &result, _state);
10706  mannwhitneyu_ucheb(x, -4.939333e+00, &tj, &tj1, &result, _state);
10707  mannwhitneyu_ucheb(x, -1.305046e+00, &tj, &tj1, &result, _state);
10708  mannwhitneyu_ucheb(x, -2.935326e-01, &tj, &tj1, &result, _state);
10709  mannwhitneyu_ucheb(x, -1.029141e-01, &tj, &tj1, &result, _state);
10710  mannwhitneyu_ucheb(x, -4.420592e-02, &tj, &tj1, &result, _state);
10711  mannwhitneyu_ucheb(x, -2.053140e-02, &tj, &tj1, &result, _state);
10712  mannwhitneyu_ucheb(x, -1.065930e-02, &tj, &tj1, &result, _state);
10713  mannwhitneyu_ucheb(x, -5.523581e-03, &tj, &tj1, &result, _state);
10714  mannwhitneyu_ucheb(x, -2.544888e-03, &tj, &tj1, &result, _state);
10715  mannwhitneyu_ucheb(x, -1.813741e-04, &tj, &tj1, &result, _state);
10716  mannwhitneyu_ucheb(x, 1.510631e-03, &tj, &tj1, &result, _state);
10717  mannwhitneyu_ucheb(x, 2.536057e-03, &tj, &tj1, &result, _state);
10718  mannwhitneyu_ucheb(x, 2.833815e-03, &tj, &tj1, &result, _state);
10719  mannwhitneyu_ucheb(x, 2.189692e-03, &tj, &tj1, &result, _state);
10720  mannwhitneyu_ucheb(x, 1.615050e-03, &tj, &tj1, &result, _state);
10721  return result;
10722 }
10723 
10724 
10725 /*************************************************************************
10726 Tail(S, 9, 11)
10727 *************************************************************************/
10728 static double mannwhitneyu_utbln9n11(double s, ae_state *_state)
10729 {
10730  double x;
10731  double tj;
10732  double tj1;
10733  double result;
10734 
10735 
10736  result = 0;
10737  x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
10738  tj = 1;
10739  tj1 = x;
10740  mannwhitneyu_ucheb(x, -4.481308e+00, &tj, &tj1, &result, _state);
10741  mannwhitneyu_ucheb(x, -4.867483e+00, &tj, &tj1, &result, _state);
10742  mannwhitneyu_ucheb(x, -1.249072e+00, &tj, &tj1, &result, _state);
10743  mannwhitneyu_ucheb(x, -2.591790e-01, &tj, &tj1, &result, _state);
10744  mannwhitneyu_ucheb(x, -8.400128e-02, &tj, &tj1, &result, _state);
10745  mannwhitneyu_ucheb(x, -3.341992e-02, &tj, &tj1, &result, _state);
10746  mannwhitneyu_ucheb(x, -1.463680e-02, &tj, &tj1, &result, _state);
10747  mannwhitneyu_ucheb(x, -7.487211e-03, &tj, &tj1, &result, _state);
10748  mannwhitneyu_ucheb(x, -4.671196e-03, &tj, &tj1, &result, _state);
10749  mannwhitneyu_ucheb(x, -3.343472e-03, &tj, &tj1, &result, _state);
10750  mannwhitneyu_ucheb(x, -2.544146e-03, &tj, &tj1, &result, _state);
10751  mannwhitneyu_ucheb(x, -1.802335e-03, &tj, &tj1, &result, _state);
10752  mannwhitneyu_ucheb(x, -1.117084e-03, &tj, &tj1, &result, _state);
10753  mannwhitneyu_ucheb(x, -6.217443e-04, &tj, &tj1, &result, _state);
10754  mannwhitneyu_ucheb(x, -2.858766e-04, &tj, &tj1, &result, _state);
10755  mannwhitneyu_ucheb(x, -3.193687e-04, &tj, &tj1, &result, _state);
10756  return result;
10757 }
10758 
10759 
10760 /*************************************************************************
10761 Tail(S, 9, 12)
10762 *************************************************************************/
10763 static double mannwhitneyu_utbln9n12(double s, ae_state *_state)
10764 {
10765  double x;
10766  double tj;
10767  double tj1;
10768  double result;
10769 
10770 
10771  result = 0;
10772  x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
10773  tj = 1;
10774  tj1 = x;
10775  mannwhitneyu_ucheb(x, -4.456776e+00, &tj, &tj1, &result, _state);
10776  mannwhitneyu_ucheb(x, -4.817037e+00, &tj, &tj1, &result, _state);
10777  mannwhitneyu_ucheb(x, -1.209788e+00, &tj, &tj1, &result, _state);
10778  mannwhitneyu_ucheb(x, -2.362108e-01, &tj, &tj1, &result, _state);
10779  mannwhitneyu_ucheb(x, -7.171356e-02, &tj, &tj1, &result, _state);
10780  mannwhitneyu_ucheb(x, -2.661557e-02, &tj, &tj1, &result, _state);
10781  mannwhitneyu_ucheb(x, -1.026141e-02, &tj, &tj1, &result, _state);
10782  mannwhitneyu_ucheb(x, -4.361908e-03, &tj, &tj1, &result, _state);
10783  mannwhitneyu_ucheb(x, -2.093885e-03, &tj, &tj1, &result, _state);
10784  mannwhitneyu_ucheb(x, -1.298389e-03, &tj, &tj1, &result, _state);
10785  mannwhitneyu_ucheb(x, -9.663603e-04, &tj, &tj1, &result, _state);
10786  mannwhitneyu_ucheb(x, -7.768522e-04, &tj, &tj1, &result, _state);
10787  mannwhitneyu_ucheb(x, -5.579015e-04, &tj, &tj1, &result, _state);
10788  mannwhitneyu_ucheb(x, -2.868677e-04, &tj, &tj1, &result, _state);
10789  mannwhitneyu_ucheb(x, -7.440652e-05, &tj, &tj1, &result, _state);
10790  mannwhitneyu_ucheb(x, 1.523037e-04, &tj, &tj1, &result, _state);
10791  return result;
10792 }
10793 
10794 
10795 /*************************************************************************
10796 Tail(S, 9, 13)
10797 *************************************************************************/
10798 static double mannwhitneyu_utbln9n13(double s, ae_state *_state)
10799 {
10800  double x;
10801  double tj;
10802  double tj1;
10803  double result;
10804 
10805 
10806  result = 0;
10807  x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
10808  tj = 1;
10809  tj1 = x;
10810  mannwhitneyu_ucheb(x, -4.438840e+00, &tj, &tj1, &result, _state);
10811  mannwhitneyu_ucheb(x, -4.779308e+00, &tj, &tj1, &result, _state);
10812  mannwhitneyu_ucheb(x, -1.180614e+00, &tj, &tj1, &result, _state);
10813  mannwhitneyu_ucheb(x, -2.196489e-01, &tj, &tj1, &result, _state);
10814  mannwhitneyu_ucheb(x, -6.346621e-02, &tj, &tj1, &result, _state);
10815  mannwhitneyu_ucheb(x, -2.234857e-02, &tj, &tj1, &result, _state);
10816  mannwhitneyu_ucheb(x, -7.796211e-03, &tj, &tj1, &result, _state);
10817  mannwhitneyu_ucheb(x, -2.575715e-03, &tj, &tj1, &result, _state);
10818  mannwhitneyu_ucheb(x, -5.525647e-04, &tj, &tj1, &result, _state);
10819  mannwhitneyu_ucheb(x, 1.964651e-04, &tj, &tj1, &result, _state);
10820  mannwhitneyu_ucheb(x, 4.275235e-04, &tj, &tj1, &result, _state);
10821  mannwhitneyu_ucheb(x, 4.299124e-04, &tj, &tj1, &result, _state);
10822  mannwhitneyu_ucheb(x, 3.397416e-04, &tj, &tj1, &result, _state);
10823  mannwhitneyu_ucheb(x, 2.295781e-04, &tj, &tj1, &result, _state);
10824  mannwhitneyu_ucheb(x, 1.237619e-04, &tj, &tj1, &result, _state);
10825  mannwhitneyu_ucheb(x, 7.269692e-05, &tj, &tj1, &result, _state);
10826  return result;
10827 }
10828 
10829 
10830 /*************************************************************************
10831 Tail(S, 9, 14)
10832 *************************************************************************/
10833 static double mannwhitneyu_utbln9n14(double s, ae_state *_state)
10834 {
10835  double x;
10836  double tj;
10837  double tj1;
10838  double result;
10839 
10840 
10841  result = 0;
10842  x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
10843  tj = 1;
10844  tj1 = x;
10845  mannwhitneyu_ucheb(x, -4.425981e+00, &tj, &tj1, &result, _state);
10846  mannwhitneyu_ucheb(x, -4.751545e+00, &tj, &tj1, &result, _state);
10847  mannwhitneyu_ucheb(x, -1.159543e+00, &tj, &tj1, &result, _state);
10848  mannwhitneyu_ucheb(x, -2.086570e-01, &tj, &tj1, &result, _state);
10849  mannwhitneyu_ucheb(x, -5.917446e-02, &tj, &tj1, &result, _state);
10850  mannwhitneyu_ucheb(x, -2.120112e-02, &tj, &tj1, &result, _state);
10851  mannwhitneyu_ucheb(x, -8.175519e-03, &tj, &tj1, &result, _state);
10852  mannwhitneyu_ucheb(x, -3.515473e-03, &tj, &tj1, &result, _state);
10853  mannwhitneyu_ucheb(x, -1.727772e-03, &tj, &tj1, &result, _state);
10854  mannwhitneyu_ucheb(x, -9.070629e-04, &tj, &tj1, &result, _state);
10855  mannwhitneyu_ucheb(x, -5.677569e-04, &tj, &tj1, &result, _state);
10856  mannwhitneyu_ucheb(x, -3.876953e-04, &tj, &tj1, &result, _state);
10857  mannwhitneyu_ucheb(x, -3.233502e-04, &tj, &tj1, &result, _state);
10858  mannwhitneyu_ucheb(x, -3.508182e-04, &tj, &tj1, &result, _state);
10859  mannwhitneyu_ucheb(x, -3.120389e-04, &tj, &tj1, &result, _state);
10860  mannwhitneyu_ucheb(x, -3.847212e-04, &tj, &tj1, &result, _state);
10861  return result;
10862 }
10863 
10864 
10865 /*************************************************************************
10866 Tail(S, 9, 15)
10867 *************************************************************************/
10868 static double mannwhitneyu_utbln9n15(double s, ae_state *_state)
10869 {
10870  double x;
10871  double tj;
10872  double tj1;
10873  double result;
10874 
10875 
10876  result = 0;
10877  x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
10878  tj = 1;
10879  tj1 = x;
10880  mannwhitneyu_ucheb(x, -4.414952e+00, &tj, &tj1, &result, _state);
10881  mannwhitneyu_ucheb(x, -4.727612e+00, &tj, &tj1, &result, _state);
10882  mannwhitneyu_ucheb(x, -1.140634e+00, &tj, &tj1, &result, _state);
10883  mannwhitneyu_ucheb(x, -1.981231e-01, &tj, &tj1, &result, _state);
10884  mannwhitneyu_ucheb(x, -5.382635e-02, &tj, &tj1, &result, _state);
10885  mannwhitneyu_ucheb(x, -1.853575e-02, &tj, &tj1, &result, _state);
10886  mannwhitneyu_ucheb(x, -6.571051e-03, &tj, &tj1, &result, _state);
10887  mannwhitneyu_ucheb(x, -2.567625e-03, &tj, &tj1, &result, _state);
10888  mannwhitneyu_ucheb(x, -9.214197e-04, &tj, &tj1, &result, _state);
10889  mannwhitneyu_ucheb(x, -2.448700e-04, &tj, &tj1, &result, _state);
10890  mannwhitneyu_ucheb(x, 1.712669e-04, &tj, &tj1, &result, _state);
10891  mannwhitneyu_ucheb(x, 4.015050e-04, &tj, &tj1, &result, _state);
10892  mannwhitneyu_ucheb(x, 5.438610e-04, &tj, &tj1, &result, _state);
10893  mannwhitneyu_ucheb(x, 6.301363e-04, &tj, &tj1, &result, _state);
10894  mannwhitneyu_ucheb(x, 5.309386e-04, &tj, &tj1, &result, _state);
10895  mannwhitneyu_ucheb(x, 5.164772e-04, &tj, &tj1, &result, _state);
10896  return result;
10897 }
10898 
10899 
10900 /*************************************************************************
10901 Tail(S, 9, 30)
10902 *************************************************************************/
10903 static double mannwhitneyu_utbln9n30(double s, ae_state *_state)
10904 {
10905  double x;
10906  double tj;
10907  double tj1;
10908  double result;
10909 
10910 
10911  result = 0;
10912  x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
10913  tj = 1;
10914  tj1 = x;
10915  mannwhitneyu_ucheb(x, -4.370720e+00, &tj, &tj1, &result, _state);
10916  mannwhitneyu_ucheb(x, -4.615712e+00, &tj, &tj1, &result, _state);
10917  mannwhitneyu_ucheb(x, -1.050023e+00, &tj, &tj1, &result, _state);
10918  mannwhitneyu_ucheb(x, -1.504775e-01, &tj, &tj1, &result, _state);
10919  mannwhitneyu_ucheb(x, -3.318265e-02, &tj, &tj1, &result, _state);
10920  mannwhitneyu_ucheb(x, -9.646826e-03, &tj, &tj1, &result, _state);
10921  mannwhitneyu_ucheb(x, -2.741492e-03, &tj, &tj1, &result, _state);
10922  mannwhitneyu_ucheb(x, -8.735360e-04, &tj, &tj1, &result, _state);
10923  mannwhitneyu_ucheb(x, -2.966911e-04, &tj, &tj1, &result, _state);
10924  mannwhitneyu_ucheb(x, -1.100738e-04, &tj, &tj1, &result, _state);
10925  mannwhitneyu_ucheb(x, -4.348991e-05, &tj, &tj1, &result, _state);
10926  mannwhitneyu_ucheb(x, -1.527687e-05, &tj, &tj1, &result, _state);
10927  mannwhitneyu_ucheb(x, -2.917286e-06, &tj, &tj1, &result, _state);
10928  mannwhitneyu_ucheb(x, 3.397466e-07, &tj, &tj1, &result, _state);
10929  mannwhitneyu_ucheb(x, -2.360175e-07, &tj, &tj1, &result, _state);
10930  mannwhitneyu_ucheb(x, -9.892252e-07, &tj, &tj1, &result, _state);
10931  return result;
10932 }
10933 
10934 
10935 /*************************************************************************
10936 Tail(S, 9, 100)
10937 *************************************************************************/
10938 static double mannwhitneyu_utbln9n100(double s, ae_state *_state)
10939 {
10940  double x;
10941  double tj;
10942  double tj1;
10943  double result;
10944 
10945 
10946  result = 0;
10947  x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
10948  tj = 1;
10949  tj1 = x;
10950  mannwhitneyu_ucheb(x, -4.372506e+00, &tj, &tj1, &result, _state);
10951  mannwhitneyu_ucheb(x, -4.590966e+00, &tj, &tj1, &result, _state);
10952  mannwhitneyu_ucheb(x, -1.021758e+00, &tj, &tj1, &result, _state);
10953  mannwhitneyu_ucheb(x, -1.359849e-01, &tj, &tj1, &result, _state);
10954  mannwhitneyu_ucheb(x, -2.755519e-02, &tj, &tj1, &result, _state);
10955  mannwhitneyu_ucheb(x, -7.533166e-03, &tj, &tj1, &result, _state);
10956  mannwhitneyu_ucheb(x, -1.936659e-03, &tj, &tj1, &result, _state);
10957  mannwhitneyu_ucheb(x, -5.634913e-04, &tj, &tj1, &result, _state);
10958  mannwhitneyu_ucheb(x, -1.730053e-04, &tj, &tj1, &result, _state);
10959  mannwhitneyu_ucheb(x, -5.791845e-05, &tj, &tj1, &result, _state);
10960  mannwhitneyu_ucheb(x, -2.030682e-05, &tj, &tj1, &result, _state);
10961  mannwhitneyu_ucheb(x, -5.228663e-06, &tj, &tj1, &result, _state);
10962  mannwhitneyu_ucheb(x, 8.631175e-07, &tj, &tj1, &result, _state);
10963  mannwhitneyu_ucheb(x, 1.636749e-06, &tj, &tj1, &result, _state);
10964  mannwhitneyu_ucheb(x, 4.404599e-07, &tj, &tj1, &result, _state);
10965  mannwhitneyu_ucheb(x, -2.789872e-07, &tj, &tj1, &result, _state);
10966  return result;
10967 }
10968 
10969 
10970 /*************************************************************************
10971 Tail(S, 10, 10)
10972 *************************************************************************/
10973 static double mannwhitneyu_utbln10n10(double s, ae_state *_state)
10974 {
10975  double x;
10976  double tj;
10977  double tj1;
10978  double result;
10979 
10980 
10981  result = 0;
10982  x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
10983  tj = 1;
10984  tj1 = x;
10985  mannwhitneyu_ucheb(x, -4.468831e+00, &tj, &tj1, &result, _state);
10986  mannwhitneyu_ucheb(x, -4.844398e+00, &tj, &tj1, &result, _state);
10987  mannwhitneyu_ucheb(x, -1.231728e+00, &tj, &tj1, &result, _state);
10988  mannwhitneyu_ucheb(x, -2.486073e-01, &tj, &tj1, &result, _state);
10989  mannwhitneyu_ucheb(x, -7.781321e-02, &tj, &tj1, &result, _state);
10990  mannwhitneyu_ucheb(x, -2.971425e-02, &tj, &tj1, &result, _state);
10991  mannwhitneyu_ucheb(x, -1.215371e-02, &tj, &tj1, &result, _state);
10992  mannwhitneyu_ucheb(x, -5.828451e-03, &tj, &tj1, &result, _state);
10993  mannwhitneyu_ucheb(x, -3.419872e-03, &tj, &tj1, &result, _state);
10994  mannwhitneyu_ucheb(x, -2.430165e-03, &tj, &tj1, &result, _state);
10995  mannwhitneyu_ucheb(x, -1.740363e-03, &tj, &tj1, &result, _state);
10996  mannwhitneyu_ucheb(x, -1.049211e-03, &tj, &tj1, &result, _state);
10997  mannwhitneyu_ucheb(x, -3.269371e-04, &tj, &tj1, &result, _state);
10998  mannwhitneyu_ucheb(x, 2.211393e-04, &tj, &tj1, &result, _state);
10999  mannwhitneyu_ucheb(x, 4.232314e-04, &tj, &tj1, &result, _state);
11000  mannwhitneyu_ucheb(x, 3.016081e-04, &tj, &tj1, &result, _state);
11001  return result;
11002 }
11003 
11004 
11005 /*************************************************************************
11006 Tail(S, 10, 11)
11007 *************************************************************************/
11008 static double mannwhitneyu_utbln10n11(double s, ae_state *_state)
11009 {
11010  double x;
11011  double tj;
11012  double tj1;
11013  double result;
11014 
11015 
11016  result = 0;
11017  x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
11018  tj = 1;
11019  tj1 = x;
11020  mannwhitneyu_ucheb(x, -4.437998e+00, &tj, &tj1, &result, _state);
11021  mannwhitneyu_ucheb(x, -4.782296e+00, &tj, &tj1, &result, _state);
11022  mannwhitneyu_ucheb(x, -1.184732e+00, &tj, &tj1, &result, _state);
11023  mannwhitneyu_ucheb(x, -2.219585e-01, &tj, &tj1, &result, _state);
11024  mannwhitneyu_ucheb(x, -6.457012e-02, &tj, &tj1, &result, _state);
11025  mannwhitneyu_ucheb(x, -2.296008e-02, &tj, &tj1, &result, _state);
11026  mannwhitneyu_ucheb(x, -8.481501e-03, &tj, &tj1, &result, _state);
11027  mannwhitneyu_ucheb(x, -3.527940e-03, &tj, &tj1, &result, _state);
11028  mannwhitneyu_ucheb(x, -1.953426e-03, &tj, &tj1, &result, _state);
11029  mannwhitneyu_ucheb(x, -1.563840e-03, &tj, &tj1, &result, _state);
11030  mannwhitneyu_ucheb(x, -1.574403e-03, &tj, &tj1, &result, _state);
11031  mannwhitneyu_ucheb(x, -1.535775e-03, &tj, &tj1, &result, _state);
11032  mannwhitneyu_ucheb(x, -1.338037e-03, &tj, &tj1, &result, _state);
11033  mannwhitneyu_ucheb(x, -1.002654e-03, &tj, &tj1, &result, _state);
11034  mannwhitneyu_ucheb(x, -5.852676e-04, &tj, &tj1, &result, _state);
11035  mannwhitneyu_ucheb(x, -3.318132e-04, &tj, &tj1, &result, _state);
11036  return result;
11037 }
11038 
11039 
11040 /*************************************************************************
11041 Tail(S, 10, 12)
11042 *************************************************************************/
11043 static double mannwhitneyu_utbln10n12(double s, ae_state *_state)
11044 {
11045  double x;
11046  double tj;
11047  double tj1;
11048  double result;
11049 
11050 
11051  result = 0;
11052  x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
11053  tj = 1;
11054  tj1 = x;
11055  mannwhitneyu_ucheb(x, -4.416082e+00, &tj, &tj1, &result, _state);
11056  mannwhitneyu_ucheb(x, -4.737458e+00, &tj, &tj1, &result, _state);
11057  mannwhitneyu_ucheb(x, -1.150952e+00, &tj, &tj1, &result, _state);
11058  mannwhitneyu_ucheb(x, -2.036884e-01, &tj, &tj1, &result, _state);
11059  mannwhitneyu_ucheb(x, -5.609030e-02, &tj, &tj1, &result, _state);
11060  mannwhitneyu_ucheb(x, -1.908684e-02, &tj, &tj1, &result, _state);
11061  mannwhitneyu_ucheb(x, -6.439666e-03, &tj, &tj1, &result, _state);
11062  mannwhitneyu_ucheb(x, -2.162647e-03, &tj, &tj1, &result, _state);
11063  mannwhitneyu_ucheb(x, -6.451601e-04, &tj, &tj1, &result, _state);
11064  mannwhitneyu_ucheb(x, -2.148757e-04, &tj, &tj1, &result, _state);
11065  mannwhitneyu_ucheb(x, -1.803981e-04, &tj, &tj1, &result, _state);
11066  mannwhitneyu_ucheb(x, -2.731621e-04, &tj, &tj1, &result, _state);
11067  mannwhitneyu_ucheb(x, -3.346903e-04, &tj, &tj1, &result, _state);
11068  mannwhitneyu_ucheb(x, -3.013151e-04, &tj, &tj1, &result, _state);
11069  mannwhitneyu_ucheb(x, -1.956148e-04, &tj, &tj1, &result, _state);
11070  mannwhitneyu_ucheb(x, -2.438381e-05, &tj, &tj1, &result, _state);
11071  return result;
11072 }
11073 
11074 
11075 /*************************************************************************
11076 Tail(S, 10, 13)
11077 *************************************************************************/
11078 static double mannwhitneyu_utbln10n13(double s, ae_state *_state)
11079 {
11080  double x;
11081  double tj;
11082  double tj1;
11083  double result;
11084 
11085 
11086  result = 0;
11087  x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
11088  tj = 1;
11089  tj1 = x;
11090  mannwhitneyu_ucheb(x, -4.399480e+00, &tj, &tj1, &result, _state);
11091  mannwhitneyu_ucheb(x, -4.702863e+00, &tj, &tj1, &result, _state);
11092  mannwhitneyu_ucheb(x, -1.124829e+00, &tj, &tj1, &result, _state);
11093  mannwhitneyu_ucheb(x, -1.897428e-01, &tj, &tj1, &result, _state);
11094  mannwhitneyu_ucheb(x, -4.979802e-02, &tj, &tj1, &result, _state);
11095  mannwhitneyu_ucheb(x, -1.634368e-02, &tj, &tj1, &result, _state);
11096  mannwhitneyu_ucheb(x, -5.180461e-03, &tj, &tj1, &result, _state);
11097  mannwhitneyu_ucheb(x, -1.484926e-03, &tj, &tj1, &result, _state);
11098  mannwhitneyu_ucheb(x, -7.864376e-05, &tj, &tj1, &result, _state);
11099  mannwhitneyu_ucheb(x, 4.186576e-04, &tj, &tj1, &result, _state);
11100  mannwhitneyu_ucheb(x, 5.886925e-04, &tj, &tj1, &result, _state);
11101  mannwhitneyu_ucheb(x, 5.836828e-04, &tj, &tj1, &result, _state);
11102  mannwhitneyu_ucheb(x, 5.074756e-04, &tj, &tj1, &result, _state);
11103  mannwhitneyu_ucheb(x, 4.209547e-04, &tj, &tj1, &result, _state);
11104  mannwhitneyu_ucheb(x, 2.883266e-04, &tj, &tj1, &result, _state);
11105  mannwhitneyu_ucheb(x, 2.380143e-04, &tj, &tj1, &result, _state);
11106  return result;
11107 }
11108 
11109 
11110 /*************************************************************************
11111 Tail(S, 10, 14)
11112 *************************************************************************/
11113 static double mannwhitneyu_utbln10n14(double s, ae_state *_state)
11114 {
11115  double x;
11116  double tj;
11117  double tj1;
11118  double result;
11119 
11120 
11121  result = 0;
11122  x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
11123  tj = 1;
11124  tj1 = x;
11125  mannwhitneyu_ucheb(x, -4.386924e+00, &tj, &tj1, &result, _state);
11126  mannwhitneyu_ucheb(x, -4.676124e+00, &tj, &tj1, &result, _state);
11127  mannwhitneyu_ucheb(x, -1.104740e+00, &tj, &tj1, &result, _state);
11128  mannwhitneyu_ucheb(x, -1.793826e-01, &tj, &tj1, &result, _state);
11129  mannwhitneyu_ucheb(x, -4.558886e-02, &tj, &tj1, &result, _state);
11130  mannwhitneyu_ucheb(x, -1.492462e-02, &tj, &tj1, &result, _state);
11131  mannwhitneyu_ucheb(x, -5.052903e-03, &tj, &tj1, &result, _state);
11132  mannwhitneyu_ucheb(x, -1.917782e-03, &tj, &tj1, &result, _state);
11133  mannwhitneyu_ucheb(x, -7.878696e-04, &tj, &tj1, &result, _state);
11134  mannwhitneyu_ucheb(x, -3.576046e-04, &tj, &tj1, &result, _state);
11135  mannwhitneyu_ucheb(x, -1.764551e-04, &tj, &tj1, &result, _state);
11136  mannwhitneyu_ucheb(x, -9.288778e-05, &tj, &tj1, &result, _state);
11137  mannwhitneyu_ucheb(x, -4.757658e-05, &tj, &tj1, &result, _state);
11138  mannwhitneyu_ucheb(x, -2.299101e-05, &tj, &tj1, &result, _state);
11139  mannwhitneyu_ucheb(x, -9.265197e-06, &tj, &tj1, &result, _state);
11140  mannwhitneyu_ucheb(x, -2.384503e-07, &tj, &tj1, &result, _state);
11141  return result;
11142 }
11143 
11144 
11145 /*************************************************************************
11146 Tail(S, 10, 15)
11147 *************************************************************************/
11148 static double mannwhitneyu_utbln10n15(double s, ae_state *_state)
11149 {
11150  double x;
11151  double tj;
11152  double tj1;
11153  double result;
11154 
11155 
11156  result = 0;
11157  x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
11158  tj = 1;
11159  tj1 = x;
11160  mannwhitneyu_ucheb(x, -4.376846e+00, &tj, &tj1, &result, _state);
11161  mannwhitneyu_ucheb(x, -4.654247e+00, &tj, &tj1, &result, _state);
11162  mannwhitneyu_ucheb(x, -1.088083e+00, &tj, &tj1, &result, _state);
11163  mannwhitneyu_ucheb(x, -1.705945e-01, &tj, &tj1, &result, _state);
11164  mannwhitneyu_ucheb(x, -4.169677e-02, &tj, &tj1, &result, _state);
11165  mannwhitneyu_ucheb(x, -1.317213e-02, &tj, &tj1, &result, _state);
11166  mannwhitneyu_ucheb(x, -4.264836e-03, &tj, &tj1, &result, _state);
11167  mannwhitneyu_ucheb(x, -1.548024e-03, &tj, &tj1, &result, _state);
11168  mannwhitneyu_ucheb(x, -6.633910e-04, &tj, &tj1, &result, _state);
11169  mannwhitneyu_ucheb(x, -3.505621e-04, &tj, &tj1, &result, _state);
11170  mannwhitneyu_ucheb(x, -2.658588e-04, &tj, &tj1, &result, _state);
11171  mannwhitneyu_ucheb(x, -2.320254e-04, &tj, &tj1, &result, _state);
11172  mannwhitneyu_ucheb(x, -2.175277e-04, &tj, &tj1, &result, _state);
11173  mannwhitneyu_ucheb(x, -2.122317e-04, &tj, &tj1, &result, _state);
11174  mannwhitneyu_ucheb(x, -1.675688e-04, &tj, &tj1, &result, _state);
11175  mannwhitneyu_ucheb(x, -1.661363e-04, &tj, &tj1, &result, _state);
11176  return result;
11177 }
11178 
11179 
11180 /*************************************************************************
11181 Tail(S, 10, 30)
11182 *************************************************************************/
11183 static double mannwhitneyu_utbln10n30(double s, ae_state *_state)
11184 {
11185  double x;
11186  double tj;
11187  double tj1;
11188  double result;
11189 
11190 
11191  result = 0;
11192  x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
11193  tj = 1;
11194  tj1 = x;
11195  mannwhitneyu_ucheb(x, -4.333977e+00, &tj, &tj1, &result, _state);
11196  mannwhitneyu_ucheb(x, -4.548099e+00, &tj, &tj1, &result, _state);
11197  mannwhitneyu_ucheb(x, -1.004444e+00, &tj, &tj1, &result, _state);
11198  mannwhitneyu_ucheb(x, -1.291014e-01, &tj, &tj1, &result, _state);
11199  mannwhitneyu_ucheb(x, -2.523674e-02, &tj, &tj1, &result, _state);
11200  mannwhitneyu_ucheb(x, -6.828211e-03, &tj, &tj1, &result, _state);
11201  mannwhitneyu_ucheb(x, -1.716917e-03, &tj, &tj1, &result, _state);
11202  mannwhitneyu_ucheb(x, -4.894256e-04, &tj, &tj1, &result, _state);
11203  mannwhitneyu_ucheb(x, -1.433371e-04, &tj, &tj1, &result, _state);
11204  mannwhitneyu_ucheb(x, -4.522675e-05, &tj, &tj1, &result, _state);
11205  mannwhitneyu_ucheb(x, -1.764192e-05, &tj, &tj1, &result, _state);
11206  mannwhitneyu_ucheb(x, -9.140235e-06, &tj, &tj1, &result, _state);
11207  mannwhitneyu_ucheb(x, -5.629230e-06, &tj, &tj1, &result, _state);
11208  mannwhitneyu_ucheb(x, -3.541895e-06, &tj, &tj1, &result, _state);
11209  mannwhitneyu_ucheb(x, -1.944946e-06, &tj, &tj1, &result, _state);
11210  mannwhitneyu_ucheb(x, -1.726360e-06, &tj, &tj1, &result, _state);
11211  return result;
11212 }
11213 
11214 
11215 /*************************************************************************
11216 Tail(S, 10, 100)
11217 *************************************************************************/
11218 static double mannwhitneyu_utbln10n100(double s, ae_state *_state)
11219 {
11220  double x;
11221  double tj;
11222  double tj1;
11223  double result;
11224 
11225 
11226  result = 0;
11227  x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
11228  tj = 1;
11229  tj1 = x;
11230  mannwhitneyu_ucheb(x, -4.334008e+00, &tj, &tj1, &result, _state);
11231  mannwhitneyu_ucheb(x, -4.522316e+00, &tj, &tj1, &result, _state);
11232  mannwhitneyu_ucheb(x, -9.769627e-01, &tj, &tj1, &result, _state);
11233  mannwhitneyu_ucheb(x, -1.158110e-01, &tj, &tj1, &result, _state);
11234  mannwhitneyu_ucheb(x, -2.053650e-02, &tj, &tj1, &result, _state);
11235  mannwhitneyu_ucheb(x, -5.242235e-03, &tj, &tj1, &result, _state);
11236  mannwhitneyu_ucheb(x, -1.173571e-03, &tj, &tj1, &result, _state);
11237  mannwhitneyu_ucheb(x, -3.033661e-04, &tj, &tj1, &result, _state);
11238  mannwhitneyu_ucheb(x, -7.824732e-05, &tj, &tj1, &result, _state);
11239  mannwhitneyu_ucheb(x, -2.084420e-05, &tj, &tj1, &result, _state);
11240  mannwhitneyu_ucheb(x, -6.610036e-06, &tj, &tj1, &result, _state);
11241  mannwhitneyu_ucheb(x, -2.728155e-06, &tj, &tj1, &result, _state);
11242  mannwhitneyu_ucheb(x, -1.217130e-06, &tj, &tj1, &result, _state);
11243  mannwhitneyu_ucheb(x, -2.340966e-07, &tj, &tj1, &result, _state);
11244  mannwhitneyu_ucheb(x, 2.001235e-07, &tj, &tj1, &result, _state);
11245  mannwhitneyu_ucheb(x, 1.694052e-07, &tj, &tj1, &result, _state);
11246  return result;
11247 }
11248 
11249 
11250 /*************************************************************************
11251 Tail(S, 11, 11)
11252 *************************************************************************/
11253 static double mannwhitneyu_utbln11n11(double s, ae_state *_state)
11254 {
11255  double x;
11256  double tj;
11257  double tj1;
11258  double result;
11259 
11260 
11261  result = 0;
11262  x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
11263  tj = 1;
11264  tj1 = x;
11265  mannwhitneyu_ucheb(x, -4.519760e+00, &tj, &tj1, &result, _state);
11266  mannwhitneyu_ucheb(x, -4.880694e+00, &tj, &tj1, &result, _state);
11267  mannwhitneyu_ucheb(x, -1.200698e+00, &tj, &tj1, &result, _state);
11268  mannwhitneyu_ucheb(x, -2.174092e-01, &tj, &tj1, &result, _state);
11269  mannwhitneyu_ucheb(x, -6.072304e-02, &tj, &tj1, &result, _state);
11270  mannwhitneyu_ucheb(x, -2.054773e-02, &tj, &tj1, &result, _state);
11271  mannwhitneyu_ucheb(x, -6.506613e-03, &tj, &tj1, &result, _state);
11272  mannwhitneyu_ucheb(x, -1.813942e-03, &tj, &tj1, &result, _state);
11273  mannwhitneyu_ucheb(x, -1.223644e-04, &tj, &tj1, &result, _state);
11274  mannwhitneyu_ucheb(x, 2.417416e-04, &tj, &tj1, &result, _state);
11275  mannwhitneyu_ucheb(x, 2.499166e-04, &tj, &tj1, &result, _state);
11276  mannwhitneyu_ucheb(x, 1.194332e-04, &tj, &tj1, &result, _state);
11277  mannwhitneyu_ucheb(x, 7.369096e-05, &tj, &tj1, &result, _state);
11278  mannwhitneyu_ucheb(x, 1.968590e-04, &tj, &tj1, &result, _state);
11279  mannwhitneyu_ucheb(x, 2.630532e-04, &tj, &tj1, &result, _state);
11280  mannwhitneyu_ucheb(x, 5.061000e-04, &tj, &tj1, &result, _state);
11281  return result;
11282 }
11283 
11284 
11285 /*************************************************************************
11286 Tail(S, 11, 12)
11287 *************************************************************************/
11288 static double mannwhitneyu_utbln11n12(double s, ae_state *_state)
11289 {
11290  double x;
11291  double tj;
11292  double tj1;
11293  double result;
11294 
11295 
11296  result = 0;
11297  x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
11298  tj = 1;
11299  tj1 = x;
11300  mannwhitneyu_ucheb(x, -4.495790e+00, &tj, &tj1, &result, _state);
11301  mannwhitneyu_ucheb(x, -4.832622e+00, &tj, &tj1, &result, _state);
11302  mannwhitneyu_ucheb(x, -1.165420e+00, &tj, &tj1, &result, _state);
11303  mannwhitneyu_ucheb(x, -1.987306e-01, &tj, &tj1, &result, _state);
11304  mannwhitneyu_ucheb(x, -5.265621e-02, &tj, &tj1, &result, _state);
11305  mannwhitneyu_ucheb(x, -1.723537e-02, &tj, &tj1, &result, _state);
11306  mannwhitneyu_ucheb(x, -5.347406e-03, &tj, &tj1, &result, _state);
11307  mannwhitneyu_ucheb(x, -1.353464e-03, &tj, &tj1, &result, _state);
11308  mannwhitneyu_ucheb(x, 6.613369e-05, &tj, &tj1, &result, _state);
11309  mannwhitneyu_ucheb(x, 5.102522e-04, &tj, &tj1, &result, _state);
11310  mannwhitneyu_ucheb(x, 5.237709e-04, &tj, &tj1, &result, _state);
11311  mannwhitneyu_ucheb(x, 3.665652e-04, &tj, &tj1, &result, _state);
11312  mannwhitneyu_ucheb(x, 1.626903e-04, &tj, &tj1, &result, _state);
11313  mannwhitneyu_ucheb(x, -1.167518e-05, &tj, &tj1, &result, _state);
11314  mannwhitneyu_ucheb(x, -8.564455e-05, &tj, &tj1, &result, _state);
11315  mannwhitneyu_ucheb(x, -1.047320e-04, &tj, &tj1, &result, _state);
11316  return result;
11317 }
11318 
11319 
11320 /*************************************************************************
11321 Tail(S, 11, 13)
11322 *************************************************************************/
11323 static double mannwhitneyu_utbln11n13(double s, ae_state *_state)
11324 {
11325  double x;
11326  double tj;
11327  double tj1;
11328  double result;
11329 
11330 
11331  result = 0;
11332  x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
11333  tj = 1;
11334  tj1 = x;
11335  mannwhitneyu_ucheb(x, -4.477880e+00, &tj, &tj1, &result, _state);
11336  mannwhitneyu_ucheb(x, -4.796242e+00, &tj, &tj1, &result, _state);
11337  mannwhitneyu_ucheb(x, -1.138769e+00, &tj, &tj1, &result, _state);
11338  mannwhitneyu_ucheb(x, -1.851739e-01, &tj, &tj1, &result, _state);
11339  mannwhitneyu_ucheb(x, -4.722104e-02, &tj, &tj1, &result, _state);
11340  mannwhitneyu_ucheb(x, -1.548304e-02, &tj, &tj1, &result, _state);
11341  mannwhitneyu_ucheb(x, -5.176683e-03, &tj, &tj1, &result, _state);
11342  mannwhitneyu_ucheb(x, -1.817895e-03, &tj, &tj1, &result, _state);
11343  mannwhitneyu_ucheb(x, -5.842451e-04, &tj, &tj1, &result, _state);
11344  mannwhitneyu_ucheb(x, -8.935870e-05, &tj, &tj1, &result, _state);
11345  mannwhitneyu_ucheb(x, 8.421777e-05, &tj, &tj1, &result, _state);
11346  mannwhitneyu_ucheb(x, 1.238831e-04, &tj, &tj1, &result, _state);
11347  mannwhitneyu_ucheb(x, 8.867026e-05, &tj, &tj1, &result, _state);
11348  mannwhitneyu_ucheb(x, 1.458255e-05, &tj, &tj1, &result, _state);
11349  mannwhitneyu_ucheb(x, -3.306259e-05, &tj, &tj1, &result, _state);
11350  mannwhitneyu_ucheb(x, -8.961487e-05, &tj, &tj1, &result, _state);
11351  return result;
11352 }
11353 
11354 
11355 /*************************************************************************
11356 Tail(S, 11, 14)
11357 *************************************************************************/
11358 static double mannwhitneyu_utbln11n14(double s, ae_state *_state)
11359 {
11360  double x;
11361  double tj;
11362  double tj1;
11363  double result;
11364 
11365 
11366  result = 0;
11367  x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
11368  tj = 1;
11369  tj1 = x;
11370  mannwhitneyu_ucheb(x, -4.463683e+00, &tj, &tj1, &result, _state);
11371  mannwhitneyu_ucheb(x, -4.766969e+00, &tj, &tj1, &result, _state);
11372  mannwhitneyu_ucheb(x, -1.117082e+00, &tj, &tj1, &result, _state);
11373  mannwhitneyu_ucheb(x, -1.739574e-01, &tj, &tj1, &result, _state);
11374  mannwhitneyu_ucheb(x, -4.238865e-02, &tj, &tj1, &result, _state);
11375  mannwhitneyu_ucheb(x, -1.350306e-02, &tj, &tj1, &result, _state);
11376  mannwhitneyu_ucheb(x, -4.425871e-03, &tj, &tj1, &result, _state);
11377  mannwhitneyu_ucheb(x, -1.640172e-03, &tj, &tj1, &result, _state);
11378  mannwhitneyu_ucheb(x, -6.660633e-04, &tj, &tj1, &result, _state);
11379  mannwhitneyu_ucheb(x, -2.879883e-04, &tj, &tj1, &result, _state);
11380  mannwhitneyu_ucheb(x, -1.349658e-04, &tj, &tj1, &result, _state);
11381  mannwhitneyu_ucheb(x, -6.271795e-05, &tj, &tj1, &result, _state);
11382  mannwhitneyu_ucheb(x, -3.304544e-05, &tj, &tj1, &result, _state);
11383  mannwhitneyu_ucheb(x, -3.024201e-05, &tj, &tj1, &result, _state);
11384  mannwhitneyu_ucheb(x, -2.816867e-05, &tj, &tj1, &result, _state);
11385  mannwhitneyu_ucheb(x, -4.596787e-05, &tj, &tj1, &result, _state);
11386  return result;
11387 }
11388 
11389 
11390 /*************************************************************************
11391 Tail(S, 11, 15)
11392 *************************************************************************/
11393 static double mannwhitneyu_utbln11n15(double s, ae_state *_state)
11394 {
11395  double x;
11396  double tj;
11397  double tj1;
11398  double result;
11399 
11400 
11401  result = 0;
11402  x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
11403  tj = 1;
11404  tj1 = x;
11405  mannwhitneyu_ucheb(x, -4.452526e+00, &tj, &tj1, &result, _state);
11406  mannwhitneyu_ucheb(x, -4.743570e+00, &tj, &tj1, &result, _state);
11407  mannwhitneyu_ucheb(x, -1.099705e+00, &tj, &tj1, &result, _state);
11408  mannwhitneyu_ucheb(x, -1.650612e-01, &tj, &tj1, &result, _state);
11409  mannwhitneyu_ucheb(x, -3.858285e-02, &tj, &tj1, &result, _state);
11410  mannwhitneyu_ucheb(x, -1.187036e-02, &tj, &tj1, &result, _state);
11411  mannwhitneyu_ucheb(x, -3.689241e-03, &tj, &tj1, &result, _state);
11412  mannwhitneyu_ucheb(x, -1.294360e-03, &tj, &tj1, &result, _state);
11413  mannwhitneyu_ucheb(x, -5.072623e-04, &tj, &tj1, &result, _state);
11414  mannwhitneyu_ucheb(x, -2.278008e-04, &tj, &tj1, &result, _state);
11415  mannwhitneyu_ucheb(x, -1.322382e-04, &tj, &tj1, &result, _state);
11416  mannwhitneyu_ucheb(x, -9.131558e-05, &tj, &tj1, &result, _state);
11417  mannwhitneyu_ucheb(x, -7.305669e-05, &tj, &tj1, &result, _state);
11418  mannwhitneyu_ucheb(x, -6.825627e-05, &tj, &tj1, &result, _state);
11419  mannwhitneyu_ucheb(x, -5.332689e-05, &tj, &tj1, &result, _state);
11420  mannwhitneyu_ucheb(x, -6.120973e-05, &tj, &tj1, &result, _state);
11421  return result;
11422 }
11423 
11424 
11425 /*************************************************************************
11426 Tail(S, 11, 30)
11427 *************************************************************************/
11428 static double mannwhitneyu_utbln11n30(double s, ae_state *_state)
11429 {
11430  double x;
11431  double tj;
11432  double tj1;
11433  double result;
11434 
11435 
11436  result = 0;
11437  x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
11438  tj = 1;
11439  tj1 = x;
11440  mannwhitneyu_ucheb(x, -4.402621e+00, &tj, &tj1, &result, _state);
11441  mannwhitneyu_ucheb(x, -4.627440e+00, &tj, &tj1, &result, _state);
11442  mannwhitneyu_ucheb(x, -1.011333e+00, &tj, &tj1, &result, _state);
11443  mannwhitneyu_ucheb(x, -1.224126e-01, &tj, &tj1, &result, _state);
11444  mannwhitneyu_ucheb(x, -2.232856e-02, &tj, &tj1, &result, _state);
11445  mannwhitneyu_ucheb(x, -5.859347e-03, &tj, &tj1, &result, _state);
11446  mannwhitneyu_ucheb(x, -1.377381e-03, &tj, &tj1, &result, _state);
11447  mannwhitneyu_ucheb(x, -3.756709e-04, &tj, &tj1, &result, _state);
11448  mannwhitneyu_ucheb(x, -1.033230e-04, &tj, &tj1, &result, _state);
11449  mannwhitneyu_ucheb(x, -2.875472e-05, &tj, &tj1, &result, _state);
11450  mannwhitneyu_ucheb(x, -8.608399e-06, &tj, &tj1, &result, _state);
11451  mannwhitneyu_ucheb(x, -3.102943e-06, &tj, &tj1, &result, _state);
11452  mannwhitneyu_ucheb(x, -1.740693e-06, &tj, &tj1, &result, _state);
11453  mannwhitneyu_ucheb(x, -1.343139e-06, &tj, &tj1, &result, _state);
11454  mannwhitneyu_ucheb(x, -9.196878e-07, &tj, &tj1, &result, _state);
11455  mannwhitneyu_ucheb(x, -6.658062e-07, &tj, &tj1, &result, _state);
11456  return result;
11457 }
11458 
11459 
11460 /*************************************************************************
11461 Tail(S, 11, 100)
11462 *************************************************************************/
11463 static double mannwhitneyu_utbln11n100(double s, ae_state *_state)
11464 {
11465  double x;
11466  double tj;
11467  double tj1;
11468  double result;
11469 
11470 
11471  result = 0;
11472  x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
11473  tj = 1;
11474  tj1 = x;
11475  mannwhitneyu_ucheb(x, -4.398795e+00, &tj, &tj1, &result, _state);
11476  mannwhitneyu_ucheb(x, -4.596486e+00, &tj, &tj1, &result, _state);
11477  mannwhitneyu_ucheb(x, -9.814761e-01, &tj, &tj1, &result, _state);
11478  mannwhitneyu_ucheb(x, -1.085187e-01, &tj, &tj1, &result, _state);
11479  mannwhitneyu_ucheb(x, -1.766529e-02, &tj, &tj1, &result, _state);
11480  mannwhitneyu_ucheb(x, -4.379425e-03, &tj, &tj1, &result, _state);
11481  mannwhitneyu_ucheb(x, -8.986351e-04, &tj, &tj1, &result, _state);
11482  mannwhitneyu_ucheb(x, -2.214705e-04, &tj, &tj1, &result, _state);
11483  mannwhitneyu_ucheb(x, -5.360075e-05, &tj, &tj1, &result, _state);
11484  mannwhitneyu_ucheb(x, -1.260869e-05, &tj, &tj1, &result, _state);
11485  mannwhitneyu_ucheb(x, -3.033307e-06, &tj, &tj1, &result, _state);
11486  mannwhitneyu_ucheb(x, -7.727087e-07, &tj, &tj1, &result, _state);
11487  mannwhitneyu_ucheb(x, -3.393883e-07, &tj, &tj1, &result, _state);
11488  mannwhitneyu_ucheb(x, -2.242989e-07, &tj, &tj1, &result, _state);
11489  mannwhitneyu_ucheb(x, -1.111928e-07, &tj, &tj1, &result, _state);
11490  mannwhitneyu_ucheb(x, 3.898823e-09, &tj, &tj1, &result, _state);
11491  return result;
11492 }
11493 
11494 
11495 /*************************************************************************
11496 Tail(S, 12, 12)
11497 *************************************************************************/
11498 static double mannwhitneyu_utbln12n12(double s, ae_state *_state)
11499 {
11500  double x;
11501  double tj;
11502  double tj1;
11503  double result;
11504 
11505 
11506  result = 0;
11507  x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
11508  tj = 1;
11509  tj1 = x;
11510  mannwhitneyu_ucheb(x, -4.472616e+00, &tj, &tj1, &result, _state);
11511  mannwhitneyu_ucheb(x, -4.786627e+00, &tj, &tj1, &result, _state);
11512  mannwhitneyu_ucheb(x, -1.132099e+00, &tj, &tj1, &result, _state);
11513  mannwhitneyu_ucheb(x, -1.817523e-01, &tj, &tj1, &result, _state);
11514  mannwhitneyu_ucheb(x, -4.570179e-02, &tj, &tj1, &result, _state);
11515  mannwhitneyu_ucheb(x, -1.479511e-02, &tj, &tj1, &result, _state);
11516  mannwhitneyu_ucheb(x, -4.799492e-03, &tj, &tj1, &result, _state);
11517  mannwhitneyu_ucheb(x, -1.565350e-03, &tj, &tj1, &result, _state);
11518  mannwhitneyu_ucheb(x, -3.530139e-04, &tj, &tj1, &result, _state);
11519  mannwhitneyu_ucheb(x, 1.380132e-04, &tj, &tj1, &result, _state);
11520  mannwhitneyu_ucheb(x, 3.242761e-04, &tj, &tj1, &result, _state);
11521  mannwhitneyu_ucheb(x, 3.576269e-04, &tj, &tj1, &result, _state);
11522  mannwhitneyu_ucheb(x, 3.018771e-04, &tj, &tj1, &result, _state);
11523  mannwhitneyu_ucheb(x, 1.933911e-04, &tj, &tj1, &result, _state);
11524  mannwhitneyu_ucheb(x, 9.002799e-05, &tj, &tj1, &result, _state);
11525  mannwhitneyu_ucheb(x, -2.022048e-06, &tj, &tj1, &result, _state);
11526  return result;
11527 }
11528 
11529 
11530 /*************************************************************************
11531 Tail(S, 12, 13)
11532 *************************************************************************/
11533 static double mannwhitneyu_utbln12n13(double s, ae_state *_state)
11534 {
11535  double x;
11536  double tj;
11537  double tj1;
11538  double result;
11539 
11540 
11541  result = 0;
11542  x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
11543  tj = 1;
11544  tj1 = x;
11545  mannwhitneyu_ucheb(x, -4.454800e+00, &tj, &tj1, &result, _state);
11546  mannwhitneyu_ucheb(x, -4.750794e+00, &tj, &tj1, &result, _state);
11547  mannwhitneyu_ucheb(x, -1.105988e+00, &tj, &tj1, &result, _state);
11548  mannwhitneyu_ucheb(x, -1.684754e-01, &tj, &tj1, &result, _state);
11549  mannwhitneyu_ucheb(x, -4.011826e-02, &tj, &tj1, &result, _state);
11550  mannwhitneyu_ucheb(x, -1.262579e-02, &tj, &tj1, &result, _state);
11551  mannwhitneyu_ucheb(x, -4.044492e-03, &tj, &tj1, &result, _state);
11552  mannwhitneyu_ucheb(x, -1.478741e-03, &tj, &tj1, &result, _state);
11553  mannwhitneyu_ucheb(x, -5.322165e-04, &tj, &tj1, &result, _state);
11554  mannwhitneyu_ucheb(x, -1.621104e-04, &tj, &tj1, &result, _state);
11555  mannwhitneyu_ucheb(x, 4.068753e-05, &tj, &tj1, &result, _state);
11556  mannwhitneyu_ucheb(x, 1.468396e-04, &tj, &tj1, &result, _state);
11557  mannwhitneyu_ucheb(x, 2.056235e-04, &tj, &tj1, &result, _state);
11558  mannwhitneyu_ucheb(x, 2.327375e-04, &tj, &tj1, &result, _state);
11559  mannwhitneyu_ucheb(x, 1.914877e-04, &tj, &tj1, &result, _state);
11560  mannwhitneyu_ucheb(x, 1.784191e-04, &tj, &tj1, &result, _state);
11561  return result;
11562 }
11563 
11564 
11565 /*************************************************************************
11566 Tail(S, 12, 14)
11567 *************************************************************************/
11568 static double mannwhitneyu_utbln12n14(double s, ae_state *_state)
11569 {
11570  double x;
11571  double tj;
11572  double tj1;
11573  double result;
11574 
11575 
11576  result = 0;
11577  x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
11578  tj = 1;
11579  tj1 = x;
11580  mannwhitneyu_ucheb(x, -4.440910e+00, &tj, &tj1, &result, _state);
11581  mannwhitneyu_ucheb(x, -4.722404e+00, &tj, &tj1, &result, _state);
11582  mannwhitneyu_ucheb(x, -1.085254e+00, &tj, &tj1, &result, _state);
11583  mannwhitneyu_ucheb(x, -1.579439e-01, &tj, &tj1, &result, _state);
11584  mannwhitneyu_ucheb(x, -3.563738e-02, &tj, &tj1, &result, _state);
11585  mannwhitneyu_ucheb(x, -1.066730e-02, &tj, &tj1, &result, _state);
11586  mannwhitneyu_ucheb(x, -3.129346e-03, &tj, &tj1, &result, _state);
11587  mannwhitneyu_ucheb(x, -1.014531e-03, &tj, &tj1, &result, _state);
11588  mannwhitneyu_ucheb(x, -3.129679e-04, &tj, &tj1, &result, _state);
11589  mannwhitneyu_ucheb(x, -8.000909e-05, &tj, &tj1, &result, _state);
11590  mannwhitneyu_ucheb(x, 1.996174e-05, &tj, &tj1, &result, _state);
11591  mannwhitneyu_ucheb(x, 6.377924e-05, &tj, &tj1, &result, _state);
11592  mannwhitneyu_ucheb(x, 8.936304e-05, &tj, &tj1, &result, _state);
11593  mannwhitneyu_ucheb(x, 1.051098e-04, &tj, &tj1, &result, _state);
11594  mannwhitneyu_ucheb(x, 9.025820e-05, &tj, &tj1, &result, _state);
11595  mannwhitneyu_ucheb(x, 8.730585e-05, &tj, &tj1, &result, _state);
11596  return result;
11597 }
11598 
11599 
11600 /*************************************************************************
11601 Tail(S, 12, 15)
11602 *************************************************************************/
11603 static double mannwhitneyu_utbln12n15(double s, ae_state *_state)
11604 {
11605  double x;
11606  double tj;
11607  double tj1;
11608  double result;
11609 
11610 
11611  result = 0;
11612  x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
11613  tj = 1;
11614  tj1 = x;
11615  mannwhitneyu_ucheb(x, -4.430123e+00, &tj, &tj1, &result, _state);
11616  mannwhitneyu_ucheb(x, -4.700008e+00, &tj, &tj1, &result, _state);
11617  mannwhitneyu_ucheb(x, -1.068971e+00, &tj, &tj1, &result, _state);
11618  mannwhitneyu_ucheb(x, -1.499725e-01, &tj, &tj1, &result, _state);
11619  mannwhitneyu_ucheb(x, -3.250897e-02, &tj, &tj1, &result, _state);
11620  mannwhitneyu_ucheb(x, -9.473145e-03, &tj, &tj1, &result, _state);
11621  mannwhitneyu_ucheb(x, -2.680008e-03, &tj, &tj1, &result, _state);
11622  mannwhitneyu_ucheb(x, -8.483350e-04, &tj, &tj1, &result, _state);
11623  mannwhitneyu_ucheb(x, -2.766992e-04, &tj, &tj1, &result, _state);
11624  mannwhitneyu_ucheb(x, -9.891081e-05, &tj, &tj1, &result, _state);
11625  mannwhitneyu_ucheb(x, -4.015140e-05, &tj, &tj1, &result, _state);
11626  mannwhitneyu_ucheb(x, -1.977756e-05, &tj, &tj1, &result, _state);
11627  mannwhitneyu_ucheb(x, -8.707414e-06, &tj, &tj1, &result, _state);
11628  mannwhitneyu_ucheb(x, 1.114786e-06, &tj, &tj1, &result, _state);
11629  mannwhitneyu_ucheb(x, 6.238865e-06, &tj, &tj1, &result, _state);
11630  mannwhitneyu_ucheb(x, 1.381445e-05, &tj, &tj1, &result, _state);
11631  return result;
11632 }
11633 
11634 
11635 /*************************************************************************
11636 Tail(S, 12, 30)
11637 *************************************************************************/
11638 static double mannwhitneyu_utbln12n30(double s, ae_state *_state)
11639 {
11640  double x;
11641  double tj;
11642  double tj1;
11643  double result;
11644 
11645 
11646  result = 0;
11647  x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
11648  tj = 1;
11649  tj1 = x;
11650  mannwhitneyu_ucheb(x, -4.380023e+00, &tj, &tj1, &result, _state);
11651  mannwhitneyu_ucheb(x, -4.585782e+00, &tj, &tj1, &result, _state);
11652  mannwhitneyu_ucheb(x, -9.838583e-01, &tj, &tj1, &result, _state);
11653  mannwhitneyu_ucheb(x, -1.103394e-01, &tj, &tj1, &result, _state);
11654  mannwhitneyu_ucheb(x, -1.834015e-02, &tj, &tj1, &result, _state);
11655  mannwhitneyu_ucheb(x, -4.635212e-03, &tj, &tj1, &result, _state);
11656  mannwhitneyu_ucheb(x, -9.948212e-04, &tj, &tj1, &result, _state);
11657  mannwhitneyu_ucheb(x, -2.574169e-04, &tj, &tj1, &result, _state);
11658  mannwhitneyu_ucheb(x, -6.747980e-05, &tj, &tj1, &result, _state);
11659  mannwhitneyu_ucheb(x, -1.833672e-05, &tj, &tj1, &result, _state);
11660  mannwhitneyu_ucheb(x, -5.722433e-06, &tj, &tj1, &result, _state);
11661  mannwhitneyu_ucheb(x, -2.181038e-06, &tj, &tj1, &result, _state);
11662  mannwhitneyu_ucheb(x, -1.206473e-06, &tj, &tj1, &result, _state);
11663  mannwhitneyu_ucheb(x, -9.716003e-07, &tj, &tj1, &result, _state);
11664  mannwhitneyu_ucheb(x, -7.476434e-07, &tj, &tj1, &result, _state);
11665  mannwhitneyu_ucheb(x, -7.217700e-07, &tj, &tj1, &result, _state);
11666  return result;
11667 }
11668 
11669 
11670 /*************************************************************************
11671 Tail(S, 12, 100)
11672 *************************************************************************/
11673 static double mannwhitneyu_utbln12n100(double s, ae_state *_state)
11674 {
11675  double x;
11676  double tj;
11677  double tj1;
11678  double result;
11679 
11680 
11681  result = 0;
11682  x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
11683  tj = 1;
11684  tj1 = x;
11685  mannwhitneyu_ucheb(x, -4.374567e+00, &tj, &tj1, &result, _state);
11686  mannwhitneyu_ucheb(x, -4.553481e+00, &tj, &tj1, &result, _state);
11687  mannwhitneyu_ucheb(x, -9.541334e-01, &tj, &tj1, &result, _state);
11688  mannwhitneyu_ucheb(x, -9.701907e-02, &tj, &tj1, &result, _state);
11689  mannwhitneyu_ucheb(x, -1.414757e-02, &tj, &tj1, &result, _state);
11690  mannwhitneyu_ucheb(x, -3.404103e-03, &tj, &tj1, &result, _state);
11691  mannwhitneyu_ucheb(x, -6.234388e-04, &tj, &tj1, &result, _state);
11692  mannwhitneyu_ucheb(x, -1.453762e-04, &tj, &tj1, &result, _state);
11693  mannwhitneyu_ucheb(x, -3.311060e-05, &tj, &tj1, &result, _state);
11694  mannwhitneyu_ucheb(x, -7.317501e-06, &tj, &tj1, &result, _state);
11695  mannwhitneyu_ucheb(x, -1.713888e-06, &tj, &tj1, &result, _state);
11696  mannwhitneyu_ucheb(x, -3.309583e-07, &tj, &tj1, &result, _state);
11697  mannwhitneyu_ucheb(x, -4.019804e-08, &tj, &tj1, &result, _state);
11698  mannwhitneyu_ucheb(x, 1.224829e-09, &tj, &tj1, &result, _state);
11699  mannwhitneyu_ucheb(x, -1.349019e-08, &tj, &tj1, &result, _state);
11700  mannwhitneyu_ucheb(x, -1.893302e-08, &tj, &tj1, &result, _state);
11701  return result;
11702 }
11703 
11704 
11705 /*************************************************************************
11706 Tail(S, 13, 13)
11707 *************************************************************************/
11708 static double mannwhitneyu_utbln13n13(double s, ae_state *_state)
11709 {
11710  double x;
11711  double tj;
11712  double tj1;
11713  double result;
11714 
11715 
11716  result = 0;
11717  x = ae_minreal(2*(s-0.000000e+00)/3.750000e+00-1, 1.0, _state);
11718  tj = 1;
11719  tj1 = x;
11720  mannwhitneyu_ucheb(x, -4.541046e+00, &tj, &tj1, &result, _state);
11721  mannwhitneyu_ucheb(x, -4.859047e+00, &tj, &tj1, &result, _state);
11722  mannwhitneyu_ucheb(x, -1.130164e+00, &tj, &tj1, &result, _state);
11723  mannwhitneyu_ucheb(x, -1.689719e-01, &tj, &tj1, &result, _state);
11724  mannwhitneyu_ucheb(x, -3.950693e-02, &tj, &tj1, &result, _state);
11725  mannwhitneyu_ucheb(x, -1.231455e-02, &tj, &tj1, &result, _state);
11726  mannwhitneyu_ucheb(x, -3.976550e-03, &tj, &tj1, &result, _state);
11727  mannwhitneyu_ucheb(x, -1.538455e-03, &tj, &tj1, &result, _state);
11728  mannwhitneyu_ucheb(x, -7.245603e-04, &tj, &tj1, &result, _state);
11729  mannwhitneyu_ucheb(x, -4.142647e-04, &tj, &tj1, &result, _state);
11730  mannwhitneyu_ucheb(x, -2.831434e-04, &tj, &tj1, &result, _state);
11731  mannwhitneyu_ucheb(x, -2.032483e-04, &tj, &tj1, &result, _state);
11732  mannwhitneyu_ucheb(x, -1.488405e-04, &tj, &tj1, &result, _state);
11733  mannwhitneyu_ucheb(x, -1.156927e-04, &tj, &tj1, &result, _state);
11734  mannwhitneyu_ucheb(x, -7.949279e-05, &tj, &tj1, &result, _state);
11735  mannwhitneyu_ucheb(x, -7.532700e-05, &tj, &tj1, &result, _state);
11736  return result;
11737 }
11738 
11739 
11740 /*************************************************************************
11741 Tail(S, 13, 14)
11742 *************************************************************************/
11743 static double mannwhitneyu_utbln13n14(double s, ae_state *_state)
11744 {
11745  double x;
11746  double tj;
11747  double tj1;
11748  double result;
11749 
11750 
11751  result = 0;
11752  x = ae_minreal(2*(s-0.000000e+00)/3.750000e+00-1, 1.0, _state);
11753  tj = 1;
11754  tj1 = x;
11755  mannwhitneyu_ucheb(x, -4.525655e+00, &tj, &tj1, &result, _state);
11756  mannwhitneyu_ucheb(x, -4.828341e+00, &tj, &tj1, &result, _state);
11757  mannwhitneyu_ucheb(x, -1.108110e+00, &tj, &tj1, &result, _state);
11758  mannwhitneyu_ucheb(x, -1.579552e-01, &tj, &tj1, &result, _state);
11759  mannwhitneyu_ucheb(x, -3.488307e-02, &tj, &tj1, &result, _state);
11760  mannwhitneyu_ucheb(x, -1.032328e-02, &tj, &tj1, &result, _state);
11761  mannwhitneyu_ucheb(x, -2.988741e-03, &tj, &tj1, &result, _state);
11762  mannwhitneyu_ucheb(x, -9.766394e-04, &tj, &tj1, &result, _state);
11763  mannwhitneyu_ucheb(x, -3.388950e-04, &tj, &tj1, &result, _state);
11764  mannwhitneyu_ucheb(x, -1.338179e-04, &tj, &tj1, &result, _state);
11765  mannwhitneyu_ucheb(x, -6.133440e-05, &tj, &tj1, &result, _state);
11766  mannwhitneyu_ucheb(x, -3.023518e-05, &tj, &tj1, &result, _state);
11767  mannwhitneyu_ucheb(x, -1.110570e-05, &tj, &tj1, &result, _state);
11768  mannwhitneyu_ucheb(x, 4.202332e-06, &tj, &tj1, &result, _state);
11769  mannwhitneyu_ucheb(x, 1.056132e-05, &tj, &tj1, &result, _state);
11770  mannwhitneyu_ucheb(x, 1.536323e-05, &tj, &tj1, &result, _state);
11771  return result;
11772 }
11773 
11774 
11775 /*************************************************************************
11776 Tail(S, 13, 15)
11777 *************************************************************************/
11778 static double mannwhitneyu_utbln13n15(double s, ae_state *_state)
11779 {
11780  double x;
11781  double tj;
11782  double tj1;
11783  double result;
11784 
11785 
11786  result = 0;
11787  x = ae_minreal(2*(s-0.000000e+00)/3.750000e+00-1, 1.0, _state);
11788  tj = 1;
11789  tj1 = x;
11790  mannwhitneyu_ucheb(x, -4.513585e+00, &tj, &tj1, &result, _state);
11791  mannwhitneyu_ucheb(x, -4.803952e+00, &tj, &tj1, &result, _state);
11792  mannwhitneyu_ucheb(x, -1.090686e+00, &tj, &tj1, &result, _state);
11793  mannwhitneyu_ucheb(x, -1.495310e-01, &tj, &tj1, &result, _state);
11794  mannwhitneyu_ucheb(x, -3.160314e-02, &tj, &tj1, &result, _state);
11795  mannwhitneyu_ucheb(x, -9.073124e-03, &tj, &tj1, &result, _state);
11796  mannwhitneyu_ucheb(x, -2.480313e-03, &tj, &tj1, &result, _state);
11797  mannwhitneyu_ucheb(x, -7.478239e-04, &tj, &tj1, &result, _state);
11798  mannwhitneyu_ucheb(x, -2.140914e-04, &tj, &tj1, &result, _state);
11799  mannwhitneyu_ucheb(x, -5.311541e-05, &tj, &tj1, &result, _state);
11800  mannwhitneyu_ucheb(x, -2.677105e-06, &tj, &tj1, &result, _state);
11801  mannwhitneyu_ucheb(x, 1.115464e-05, &tj, &tj1, &result, _state);
11802  mannwhitneyu_ucheb(x, 1.578563e-05, &tj, &tj1, &result, _state);
11803  mannwhitneyu_ucheb(x, 2.044604e-05, &tj, &tj1, &result, _state);
11804  mannwhitneyu_ucheb(x, 1.888939e-05, &tj, &tj1, &result, _state);
11805  mannwhitneyu_ucheb(x, 2.395644e-05, &tj, &tj1, &result, _state);
11806  return result;
11807 }
11808 
11809 
11810 /*************************************************************************
11811 Tail(S, 13, 30)
11812 *************************************************************************/
11813 static double mannwhitneyu_utbln13n30(double s, ae_state *_state)
11814 {
11815  double x;
11816  double tj;
11817  double tj1;
11818  double result;
11819 
11820 
11821  result = 0;
11822  x = ae_minreal(2*(s-0.000000e+00)/3.750000e+00-1, 1.0, _state);
11823  tj = 1;
11824  tj1 = x;
11825  mannwhitneyu_ucheb(x, -4.455999e+00, &tj, &tj1, &result, _state);
11826  mannwhitneyu_ucheb(x, -4.678434e+00, &tj, &tj1, &result, _state);
11827  mannwhitneyu_ucheb(x, -9.995491e-01, &tj, &tj1, &result, _state);
11828  mannwhitneyu_ucheb(x, -1.078100e-01, &tj, &tj1, &result, _state);
11829  mannwhitneyu_ucheb(x, -1.705220e-02, &tj, &tj1, &result, _state);
11830  mannwhitneyu_ucheb(x, -4.258739e-03, &tj, &tj1, &result, _state);
11831  mannwhitneyu_ucheb(x, -8.671526e-04, &tj, &tj1, &result, _state);
11832  mannwhitneyu_ucheb(x, -2.185458e-04, &tj, &tj1, &result, _state);
11833  mannwhitneyu_ucheb(x, -5.507764e-05, &tj, &tj1, &result, _state);
11834  mannwhitneyu_ucheb(x, -1.411446e-05, &tj, &tj1, &result, _state);
11835  mannwhitneyu_ucheb(x, -4.044355e-06, &tj, &tj1, &result, _state);
11836  mannwhitneyu_ucheb(x, -1.285765e-06, &tj, &tj1, &result, _state);
11837  mannwhitneyu_ucheb(x, -5.345282e-07, &tj, &tj1, &result, _state);
11838  mannwhitneyu_ucheb(x, -3.066940e-07, &tj, &tj1, &result, _state);
11839  mannwhitneyu_ucheb(x, -1.962037e-07, &tj, &tj1, &result, _state);
11840  mannwhitneyu_ucheb(x, -1.723644e-07, &tj, &tj1, &result, _state);
11841  return result;
11842 }
11843 
11844 
11845 /*************************************************************************
11846 Tail(S, 13, 100)
11847 *************************************************************************/
11848 static double mannwhitneyu_utbln13n100(double s, ae_state *_state)
11849 {
11850  double x;
11851  double tj;
11852  double tj1;
11853  double result;
11854 
11855 
11856  result = 0;
11857  x = ae_minreal(2*(s-0.000000e+00)/3.750000e+00-1, 1.0, _state);
11858  tj = 1;
11859  tj1 = x;
11860  mannwhitneyu_ucheb(x, -4.446787e+00, &tj, &tj1, &result, _state);
11861  mannwhitneyu_ucheb(x, -4.640804e+00, &tj, &tj1, &result, _state);
11862  mannwhitneyu_ucheb(x, -9.671552e-01, &tj, &tj1, &result, _state);
11863  mannwhitneyu_ucheb(x, -9.364990e-02, &tj, &tj1, &result, _state);
11864  mannwhitneyu_ucheb(x, -1.274444e-02, &tj, &tj1, &result, _state);
11865  mannwhitneyu_ucheb(x, -3.047440e-03, &tj, &tj1, &result, _state);
11866  mannwhitneyu_ucheb(x, -5.161439e-04, &tj, &tj1, &result, _state);
11867  mannwhitneyu_ucheb(x, -1.171729e-04, &tj, &tj1, &result, _state);
11868  mannwhitneyu_ucheb(x, -2.562171e-05, &tj, &tj1, &result, _state);
11869  mannwhitneyu_ucheb(x, -5.359762e-06, &tj, &tj1, &result, _state);
11870  mannwhitneyu_ucheb(x, -1.275494e-06, &tj, &tj1, &result, _state);
11871  mannwhitneyu_ucheb(x, -2.747635e-07, &tj, &tj1, &result, _state);
11872  mannwhitneyu_ucheb(x, -5.700292e-08, &tj, &tj1, &result, _state);
11873  mannwhitneyu_ucheb(x, -2.565559e-09, &tj, &tj1, &result, _state);
11874  mannwhitneyu_ucheb(x, 5.005396e-09, &tj, &tj1, &result, _state);
11875  mannwhitneyu_ucheb(x, 3.335794e-09, &tj, &tj1, &result, _state);
11876  return result;
11877 }
11878 
11879 
11880 /*************************************************************************
11881 Tail(S, 14, 14)
11882 *************************************************************************/
11883 static double mannwhitneyu_utbln14n14(double s, ae_state *_state)
11884 {
11885  double x;
11886  double tj;
11887  double tj1;
11888  double result;
11889 
11890 
11891  result = 0;
11892  x = ae_minreal(2*(s-0.000000e+00)/3.750000e+00-1, 1.0, _state);
11893  tj = 1;
11894  tj1 = x;
11895  mannwhitneyu_ucheb(x, -4.510624e+00, &tj, &tj1, &result, _state);
11896  mannwhitneyu_ucheb(x, -4.798584e+00, &tj, &tj1, &result, _state);
11897  mannwhitneyu_ucheb(x, -1.087107e+00, &tj, &tj1, &result, _state);
11898  mannwhitneyu_ucheb(x, -1.478532e-01, &tj, &tj1, &result, _state);
11899  mannwhitneyu_ucheb(x, -3.098050e-02, &tj, &tj1, &result, _state);
11900  mannwhitneyu_ucheb(x, -8.855986e-03, &tj, &tj1, &result, _state);
11901  mannwhitneyu_ucheb(x, -2.409083e-03, &tj, &tj1, &result, _state);
11902  mannwhitneyu_ucheb(x, -7.299536e-04, &tj, &tj1, &result, _state);
11903  mannwhitneyu_ucheb(x, -2.176177e-04, &tj, &tj1, &result, _state);
11904  mannwhitneyu_ucheb(x, -6.479417e-05, &tj, &tj1, &result, _state);
11905  mannwhitneyu_ucheb(x, -1.812761e-05, &tj, &tj1, &result, _state);
11906  mannwhitneyu_ucheb(x, -5.225872e-06, &tj, &tj1, &result, _state);
11907  mannwhitneyu_ucheb(x, 4.516521e-07, &tj, &tj1, &result, _state);
11908  mannwhitneyu_ucheb(x, 6.730551e-06, &tj, &tj1, &result, _state);
11909  mannwhitneyu_ucheb(x, 9.237563e-06, &tj, &tj1, &result, _state);
11910  mannwhitneyu_ucheb(x, 1.611820e-05, &tj, &tj1, &result, _state);
11911  return result;
11912 }
11913 
11914 
11915 /*************************************************************************
11916 Tail(S, 14, 15)
11917 *************************************************************************/
11918 static double mannwhitneyu_utbln14n15(double s, ae_state *_state)
11919 {
11920  double x;
11921  double tj;
11922  double tj1;
11923  double result;
11924 
11925 
11926  result = 0;
11927  x = ae_minreal(2*(s-0.000000e+00)/3.750000e+00-1, 1.0, _state);
11928  tj = 1;
11929  tj1 = x;
11930  mannwhitneyu_ucheb(x, -4.498681e+00, &tj, &tj1, &result, _state);
11931  mannwhitneyu_ucheb(x, -4.774668e+00, &tj, &tj1, &result, _state);
11932  mannwhitneyu_ucheb(x, -1.070267e+00, &tj, &tj1, &result, _state);
11933  mannwhitneyu_ucheb(x, -1.399348e-01, &tj, &tj1, &result, _state);
11934  mannwhitneyu_ucheb(x, -2.807239e-02, &tj, &tj1, &result, _state);
11935  mannwhitneyu_ucheb(x, -7.845763e-03, &tj, &tj1, &result, _state);
11936  mannwhitneyu_ucheb(x, -2.071773e-03, &tj, &tj1, &result, _state);
11937  mannwhitneyu_ucheb(x, -6.261698e-04, &tj, &tj1, &result, _state);
11938  mannwhitneyu_ucheb(x, -2.011695e-04, &tj, &tj1, &result, _state);
11939  mannwhitneyu_ucheb(x, -7.305946e-05, &tj, &tj1, &result, _state);
11940  mannwhitneyu_ucheb(x, -3.879295e-05, &tj, &tj1, &result, _state);
11941  mannwhitneyu_ucheb(x, -2.999439e-05, &tj, &tj1, &result, _state);
11942  mannwhitneyu_ucheb(x, -2.904438e-05, &tj, &tj1, &result, _state);
11943  mannwhitneyu_ucheb(x, -2.944986e-05, &tj, &tj1, &result, _state);
11944  mannwhitneyu_ucheb(x, -2.373908e-05, &tj, &tj1, &result, _state);
11945  mannwhitneyu_ucheb(x, -2.140794e-05, &tj, &tj1, &result, _state);
11946  return result;
11947 }
11948 
11949 
11950 /*************************************************************************
11951 Tail(S, 14, 30)
11952 *************************************************************************/
11953 static double mannwhitneyu_utbln14n30(double s, ae_state *_state)
11954 {
11955  double x;
11956  double tj;
11957  double tj1;
11958  double result;
11959 
11960 
11961  result = 0;
11962  x = ae_minreal(2*(s-0.000000e+00)/3.750000e+00-1, 1.0, _state);
11963  tj = 1;
11964  tj1 = x;
11965  mannwhitneyu_ucheb(x, -4.440378e+00, &tj, &tj1, &result, _state);
11966  mannwhitneyu_ucheb(x, -4.649587e+00, &tj, &tj1, &result, _state);
11967  mannwhitneyu_ucheb(x, -9.807829e-01, &tj, &tj1, &result, _state);
11968  mannwhitneyu_ucheb(x, -9.989753e-02, &tj, &tj1, &result, _state);
11969  mannwhitneyu_ucheb(x, -1.463646e-02, &tj, &tj1, &result, _state);
11970  mannwhitneyu_ucheb(x, -3.586580e-03, &tj, &tj1, &result, _state);
11971  mannwhitneyu_ucheb(x, -6.745917e-04, &tj, &tj1, &result, _state);
11972  mannwhitneyu_ucheb(x, -1.635398e-04, &tj, &tj1, &result, _state);
11973  mannwhitneyu_ucheb(x, -3.923172e-05, &tj, &tj1, &result, _state);
11974  mannwhitneyu_ucheb(x, -9.446699e-06, &tj, &tj1, &result, _state);
11975  mannwhitneyu_ucheb(x, -2.613892e-06, &tj, &tj1, &result, _state);
11976  mannwhitneyu_ucheb(x, -8.214073e-07, &tj, &tj1, &result, _state);
11977  mannwhitneyu_ucheb(x, -3.651683e-07, &tj, &tj1, &result, _state);
11978  mannwhitneyu_ucheb(x, -2.272777e-07, &tj, &tj1, &result, _state);
11979  mannwhitneyu_ucheb(x, -1.464988e-07, &tj, &tj1, &result, _state);
11980  mannwhitneyu_ucheb(x, -1.109803e-07, &tj, &tj1, &result, _state);
11981  return result;
11982 }
11983 
11984 
11985 /*************************************************************************
11986 Tail(S, 14, 100)
11987 *************************************************************************/
11988 static double mannwhitneyu_utbln14n100(double s, ae_state *_state)
11989 {
11990  double x;
11991  double tj;
11992  double tj1;
11993  double result;
11994 
11995 
11996  result = 0;
11997  x = ae_minreal(2*(s-0.000000e+00)/3.750000e+00-1, 1.0, _state);
11998  tj = 1;
11999  tj1 = x;
12000  mannwhitneyu_ucheb(x, -4.429701e+00, &tj, &tj1, &result, _state);
12001  mannwhitneyu_ucheb(x, -4.610577e+00, &tj, &tj1, &result, _state);
12002  mannwhitneyu_ucheb(x, -9.482675e-01, &tj, &tj1, &result, _state);
12003  mannwhitneyu_ucheb(x, -8.605550e-02, &tj, &tj1, &result, _state);
12004  mannwhitneyu_ucheb(x, -1.062151e-02, &tj, &tj1, &result, _state);
12005  mannwhitneyu_ucheb(x, -2.525154e-03, &tj, &tj1, &result, _state);
12006  mannwhitneyu_ucheb(x, -3.835983e-04, &tj, &tj1, &result, _state);
12007  mannwhitneyu_ucheb(x, -8.411440e-05, &tj, &tj1, &result, _state);
12008  mannwhitneyu_ucheb(x, -1.744901e-05, &tj, &tj1, &result, _state);
12009  mannwhitneyu_ucheb(x, -3.318850e-06, &tj, &tj1, &result, _state);
12010  mannwhitneyu_ucheb(x, -7.692100e-07, &tj, &tj1, &result, _state);
12011  mannwhitneyu_ucheb(x, -1.536270e-07, &tj, &tj1, &result, _state);
12012  mannwhitneyu_ucheb(x, -3.705888e-08, &tj, &tj1, &result, _state);
12013  mannwhitneyu_ucheb(x, -7.999599e-09, &tj, &tj1, &result, _state);
12014  mannwhitneyu_ucheb(x, -2.908395e-09, &tj, &tj1, &result, _state);
12015  mannwhitneyu_ucheb(x, 1.546923e-09, &tj, &tj1, &result, _state);
12016  return result;
12017 }
12018 
12019 
12020 /*************************************************************************
12021 Tail(S, N1, N2)
12022 *************************************************************************/
12023 static double mannwhitneyu_usigma(double s,
12024  ae_int_t n1,
12025  ae_int_t n2,
12026  ae_state *_state)
12027 {
12028  double f0;
12029  double f1;
12030  double f2;
12031  double f3;
12032  double f4;
12033  double s0;
12034  double s1;
12035  double s2;
12036  double s3;
12037  double s4;
12038  double result;
12039 
12040 
12041  result = 0;
12042 
12043  /*
12044  * N1=5, N2 = 5, 6, 7, ...
12045  */
12046  if( ae_minint(n1, n2, _state)==5 )
12047  {
12048  if( ae_maxint(n1, n2, _state)==5 )
12049  {
12050  result = mannwhitneyu_utbln5n5(s, _state);
12051  }
12052  if( ae_maxint(n1, n2, _state)==6 )
12053  {
12054  result = mannwhitneyu_utbln5n6(s, _state);
12055  }
12056  if( ae_maxint(n1, n2, _state)==7 )
12057  {
12058  result = mannwhitneyu_utbln5n7(s, _state);
12059  }
12060  if( ae_maxint(n1, n2, _state)==8 )
12061  {
12062  result = mannwhitneyu_utbln5n8(s, _state);
12063  }
12064  if( ae_maxint(n1, n2, _state)==9 )
12065  {
12066  result = mannwhitneyu_utbln5n9(s, _state);
12067  }
12068  if( ae_maxint(n1, n2, _state)==10 )
12069  {
12070  result = mannwhitneyu_utbln5n10(s, _state);
12071  }
12072  if( ae_maxint(n1, n2, _state)==11 )
12073  {
12074  result = mannwhitneyu_utbln5n11(s, _state);
12075  }
12076  if( ae_maxint(n1, n2, _state)==12 )
12077  {
12078  result = mannwhitneyu_utbln5n12(s, _state);
12079  }
12080  if( ae_maxint(n1, n2, _state)==13 )
12081  {
12082  result = mannwhitneyu_utbln5n13(s, _state);
12083  }
12084  if( ae_maxint(n1, n2, _state)==14 )
12085  {
12086  result = mannwhitneyu_utbln5n14(s, _state);
12087  }
12088  if( ae_maxint(n1, n2, _state)==15 )
12089  {
12090  result = mannwhitneyu_utbln5n15(s, _state);
12091  }
12092  if( ae_maxint(n1, n2, _state)==16 )
12093  {
12094  result = mannwhitneyu_utbln5n16(s, _state);
12095  }
12096  if( ae_maxint(n1, n2, _state)==17 )
12097  {
12098  result = mannwhitneyu_utbln5n17(s, _state);
12099  }
12100  if( ae_maxint(n1, n2, _state)==18 )
12101  {
12102  result = mannwhitneyu_utbln5n18(s, _state);
12103  }
12104  if( ae_maxint(n1, n2, _state)==19 )
12105  {
12106  result = mannwhitneyu_utbln5n19(s, _state);
12107  }
12108  if( ae_maxint(n1, n2, _state)==20 )
12109  {
12110  result = mannwhitneyu_utbln5n20(s, _state);
12111  }
12112  if( ae_maxint(n1, n2, _state)==21 )
12113  {
12114  result = mannwhitneyu_utbln5n21(s, _state);
12115  }
12116  if( ae_maxint(n1, n2, _state)==22 )
12117  {
12118  result = mannwhitneyu_utbln5n22(s, _state);
12119  }
12120  if( ae_maxint(n1, n2, _state)==23 )
12121  {
12122  result = mannwhitneyu_utbln5n23(s, _state);
12123  }
12124  if( ae_maxint(n1, n2, _state)==24 )
12125  {
12126  result = mannwhitneyu_utbln5n24(s, _state);
12127  }
12128  if( ae_maxint(n1, n2, _state)==25 )
12129  {
12130  result = mannwhitneyu_utbln5n25(s, _state);
12131  }
12132  if( ae_maxint(n1, n2, _state)==26 )
12133  {
12134  result = mannwhitneyu_utbln5n26(s, _state);
12135  }
12136  if( ae_maxint(n1, n2, _state)==27 )
12137  {
12138  result = mannwhitneyu_utbln5n27(s, _state);
12139  }
12140  if( ae_maxint(n1, n2, _state)==28 )
12141  {
12142  result = mannwhitneyu_utbln5n28(s, _state);
12143  }
12144  if( ae_maxint(n1, n2, _state)==29 )
12145  {
12146  result = mannwhitneyu_utbln5n29(s, _state);
12147  }
12148  if( ae_maxint(n1, n2, _state)>29 )
12149  {
12150  f0 = mannwhitneyu_utbln5n15(s, _state);
12151  f1 = mannwhitneyu_utbln5n30(s, _state);
12152  f2 = mannwhitneyu_utbln5n100(s, _state);
12153  result = mannwhitneyu_uninterpolate(f0, f1, f2, ae_maxint(n1, n2, _state), _state);
12154  }
12155  return result;
12156  }
12157 
12158  /*
12159  * N1=6, N2 = 6, 7, 8, ...
12160  */
12161  if( ae_minint(n1, n2, _state)==6 )
12162  {
12163  if( ae_maxint(n1, n2, _state)==6 )
12164  {
12165  result = mannwhitneyu_utbln6n6(s, _state);
12166  }
12167  if( ae_maxint(n1, n2, _state)==7 )
12168  {
12169  result = mannwhitneyu_utbln6n7(s, _state);
12170  }
12171  if( ae_maxint(n1, n2, _state)==8 )
12172  {
12173  result = mannwhitneyu_utbln6n8(s, _state);
12174  }
12175  if( ae_maxint(n1, n2, _state)==9 )
12176  {
12177  result = mannwhitneyu_utbln6n9(s, _state);
12178  }
12179  if( ae_maxint(n1, n2, _state)==10 )
12180  {
12181  result = mannwhitneyu_utbln6n10(s, _state);
12182  }
12183  if( ae_maxint(n1, n2, _state)==11 )
12184  {
12185  result = mannwhitneyu_utbln6n11(s, _state);
12186  }
12187  if( ae_maxint(n1, n2, _state)==12 )
12188  {
12189  result = mannwhitneyu_utbln6n12(s, _state);
12190  }
12191  if( ae_maxint(n1, n2, _state)==13 )
12192  {
12193  result = mannwhitneyu_utbln6n13(s, _state);
12194  }
12195  if( ae_maxint(n1, n2, _state)==14 )
12196  {
12197  result = mannwhitneyu_utbln6n14(s, _state);
12198  }
12199  if( ae_maxint(n1, n2, _state)==15 )
12200  {
12201  result = mannwhitneyu_utbln6n15(s, _state);
12202  }
12203  if( ae_maxint(n1, n2, _state)>15 )
12204  {
12205  f0 = mannwhitneyu_utbln6n15(s, _state);
12206  f1 = mannwhitneyu_utbln6n30(s, _state);
12207  f2 = mannwhitneyu_utbln6n100(s, _state);
12208  result = mannwhitneyu_uninterpolate(f0, f1, f2, ae_maxint(n1, n2, _state), _state);
12209  }
12210  return result;
12211  }
12212 
12213  /*
12214  * N1=7, N2 = 7, 8, ...
12215  */
12216  if( ae_minint(n1, n2, _state)==7 )
12217  {
12218  if( ae_maxint(n1, n2, _state)==7 )
12219  {
12220  result = mannwhitneyu_utbln7n7(s, _state);
12221  }
12222  if( ae_maxint(n1, n2, _state)==8 )
12223  {
12224  result = mannwhitneyu_utbln7n8(s, _state);
12225  }
12226  if( ae_maxint(n1, n2, _state)==9 )
12227  {
12228  result = mannwhitneyu_utbln7n9(s, _state);
12229  }
12230  if( ae_maxint(n1, n2, _state)==10 )
12231  {
12232  result = mannwhitneyu_utbln7n10(s, _state);
12233  }
12234  if( ae_maxint(n1, n2, _state)==11 )
12235  {
12236  result = mannwhitneyu_utbln7n11(s, _state);
12237  }
12238  if( ae_maxint(n1, n2, _state)==12 )
12239  {
12240  result = mannwhitneyu_utbln7n12(s, _state);
12241  }
12242  if( ae_maxint(n1, n2, _state)==13 )
12243  {
12244  result = mannwhitneyu_utbln7n13(s, _state);
12245  }
12246  if( ae_maxint(n1, n2, _state)==14 )
12247  {
12248  result = mannwhitneyu_utbln7n14(s, _state);
12249  }
12250  if( ae_maxint(n1, n2, _state)==15 )
12251  {
12252  result = mannwhitneyu_utbln7n15(s, _state);
12253  }
12254  if( ae_maxint(n1, n2, _state)>15 )
12255  {
12256  f0 = mannwhitneyu_utbln7n15(s, _state);
12257  f1 = mannwhitneyu_utbln7n30(s, _state);
12258  f2 = mannwhitneyu_utbln7n100(s, _state);
12259  result = mannwhitneyu_uninterpolate(f0, f1, f2, ae_maxint(n1, n2, _state), _state);
12260  }
12261  return result;
12262  }
12263 
12264  /*
12265  * N1=8, N2 = 8, 9, 10, ...
12266  */
12267  if( ae_minint(n1, n2, _state)==8 )
12268  {
12269  if( ae_maxint(n1, n2, _state)==8 )
12270  {
12271  result = mannwhitneyu_utbln8n8(s, _state);
12272  }
12273  if( ae_maxint(n1, n2, _state)==9 )
12274  {
12275  result = mannwhitneyu_utbln8n9(s, _state);
12276  }
12277  if( ae_maxint(n1, n2, _state)==10 )
12278  {
12279  result = mannwhitneyu_utbln8n10(s, _state);
12280  }
12281  if( ae_maxint(n1, n2, _state)==11 )
12282  {
12283  result = mannwhitneyu_utbln8n11(s, _state);
12284  }
12285  if( ae_maxint(n1, n2, _state)==12 )
12286  {
12287  result = mannwhitneyu_utbln8n12(s, _state);
12288  }
12289  if( ae_maxint(n1, n2, _state)==13 )
12290  {
12291  result = mannwhitneyu_utbln8n13(s, _state);
12292  }
12293  if( ae_maxint(n1, n2, _state)==14 )
12294  {
12295  result = mannwhitneyu_utbln8n14(s, _state);
12296  }
12297  if( ae_maxint(n1, n2, _state)==15 )
12298  {
12299  result = mannwhitneyu_utbln8n15(s, _state);
12300  }
12301  if( ae_maxint(n1, n2, _state)>15 )
12302  {
12303  f0 = mannwhitneyu_utbln8n15(s, _state);
12304  f1 = mannwhitneyu_utbln8n30(s, _state);
12305  f2 = mannwhitneyu_utbln8n100(s, _state);
12306  result = mannwhitneyu_uninterpolate(f0, f1, f2, ae_maxint(n1, n2, _state), _state);
12307  }
12308  return result;
12309  }
12310 
12311  /*
12312  * N1=9, N2 = 9, 10, ...
12313  */
12314  if( ae_minint(n1, n2, _state)==9 )
12315  {
12316  if( ae_maxint(n1, n2, _state)==9 )
12317  {
12318  result = mannwhitneyu_utbln9n9(s, _state);
12319  }
12320  if( ae_maxint(n1, n2, _state)==10 )
12321  {
12322  result = mannwhitneyu_utbln9n10(s, _state);
12323  }
12324  if( ae_maxint(n1, n2, _state)==11 )
12325  {
12326  result = mannwhitneyu_utbln9n11(s, _state);
12327  }
12328  if( ae_maxint(n1, n2, _state)==12 )
12329  {
12330  result = mannwhitneyu_utbln9n12(s, _state);
12331  }
12332  if( ae_maxint(n1, n2, _state)==13 )
12333  {
12334  result = mannwhitneyu_utbln9n13(s, _state);
12335  }
12336  if( ae_maxint(n1, n2, _state)==14 )
12337  {
12338  result = mannwhitneyu_utbln9n14(s, _state);
12339  }
12340  if( ae_maxint(n1, n2, _state)==15 )
12341  {
12342  result = mannwhitneyu_utbln9n15(s, _state);
12343  }
12344  if( ae_maxint(n1, n2, _state)>15 )
12345  {
12346  f0 = mannwhitneyu_utbln9n15(s, _state);
12347  f1 = mannwhitneyu_utbln9n30(s, _state);
12348  f2 = mannwhitneyu_utbln9n100(s, _state);
12349  result = mannwhitneyu_uninterpolate(f0, f1, f2, ae_maxint(n1, n2, _state), _state);
12350  }
12351  return result;
12352  }
12353 
12354  /*
12355  * N1=10, N2 = 10, 11, ...
12356  */
12357  if( ae_minint(n1, n2, _state)==10 )
12358  {
12359  if( ae_maxint(n1, n2, _state)==10 )
12360  {
12361  result = mannwhitneyu_utbln10n10(s, _state);
12362  }
12363  if( ae_maxint(n1, n2, _state)==11 )
12364  {
12365  result = mannwhitneyu_utbln10n11(s, _state);
12366  }
12367  if( ae_maxint(n1, n2, _state)==12 )
12368  {
12369  result = mannwhitneyu_utbln10n12(s, _state);
12370  }
12371  if( ae_maxint(n1, n2, _state)==13 )
12372  {
12373  result = mannwhitneyu_utbln10n13(s, _state);
12374  }
12375  if( ae_maxint(n1, n2, _state)==14 )
12376  {
12377  result = mannwhitneyu_utbln10n14(s, _state);
12378  }
12379  if( ae_maxint(n1, n2, _state)==15 )
12380  {
12381  result = mannwhitneyu_utbln10n15(s, _state);
12382  }
12383  if( ae_maxint(n1, n2, _state)>15 )
12384  {
12385  f0 = mannwhitneyu_utbln10n15(s, _state);
12386  f1 = mannwhitneyu_utbln10n30(s, _state);
12387  f2 = mannwhitneyu_utbln10n100(s, _state);
12388  result = mannwhitneyu_uninterpolate(f0, f1, f2, ae_maxint(n1, n2, _state), _state);
12389  }
12390  return result;
12391  }
12392 
12393  /*
12394  * N1=11, N2 = 11, 12, ...
12395  */
12396  if( ae_minint(n1, n2, _state)==11 )
12397  {
12398  if( ae_maxint(n1, n2, _state)==11 )
12399  {
12400  result = mannwhitneyu_utbln11n11(s, _state);
12401  }
12402  if( ae_maxint(n1, n2, _state)==12 )
12403  {
12404  result = mannwhitneyu_utbln11n12(s, _state);
12405  }
12406  if( ae_maxint(n1, n2, _state)==13 )
12407  {
12408  result = mannwhitneyu_utbln11n13(s, _state);
12409  }
12410  if( ae_maxint(n1, n2, _state)==14 )
12411  {
12412  result = mannwhitneyu_utbln11n14(s, _state);
12413  }
12414  if( ae_maxint(n1, n2, _state)==15 )
12415  {
12416  result = mannwhitneyu_utbln11n15(s, _state);
12417  }
12418  if( ae_maxint(n1, n2, _state)>15 )
12419  {
12420  f0 = mannwhitneyu_utbln11n15(s, _state);
12421  f1 = mannwhitneyu_utbln11n30(s, _state);
12422  f2 = mannwhitneyu_utbln11n100(s, _state);
12423  result = mannwhitneyu_uninterpolate(f0, f1, f2, ae_maxint(n1, n2, _state), _state);
12424  }
12425  return result;
12426  }
12427 
12428  /*
12429  * N1=12, N2 = 12, 13, ...
12430  */
12431  if( ae_minint(n1, n2, _state)==12 )
12432  {
12433  if( ae_maxint(n1, n2, _state)==12 )
12434  {
12435  result = mannwhitneyu_utbln12n12(s, _state);
12436  }
12437  if( ae_maxint(n1, n2, _state)==13 )
12438  {
12439  result = mannwhitneyu_utbln12n13(s, _state);
12440  }
12441  if( ae_maxint(n1, n2, _state)==14 )
12442  {
12443  result = mannwhitneyu_utbln12n14(s, _state);
12444  }
12445  if( ae_maxint(n1, n2, _state)==15 )
12446  {
12447  result = mannwhitneyu_utbln12n15(s, _state);
12448  }
12449  if( ae_maxint(n1, n2, _state)>15 )
12450  {
12451  f0 = mannwhitneyu_utbln12n15(s, _state);
12452  f1 = mannwhitneyu_utbln12n30(s, _state);
12453  f2 = mannwhitneyu_utbln12n100(s, _state);
12454  result = mannwhitneyu_uninterpolate(f0, f1, f2, ae_maxint(n1, n2, _state), _state);
12455  }
12456  return result;
12457  }
12458 
12459  /*
12460  * N1=13, N2 = 13, 14, ...
12461  */
12462  if( ae_minint(n1, n2, _state)==13 )
12463  {
12464  if( ae_maxint(n1, n2, _state)==13 )
12465  {
12466  result = mannwhitneyu_utbln13n13(s, _state);
12467  }
12468  if( ae_maxint(n1, n2, _state)==14 )
12469  {
12470  result = mannwhitneyu_utbln13n14(s, _state);
12471  }
12472  if( ae_maxint(n1, n2, _state)==15 )
12473  {
12474  result = mannwhitneyu_utbln13n15(s, _state);
12475  }
12476  if( ae_maxint(n1, n2, _state)>15 )
12477  {
12478  f0 = mannwhitneyu_utbln13n15(s, _state);
12479  f1 = mannwhitneyu_utbln13n30(s, _state);
12480  f2 = mannwhitneyu_utbln13n100(s, _state);
12481  result = mannwhitneyu_uninterpolate(f0, f1, f2, ae_maxint(n1, n2, _state), _state);
12482  }
12483  return result;
12484  }
12485 
12486  /*
12487  * N1=14, N2 = 14, 15, ...
12488  */
12489  if( ae_minint(n1, n2, _state)==14 )
12490  {
12491  if( ae_maxint(n1, n2, _state)==14 )
12492  {
12493  result = mannwhitneyu_utbln14n14(s, _state);
12494  }
12495  if( ae_maxint(n1, n2, _state)==15 )
12496  {
12497  result = mannwhitneyu_utbln14n15(s, _state);
12498  }
12499  if( ae_maxint(n1, n2, _state)>15 )
12500  {
12501  f0 = mannwhitneyu_utbln14n15(s, _state);
12502  f1 = mannwhitneyu_utbln14n30(s, _state);
12503  f2 = mannwhitneyu_utbln14n100(s, _state);
12504  result = mannwhitneyu_uninterpolate(f0, f1, f2, ae_maxint(n1, n2, _state), _state);
12505  }
12506  return result;
12507  }
12508 
12509  /*
12510  * N1 >= 15, N2 >= 15
12511  */
12512  if( ae_fp_greater(s,4) )
12513  {
12514  s = 4;
12515  }
12516  if( ae_fp_less(s,3) )
12517  {
12518  s0 = 0.000000e+00;
12519  f0 = mannwhitneyu_usigma000(n1, n2, _state);
12520  s1 = 7.500000e-01;
12521  f1 = mannwhitneyu_usigma075(n1, n2, _state);
12522  s2 = 1.500000e+00;
12523  f2 = mannwhitneyu_usigma150(n1, n2, _state);
12524  s3 = 2.250000e+00;
12525  f3 = mannwhitneyu_usigma225(n1, n2, _state);
12526  s4 = 3.000000e+00;
12527  f4 = mannwhitneyu_usigma300(n1, n2, _state);
12528  f1 = ((s-s0)*f1-(s-s1)*f0)/(s1-s0);
12529  f2 = ((s-s0)*f2-(s-s2)*f0)/(s2-s0);
12530  f3 = ((s-s0)*f3-(s-s3)*f0)/(s3-s0);
12531  f4 = ((s-s0)*f4-(s-s4)*f0)/(s4-s0);
12532  f2 = ((s-s1)*f2-(s-s2)*f1)/(s2-s1);
12533  f3 = ((s-s1)*f3-(s-s3)*f1)/(s3-s1);
12534  f4 = ((s-s1)*f4-(s-s4)*f1)/(s4-s1);
12535  f3 = ((s-s2)*f3-(s-s3)*f2)/(s3-s2);
12536  f4 = ((s-s2)*f4-(s-s4)*f2)/(s4-s2);
12537  f4 = ((s-s3)*f4-(s-s4)*f3)/(s4-s3);
12538  result = f4;
12539  }
12540  else
12541  {
12542  s0 = 3.000000e+00;
12543  f0 = mannwhitneyu_usigma300(n1, n2, _state);
12544  s1 = 3.333333e+00;
12545  f1 = mannwhitneyu_usigma333(n1, n2, _state);
12546  s2 = 3.666667e+00;
12547  f2 = mannwhitneyu_usigma367(n1, n2, _state);
12548  s3 = 4.000000e+00;
12549  f3 = mannwhitneyu_usigma400(n1, n2, _state);
12550  f1 = ((s-s0)*f1-(s-s1)*f0)/(s1-s0);
12551  f2 = ((s-s0)*f2-(s-s2)*f0)/(s2-s0);
12552  f3 = ((s-s0)*f3-(s-s3)*f0)/(s3-s0);
12553  f2 = ((s-s1)*f2-(s-s2)*f1)/(s2-s1);
12554  f3 = ((s-s1)*f3-(s-s3)*f1)/(s3-s1);
12555  f3 = ((s-s2)*f3-(s-s3)*f2)/(s3-s2);
12556  result = f3;
12557  }
12558  return result;
12559 }
12560 
12561 
12562 
12563 
12564 /*************************************************************************
12565 Sign test
12566 
12567 This test checks three hypotheses about the median of the given sample.
12568 The following tests are performed:
12569  * two-tailed test (null hypothesis - the median is equal to the given
12570  value)
12571  * left-tailed test (null hypothesis - the median is greater than or
12572  equal to the given value)
12573  * right-tailed test (null hypothesis - the median is less than or
12574  equal to the given value)
12575 
12576 Requirements:
12577  * the scale of measurement should be ordinal, interval or ratio (i.e.
12578  the test could not be applied to nominal variables).
12579 
12580 The test is non-parametric and doesn't require distribution X to be normal
12581 
12582 Input parameters:
12583  X - sample. Array whose index goes from 0 to N-1.
12584  N - size of the sample.
12585  Median - assumed median value.
12586 
12587 Output parameters:
12588  BothTails - p-value for two-tailed test.
12589  If BothTails is less than the given significance level
12590  the null hypothesis is rejected.
12591  LeftTail - p-value for left-tailed test.
12592  If LeftTail is less than the given significance level,
12593  the null hypothesis is rejected.
12594  RightTail - p-value for right-tailed test.
12595  If RightTail is less than the given significance level
12596  the null hypothesis is rejected.
12597 
12598 While calculating p-values high-precision binomial distribution
12599 approximation is used, so significance levels have about 15 exact digits.
12600 
12601  -- ALGLIB --
12602  Copyright 08.09.2006 by Bochkanov Sergey
12603 *************************************************************************/
12604 void onesamplesigntest(/* Real */ ae_vector* x,
12605  ae_int_t n,
12606  double median,
12607  double* bothtails,
12608  double* lefttail,
12609  double* righttail,
12610  ae_state *_state)
12611 {
12612  ae_int_t i;
12613  ae_int_t gtcnt;
12614  ae_int_t necnt;
12615 
12616  *bothtails = 0;
12617  *lefttail = 0;
12618  *righttail = 0;
12619 
12620  if( n<=1 )
12621  {
12622  *bothtails = 1.0;
12623  *lefttail = 1.0;
12624  *righttail = 1.0;
12625  return;
12626  }
12627 
12628  /*
12629  * Calculate:
12630  * GTCnt - count of x[i]>Median
12631  * NECnt - count of x[i]<>Median
12632  */
12633  gtcnt = 0;
12634  necnt = 0;
12635  for(i=0; i<=n-1; i++)
12636  {
12637  if( ae_fp_greater(x->ptr.p_double[i],median) )
12638  {
12639  gtcnt = gtcnt+1;
12640  }
12641  if( ae_fp_neq(x->ptr.p_double[i],median) )
12642  {
12643  necnt = necnt+1;
12644  }
12645  }
12646  if( necnt==0 )
12647  {
12648 
12649  /*
12650  * all x[i] are equal to Median.
12651  * So we can conclude that Median is a true median :)
12652  */
12653  *bothtails = 1.0;
12654  *lefttail = 1.0;
12655  *righttail = 1.0;
12656  return;
12657  }
12658  *bothtails = ae_minreal(2*binomialdistribution(ae_minint(gtcnt, necnt-gtcnt, _state), necnt, 0.5, _state), 1.0, _state);
12659  *lefttail = binomialdistribution(gtcnt, necnt, 0.5, _state);
12660  *righttail = binomialcdistribution(gtcnt-1, necnt, 0.5, _state);
12661 }
12662 
12663 
12664 
12665 
12666 /*************************************************************************
12667 One-sample t-test
12668 
12669 This test checks three hypotheses about the mean of the given sample. The
12670 following tests are performed:
12671  * two-tailed test (null hypothesis - the mean is equal to the given
12672  value)
12673  * left-tailed test (null hypothesis - the mean is greater than or
12674  equal to the given value)
12675  * right-tailed test (null hypothesis - the mean is less than or equal
12676  to the given value).
12677 
12678 The test is based on the assumption that a given sample has a normal
12679 distribution and an unknown dispersion. If the distribution sharply
12680 differs from normal, the test will work incorrectly.
12681 
12682 INPUT PARAMETERS:
12683  X - sample. Array whose index goes from 0 to N-1.
12684  N - size of sample, N>=0
12685  Mean - assumed value of the mean.
12686 
12687 OUTPUT PARAMETERS:
12688  BothTails - p-value for two-tailed test.
12689  If BothTails is less than the given significance level
12690  the null hypothesis is rejected.
12691  LeftTail - p-value for left-tailed test.
12692  If LeftTail is less than the given significance level,
12693  the null hypothesis is rejected.
12694  RightTail - p-value for right-tailed test.
12695  If RightTail is less than the given significance level
12696  the null hypothesis is rejected.
12697 
12698 NOTE: this function correctly handles degenerate cases:
12699  * when N=0, all p-values are set to 1.0
12700  * when variance of X[] is exactly zero, p-values are set
12701  to 1.0 or 0.0, depending on difference between sample mean and
12702  value of mean being tested.
12703 
12704 
12705  -- ALGLIB --
12706  Copyright 08.09.2006 by Bochkanov Sergey
12707 *************************************************************************/
12708 void studentttest1(/* Real */ ae_vector* x,
12709  ae_int_t n,
12710  double mean,
12711  double* bothtails,
12712  double* lefttail,
12713  double* righttail,
12714  ae_state *_state)
12715 {
12716  ae_int_t i;
12717  double xmean;
12718  double x0;
12719  double v;
12720  ae_bool samex;
12721  double xvariance;
12722  double xstddev;
12723  double v1;
12724  double v2;
12725  double stat;
12726  double s;
12727 
12728  *bothtails = 0;
12729  *lefttail = 0;
12730  *righttail = 0;
12731 
12732  if( n<=0 )
12733  {
12734  *bothtails = 1.0;
12735  *lefttail = 1.0;
12736  *righttail = 1.0;
12737  return;
12738  }
12739 
12740  /*
12741  * Mean
12742  */
12743  xmean = 0;
12744  x0 = x->ptr.p_double[0];
12745  samex = ae_true;
12746  for(i=0; i<=n-1; i++)
12747  {
12748  v = x->ptr.p_double[i];
12749  xmean = xmean+v;
12750  samex = samex&&ae_fp_eq(v,x0);
12751  }
12752  if( samex )
12753  {
12754  xmean = x0;
12755  }
12756  else
12757  {
12758  xmean = xmean/n;
12759  }
12760 
12761  /*
12762  * Variance (using corrected two-pass algorithm)
12763  */
12764  xvariance = 0;
12765  xstddev = 0;
12766  if( n!=1&&!samex )
12767  {
12768  v1 = 0;
12769  for(i=0; i<=n-1; i++)
12770  {
12771  v1 = v1+ae_sqr(x->ptr.p_double[i]-xmean, _state);
12772  }
12773  v2 = 0;
12774  for(i=0; i<=n-1; i++)
12775  {
12776  v2 = v2+(x->ptr.p_double[i]-xmean);
12777  }
12778  v2 = ae_sqr(v2, _state)/n;
12779  xvariance = (v1-v2)/(n-1);
12780  if( ae_fp_less(xvariance,0) )
12781  {
12782  xvariance = 0;
12783  }
12784  xstddev = ae_sqrt(xvariance, _state);
12785  }
12786  if( ae_fp_eq(xstddev,0) )
12787  {
12788  if( ae_fp_eq(xmean,mean) )
12789  {
12790  *bothtails = 1.0;
12791  }
12792  else
12793  {
12794  *bothtails = 0.0;
12795  }
12796  if( ae_fp_greater_eq(xmean,mean) )
12797  {
12798  *lefttail = 1.0;
12799  }
12800  else
12801  {
12802  *lefttail = 0.0;
12803  }
12804  if( ae_fp_less_eq(xmean,mean) )
12805  {
12806  *righttail = 1.0;
12807  }
12808  else
12809  {
12810  *righttail = 0.0;
12811  }
12812  return;
12813  }
12814 
12815  /*
12816  * Statistic
12817  */
12818  stat = (xmean-mean)/(xstddev/ae_sqrt(n, _state));
12819  s = studenttdistribution(n-1, stat, _state);
12820  *bothtails = 2*ae_minreal(s, 1-s, _state);
12821  *lefttail = s;
12822  *righttail = 1-s;
12823 }
12824 
12825 
12826 /*************************************************************************
12827 Two-sample pooled test
12828 
12829 This test checks three hypotheses about the mean of the given samples. The
12830 following tests are performed:
12831  * two-tailed test (null hypothesis - the means are equal)
12832  * left-tailed test (null hypothesis - the mean of the first sample is
12833  greater than or equal to the mean of the second sample)
12834  * right-tailed test (null hypothesis - the mean of the first sample is
12835  less than or equal to the mean of the second sample).
12836 
12837 Test is based on the following assumptions:
12838  * given samples have normal distributions
12839  * dispersions are equal
12840  * samples are independent.
12841 
12842 Input parameters:
12843  X - sample 1. Array whose index goes from 0 to N-1.
12844  N - size of sample.
12845  Y - sample 2. Array whose index goes from 0 to M-1.
12846  M - size of sample.
12847 
12848 Output parameters:
12849  BothTails - p-value for two-tailed test.
12850  If BothTails is less than the given significance level
12851  the null hypothesis is rejected.
12852  LeftTail - p-value for left-tailed test.
12853  If LeftTail is less than the given significance level,
12854  the null hypothesis is rejected.
12855  RightTail - p-value for right-tailed test.
12856  If RightTail is less than the given significance level
12857  the null hypothesis is rejected.
12858 
12859 NOTE: this function correctly handles degenerate cases:
12860  * when N=0 or M=0, all p-values are set to 1.0
12861  * when both samples has exactly zero variance, p-values are set
12862  to 1.0 or 0.0, depending on difference between means.
12863 
12864  -- ALGLIB --
12865  Copyright 18.09.2006 by Bochkanov Sergey
12866 *************************************************************************/
12867 void studentttest2(/* Real */ ae_vector* x,
12868  ae_int_t n,
12869  /* Real */ ae_vector* y,
12870  ae_int_t m,
12871  double* bothtails,
12872  double* lefttail,
12873  double* righttail,
12874  ae_state *_state)
12875 {
12876  ae_int_t i;
12877  ae_bool samex;
12878  ae_bool samey;
12879  double x0;
12880  double y0;
12881  double xmean;
12882  double ymean;
12883  double v;
12884  double stat;
12885  double s;
12886  double p;
12887 
12888  *bothtails = 0;
12889  *lefttail = 0;
12890  *righttail = 0;
12891 
12892  if( n<=0||m<=0 )
12893  {
12894  *bothtails = 1.0;
12895  *lefttail = 1.0;
12896  *righttail = 1.0;
12897  return;
12898  }
12899 
12900  /*
12901  * Mean
12902  */
12903  xmean = 0;
12904  x0 = x->ptr.p_double[0];
12905  samex = ae_true;
12906  for(i=0; i<=n-1; i++)
12907  {
12908  v = x->ptr.p_double[i];
12909  xmean = xmean+v;
12910  samex = samex&&ae_fp_eq(v,x0);
12911  }
12912  if( samex )
12913  {
12914  xmean = x0;
12915  }
12916  else
12917  {
12918  xmean = xmean/n;
12919  }
12920  ymean = 0;
12921  y0 = y->ptr.p_double[0];
12922  samey = ae_true;
12923  for(i=0; i<=m-1; i++)
12924  {
12925  v = y->ptr.p_double[i];
12926  ymean = ymean+v;
12927  samey = samey&&ae_fp_eq(v,y0);
12928  }
12929  if( samey )
12930  {
12931  ymean = y0;
12932  }
12933  else
12934  {
12935  ymean = ymean/m;
12936  }
12937 
12938  /*
12939  * S
12940  */
12941  s = 0;
12942  if( n+m>2 )
12943  {
12944  for(i=0; i<=n-1; i++)
12945  {
12946  s = s+ae_sqr(x->ptr.p_double[i]-xmean, _state);
12947  }
12948  for(i=0; i<=m-1; i++)
12949  {
12950  s = s+ae_sqr(y->ptr.p_double[i]-ymean, _state);
12951  }
12952  s = ae_sqrt(s*((double)1/(double)n+(double)1/(double)m)/(n+m-2), _state);
12953  }
12954  if( ae_fp_eq(s,0) )
12955  {
12956  if( ae_fp_eq(xmean,ymean) )
12957  {
12958  *bothtails = 1.0;
12959  }
12960  else
12961  {
12962  *bothtails = 0.0;
12963  }
12964  if( ae_fp_greater_eq(xmean,ymean) )
12965  {
12966  *lefttail = 1.0;
12967  }
12968  else
12969  {
12970  *lefttail = 0.0;
12971  }
12972  if( ae_fp_less_eq(xmean,ymean) )
12973  {
12974  *righttail = 1.0;
12975  }
12976  else
12977  {
12978  *righttail = 0.0;
12979  }
12980  return;
12981  }
12982 
12983  /*
12984  * Statistic
12985  */
12986  stat = (xmean-ymean)/s;
12987  p = studenttdistribution(n+m-2, stat, _state);
12988  *bothtails = 2*ae_minreal(p, 1-p, _state);
12989  *lefttail = p;
12990  *righttail = 1-p;
12991 }
12992 
12993 
12994 /*************************************************************************
12995 Two-sample unpooled test
12996 
12997 This test checks three hypotheses about the mean of the given samples. The
12998 following tests are performed:
12999  * two-tailed test (null hypothesis - the means are equal)
13000  * left-tailed test (null hypothesis - the mean of the first sample is
13001  greater than or equal to the mean of the second sample)
13002  * right-tailed test (null hypothesis - the mean of the first sample is
13003  less than or equal to the mean of the second sample).
13004 
13005 Test is based on the following assumptions:
13006  * given samples have normal distributions
13007  * samples are independent.
13008 Equality of variances is NOT required.
13009 
13010 Input parameters:
13011  X - sample 1. Array whose index goes from 0 to N-1.
13012  N - size of the sample.
13013  Y - sample 2. Array whose index goes from 0 to M-1.
13014  M - size of the sample.
13015 
13016 Output parameters:
13017  BothTails - p-value for two-tailed test.
13018  If BothTails is less than the given significance level
13019  the null hypothesis is rejected.
13020  LeftTail - p-value for left-tailed test.
13021  If LeftTail is less than the given significance level,
13022  the null hypothesis is rejected.
13023  RightTail - p-value for right-tailed test.
13024  If RightTail is less than the given significance level
13025  the null hypothesis is rejected.
13026 
13027 NOTE: this function correctly handles degenerate cases:
13028  * when N=0 or M=0, all p-values are set to 1.0
13029  * when both samples has zero variance, p-values are set
13030  to 1.0 or 0.0, depending on difference between means.
13031  * when only one sample has zero variance, test reduces to 1-sample
13032  version.
13033 
13034  -- ALGLIB --
13035  Copyright 18.09.2006 by Bochkanov Sergey
13036 *************************************************************************/
13037 void unequalvariancettest(/* Real */ ae_vector* x,
13038  ae_int_t n,
13039  /* Real */ ae_vector* y,
13040  ae_int_t m,
13041  double* bothtails,
13042  double* lefttail,
13043  double* righttail,
13044  ae_state *_state)
13045 {
13046  ae_int_t i;
13047  ae_bool samex;
13048  ae_bool samey;
13049  double x0;
13050  double y0;
13051  double xmean;
13052  double ymean;
13053  double xvar;
13054  double yvar;
13055  double v;
13056  double df;
13057  double p;
13058  double stat;
13059  double c;
13060 
13061  *bothtails = 0;
13062  *lefttail = 0;
13063  *righttail = 0;
13064 
13065  if( n<=0||m<=0 )
13066  {
13067  *bothtails = 1.0;
13068  *lefttail = 1.0;
13069  *righttail = 1.0;
13070  return;
13071  }
13072 
13073  /*
13074  * Mean
13075  */
13076  xmean = 0;
13077  x0 = x->ptr.p_double[0];
13078  samex = ae_true;
13079  for(i=0; i<=n-1; i++)
13080  {
13081  v = x->ptr.p_double[i];
13082  xmean = xmean+v;
13083  samex = samex&&ae_fp_eq(v,x0);
13084  }
13085  if( samex )
13086  {
13087  xmean = x0;
13088  }
13089  else
13090  {
13091  xmean = xmean/n;
13092  }
13093  ymean = 0;
13094  y0 = y->ptr.p_double[0];
13095  samey = ae_true;
13096  for(i=0; i<=m-1; i++)
13097  {
13098  v = y->ptr.p_double[i];
13099  ymean = ymean+v;
13100  samey = samey&&ae_fp_eq(v,y0);
13101  }
13102  if( samey )
13103  {
13104  ymean = y0;
13105  }
13106  else
13107  {
13108  ymean = ymean/m;
13109  }
13110 
13111  /*
13112  * Variance (using corrected two-pass algorithm)
13113  */
13114  xvar = 0;
13115  if( n>=2&&!samex )
13116  {
13117  for(i=0; i<=n-1; i++)
13118  {
13119  xvar = xvar+ae_sqr(x->ptr.p_double[i]-xmean, _state);
13120  }
13121  xvar = xvar/(n-1);
13122  }
13123  yvar = 0;
13124  if( m>=2&&!samey )
13125  {
13126  for(i=0; i<=m-1; i++)
13127  {
13128  yvar = yvar+ae_sqr(y->ptr.p_double[i]-ymean, _state);
13129  }
13130  yvar = yvar/(m-1);
13131  }
13132 
13133  /*
13134  * Handle different special cases
13135  * (one or both variances are zero).
13136  */
13137  if( ae_fp_eq(xvar,0)&&ae_fp_eq(yvar,0) )
13138  {
13139  if( ae_fp_eq(xmean,ymean) )
13140  {
13141  *bothtails = 1.0;
13142  }
13143  else
13144  {
13145  *bothtails = 0.0;
13146  }
13147  if( ae_fp_greater_eq(xmean,ymean) )
13148  {
13149  *lefttail = 1.0;
13150  }
13151  else
13152  {
13153  *lefttail = 0.0;
13154  }
13155  if( ae_fp_less_eq(xmean,ymean) )
13156  {
13157  *righttail = 1.0;
13158  }
13159  else
13160  {
13161  *righttail = 0.0;
13162  }
13163  return;
13164  }
13165  if( ae_fp_eq(xvar,0) )
13166  {
13167 
13168  /*
13169  * X is constant, unpooled 2-sample test reduces to 1-sample test.
13170  *
13171  * NOTE: right-tail and left-tail must be passed to 1-sample
13172  * t-test in reverse order because we reverse order of
13173  * of samples.
13174  */
13175  studentttest1(y, m, xmean, bothtails, righttail, lefttail, _state);
13176  return;
13177  }
13178  if( ae_fp_eq(yvar,0) )
13179  {
13180 
13181  /*
13182  * Y is constant, unpooled 2-sample test reduces to 1-sample test.
13183  */
13184  studentttest1(x, n, ymean, bothtails, lefttail, righttail, _state);
13185  return;
13186  }
13187 
13188  /*
13189  * Statistic
13190  */
13191  stat = (xmean-ymean)/ae_sqrt(xvar/n+yvar/m, _state);
13192  c = xvar/n/(xvar/n+yvar/m);
13193  df = (n-1)*(m-1)/((m-1)*ae_sqr(c, _state)+(n-1)*ae_sqr(1-c, _state));
13194  if( ae_fp_greater(stat,0) )
13195  {
13196  p = 1-0.5*incompletebeta(df/2, 0.5, df/(df+ae_sqr(stat, _state)), _state);
13197  }
13198  else
13199  {
13200  p = 0.5*incompletebeta(df/2, 0.5, df/(df+ae_sqr(stat, _state)), _state);
13201  }
13202  *bothtails = 2*ae_minreal(p, 1-p, _state);
13203  *lefttail = p;
13204  *righttail = 1-p;
13205 }
13206 
13207 
13208 
13209 
13210 /*************************************************************************
13211 Two-sample F-test
13212 
13213 This test checks three hypotheses about dispersions of the given samples.
13214 The following tests are performed:
13215  * two-tailed test (null hypothesis - the dispersions are equal)
13216  * left-tailed test (null hypothesis - the dispersion of the first
13217  sample is greater than or equal to the dispersion of the second
13218  sample).
13219  * right-tailed test (null hypothesis - the dispersion of the first
13220  sample is less than or equal to the dispersion of the second sample)
13221 
13222 The test is based on the following assumptions:
13223  * the given samples have normal distributions
13224  * the samples are independent.
13225 
13226 Input parameters:
13227  X - sample 1. Array whose index goes from 0 to N-1.
13228  N - sample size.
13229  Y - sample 2. Array whose index goes from 0 to M-1.
13230  M - sample size.
13231 
13232 Output parameters:
13233  BothTails - p-value for two-tailed test.
13234  If BothTails is less than the given significance level
13235  the null hypothesis is rejected.
13236  LeftTail - p-value for left-tailed test.
13237  If LeftTail is less than the given significance level,
13238  the null hypothesis is rejected.
13239  RightTail - p-value for right-tailed test.
13240  If RightTail is less than the given significance level
13241  the null hypothesis is rejected.
13242 
13243  -- ALGLIB --
13244  Copyright 19.09.2006 by Bochkanov Sergey
13245 *************************************************************************/
13246 void ftest(/* Real */ ae_vector* x,
13247  ae_int_t n,
13248  /* Real */ ae_vector* y,
13249  ae_int_t m,
13250  double* bothtails,
13251  double* lefttail,
13252  double* righttail,
13253  ae_state *_state)
13254 {
13255  ae_int_t i;
13256  double xmean;
13257  double ymean;
13258  double xvar;
13259  double yvar;
13260  ae_int_t df1;
13261  ae_int_t df2;
13262  double stat;
13263 
13264  *bothtails = 0;
13265  *lefttail = 0;
13266  *righttail = 0;
13267 
13268  if( n<=2||m<=2 )
13269  {
13270  *bothtails = 1.0;
13271  *lefttail = 1.0;
13272  *righttail = 1.0;
13273  return;
13274  }
13275 
13276  /*
13277  * Mean
13278  */
13279  xmean = 0;
13280  for(i=0; i<=n-1; i++)
13281  {
13282  xmean = xmean+x->ptr.p_double[i];
13283  }
13284  xmean = xmean/n;
13285  ymean = 0;
13286  for(i=0; i<=m-1; i++)
13287  {
13288  ymean = ymean+y->ptr.p_double[i];
13289  }
13290  ymean = ymean/m;
13291 
13292  /*
13293  * Variance (using corrected two-pass algorithm)
13294  */
13295  xvar = 0;
13296  for(i=0; i<=n-1; i++)
13297  {
13298  xvar = xvar+ae_sqr(x->ptr.p_double[i]-xmean, _state);
13299  }
13300  xvar = xvar/(n-1);
13301  yvar = 0;
13302  for(i=0; i<=m-1; i++)
13303  {
13304  yvar = yvar+ae_sqr(y->ptr.p_double[i]-ymean, _state);
13305  }
13306  yvar = yvar/(m-1);
13307  if( ae_fp_eq(xvar,0)||ae_fp_eq(yvar,0) )
13308  {
13309  *bothtails = 1.0;
13310  *lefttail = 1.0;
13311  *righttail = 1.0;
13312  return;
13313  }
13314 
13315  /*
13316  * Statistic
13317  */
13318  df1 = n-1;
13319  df2 = m-1;
13320  stat = ae_minreal(xvar/yvar, yvar/xvar, _state);
13321  *bothtails = 1-(fdistribution(df1, df2, 1/stat, _state)-fdistribution(df1, df2, stat, _state));
13322  *lefttail = fdistribution(df1, df2, xvar/yvar, _state);
13323  *righttail = 1-(*lefttail);
13324 }
13325 
13326 
13327 /*************************************************************************
13328 One-sample chi-square test
13329 
13330 This test checks three hypotheses about the dispersion of the given sample
13331 The following tests are performed:
13332  * two-tailed test (null hypothesis - the dispersion equals the given
13333  number)
13334  * left-tailed test (null hypothesis - the dispersion is greater than
13335  or equal to the given number)
13336  * right-tailed test (null hypothesis - dispersion is less than or
13337  equal to the given number).
13338 
13339 Test is based on the following assumptions:
13340  * the given sample has a normal distribution.
13341 
13342 Input parameters:
13343  X - sample 1. Array whose index goes from 0 to N-1.
13344  N - size of the sample.
13345  Variance - dispersion value to compare with.
13346 
13347 Output parameters:
13348  BothTails - p-value for two-tailed test.
13349  If BothTails is less than the given significance level
13350  the null hypothesis is rejected.
13351  LeftTail - p-value for left-tailed test.
13352  If LeftTail is less than the given significance level,
13353  the null hypothesis is rejected.
13354  RightTail - p-value for right-tailed test.
13355  If RightTail is less than the given significance level
13356  the null hypothesis is rejected.
13357 
13358  -- ALGLIB --
13359  Copyright 19.09.2006 by Bochkanov Sergey
13360 *************************************************************************/
13362  ae_int_t n,
13363  double variance,
13364  double* bothtails,
13365  double* lefttail,
13366  double* righttail,
13367  ae_state *_state)
13368 {
13369  ae_int_t i;
13370  double xmean;
13371  double xvar;
13372  double s;
13373  double stat;
13374 
13375  *bothtails = 0;
13376  *lefttail = 0;
13377  *righttail = 0;
13378 
13379  if( n<=1 )
13380  {
13381  *bothtails = 1.0;
13382  *lefttail = 1.0;
13383  *righttail = 1.0;
13384  return;
13385  }
13386 
13387  /*
13388  * Mean
13389  */
13390  xmean = 0;
13391  for(i=0; i<=n-1; i++)
13392  {
13393  xmean = xmean+x->ptr.p_double[i];
13394  }
13395  xmean = xmean/n;
13396 
13397  /*
13398  * Variance
13399  */
13400  xvar = 0;
13401  for(i=0; i<=n-1; i++)
13402  {
13403  xvar = xvar+ae_sqr(x->ptr.p_double[i]-xmean, _state);
13404  }
13405  xvar = xvar/(n-1);
13406  if( ae_fp_eq(xvar,0) )
13407  {
13408  *bothtails = 1.0;
13409  *lefttail = 1.0;
13410  *righttail = 1.0;
13411  return;
13412  }
13413 
13414  /*
13415  * Statistic
13416  */
13417  stat = (n-1)*xvar/variance;
13418  s = chisquaredistribution(n-1, stat, _state);
13419  *bothtails = 2*ae_minreal(s, 1-s, _state);
13420  *lefttail = s;
13421  *righttail = 1-(*lefttail);
13422 }
13423 
13424 
13425 
13426 
13427 /*************************************************************************
13428 Wilcoxon signed-rank test
13429 
13430 This test checks three hypotheses about the median of the given sample.
13431 The following tests are performed:
13432  * two-tailed test (null hypothesis - the median is equal to the given
13433  value)
13434  * left-tailed test (null hypothesis - the median is greater than or
13435  equal to the given value)
13436  * right-tailed test (null hypothesis - the median is less than or
13437  equal to the given value)
13438 
13439 Requirements:
13440  * the scale of measurement should be ordinal, interval or ratio (i.e.
13441  the test could not be applied to nominal variables).
13442  * the distribution should be continuous and symmetric relative to its
13443  median.
13444  * number of distinct values in the X array should be greater than 4
13445 
13446 The test is non-parametric and doesn't require distribution X to be normal
13447 
13448 Input parameters:
13449  X - sample. Array whose index goes from 0 to N-1.
13450  N - size of the sample.
13451  Median - assumed median value.
13452 
13453 Output parameters:
13454  BothTails - p-value for two-tailed test.
13455  If BothTails is less than the given significance level
13456  the null hypothesis is rejected.
13457  LeftTail - p-value for left-tailed test.
13458  If LeftTail is less than the given significance level,
13459  the null hypothesis is rejected.
13460  RightTail - p-value for right-tailed test.
13461  If RightTail is less than the given significance level
13462  the null hypothesis is rejected.
13463 
13464 To calculate p-values, special approximation is used. This method lets us
13465 calculate p-values with two decimal places in interval [0.0001, 1].
13466 
13467 "Two decimal places" does not sound very impressive, but in practice the
13468 relative error of less than 1% is enough to make a decision.
13469 
13470 There is no approximation outside the [0.0001, 1] interval. Therefore, if
13471 the significance level outlies this interval, the test returns 0.0001.
13472 
13473  -- ALGLIB --
13474  Copyright 08.09.2006 by Bochkanov Sergey
13475 *************************************************************************/
13477  ae_int_t n,
13478  double e,
13479  double* bothtails,
13480  double* lefttail,
13481  double* righttail,
13482  ae_state *_state)
13483 {
13484  ae_frame _frame_block;
13485  ae_vector _x;
13486  ae_int_t i;
13487  ae_int_t j;
13488  ae_int_t k;
13489  ae_int_t t;
13490  double tmp;
13491  ae_int_t tmpi;
13492  ae_int_t ns;
13493  ae_vector r;
13494  ae_vector c;
13495  double w;
13496  double p;
13497  double mp;
13498  double s;
13499  double sigma;
13500  double mu;
13501 
13502  ae_frame_make(_state, &_frame_block);
13503  ae_vector_init_copy(&_x, x, _state, ae_true);
13504  x = &_x;
13505  *bothtails = 0;
13506  *lefttail = 0;
13507  *righttail = 0;
13508  ae_vector_init(&r, 0, DT_REAL, _state, ae_true);
13509  ae_vector_init(&c, 0, DT_INT, _state, ae_true);
13510 
13511 
13512  /*
13513  * Prepare
13514  */
13515  if( n<5 )
13516  {
13517  *bothtails = 1.0;
13518  *lefttail = 1.0;
13519  *righttail = 1.0;
13520  ae_frame_leave(_state);
13521  return;
13522  }
13523  ns = 0;
13524  for(i=0; i<=n-1; i++)
13525  {
13526  if( ae_fp_eq(x->ptr.p_double[i],e) )
13527  {
13528  continue;
13529  }
13530  x->ptr.p_double[ns] = x->ptr.p_double[i];
13531  ns = ns+1;
13532  }
13533  if( ns<5 )
13534  {
13535  *bothtails = 1.0;
13536  *lefttail = 1.0;
13537  *righttail = 1.0;
13538  ae_frame_leave(_state);
13539  return;
13540  }
13541  ae_vector_set_length(&r, ns-1+1, _state);
13542  ae_vector_set_length(&c, ns-1+1, _state);
13543  for(i=0; i<=ns-1; i++)
13544  {
13545  r.ptr.p_double[i] = ae_fabs(x->ptr.p_double[i]-e, _state);
13546  c.ptr.p_int[i] = i;
13547  }
13548 
13549  /*
13550  * sort {R, C}
13551  */
13552  if( ns!=1 )
13553  {
13554  i = 2;
13555  do
13556  {
13557  t = i;
13558  while(t!=1)
13559  {
13560  k = t/2;
13561  if( ae_fp_greater_eq(r.ptr.p_double[k-1],r.ptr.p_double[t-1]) )
13562  {
13563  t = 1;
13564  }
13565  else
13566  {
13567  tmp = r.ptr.p_double[k-1];
13568  r.ptr.p_double[k-1] = r.ptr.p_double[t-1];
13569  r.ptr.p_double[t-1] = tmp;
13570  tmpi = c.ptr.p_int[k-1];
13571  c.ptr.p_int[k-1] = c.ptr.p_int[t-1];
13572  c.ptr.p_int[t-1] = tmpi;
13573  t = k;
13574  }
13575  }
13576  i = i+1;
13577  }
13578  while(i<=ns);
13579  i = ns-1;
13580  do
13581  {
13582  tmp = r.ptr.p_double[i];
13583  r.ptr.p_double[i] = r.ptr.p_double[0];
13584  r.ptr.p_double[0] = tmp;
13585  tmpi = c.ptr.p_int[i];
13586  c.ptr.p_int[i] = c.ptr.p_int[0];
13587  c.ptr.p_int[0] = tmpi;
13588  t = 1;
13589  while(t!=0)
13590  {
13591  k = 2*t;
13592  if( k>i )
13593  {
13594  t = 0;
13595  }
13596  else
13597  {
13598  if( k<i )
13599  {
13600  if( ae_fp_greater(r.ptr.p_double[k],r.ptr.p_double[k-1]) )
13601  {
13602  k = k+1;
13603  }
13604  }
13605  if( ae_fp_greater_eq(r.ptr.p_double[t-1],r.ptr.p_double[k-1]) )
13606  {
13607  t = 0;
13608  }
13609  else
13610  {
13611  tmp = r.ptr.p_double[k-1];
13612  r.ptr.p_double[k-1] = r.ptr.p_double[t-1];
13613  r.ptr.p_double[t-1] = tmp;
13614  tmpi = c.ptr.p_int[k-1];
13615  c.ptr.p_int[k-1] = c.ptr.p_int[t-1];
13616  c.ptr.p_int[t-1] = tmpi;
13617  t = k;
13618  }
13619  }
13620  }
13621  i = i-1;
13622  }
13623  while(i>=1);
13624  }
13625 
13626  /*
13627  * compute tied ranks
13628  */
13629  i = 0;
13630  while(i<=ns-1)
13631  {
13632  j = i+1;
13633  while(j<=ns-1)
13634  {
13635  if( ae_fp_neq(r.ptr.p_double[j],r.ptr.p_double[i]) )
13636  {
13637  break;
13638  }
13639  j = j+1;
13640  }
13641  for(k=i; k<=j-1; k++)
13642  {
13643  r.ptr.p_double[k] = 1+(double)(i+j-1)/(double)2;
13644  }
13645  i = j;
13646  }
13647 
13648  /*
13649  * Compute W+
13650  */
13651  w = 0;
13652  for(i=0; i<=ns-1; i++)
13653  {
13654  if( ae_fp_greater(x->ptr.p_double[c.ptr.p_int[i]],e) )
13655  {
13656  w = w+r.ptr.p_double[i];
13657  }
13658  }
13659 
13660  /*
13661  * Result
13662  */
13663  mu = (double)(ns*(ns+1))/(double)4;
13664  sigma = ae_sqrt((double)(ns*(ns+1)*(2*ns+1))/(double)24, _state);
13665  s = (w-mu)/sigma;
13666  if( ae_fp_less_eq(s,0) )
13667  {
13668  p = ae_exp(wsr_wsigma(-(w-mu)/sigma, ns, _state), _state);
13669  mp = 1-ae_exp(wsr_wsigma(-(w-1-mu)/sigma, ns, _state), _state);
13670  }
13671  else
13672  {
13673  mp = ae_exp(wsr_wsigma((w-mu)/sigma, ns, _state), _state);
13674  p = 1-ae_exp(wsr_wsigma((w+1-mu)/sigma, ns, _state), _state);
13675  }
13676  *bothtails = ae_maxreal(2*ae_minreal(p, mp, _state), 1.0E-4, _state);
13677  *lefttail = ae_maxreal(p, 1.0E-4, _state);
13678  *righttail = ae_maxreal(mp, 1.0E-4, _state);
13679  ae_frame_leave(_state);
13680 }
13681 
13682 
13683 /*************************************************************************
13684 Sequential Chebyshev interpolation.
13685 *************************************************************************/
13686 static void wsr_wcheb(double x,
13687  double c,
13688  double* tj,
13689  double* tj1,
13690  double* r,
13691  ae_state *_state)
13692 {
13693  double t;
13694 
13695 
13696  *r = *r+c*(*tj);
13697  t = 2*x*(*tj1)-(*tj);
13698  *tj = *tj1;
13699  *tj1 = t;
13700 }
13701 
13702 
13703 /*************************************************************************
13704 Tail(S, 5)
13705 *************************************************************************/
13706 static double wsr_w5(double s, ae_state *_state)
13707 {
13708  ae_int_t w;
13709  double r;
13710  double result;
13711 
13712 
13713  r = 0;
13714  w = ae_round(-3.708099e+00*s+7.500000e+00, _state);
13715  if( w>=7 )
13716  {
13717  r = -6.931e-01;
13718  }
13719  if( w==6 )
13720  {
13721  r = -9.008e-01;
13722  }
13723  if( w==5 )
13724  {
13725  r = -1.163e+00;
13726  }
13727  if( w==4 )
13728  {
13729  r = -1.520e+00;
13730  }
13731  if( w==3 )
13732  {
13733  r = -1.856e+00;
13734  }
13735  if( w==2 )
13736  {
13737  r = -2.367e+00;
13738  }
13739  if( w==1 )
13740  {
13741  r = -2.773e+00;
13742  }
13743  if( w<=0 )
13744  {
13745  r = -3.466e+00;
13746  }
13747  result = r;
13748  return result;
13749 }
13750 
13751 
13752 /*************************************************************************
13753 Tail(S, 6)
13754 *************************************************************************/
13755 static double wsr_w6(double s, ae_state *_state)
13756 {
13757  ae_int_t w;
13758  double r;
13759  double result;
13760 
13761 
13762  r = 0;
13763  w = ae_round(-4.769696e+00*s+1.050000e+01, _state);
13764  if( w>=10 )
13765  {
13766  r = -6.931e-01;
13767  }
13768  if( w==9 )
13769  {
13770  r = -8.630e-01;
13771  }
13772  if( w==8 )
13773  {
13774  r = -1.068e+00;
13775  }
13776  if( w==7 )
13777  {
13778  r = -1.269e+00;
13779  }
13780  if( w==6 )
13781  {
13782  r = -1.520e+00;
13783  }
13784  if( w==5 )
13785  {
13786  r = -1.856e+00;
13787  }
13788  if( w==4 )
13789  {
13790  r = -2.213e+00;
13791  }
13792  if( w==3 )
13793  {
13794  r = -2.549e+00;
13795  }
13796  if( w==2 )
13797  {
13798  r = -3.060e+00;
13799  }
13800  if( w==1 )
13801  {
13802  r = -3.466e+00;
13803  }
13804  if( w<=0 )
13805  {
13806  r = -4.159e+00;
13807  }
13808  result = r;
13809  return result;
13810 }
13811 
13812 
13813 /*************************************************************************
13814 Tail(S, 7)
13815 *************************************************************************/
13816 static double wsr_w7(double s, ae_state *_state)
13817 {
13818  ae_int_t w;
13819  double r;
13820  double result;
13821 
13822 
13823  r = 0;
13824  w = ae_round(-5.916080e+00*s+1.400000e+01, _state);
13825  if( w>=14 )
13826  {
13827  r = -6.325e-01;
13828  }
13829  if( w==13 )
13830  {
13831  r = -7.577e-01;
13832  }
13833  if( w==12 )
13834  {
13835  r = -9.008e-01;
13836  }
13837  if( w==11 )
13838  {
13839  r = -1.068e+00;
13840  }
13841  if( w==10 )
13842  {
13843  r = -1.241e+00;
13844  }
13845  if( w==9 )
13846  {
13847  r = -1.451e+00;
13848  }
13849  if( w==8 )
13850  {
13851  r = -1.674e+00;
13852  }
13853  if( w==7 )
13854  {
13855  r = -1.908e+00;
13856  }
13857  if( w==6 )
13858  {
13859  r = -2.213e+00;
13860  }
13861  if( w==5 )
13862  {
13863  r = -2.549e+00;
13864  }
13865  if( w==4 )
13866  {
13867  r = -2.906e+00;
13868  }
13869  if( w==3 )
13870  {
13871  r = -3.243e+00;
13872  }
13873  if( w==2 )
13874  {
13875  r = -3.753e+00;
13876  }
13877  if( w==1 )
13878  {
13879  r = -4.159e+00;
13880  }
13881  if( w<=0 )
13882  {
13883  r = -4.852e+00;
13884  }
13885  result = r;
13886  return result;
13887 }
13888 
13889 
13890 /*************************************************************************
13891 Tail(S, 8)
13892 *************************************************************************/
13893 static double wsr_w8(double s, ae_state *_state)
13894 {
13895  ae_int_t w;
13896  double r;
13897  double result;
13898 
13899 
13900  r = 0;
13901  w = ae_round(-7.141428e+00*s+1.800000e+01, _state);
13902  if( w>=18 )
13903  {
13904  r = -6.399e-01;
13905  }
13906  if( w==17 )
13907  {
13908  r = -7.494e-01;
13909  }
13910  if( w==16 )
13911  {
13912  r = -8.630e-01;
13913  }
13914  if( w==15 )
13915  {
13916  r = -9.913e-01;
13917  }
13918  if( w==14 )
13919  {
13920  r = -1.138e+00;
13921  }
13922  if( w==13 )
13923  {
13924  r = -1.297e+00;
13925  }
13926  if( w==12 )
13927  {
13928  r = -1.468e+00;
13929  }
13930  if( w==11 )
13931  {
13932  r = -1.653e+00;
13933  }
13934  if( w==10 )
13935  {
13936  r = -1.856e+00;
13937  }
13938  if( w==9 )
13939  {
13940  r = -2.079e+00;
13941  }
13942  if( w==8 )
13943  {
13944  r = -2.326e+00;
13945  }
13946  if( w==7 )
13947  {
13948  r = -2.601e+00;
13949  }
13950  if( w==6 )
13951  {
13952  r = -2.906e+00;
13953  }
13954  if( w==5 )
13955  {
13956  r = -3.243e+00;
13957  }
13958  if( w==4 )
13959  {
13960  r = -3.599e+00;
13961  }
13962  if( w==3 )
13963  {
13964  r = -3.936e+00;
13965  }
13966  if( w==2 )
13967  {
13968  r = -4.447e+00;
13969  }
13970  if( w==1 )
13971  {
13972  r = -4.852e+00;
13973  }
13974  if( w<=0 )
13975  {
13976  r = -5.545e+00;
13977  }
13978  result = r;
13979  return result;
13980 }
13981 
13982 
13983 /*************************************************************************
13984 Tail(S, 9)
13985 *************************************************************************/
13986 static double wsr_w9(double s, ae_state *_state)
13987 {
13988  ae_int_t w;
13989  double r;
13990  double result;
13991 
13992 
13993  r = 0;
13994  w = ae_round(-8.440972e+00*s+2.250000e+01, _state);
13995  if( w>=22 )
13996  {
13997  r = -6.931e-01;
13998  }
13999  if( w==21 )
14000  {
14001  r = -7.873e-01;
14002  }
14003  if( w==20 )
14004  {
14005  r = -8.912e-01;
14006  }
14007  if( w==19 )
14008  {
14009  r = -1.002e+00;
14010  }
14011  if( w==18 )
14012  {
14013  r = -1.120e+00;
14014  }
14015  if( w==17 )
14016  {
14017  r = -1.255e+00;
14018  }
14019  if( w==16 )
14020  {
14021  r = -1.394e+00;
14022  }
14023  if( w==15 )
14024  {
14025  r = -1.547e+00;
14026  }
14027  if( w==14 )
14028  {
14029  r = -1.717e+00;
14030  }
14031  if( w==13 )
14032  {
14033  r = -1.895e+00;
14034  }
14035  if( w==12 )
14036  {
14037  r = -2.079e+00;
14038  }
14039  if( w==11 )
14040  {
14041  r = -2.287e+00;
14042  }
14043  if( w==10 )
14044  {
14045  r = -2.501e+00;
14046  }
14047  if( w==9 )
14048  {
14049  r = -2.742e+00;
14050  }
14051  if( w==8 )
14052  {
14053  r = -3.019e+00;
14054  }
14055  if( w==7 )
14056  {
14057  r = -3.294e+00;
14058  }
14059  if( w==6 )
14060  {
14061  r = -3.599e+00;
14062  }
14063  if( w==5 )
14064  {
14065  r = -3.936e+00;
14066  }
14067  if( w==4 )
14068  {
14069  r = -4.292e+00;
14070  }
14071  if( w==3 )
14072  {
14073  r = -4.629e+00;
14074  }
14075  if( w==2 )
14076  {
14077  r = -5.140e+00;
14078  }
14079  if( w==1 )
14080  {
14081  r = -5.545e+00;
14082  }
14083  if( w<=0 )
14084  {
14085  r = -6.238e+00;
14086  }
14087  result = r;
14088  return result;
14089 }
14090 
14091 
14092 /*************************************************************************
14093 Tail(S, 10)
14094 *************************************************************************/
14095 static double wsr_w10(double s, ae_state *_state)
14096 {
14097  ae_int_t w;
14098  double r;
14099  double result;
14100 
14101 
14102  r = 0;
14103  w = ae_round(-9.810708e+00*s+2.750000e+01, _state);
14104  if( w>=27 )
14105  {
14106  r = -6.931e-01;
14107  }
14108  if( w==26 )
14109  {
14110  r = -7.745e-01;
14111  }
14112  if( w==25 )
14113  {
14114  r = -8.607e-01;
14115  }
14116  if( w==24 )
14117  {
14118  r = -9.551e-01;
14119  }
14120  if( w==23 )
14121  {
14122  r = -1.057e+00;
14123  }
14124  if( w==22 )
14125  {
14126  r = -1.163e+00;
14127  }
14128  if( w==21 )
14129  {
14130  r = -1.279e+00;
14131  }
14132  if( w==20 )
14133  {
14134  r = -1.402e+00;
14135  }
14136  if( w==19 )
14137  {
14138  r = -1.533e+00;
14139  }
14140  if( w==18 )
14141  {
14142  r = -1.674e+00;
14143  }
14144  if( w==17 )
14145  {
14146  r = -1.826e+00;
14147  }
14148  if( w==16 )
14149  {
14150  r = -1.983e+00;
14151  }
14152  if( w==15 )
14153  {
14154  r = -2.152e+00;
14155  }
14156  if( w==14 )
14157  {
14158  r = -2.336e+00;
14159  }
14160  if( w==13 )
14161  {
14162  r = -2.525e+00;
14163  }
14164  if( w==12 )
14165  {
14166  r = -2.727e+00;
14167  }
14168  if( w==11 )
14169  {
14170  r = -2.942e+00;
14171  }
14172  if( w==10 )
14173  {
14174  r = -3.170e+00;
14175  }
14176  if( w==9 )
14177  {
14178  r = -3.435e+00;
14179  }
14180  if( w==8 )
14181  {
14182  r = -3.713e+00;
14183  }
14184  if( w==7 )
14185  {
14186  r = -3.987e+00;
14187  }
14188  if( w==6 )
14189  {
14190  r = -4.292e+00;
14191  }
14192  if( w==5 )
14193  {
14194  r = -4.629e+00;
14195  }
14196  if( w==4 )
14197  {
14198  r = -4.986e+00;
14199  }
14200  if( w==3 )
14201  {
14202  r = -5.322e+00;
14203  }
14204  if( w==2 )
14205  {
14206  r = -5.833e+00;
14207  }
14208  if( w==1 )
14209  {
14210  r = -6.238e+00;
14211  }
14212  if( w<=0 )
14213  {
14214  r = -6.931e+00;
14215  }
14216  result = r;
14217  return result;
14218 }
14219 
14220 
14221 /*************************************************************************
14222 Tail(S, 11)
14223 *************************************************************************/
14224 static double wsr_w11(double s, ae_state *_state)
14225 {
14226  ae_int_t w;
14227  double r;
14228  double result;
14229 
14230 
14231  r = 0;
14232  w = ae_round(-1.124722e+01*s+3.300000e+01, _state);
14233  if( w>=33 )
14234  {
14235  r = -6.595e-01;
14236  }
14237  if( w==32 )
14238  {
14239  r = -7.279e-01;
14240  }
14241  if( w==31 )
14242  {
14243  r = -8.002e-01;
14244  }
14245  if( w==30 )
14246  {
14247  r = -8.782e-01;
14248  }
14249  if( w==29 )
14250  {
14251  r = -9.615e-01;
14252  }
14253  if( w==28 )
14254  {
14255  r = -1.050e+00;
14256  }
14257  if( w==27 )
14258  {
14259  r = -1.143e+00;
14260  }
14261  if( w==26 )
14262  {
14263  r = -1.243e+00;
14264  }
14265  if( w==25 )
14266  {
14267  r = -1.348e+00;
14268  }
14269  if( w==24 )
14270  {
14271  r = -1.459e+00;
14272  }
14273  if( w==23 )
14274  {
14275  r = -1.577e+00;
14276  }
14277  if( w==22 )
14278  {
14279  r = -1.700e+00;
14280  }
14281  if( w==21 )
14282  {
14283  r = -1.832e+00;
14284  }
14285  if( w==20 )
14286  {
14287  r = -1.972e+00;
14288  }
14289  if( w==19 )
14290  {
14291  r = -2.119e+00;
14292  }
14293  if( w==18 )
14294  {
14295  r = -2.273e+00;
14296  }
14297  if( w==17 )
14298  {
14299  r = -2.437e+00;
14300  }
14301  if( w==16 )
14302  {
14303  r = -2.607e+00;
14304  }
14305  if( w==15 )
14306  {
14307  r = -2.788e+00;
14308  }
14309  if( w==14 )
14310  {
14311  r = -2.980e+00;
14312  }
14313  if( w==13 )
14314  {
14315  r = -3.182e+00;
14316  }
14317  if( w==12 )
14318  {
14319  r = -3.391e+00;
14320  }
14321  if( w==11 )
14322  {
14323  r = -3.617e+00;
14324  }
14325  if( w==10 )
14326  {
14327  r = -3.863e+00;
14328  }
14329  if( w==9 )
14330  {
14331  r = -4.128e+00;
14332  }
14333  if( w==8 )
14334  {
14335  r = -4.406e+00;
14336  }
14337  if( w==7 )
14338  {
14339  r = -4.680e+00;
14340  }
14341  if( w==6 )
14342  {
14343  r = -4.986e+00;
14344  }
14345  if( w==5 )
14346  {
14347  r = -5.322e+00;
14348  }
14349  if( w==4 )
14350  {
14351  r = -5.679e+00;
14352  }
14353  if( w==3 )
14354  {
14355  r = -6.015e+00;
14356  }
14357  if( w==2 )
14358  {
14359  r = -6.526e+00;
14360  }
14361  if( w==1 )
14362  {
14363  r = -6.931e+00;
14364  }
14365  if( w<=0 )
14366  {
14367  r = -7.625e+00;
14368  }
14369  result = r;
14370  return result;
14371 }
14372 
14373 
14374 /*************************************************************************
14375 Tail(S, 12)
14376 *************************************************************************/
14377 static double wsr_w12(double s, ae_state *_state)
14378 {
14379  ae_int_t w;
14380  double r;
14381  double result;
14382 
14383 
14384  r = 0;
14385  w = ae_round(-1.274755e+01*s+3.900000e+01, _state);
14386  if( w>=39 )
14387  {
14388  r = -6.633e-01;
14389  }
14390  if( w==38 )
14391  {
14392  r = -7.239e-01;
14393  }
14394  if( w==37 )
14395  {
14396  r = -7.878e-01;
14397  }
14398  if( w==36 )
14399  {
14400  r = -8.556e-01;
14401  }
14402  if( w==35 )
14403  {
14404  r = -9.276e-01;
14405  }
14406  if( w==34 )
14407  {
14408  r = -1.003e+00;
14409  }
14410  if( w==33 )
14411  {
14412  r = -1.083e+00;
14413  }
14414  if( w==32 )
14415  {
14416  r = -1.168e+00;
14417  }
14418  if( w==31 )
14419  {
14420  r = -1.256e+00;
14421  }
14422  if( w==30 )
14423  {
14424  r = -1.350e+00;
14425  }
14426  if( w==29 )
14427  {
14428  r = -1.449e+00;
14429  }
14430  if( w==28 )
14431  {
14432  r = -1.552e+00;
14433  }
14434  if( w==27 )
14435  {
14436  r = -1.660e+00;
14437  }
14438  if( w==26 )
14439  {
14440  r = -1.774e+00;
14441  }
14442  if( w==25 )
14443  {
14444  r = -1.893e+00;
14445  }
14446  if( w==24 )
14447  {
14448  r = -2.017e+00;
14449  }
14450  if( w==23 )
14451  {
14452  r = -2.148e+00;
14453  }
14454  if( w==22 )
14455  {
14456  r = -2.285e+00;
14457  }
14458  if( w==21 )
14459  {
14460  r = -2.429e+00;
14461  }
14462  if( w==20 )
14463  {
14464  r = -2.581e+00;
14465  }
14466  if( w==19 )
14467  {
14468  r = -2.738e+00;
14469  }
14470  if( w==18 )
14471  {
14472  r = -2.902e+00;
14473  }
14474  if( w==17 )
14475  {
14476  r = -3.076e+00;
14477  }
14478  if( w==16 )
14479  {
14480  r = -3.255e+00;
14481  }
14482  if( w==15 )
14483  {
14484  r = -3.443e+00;
14485  }
14486  if( w==14 )
14487  {
14488  r = -3.645e+00;
14489  }
14490  if( w==13 )
14491  {
14492  r = -3.852e+00;
14493  }
14494  if( w==12 )
14495  {
14496  r = -4.069e+00;
14497  }
14498  if( w==11 )
14499  {
14500  r = -4.310e+00;
14501  }
14502  if( w==10 )
14503  {
14504  r = -4.557e+00;
14505  }
14506  if( w==9 )
14507  {
14508  r = -4.821e+00;
14509  }
14510  if( w==8 )
14511  {
14512  r = -5.099e+00;
14513  }
14514  if( w==7 )
14515  {
14516  r = -5.373e+00;
14517  }
14518  if( w==6 )
14519  {
14520  r = -5.679e+00;
14521  }
14522  if( w==5 )
14523  {
14524  r = -6.015e+00;
14525  }
14526  if( w==4 )
14527  {
14528  r = -6.372e+00;
14529  }
14530  if( w==3 )
14531  {
14532  r = -6.708e+00;
14533  }
14534  if( w==2 )
14535  {
14536  r = -7.219e+00;
14537  }
14538  if( w==1 )
14539  {
14540  r = -7.625e+00;
14541  }
14542  if( w<=0 )
14543  {
14544  r = -8.318e+00;
14545  }
14546  result = r;
14547  return result;
14548 }
14549 
14550 
14551 /*************************************************************************
14552 Tail(S, 13)
14553 *************************************************************************/
14554 static double wsr_w13(double s, ae_state *_state)
14555 {
14556  ae_int_t w;
14557  double r;
14558  double result;
14559 
14560 
14561  r = 0;
14562  w = ae_round(-1.430909e+01*s+4.550000e+01, _state);
14563  if( w>=45 )
14564  {
14565  r = -6.931e-01;
14566  }
14567  if( w==44 )
14568  {
14569  r = -7.486e-01;
14570  }
14571  if( w==43 )
14572  {
14573  r = -8.068e-01;
14574  }
14575  if( w==42 )
14576  {
14577  r = -8.683e-01;
14578  }
14579  if( w==41 )
14580  {
14581  r = -9.328e-01;
14582  }
14583  if( w==40 )
14584  {
14585  r = -1.001e+00;
14586  }
14587  if( w==39 )
14588  {
14589  r = -1.072e+00;
14590  }
14591  if( w==38 )
14592  {
14593  r = -1.146e+00;
14594  }
14595  if( w==37 )
14596  {
14597  r = -1.224e+00;
14598  }
14599  if( w==36 )
14600  {
14601  r = -1.306e+00;
14602  }
14603  if( w==35 )
14604  {
14605  r = -1.392e+00;
14606  }
14607  if( w==34 )
14608  {
14609  r = -1.481e+00;
14610  }
14611  if( w==33 )
14612  {
14613  r = -1.574e+00;
14614  }
14615  if( w==32 )
14616  {
14617  r = -1.672e+00;
14618  }
14619  if( w==31 )
14620  {
14621  r = -1.773e+00;
14622  }
14623  if( w==30 )
14624  {
14625  r = -1.879e+00;
14626  }
14627  if( w==29 )
14628  {
14629  r = -1.990e+00;
14630  }
14631  if( w==28 )
14632  {
14633  r = -2.104e+00;
14634  }
14635  if( w==27 )
14636  {
14637  r = -2.224e+00;
14638  }
14639  if( w==26 )
14640  {
14641  r = -2.349e+00;
14642  }
14643  if( w==25 )
14644  {
14645  r = -2.479e+00;
14646  }
14647  if( w==24 )
14648  {
14649  r = -2.614e+00;
14650  }
14651  if( w==23 )
14652  {
14653  r = -2.755e+00;
14654  }
14655  if( w==22 )
14656  {
14657  r = -2.902e+00;
14658  }
14659  if( w==21 )
14660  {
14661  r = -3.055e+00;
14662  }
14663  if( w==20 )
14664  {
14665  r = -3.215e+00;
14666  }
14667  if( w==19 )
14668  {
14669  r = -3.380e+00;
14670  }
14671  if( w==18 )
14672  {
14673  r = -3.551e+00;
14674  }
14675  if( w==17 )
14676  {
14677  r = -3.733e+00;
14678  }
14679  if( w==16 )
14680  {
14681  r = -3.917e+00;
14682  }
14683  if( w==15 )
14684  {
14685  r = -4.113e+00;
14686  }
14687  if( w==14 )
14688  {
14689  r = -4.320e+00;
14690  }
14691  if( w==13 )
14692  {
14693  r = -4.534e+00;
14694  }
14695  if( w==12 )
14696  {
14697  r = -4.762e+00;
14698  }
14699  if( w==11 )
14700  {
14701  r = -5.004e+00;
14702  }
14703  if( w==10 )
14704  {
14705  r = -5.250e+00;
14706  }
14707  if( w==9 )
14708  {
14709  r = -5.514e+00;
14710  }
14711  if( w==8 )
14712  {
14713  r = -5.792e+00;
14714  }
14715  if( w==7 )
14716  {
14717  r = -6.066e+00;
14718  }
14719  if( w==6 )
14720  {
14721  r = -6.372e+00;
14722  }
14723  if( w==5 )
14724  {
14725  r = -6.708e+00;
14726  }
14727  if( w==4 )
14728  {
14729  r = -7.065e+00;
14730  }
14731  if( w==3 )
14732  {
14733  r = -7.401e+00;
14734  }
14735  if( w==2 )
14736  {
14737  r = -7.912e+00;
14738  }
14739  if( w==1 )
14740  {
14741  r = -8.318e+00;
14742  }
14743  if( w<=0 )
14744  {
14745  r = -9.011e+00;
14746  }
14747  result = r;
14748  return result;
14749 }
14750 
14751 
14752 /*************************************************************************
14753 Tail(S, 14)
14754 *************************************************************************/
14755 static double wsr_w14(double s, ae_state *_state)
14756 {
14757  ae_int_t w;
14758  double r;
14759  double result;
14760 
14761 
14762  r = 0;
14763  w = ae_round(-1.592953e+01*s+5.250000e+01, _state);
14764  if( w>=52 )
14765  {
14766  r = -6.931e-01;
14767  }
14768  if( w==51 )
14769  {
14770  r = -7.428e-01;
14771  }
14772  if( w==50 )
14773  {
14774  r = -7.950e-01;
14775  }
14776  if( w==49 )
14777  {
14778  r = -8.495e-01;
14779  }
14780  if( w==48 )
14781  {
14782  r = -9.067e-01;
14783  }
14784  if( w==47 )
14785  {
14786  r = -9.664e-01;
14787  }
14788  if( w==46 )
14789  {
14790  r = -1.029e+00;
14791  }
14792  if( w==45 )
14793  {
14794  r = -1.094e+00;
14795  }
14796  if( w==44 )
14797  {
14798  r = -1.162e+00;
14799  }
14800  if( w==43 )
14801  {
14802  r = -1.233e+00;
14803  }
14804  if( w==42 )
14805  {
14806  r = -1.306e+00;
14807  }
14808  if( w==41 )
14809  {
14810  r = -1.383e+00;
14811  }
14812  if( w==40 )
14813  {
14814  r = -1.463e+00;
14815  }
14816  if( w==39 )
14817  {
14818  r = -1.546e+00;
14819  }
14820  if( w==38 )
14821  {
14822  r = -1.632e+00;
14823  }
14824  if( w==37 )
14825  {
14826  r = -1.722e+00;
14827  }
14828  if( w==36 )
14829  {
14830  r = -1.815e+00;
14831  }
14832  if( w==35 )
14833  {
14834  r = -1.911e+00;
14835  }
14836  if( w==34 )
14837  {
14838  r = -2.011e+00;
14839  }
14840  if( w==33 )
14841  {
14842  r = -2.115e+00;
14843  }
14844  if( w==32 )
14845  {
14846  r = -2.223e+00;
14847  }
14848  if( w==31 )
14849  {
14850  r = -2.334e+00;
14851  }
14852  if( w==30 )
14853  {
14854  r = -2.450e+00;
14855  }
14856  if( w==29 )
14857  {
14858  r = -2.570e+00;
14859  }
14860  if( w==28 )
14861  {
14862  r = -2.694e+00;
14863  }
14864  if( w==27 )
14865  {
14866  r = -2.823e+00;
14867  }
14868  if( w==26 )
14869  {
14870  r = -2.956e+00;
14871  }
14872  if( w==25 )
14873  {
14874  r = -3.095e+00;
14875  }
14876  if( w==24 )
14877  {
14878  r = -3.238e+00;
14879  }
14880  if( w==23 )
14881  {
14882  r = -3.387e+00;
14883  }
14884  if( w==22 )
14885  {
14886  r = -3.541e+00;
14887  }
14888  if( w==21 )
14889  {
14890  r = -3.700e+00;
14891  }
14892  if( w==20 )
14893  {
14894  r = -3.866e+00;
14895  }
14896  if( w==19 )
14897  {
14898  r = -4.038e+00;
14899  }
14900  if( w==18 )
14901  {
14902  r = -4.215e+00;
14903  }
14904  if( w==17 )
14905  {
14906  r = -4.401e+00;
14907  }
14908  if( w==16 )
14909  {
14910  r = -4.592e+00;
14911  }
14912  if( w==15 )
14913  {
14914  r = -4.791e+00;
14915  }
14916  if( w==14 )
14917  {
14918  r = -5.004e+00;
14919  }
14920  if( w==13 )
14921  {
14922  r = -5.227e+00;
14923  }
14924  if( w==12 )
14925  {
14926  r = -5.456e+00;
14927  }
14928  if( w==11 )
14929  {
14930  r = -5.697e+00;
14931  }
14932  if( w==10 )
14933  {
14934  r = -5.943e+00;
14935  }
14936  if( w==9 )
14937  {
14938  r = -6.208e+00;
14939  }
14940  if( w==8 )
14941  {
14942  r = -6.485e+00;
14943  }
14944  if( w==7 )
14945  {
14946  r = -6.760e+00;
14947  }
14948  if( w==6 )
14949  {
14950  r = -7.065e+00;
14951  }
14952  if( w==5 )
14953  {
14954  r = -7.401e+00;
14955  }
14956  if( w==4 )
14957  {
14958  r = -7.758e+00;
14959  }
14960  if( w==3 )
14961  {
14962  r = -8.095e+00;
14963  }
14964  if( w==2 )
14965  {
14966  r = -8.605e+00;
14967  }
14968  if( w==1 )
14969  {
14970  r = -9.011e+00;
14971  }
14972  if( w<=0 )
14973  {
14974  r = -9.704e+00;
14975  }
14976  result = r;
14977  return result;
14978 }
14979 
14980 
14981 /*************************************************************************
14982 Tail(S, 15)
14983 *************************************************************************/
14984 static double wsr_w15(double s, ae_state *_state)
14985 {
14986  ae_int_t w;
14987  double r;
14988  double result;
14989 
14990 
14991  r = 0;
14992  w = ae_round(-1.760682e+01*s+6.000000e+01, _state);
14993  if( w>=60 )
14994  {
14995  r = -6.714e-01;
14996  }
14997  if( w==59 )
14998  {
14999  r = -7.154e-01;
15000  }
15001  if( w==58 )
15002  {
15003  r = -7.613e-01;
15004  }
15005  if( w==57 )
15006  {
15007  r = -8.093e-01;
15008  }
15009  if( w==56 )
15010  {
15011  r = -8.593e-01;
15012  }
15013  if( w==55 )
15014  {
15015  r = -9.114e-01;
15016  }
15017  if( w==54 )
15018  {
15019  r = -9.656e-01;
15020  }
15021  if( w==53 )
15022  {
15023  r = -1.022e+00;
15024  }
15025  if( w==52 )
15026  {
15027  r = -1.081e+00;
15028  }
15029  if( w==51 )
15030  {
15031  r = -1.142e+00;
15032  }
15033  if( w==50 )
15034  {
15035  r = -1.205e+00;
15036  }
15037  if( w==49 )
15038  {
15039  r = -1.270e+00;
15040  }
15041  if( w==48 )
15042  {
15043  r = -1.339e+00;
15044  }
15045  if( w==47 )
15046  {
15047  r = -1.409e+00;
15048  }
15049  if( w==46 )
15050  {
15051  r = -1.482e+00;
15052  }
15053  if( w==45 )
15054  {
15055  r = -1.558e+00;
15056  }
15057  if( w==44 )
15058  {
15059  r = -1.636e+00;
15060  }
15061  if( w==43 )
15062  {
15063  r = -1.717e+00;
15064  }
15065  if( w==42 )
15066  {
15067  r = -1.801e+00;
15068  }
15069  if( w==41 )
15070  {
15071  r = -1.888e+00;
15072  }
15073  if( w==40 )
15074  {
15075  r = -1.977e+00;
15076  }
15077  if( w==39 )
15078  {
15079  r = -2.070e+00;
15080  }
15081  if( w==38 )
15082  {
15083  r = -2.166e+00;
15084  }
15085  if( w==37 )
15086  {
15087  r = -2.265e+00;
15088  }
15089  if( w==36 )
15090  {
15091  r = -2.366e+00;
15092  }
15093  if( w==35 )
15094  {
15095  r = -2.472e+00;
15096  }
15097  if( w==34 )
15098  {
15099  r = -2.581e+00;
15100  }
15101  if( w==33 )
15102  {
15103  r = -2.693e+00;
15104  }
15105  if( w==32 )
15106  {
15107  r = -2.809e+00;
15108  }
15109  if( w==31 )
15110  {
15111  r = -2.928e+00;
15112  }
15113  if( w==30 )
15114  {
15115  r = -3.051e+00;
15116  }
15117  if( w==29 )
15118  {
15119  r = -3.179e+00;
15120  }
15121  if( w==28 )
15122  {
15123  r = -3.310e+00;
15124  }
15125  if( w==27 )
15126  {
15127  r = -3.446e+00;
15128  }
15129  if( w==26 )
15130  {
15131  r = -3.587e+00;
15132  }
15133  if( w==25 )
15134  {
15135  r = -3.732e+00;
15136  }
15137  if( w==24 )
15138  {
15139  r = -3.881e+00;
15140  }
15141  if( w==23 )
15142  {
15143  r = -4.036e+00;
15144  }
15145  if( w==22 )
15146  {
15147  r = -4.195e+00;
15148  }
15149  if( w==21 )
15150  {
15151  r = -4.359e+00;
15152  }
15153  if( w==20 )
15154  {
15155  r = -4.531e+00;
15156  }
15157  if( w==19 )
15158  {
15159  r = -4.707e+00;
15160  }
15161  if( w==18 )
15162  {
15163  r = -4.888e+00;
15164  }
15165  if( w==17 )
15166  {
15167  r = -5.079e+00;
15168  }
15169  if( w==16 )
15170  {
15171  r = -5.273e+00;
15172  }
15173  if( w==15 )
15174  {
15175  r = -5.477e+00;
15176  }
15177  if( w==14 )
15178  {
15179  r = -5.697e+00;
15180  }
15181  if( w==13 )
15182  {
15183  r = -5.920e+00;
15184  }
15185  if( w==12 )
15186  {
15187  r = -6.149e+00;
15188  }
15189  if( w==11 )
15190  {
15191  r = -6.390e+00;
15192  }
15193  if( w==10 )
15194  {
15195  r = -6.636e+00;
15196  }
15197  if( w==9 )
15198  {
15199  r = -6.901e+00;
15200  }
15201  if( w==8 )
15202  {
15203  r = -7.178e+00;
15204  }
15205  if( w==7 )
15206  {
15207  r = -7.453e+00;
15208  }
15209  if( w==6 )
15210  {
15211  r = -7.758e+00;
15212  }
15213  if( w==5 )
15214  {
15215  r = -8.095e+00;
15216  }
15217  if( w==4 )
15218  {
15219  r = -8.451e+00;
15220  }
15221  if( w==3 )
15222  {
15223  r = -8.788e+00;
15224  }
15225  if( w==2 )
15226  {
15227  r = -9.299e+00;
15228  }
15229  if( w==1 )
15230  {
15231  r = -9.704e+00;
15232  }
15233  if( w<=0 )
15234  {
15235  r = -1.040e+01;
15236  }
15237  result = r;
15238  return result;
15239 }
15240 
15241 
15242 /*************************************************************************
15243 Tail(S, 16)
15244 *************************************************************************/
15245 static double wsr_w16(double s, ae_state *_state)
15246 {
15247  ae_int_t w;
15248  double r;
15249  double result;
15250 
15251 
15252  r = 0;
15253  w = ae_round(-1.933908e+01*s+6.800000e+01, _state);
15254  if( w>=68 )
15255  {
15256  r = -6.733e-01;
15257  }
15258  if( w==67 )
15259  {
15260  r = -7.134e-01;
15261  }
15262  if( w==66 )
15263  {
15264  r = -7.551e-01;
15265  }
15266  if( w==65 )
15267  {
15268  r = -7.986e-01;
15269  }
15270  if( w==64 )
15271  {
15272  r = -8.437e-01;
15273  }
15274  if( w==63 )
15275  {
15276  r = -8.905e-01;
15277  }
15278  if( w==62 )
15279  {
15280  r = -9.391e-01;
15281  }
15282  if( w==61 )
15283  {
15284  r = -9.895e-01;
15285  }
15286  if( w==60 )
15287  {
15288  r = -1.042e+00;
15289  }
15290  if( w==59 )
15291  {
15292  r = -1.096e+00;
15293  }
15294  if( w==58 )
15295  {
15296  r = -1.152e+00;
15297  }
15298  if( w==57 )
15299  {
15300  r = -1.210e+00;
15301  }
15302  if( w==56 )
15303  {
15304  r = -1.270e+00;
15305  }
15306  if( w==55 )
15307  {
15308  r = -1.331e+00;
15309  }
15310  if( w==54 )
15311  {
15312  r = -1.395e+00;
15313  }
15314  if( w==53 )
15315  {
15316  r = -1.462e+00;
15317  }
15318  if( w==52 )
15319  {
15320  r = -1.530e+00;
15321  }
15322  if( w==51 )
15323  {
15324  r = -1.600e+00;
15325  }
15326  if( w==50 )
15327  {
15328  r = -1.673e+00;
15329  }
15330  if( w==49 )
15331  {
15332  r = -1.748e+00;
15333  }
15334  if( w==48 )
15335  {
15336  r = -1.825e+00;
15337  }
15338  if( w==47 )
15339  {
15340  r = -1.904e+00;
15341  }
15342  if( w==46 )
15343  {
15344  r = -1.986e+00;
15345  }
15346  if( w==45 )
15347  {
15348  r = -2.071e+00;
15349  }
15350  if( w==44 )
15351  {
15352  r = -2.158e+00;
15353  }
15354  if( w==43 )
15355  {
15356  r = -2.247e+00;
15357  }
15358  if( w==42 )
15359  {
15360  r = -2.339e+00;
15361  }
15362  if( w==41 )
15363  {
15364  r = -2.434e+00;
15365  }
15366  if( w==40 )
15367  {
15368  r = -2.532e+00;
15369  }
15370  if( w==39 )
15371  {
15372  r = -2.632e+00;
15373  }
15374  if( w==38 )
15375  {
15376  r = -2.735e+00;
15377  }
15378  if( w==37 )
15379  {
15380  r = -2.842e+00;
15381  }
15382  if( w==36 )
15383  {
15384  r = -2.951e+00;
15385  }
15386  if( w==35 )
15387  {
15388  r = -3.064e+00;
15389  }
15390  if( w==34 )
15391  {
15392  r = -3.179e+00;
15393  }
15394  if( w==33 )
15395  {
15396  r = -3.298e+00;
15397  }
15398  if( w==32 )
15399  {
15400  r = -3.420e+00;
15401  }
15402  if( w==31 )
15403  {
15404  r = -3.546e+00;
15405  }
15406  if( w==30 )
15407  {
15408  r = -3.676e+00;
15409  }
15410  if( w==29 )
15411  {
15412  r = -3.810e+00;
15413  }
15414  if( w==28 )
15415  {
15416  r = -3.947e+00;
15417  }
15418  if( w==27 )
15419  {
15420  r = -4.088e+00;
15421  }
15422  if( w==26 )
15423  {
15424  r = -4.234e+00;
15425  }
15426  if( w==25 )
15427  {
15428  r = -4.383e+00;
15429  }
15430  if( w==24 )
15431  {
15432  r = -4.538e+00;
15433  }
15434  if( w==23 )
15435  {
15436  r = -4.697e+00;
15437  }
15438  if( w==22 )
15439  {
15440  r = -4.860e+00;
15441  }
15442  if( w==21 )
15443  {
15444  r = -5.029e+00;
15445  }
15446  if( w==20 )
15447  {
15448  r = -5.204e+00;
15449  }
15450  if( w==19 )
15451  {
15452  r = -5.383e+00;
15453  }
15454  if( w==18 )
15455  {
15456  r = -5.569e+00;
15457  }
15458  if( w==17 )
15459  {
15460  r = -5.762e+00;
15461  }
15462  if( w==16 )
15463  {
15464  r = -5.960e+00;
15465  }
15466  if( w==15 )
15467  {
15468  r = -6.170e+00;
15469  }
15470  if( w==14 )
15471  {
15472  r = -6.390e+00;
15473  }
15474  if( w==13 )
15475  {
15476  r = -6.613e+00;
15477  }
15478  if( w==12 )
15479  {
15480  r = -6.842e+00;
15481  }
15482  if( w==11 )
15483  {
15484  r = -7.083e+00;
15485  }
15486  if( w==10 )
15487  {
15488  r = -7.329e+00;
15489  }
15490  if( w==9 )
15491  {
15492  r = -7.594e+00;
15493  }
15494  if( w==8 )
15495  {
15496  r = -7.871e+00;
15497  }
15498  if( w==7 )
15499  {
15500  r = -8.146e+00;
15501  }
15502  if( w==6 )
15503  {
15504  r = -8.451e+00;
15505  }
15506  if( w==5 )
15507  {
15508  r = -8.788e+00;
15509  }
15510  if( w==4 )
15511  {
15512  r = -9.144e+00;
15513  }
15514  if( w==3 )
15515  {
15516  r = -9.481e+00;
15517  }
15518  if( w==2 )
15519  {
15520  r = -9.992e+00;
15521  }
15522  if( w==1 )
15523  {
15524  r = -1.040e+01;
15525  }
15526  if( w<=0 )
15527  {
15528  r = -1.109e+01;
15529  }
15530  result = r;
15531  return result;
15532 }
15533 
15534 
15535 /*************************************************************************
15536 Tail(S, 17)
15537 *************************************************************************/
15538 static double wsr_w17(double s, ae_state *_state)
15539 {
15540  ae_int_t w;
15541  double r;
15542  double result;
15543 
15544 
15545  r = 0;
15546  w = ae_round(-2.112463e+01*s+7.650000e+01, _state);
15547  if( w>=76 )
15548  {
15549  r = -6.931e-01;
15550  }
15551  if( w==75 )
15552  {
15553  r = -7.306e-01;
15554  }
15555  if( w==74 )
15556  {
15557  r = -7.695e-01;
15558  }
15559  if( w==73 )
15560  {
15561  r = -8.097e-01;
15562  }
15563  if( w==72 )
15564  {
15565  r = -8.514e-01;
15566  }
15567  if( w==71 )
15568  {
15569  r = -8.946e-01;
15570  }
15571  if( w==70 )
15572  {
15573  r = -9.392e-01;
15574  }
15575  if( w==69 )
15576  {
15577  r = -9.853e-01;
15578  }
15579  if( w==68 )
15580  {
15581  r = -1.033e+00;
15582  }
15583  if( w==67 )
15584  {
15585  r = -1.082e+00;
15586  }
15587  if( w==66 )
15588  {
15589  r = -1.133e+00;
15590  }
15591  if( w==65 )
15592  {
15593  r = -1.185e+00;
15594  }
15595  if( w==64 )
15596  {
15597  r = -1.240e+00;
15598  }
15599  if( w==63 )
15600  {
15601  r = -1.295e+00;
15602  }
15603  if( w==62 )
15604  {
15605  r = -1.353e+00;
15606  }
15607  if( w==61 )
15608  {
15609  r = -1.412e+00;
15610  }
15611  if( w==60 )
15612  {
15613  r = -1.473e+00;
15614  }
15615  if( w==59 )
15616  {
15617  r = -1.536e+00;
15618  }
15619  if( w==58 )
15620  {
15621  r = -1.600e+00;
15622  }
15623  if( w==57 )
15624  {
15625  r = -1.666e+00;
15626  }
15627  if( w==56 )
15628  {
15629  r = -1.735e+00;
15630  }
15631  if( w==55 )
15632  {
15633  r = -1.805e+00;
15634  }
15635  if( w==54 )
15636  {
15637  r = -1.877e+00;
15638  }
15639  if( w==53 )
15640  {
15641  r = -1.951e+00;
15642  }
15643  if( w==52 )
15644  {
15645  r = -2.028e+00;
15646  }
15647  if( w==51 )
15648  {
15649  r = -2.106e+00;
15650  }
15651  if( w==50 )
15652  {
15653  r = -2.186e+00;
15654  }
15655  if( w==49 )
15656  {
15657  r = -2.269e+00;
15658  }
15659  if( w==48 )
15660  {
15661  r = -2.353e+00;
15662  }
15663  if( w==47 )
15664  {
15665  r = -2.440e+00;
15666  }
15667  if( w==46 )
15668  {
15669  r = -2.530e+00;
15670  }
15671  if( w==45 )
15672  {
15673  r = -2.621e+00;
15674  }
15675  if( w==44 )
15676  {
15677  r = -2.715e+00;
15678  }
15679  if( w==43 )
15680  {
15681  r = -2.812e+00;
15682  }
15683  if( w==42 )
15684  {
15685  r = -2.911e+00;
15686  }
15687  if( w==41 )
15688  {
15689  r = -3.012e+00;
15690  }
15691  if( w==40 )
15692  {
15693  r = -3.116e+00;
15694  }
15695  if( w==39 )
15696  {
15697  r = -3.223e+00;
15698  }
15699  if( w==38 )
15700  {
15701  r = -3.332e+00;
15702  }
15703  if( w==37 )
15704  {
15705  r = -3.445e+00;
15706  }
15707  if( w==36 )
15708  {
15709  r = -3.560e+00;
15710  }
15711  if( w==35 )
15712  {
15713  r = -3.678e+00;
15714  }
15715  if( w==34 )
15716  {
15717  r = -3.799e+00;
15718  }
15719  if( w==33 )
15720  {
15721  r = -3.924e+00;
15722  }
15723  if( w==32 )
15724  {
15725  r = -4.052e+00;
15726  }
15727  if( w==31 )
15728  {
15729  r = -4.183e+00;
15730  }
15731  if( w==30 )
15732  {
15733  r = -4.317e+00;
15734  }
15735  if( w==29 )
15736  {
15737  r = -4.456e+00;
15738  }
15739  if( w==28 )
15740  {
15741  r = -4.597e+00;
15742  }
15743  if( w==27 )
15744  {
15745  r = -4.743e+00;
15746  }
15747  if( w==26 )
15748  {
15749  r = -4.893e+00;
15750  }
15751  if( w==25 )
15752  {
15753  r = -5.047e+00;
15754  }
15755  if( w==24 )
15756  {
15757  r = -5.204e+00;
15758  }
15759  if( w==23 )
15760  {
15761  r = -5.367e+00;
15762  }
15763  if( w==22 )
15764  {
15765  r = -5.534e+00;
15766  }
15767  if( w==21 )
15768  {
15769  r = -5.706e+00;
15770  }
15771  if( w==20 )
15772  {
15773  r = -5.884e+00;
15774  }
15775  if( w==19 )
15776  {
15777  r = -6.066e+00;
15778  }
15779  if( w==18 )
15780  {
15781  r = -6.254e+00;
15782  }
15783  if( w==17 )
15784  {
15785  r = -6.451e+00;
15786  }
15787  if( w==16 )
15788  {
15789  r = -6.654e+00;
15790  }
15791  if( w==15 )
15792  {
15793  r = -6.864e+00;
15794  }
15795  if( w==14 )
15796  {
15797  r = -7.083e+00;
15798  }
15799  if( w==13 )
15800  {
15801  r = -7.306e+00;
15802  }
15803  if( w==12 )
15804  {
15805  r = -7.535e+00;
15806  }
15807  if( w==11 )
15808  {
15809  r = -7.776e+00;
15810  }
15811  if( w==10 )
15812  {
15813  r = -8.022e+00;
15814  }
15815  if( w==9 )
15816  {
15817  r = -8.287e+00;
15818  }
15819  if( w==8 )
15820  {
15821  r = -8.565e+00;
15822  }
15823  if( w==7 )
15824  {
15825  r = -8.839e+00;
15826  }
15827  if( w==6 )
15828  {
15829  r = -9.144e+00;
15830  }
15831  if( w==5 )
15832  {
15833  r = -9.481e+00;
15834  }
15835  if( w==4 )
15836  {
15837  r = -9.838e+00;
15838  }
15839  if( w==3 )
15840  {
15841  r = -1.017e+01;
15842  }
15843  if( w==2 )
15844  {
15845  r = -1.068e+01;
15846  }
15847  if( w==1 )
15848  {
15849  r = -1.109e+01;
15850  }
15851  if( w<=0 )
15852  {
15853  r = -1.178e+01;
15854  }
15855  result = r;
15856  return result;
15857 }
15858 
15859 
15860 /*************************************************************************
15861 Tail(S, 18)
15862 *************************************************************************/
15863 static double wsr_w18(double s, ae_state *_state)
15864 {
15865  ae_int_t w;
15866  double r;
15867  double result;
15868 
15869 
15870  r = 0;
15871  w = ae_round(-2.296193e+01*s+8.550000e+01, _state);
15872  if( w>=85 )
15873  {
15874  r = -6.931e-01;
15875  }
15876  if( w==84 )
15877  {
15878  r = -7.276e-01;
15879  }
15880  if( w==83 )
15881  {
15882  r = -7.633e-01;
15883  }
15884  if( w==82 )
15885  {
15886  r = -8.001e-01;
15887  }
15888  if( w==81 )
15889  {
15890  r = -8.381e-01;
15891  }
15892  if( w==80 )
15893  {
15894  r = -8.774e-01;
15895  }
15896  if( w==79 )
15897  {
15898  r = -9.179e-01;
15899  }
15900  if( w==78 )
15901  {
15902  r = -9.597e-01;
15903  }
15904  if( w==77 )
15905  {
15906  r = -1.003e+00;
15907  }
15908  if( w==76 )
15909  {
15910  r = -1.047e+00;
15911  }
15912  if( w==75 )
15913  {
15914  r = -1.093e+00;
15915  }
15916  if( w==74 )
15917  {
15918  r = -1.140e+00;
15919  }
15920  if( w==73 )
15921  {
15922  r = -1.188e+00;
15923  }
15924  if( w==72 )
15925  {
15926  r = -1.238e+00;
15927  }
15928  if( w==71 )
15929  {
15930  r = -1.289e+00;
15931  }
15932  if( w==70 )
15933  {
15934  r = -1.342e+00;
15935  }
15936  if( w==69 )
15937  {
15938  r = -1.396e+00;
15939  }
15940  if( w==68 )
15941  {
15942  r = -1.452e+00;
15943  }
15944  if( w==67 )
15945  {
15946  r = -1.509e+00;
15947  }
15948  if( w==66 )
15949  {
15950  r = -1.568e+00;
15951  }
15952  if( w==65 )
15953  {
15954  r = -1.628e+00;
15955  }
15956  if( w==64 )
15957  {
15958  r = -1.690e+00;
15959  }
15960  if( w==63 )
15961  {
15962  r = -1.753e+00;
15963  }
15964  if( w==62 )
15965  {
15966  r = -1.818e+00;
15967  }
15968  if( w==61 )
15969  {
15970  r = -1.885e+00;
15971  }
15972  if( w==60 )
15973  {
15974  r = -1.953e+00;
15975  }
15976  if( w==59 )
15977  {
15978  r = -2.023e+00;
15979  }
15980  if( w==58 )
15981  {
15982  r = -2.095e+00;
15983  }
15984  if( w==57 )
15985  {
15986  r = -2.168e+00;
15987  }
15988  if( w==56 )
15989  {
15990  r = -2.244e+00;
15991  }
15992  if( w==55 )
15993  {
15994  r = -2.321e+00;
15995  }
15996  if( w==54 )
15997  {
15998  r = -2.400e+00;
15999  }
16000  if( w==53 )
16001  {
16002  r = -2.481e+00;
16003  }
16004  if( w==52 )
16005  {
16006  r = -2.564e+00;
16007  }
16008  if( w==51 )
16009  {
16010  r = -2.648e+00;
16011  }
16012  if( w==50 )
16013  {
16014  r = -2.735e+00;
16015  }
16016  if( w==49 )
16017  {
16018  r = -2.824e+00;
16019  }
16020  if( w==48 )
16021  {
16022  r = -2.915e+00;
16023  }
16024  if( w==47 )
16025  {
16026  r = -3.008e+00;
16027  }
16028  if( w==46 )
16029  {
16030  r = -3.104e+00;
16031  }
16032  if( w==45 )
16033  {
16034  r = -3.201e+00;
16035  }
16036  if( w==44 )
16037  {
16038  r = -3.301e+00;
16039  }
16040  if( w==43 )
16041  {
16042  r = -3.403e+00;
16043  }
16044  if( w==42 )
16045  {
16046  r = -3.508e+00;
16047  }
16048  if( w==41 )
16049  {
16050  r = -3.615e+00;
16051  }
16052  if( w==40 )
16053  {
16054  r = -3.724e+00;
16055  }
16056  if( w==39 )
16057  {
16058  r = -3.836e+00;
16059  }
16060  if( w==38 )
16061  {
16062  r = -3.950e+00;
16063  }
16064  if( w==37 )
16065  {
16066  r = -4.068e+00;
16067  }
16068  if( w==36 )
16069  {
16070  r = -4.188e+00;
16071  }
16072  if( w==35 )
16073  {
16074  r = -4.311e+00;
16075  }
16076  if( w==34 )
16077  {
16078  r = -4.437e+00;
16079  }
16080  if( w==33 )
16081  {
16082  r = -4.565e+00;
16083  }
16084  if( w==32 )
16085  {
16086  r = -4.698e+00;
16087  }
16088  if( w==31 )
16089  {
16090  r = -4.833e+00;
16091  }
16092  if( w==30 )
16093  {
16094  r = -4.971e+00;
16095  }
16096  if( w==29 )
16097  {
16098  r = -5.113e+00;
16099  }
16100  if( w==28 )
16101  {
16102  r = -5.258e+00;
16103  }
16104  if( w==27 )
16105  {
16106  r = -5.408e+00;
16107  }
16108  if( w==26 )
16109  {
16110  r = -5.561e+00;
16111  }
16112  if( w==25 )
16113  {
16114  r = -5.717e+00;
16115  }
16116  if( w==24 )
16117  {
16118  r = -5.878e+00;
16119  }
16120  if( w==23 )
16121  {
16122  r = -6.044e+00;
16123  }
16124  if( w==22 )
16125  {
16126  r = -6.213e+00;
16127  }
16128  if( w==21 )
16129  {
16130  r = -6.388e+00;
16131  }
16132  if( w==20 )
16133  {
16134  r = -6.569e+00;
16135  }
16136  if( w==19 )
16137  {
16138  r = -6.753e+00;
16139  }
16140  if( w==18 )
16141  {
16142  r = -6.943e+00;
16143  }
16144  if( w==17 )
16145  {
16146  r = -7.144e+00;
16147  }
16148  if( w==16 )
16149  {
16150  r = -7.347e+00;
16151  }
16152  if( w==15 )
16153  {
16154  r = -7.557e+00;
16155  }
16156  if( w==14 )
16157  {
16158  r = -7.776e+00;
16159  }
16160  if( w==13 )
16161  {
16162  r = -7.999e+00;
16163  }
16164  if( w==12 )
16165  {
16166  r = -8.228e+00;
16167  }
16168  if( w==11 )
16169  {
16170  r = -8.469e+00;
16171  }
16172  if( w==10 )
16173  {
16174  r = -8.715e+00;
16175  }
16176  if( w==9 )
16177  {
16178  r = -8.980e+00;
16179  }
16180  if( w==8 )
16181  {
16182  r = -9.258e+00;
16183  }
16184  if( w==7 )
16185  {
16186  r = -9.532e+00;
16187  }
16188  if( w==6 )
16189  {
16190  r = -9.838e+00;
16191  }
16192  if( w==5 )
16193  {
16194  r = -1.017e+01;
16195  }
16196  if( w==4 )
16197  {
16198  r = -1.053e+01;
16199  }
16200  if( w==3 )
16201  {
16202  r = -1.087e+01;
16203  }
16204  if( w==2 )
16205  {
16206  r = -1.138e+01;
16207  }
16208  if( w==1 )
16209  {
16210  r = -1.178e+01;
16211  }
16212  if( w<=0 )
16213  {
16214  r = -1.248e+01;
16215  }
16216  result = r;
16217  return result;
16218 }
16219 
16220 
16221 /*************************************************************************
16222 Tail(S, 19)
16223 *************************************************************************/
16224 static double wsr_w19(double s, ae_state *_state)
16225 {
16226  ae_int_t w;
16227  double r;
16228  double result;
16229 
16230 
16231  r = 0;
16232  w = ae_round(-2.484955e+01*s+9.500000e+01, _state);
16233  if( w>=95 )
16234  {
16235  r = -6.776e-01;
16236  }
16237  if( w==94 )
16238  {
16239  r = -7.089e-01;
16240  }
16241  if( w==93 )
16242  {
16243  r = -7.413e-01;
16244  }
16245  if( w==92 )
16246  {
16247  r = -7.747e-01;
16248  }
16249  if( w==91 )
16250  {
16251  r = -8.090e-01;
16252  }
16253  if( w==90 )
16254  {
16255  r = -8.445e-01;
16256  }
16257  if( w==89 )
16258  {
16259  r = -8.809e-01;
16260  }
16261  if( w==88 )
16262  {
16263  r = -9.185e-01;
16264  }
16265  if( w==87 )
16266  {
16267  r = -9.571e-01;
16268  }
16269  if( w==86 )
16270  {
16271  r = -9.968e-01;
16272  }
16273  if( w==85 )
16274  {
16275  r = -1.038e+00;
16276  }
16277  if( w==84 )
16278  {
16279  r = -1.080e+00;
16280  }
16281  if( w==83 )
16282  {
16283  r = -1.123e+00;
16284  }
16285  if( w==82 )
16286  {
16287  r = -1.167e+00;
16288  }
16289  if( w==81 )
16290  {
16291  r = -1.213e+00;
16292  }
16293  if( w==80 )
16294  {
16295  r = -1.259e+00;
16296  }
16297  if( w==79 )
16298  {
16299  r = -1.307e+00;
16300  }
16301  if( w==78 )
16302  {
16303  r = -1.356e+00;
16304  }
16305  if( w==77 )
16306  {
16307  r = -1.407e+00;
16308  }
16309  if( w==76 )
16310  {
16311  r = -1.458e+00;
16312  }
16313  if( w==75 )
16314  {
16315  r = -1.511e+00;
16316  }
16317  if( w==74 )
16318  {
16319  r = -1.565e+00;
16320  }
16321  if( w==73 )
16322  {
16323  r = -1.621e+00;
16324  }
16325  if( w==72 )
16326  {
16327  r = -1.678e+00;
16328  }
16329  if( w==71 )
16330  {
16331  r = -1.736e+00;
16332  }
16333  if( w==70 )
16334  {
16335  r = -1.796e+00;
16336  }
16337  if( w==69 )
16338  {
16339  r = -1.857e+00;
16340  }
16341  if( w==68 )
16342  {
16343  r = -1.919e+00;
16344  }
16345  if( w==67 )
16346  {
16347  r = -1.983e+00;
16348  }
16349  if( w==66 )
16350  {
16351  r = -2.048e+00;
16352  }
16353  if( w==65 )
16354  {
16355  r = -2.115e+00;
16356  }
16357  if( w==64 )
16358  {
16359  r = -2.183e+00;
16360  }
16361  if( w==63 )
16362  {
16363  r = -2.253e+00;
16364  }
16365  if( w==62 )
16366  {
16367  r = -2.325e+00;
16368  }
16369  if( w==61 )
16370  {
16371  r = -2.398e+00;
16372  }
16373  if( w==60 )
16374  {
16375  r = -2.472e+00;
16376  }
16377  if( w==59 )
16378  {
16379  r = -2.548e+00;
16380  }
16381  if( w==58 )
16382  {
16383  r = -2.626e+00;
16384  }
16385  if( w==57 )
16386  {
16387  r = -2.706e+00;
16388  }
16389  if( w==56 )
16390  {
16391  r = -2.787e+00;
16392  }
16393  if( w==55 )
16394  {
16395  r = -2.870e+00;
16396  }
16397  if( w==54 )
16398  {
16399  r = -2.955e+00;
16400  }
16401  if( w==53 )
16402  {
16403  r = -3.042e+00;
16404  }
16405  if( w==52 )
16406  {
16407  r = -3.130e+00;
16408  }
16409  if( w==51 )
16410  {
16411  r = -3.220e+00;
16412  }
16413  if( w==50 )
16414  {
16415  r = -3.313e+00;
16416  }
16417  if( w==49 )
16418  {
16419  r = -3.407e+00;
16420  }
16421  if( w==48 )
16422  {
16423  r = -3.503e+00;
16424  }
16425  if( w==47 )
16426  {
16427  r = -3.601e+00;
16428  }
16429  if( w==46 )
16430  {
16431  r = -3.702e+00;
16432  }
16433  if( w==45 )
16434  {
16435  r = -3.804e+00;
16436  }
16437  if( w==44 )
16438  {
16439  r = -3.909e+00;
16440  }
16441  if( w==43 )
16442  {
16443  r = -4.015e+00;
16444  }
16445  if( w==42 )
16446  {
16447  r = -4.125e+00;
16448  }
16449  if( w==41 )
16450  {
16451  r = -4.236e+00;
16452  }
16453  if( w==40 )
16454  {
16455  r = -4.350e+00;
16456  }
16457  if( w==39 )
16458  {
16459  r = -4.466e+00;
16460  }
16461  if( w==38 )
16462  {
16463  r = -4.585e+00;
16464  }
16465  if( w==37 )
16466  {
16467  r = -4.706e+00;
16468  }
16469  if( w==36 )
16470  {
16471  r = -4.830e+00;
16472  }
16473  if( w==35 )
16474  {
16475  r = -4.957e+00;
16476  }
16477  if( w==34 )
16478  {
16479  r = -5.086e+00;
16480  }
16481  if( w==33 )
16482  {
16483  r = -5.219e+00;
16484  }
16485  if( w==32 )
16486  {
16487  r = -5.355e+00;
16488  }
16489  if( w==31 )
16490  {
16491  r = -5.493e+00;
16492  }
16493  if( w==30 )
16494  {
16495  r = -5.634e+00;
16496  }
16497  if( w==29 )
16498  {
16499  r = -5.780e+00;
16500  }
16501  if( w==28 )
16502  {
16503  r = -5.928e+00;
16504  }
16505  if( w==27 )
16506  {
16507  r = -6.080e+00;
16508  }
16509  if( w==26 )
16510  {
16511  r = -6.235e+00;
16512  }
16513  if( w==25 )
16514  {
16515  r = -6.394e+00;
16516  }
16517  if( w==24 )
16518  {
16519  r = -6.558e+00;
16520  }
16521  if( w==23 )
16522  {
16523  r = -6.726e+00;
16524  }
16525  if( w==22 )
16526  {
16527  r = -6.897e+00;
16528  }
16529  if( w==21 )
16530  {
16531  r = -7.074e+00;
16532  }
16533  if( w==20 )
16534  {
16535  r = -7.256e+00;
16536  }
16537  if( w==19 )
16538  {
16539  r = -7.443e+00;
16540  }
16541  if( w==18 )
16542  {
16543  r = -7.636e+00;
16544  }
16545  if( w==17 )
16546  {
16547  r = -7.837e+00;
16548  }
16549  if( w==16 )
16550  {
16551  r = -8.040e+00;
16552  }
16553  if( w==15 )
16554  {
16555  r = -8.250e+00;
16556  }
16557  if( w==14 )
16558  {
16559  r = -8.469e+00;
16560  }
16561  if( w==13 )
16562  {
16563  r = -8.692e+00;
16564  }
16565  if( w==12 )
16566  {
16567  r = -8.921e+00;
16568  }
16569  if( w==11 )
16570  {
16571  r = -9.162e+00;
16572  }
16573  if( w==10 )
16574  {
16575  r = -9.409e+00;
16576  }
16577  if( w==9 )
16578  {
16579  r = -9.673e+00;
16580  }
16581  if( w==8 )
16582  {
16583  r = -9.951e+00;
16584  }
16585  if( w==7 )
16586  {
16587  r = -1.023e+01;
16588  }
16589  if( w==6 )
16590  {
16591  r = -1.053e+01;
16592  }
16593  if( w==5 )
16594  {
16595  r = -1.087e+01;
16596  }
16597  if( w==4 )
16598  {
16599  r = -1.122e+01;
16600  }
16601  if( w==3 )
16602  {
16603  r = -1.156e+01;
16604  }
16605  if( w==2 )
16606  {
16607  r = -1.207e+01;
16608  }
16609  if( w==1 )
16610  {
16611  r = -1.248e+01;
16612  }
16613  if( w<=0 )
16614  {
16615  r = -1.317e+01;
16616  }
16617  result = r;
16618  return result;
16619 }
16620 
16621 
16622 /*************************************************************************
16623 Tail(S, 20)
16624 *************************************************************************/
16625 static double wsr_w20(double s, ae_state *_state)
16626 {
16627  ae_int_t w;
16628  double r;
16629  double result;
16630 
16631 
16632  r = 0;
16633  w = ae_round(-2.678619e+01*s+1.050000e+02, _state);
16634  if( w>=105 )
16635  {
16636  r = -6.787e-01;
16637  }
16638  if( w==104 )
16639  {
16640  r = -7.078e-01;
16641  }
16642  if( w==103 )
16643  {
16644  r = -7.378e-01;
16645  }
16646  if( w==102 )
16647  {
16648  r = -7.686e-01;
16649  }
16650  if( w==101 )
16651  {
16652  r = -8.004e-01;
16653  }
16654  if( w==100 )
16655  {
16656  r = -8.330e-01;
16657  }
16658  if( w==99 )
16659  {
16660  r = -8.665e-01;
16661  }
16662  if( w==98 )
16663  {
16664  r = -9.010e-01;
16665  }
16666  if( w==97 )
16667  {
16668  r = -9.363e-01;
16669  }
16670  if( w==96 )
16671  {
16672  r = -9.726e-01;
16673  }
16674  if( w==95 )
16675  {
16676  r = -1.010e+00;
16677  }
16678  if( w==94 )
16679  {
16680  r = -1.048e+00;
16681  }
16682  if( w==93 )
16683  {
16684  r = -1.087e+00;
16685  }
16686  if( w==92 )
16687  {
16688  r = -1.128e+00;
16689  }
16690  if( w==91 )
16691  {
16692  r = -1.169e+00;
16693  }
16694  if( w==90 )
16695  {
16696  r = -1.211e+00;
16697  }
16698  if( w==89 )
16699  {
16700  r = -1.254e+00;
16701  }
16702  if( w==88 )
16703  {
16704  r = -1.299e+00;
16705  }
16706  if( w==87 )
16707  {
16708  r = -1.344e+00;
16709  }
16710  if( w==86 )
16711  {
16712  r = -1.390e+00;
16713  }
16714  if( w==85 )
16715  {
16716  r = -1.438e+00;
16717  }
16718  if( w==84 )
16719  {
16720  r = -1.486e+00;
16721  }
16722  if( w==83 )
16723  {
16724  r = -1.536e+00;
16725  }
16726  if( w==82 )
16727  {
16728  r = -1.587e+00;
16729  }
16730  if( w==81 )
16731  {
16732  r = -1.639e+00;
16733  }
16734  if( w==80 )
16735  {
16736  r = -1.692e+00;
16737  }
16738  if( w==79 )
16739  {
16740  r = -1.746e+00;
16741  }
16742  if( w==78 )
16743  {
16744  r = -1.802e+00;
16745  }
16746  if( w==77 )
16747  {
16748  r = -1.859e+00;
16749  }
16750  if( w==76 )
16751  {
16752  r = -1.916e+00;
16753  }
16754  if( w==75 )
16755  {
16756  r = -1.976e+00;
16757  }
16758  if( w==74 )
16759  {
16760  r = -2.036e+00;
16761  }
16762  if( w==73 )
16763  {
16764  r = -2.098e+00;
16765  }
16766  if( w==72 )
16767  {
16768  r = -2.161e+00;
16769  }
16770  if( w==71 )
16771  {
16772  r = -2.225e+00;
16773  }
16774  if( w==70 )
16775  {
16776  r = -2.290e+00;
16777  }
16778  if( w==69 )
16779  {
16780  r = -2.357e+00;
16781  }
16782  if( w==68 )
16783  {
16784  r = -2.426e+00;
16785  }
16786  if( w==67 )
16787  {
16788  r = -2.495e+00;
16789  }
16790  if( w==66 )
16791  {
16792  r = -2.566e+00;
16793  }
16794  if( w==65 )
16795  {
16796  r = -2.639e+00;
16797  }
16798  if( w==64 )
16799  {
16800  r = -2.713e+00;
16801  }
16802  if( w==63 )
16803  {
16804  r = -2.788e+00;
16805  }
16806  if( w==62 )
16807  {
16808  r = -2.865e+00;
16809  }
16810  if( w==61 )
16811  {
16812  r = -2.943e+00;
16813  }
16814  if( w==60 )
16815  {
16816  r = -3.023e+00;
16817  }
16818  if( w==59 )
16819  {
16820  r = -3.104e+00;
16821  }
16822  if( w==58 )
16823  {
16824  r = -3.187e+00;
16825  }
16826  if( w==57 )
16827  {
16828  r = -3.272e+00;
16829  }
16830  if( w==56 )
16831  {
16832  r = -3.358e+00;
16833  }
16834  if( w==55 )
16835  {
16836  r = -3.446e+00;
16837  }
16838  if( w==54 )
16839  {
16840  r = -3.536e+00;
16841  }
16842  if( w==53 )
16843  {
16844  r = -3.627e+00;
16845  }
16846  if( w==52 )
16847  {
16848  r = -3.721e+00;
16849  }
16850  if( w==51 )
16851  {
16852  r = -3.815e+00;
16853  }
16854  if( w==50 )
16855  {
16856  r = -3.912e+00;
16857  }
16858  if( w==49 )
16859  {
16860  r = -4.011e+00;
16861  }
16862  if( w==48 )
16863  {
16864  r = -4.111e+00;
16865  }
16866  if( w==47 )
16867  {
16868  r = -4.214e+00;
16869  }
16870  if( w==46 )
16871  {
16872  r = -4.318e+00;
16873  }
16874  if( w==45 )
16875  {
16876  r = -4.425e+00;
16877  }
16878  if( w==44 )
16879  {
16880  r = -4.534e+00;
16881  }
16882  if( w==43 )
16883  {
16884  r = -4.644e+00;
16885  }
16886  if( w==42 )
16887  {
16888  r = -4.757e+00;
16889  }
16890  if( w==41 )
16891  {
16892  r = -4.872e+00;
16893  }
16894  if( w==40 )
16895  {
16896  r = -4.990e+00;
16897  }
16898  if( w==39 )
16899  {
16900  r = -5.109e+00;
16901  }
16902  if( w==38 )
16903  {
16904  r = -5.232e+00;
16905  }
16906  if( w==37 )
16907  {
16908  r = -5.356e+00;
16909  }
16910  if( w==36 )
16911  {
16912  r = -5.484e+00;
16913  }
16914  if( w==35 )
16915  {
16916  r = -5.614e+00;
16917  }
16918  if( w==34 )
16919  {
16920  r = -5.746e+00;
16921  }
16922  if( w==33 )
16923  {
16924  r = -5.882e+00;
16925  }
16926  if( w==32 )
16927  {
16928  r = -6.020e+00;
16929  }
16930  if( w==31 )
16931  {
16932  r = -6.161e+00;
16933  }
16934  if( w==30 )
16935  {
16936  r = -6.305e+00;
16937  }
16938  if( w==29 )
16939  {
16940  r = -6.453e+00;
16941  }
16942  if( w==28 )
16943  {
16944  r = -6.603e+00;
16945  }
16946  if( w==27 )
16947  {
16948  r = -6.757e+00;
16949  }
16950  if( w==26 )
16951  {
16952  r = -6.915e+00;
16953  }
16954  if( w==25 )
16955  {
16956  r = -7.076e+00;
16957  }
16958  if( w==24 )
16959  {
16960  r = -7.242e+00;
16961  }
16962  if( w==23 )
16963  {
16964  r = -7.411e+00;
16965  }
16966  if( w==22 )
16967  {
16968  r = -7.584e+00;
16969  }
16970  if( w==21 )
16971  {
16972  r = -7.763e+00;
16973  }
16974  if( w==20 )
16975  {
16976  r = -7.947e+00;
16977  }
16978  if( w==19 )
16979  {
16980  r = -8.136e+00;
16981  }
16982  if( w==18 )
16983  {
16984  r = -8.330e+00;
16985  }
16986  if( w==17 )
16987  {
16988  r = -8.530e+00;
16989  }
16990  if( w==16 )
16991  {
16992  r = -8.733e+00;
16993  }
16994  if( w==15 )
16995  {
16996  r = -8.943e+00;
16997  }
16998  if( w==14 )
16999  {
17000  r = -9.162e+00;
17001  }
17002  if( w==13 )
17003  {
17004  r = -9.386e+00;
17005  }
17006  if( w==12 )
17007  {
17008  r = -9.614e+00;
17009  }
17010  if( w==11 )
17011  {
17012  r = -9.856e+00;
17013  }
17014  if( w==10 )
17015  {
17016  r = -1.010e+01;
17017  }
17018  if( w==9 )
17019  {
17020  r = -1.037e+01;
17021  }
17022  if( w==8 )
17023  {
17024  r = -1.064e+01;
17025  }
17026  if( w==7 )
17027  {
17028  r = -1.092e+01;
17029  }
17030  if( w==6 )
17031  {
17032  r = -1.122e+01;
17033  }
17034  if( w==5 )
17035  {
17036  r = -1.156e+01;
17037  }
17038  if( w==4 )
17039  {
17040  r = -1.192e+01;
17041  }
17042  if( w==3 )
17043  {
17044  r = -1.225e+01;
17045  }
17046  if( w==2 )
17047  {
17048  r = -1.276e+01;
17049  }
17050  if( w==1 )
17051  {
17052  r = -1.317e+01;
17053  }
17054  if( w<=0 )
17055  {
17056  r = -1.386e+01;
17057  }
17058  result = r;
17059  return result;
17060 }
17061 
17062 
17063 /*************************************************************************
17064 Tail(S, 21)
17065 *************************************************************************/
17066 static double wsr_w21(double s, ae_state *_state)
17067 {
17068  ae_int_t w;
17069  double r;
17070  double result;
17071 
17072 
17073  r = 0;
17074  w = ae_round(-2.877064e+01*s+1.155000e+02, _state);
17075  if( w>=115 )
17076  {
17077  r = -6.931e-01;
17078  }
17079  if( w==114 )
17080  {
17081  r = -7.207e-01;
17082  }
17083  if( w==113 )
17084  {
17085  r = -7.489e-01;
17086  }
17087  if( w==112 )
17088  {
17089  r = -7.779e-01;
17090  }
17091  if( w==111 )
17092  {
17093  r = -8.077e-01;
17094  }
17095  if( w==110 )
17096  {
17097  r = -8.383e-01;
17098  }
17099  if( w==109 )
17100  {
17101  r = -8.697e-01;
17102  }
17103  if( w==108 )
17104  {
17105  r = -9.018e-01;
17106  }
17107  if( w==107 )
17108  {
17109  r = -9.348e-01;
17110  }
17111  if( w==106 )
17112  {
17113  r = -9.685e-01;
17114  }
17115  if( w==105 )
17116  {
17117  r = -1.003e+00;
17118  }
17119  if( w==104 )
17120  {
17121  r = -1.039e+00;
17122  }
17123  if( w==103 )
17124  {
17125  r = -1.075e+00;
17126  }
17127  if( w==102 )
17128  {
17129  r = -1.112e+00;
17130  }
17131  if( w==101 )
17132  {
17133  r = -1.150e+00;
17134  }
17135  if( w==100 )
17136  {
17137  r = -1.189e+00;
17138  }
17139  if( w==99 )
17140  {
17141  r = -1.229e+00;
17142  }
17143  if( w==98 )
17144  {
17145  r = -1.269e+00;
17146  }
17147  if( w==97 )
17148  {
17149  r = -1.311e+00;
17150  }
17151  if( w==96 )
17152  {
17153  r = -1.353e+00;
17154  }
17155  if( w==95 )
17156  {
17157  r = -1.397e+00;
17158  }
17159  if( w==94 )
17160  {
17161  r = -1.441e+00;
17162  }
17163  if( w==93 )
17164  {
17165  r = -1.486e+00;
17166  }
17167  if( w==92 )
17168  {
17169  r = -1.533e+00;
17170  }
17171  if( w==91 )
17172  {
17173  r = -1.580e+00;
17174  }
17175  if( w==90 )
17176  {
17177  r = -1.628e+00;
17178  }
17179  if( w==89 )
17180  {
17181  r = -1.677e+00;
17182  }
17183  if( w==88 )
17184  {
17185  r = -1.728e+00;
17186  }
17187  if( w==87 )
17188  {
17189  r = -1.779e+00;
17190  }
17191  if( w==86 )
17192  {
17193  r = -1.831e+00;
17194  }
17195  if( w==85 )
17196  {
17197  r = -1.884e+00;
17198  }
17199  if( w==84 )
17200  {
17201  r = -1.939e+00;
17202  }
17203  if( w==83 )
17204  {
17205  r = -1.994e+00;
17206  }
17207  if( w==82 )
17208  {
17209  r = -2.051e+00;
17210  }
17211  if( w==81 )
17212  {
17213  r = -2.108e+00;
17214  }
17215  if( w==80 )
17216  {
17217  r = -2.167e+00;
17218  }
17219  if( w==79 )
17220  {
17221  r = -2.227e+00;
17222  }
17223  if( w==78 )
17224  {
17225  r = -2.288e+00;
17226  }
17227  if( w==77 )
17228  {
17229  r = -2.350e+00;
17230  }
17231  if( w==76 )
17232  {
17233  r = -2.414e+00;
17234  }
17235  if( w==75 )
17236  {
17237  r = -2.478e+00;
17238  }
17239  if( w==74 )
17240  {
17241  r = -2.544e+00;
17242  }
17243  if( w==73 )
17244  {
17245  r = -2.611e+00;
17246  }
17247  if( w==72 )
17248  {
17249  r = -2.679e+00;
17250  }
17251  if( w==71 )
17252  {
17253  r = -2.748e+00;
17254  }
17255  if( w==70 )
17256  {
17257  r = -2.819e+00;
17258  }
17259  if( w==69 )
17260  {
17261  r = -2.891e+00;
17262  }
17263  if( w==68 )
17264  {
17265  r = -2.964e+00;
17266  }
17267  if( w==67 )
17268  {
17269  r = -3.039e+00;
17270  }
17271  if( w==66 )
17272  {
17273  r = -3.115e+00;
17274  }
17275  if( w==65 )
17276  {
17277  r = -3.192e+00;
17278  }
17279  if( w==64 )
17280  {
17281  r = -3.270e+00;
17282  }
17283  if( w==63 )
17284  {
17285  r = -3.350e+00;
17286  }
17287  if( w==62 )
17288  {
17289  r = -3.432e+00;
17290  }
17291  if( w==61 )
17292  {
17293  r = -3.515e+00;
17294  }
17295  if( w==60 )
17296  {
17297  r = -3.599e+00;
17298  }
17299  if( w==59 )
17300  {
17301  r = -3.685e+00;
17302  }
17303  if( w==58 )
17304  {
17305  r = -3.772e+00;
17306  }
17307  if( w==57 )
17308  {
17309  r = -3.861e+00;
17310  }
17311  if( w==56 )
17312  {
17313  r = -3.952e+00;
17314  }
17315  if( w==55 )
17316  {
17317  r = -4.044e+00;
17318  }
17319  if( w==54 )
17320  {
17321  r = -4.138e+00;
17322  }
17323  if( w==53 )
17324  {
17325  r = -4.233e+00;
17326  }
17327  if( w==52 )
17328  {
17329  r = -4.330e+00;
17330  }
17331  if( w==51 )
17332  {
17333  r = -4.429e+00;
17334  }
17335  if( w==50 )
17336  {
17337  r = -4.530e+00;
17338  }
17339  if( w==49 )
17340  {
17341  r = -4.632e+00;
17342  }
17343  if( w==48 )
17344  {
17345  r = -4.736e+00;
17346  }
17347  if( w==47 )
17348  {
17349  r = -4.842e+00;
17350  }
17351  if( w==46 )
17352  {
17353  r = -4.950e+00;
17354  }
17355  if( w==45 )
17356  {
17357  r = -5.060e+00;
17358  }
17359  if( w==44 )
17360  {
17361  r = -5.172e+00;
17362  }
17363  if( w==43 )
17364  {
17365  r = -5.286e+00;
17366  }
17367  if( w==42 )
17368  {
17369  r = -5.402e+00;
17370  }
17371  if( w==41 )
17372  {
17373  r = -5.520e+00;
17374  }
17375  if( w==40 )
17376  {
17377  r = -5.641e+00;
17378  }
17379  if( w==39 )
17380  {
17381  r = -5.763e+00;
17382  }
17383  if( w==38 )
17384  {
17385  r = -5.889e+00;
17386  }
17387  if( w==37 )
17388  {
17389  r = -6.016e+00;
17390  }
17391  if( w==36 )
17392  {
17393  r = -6.146e+00;
17394  }
17395  if( w==35 )
17396  {
17397  r = -6.278e+00;
17398  }
17399  if( w==34 )
17400  {
17401  r = -6.413e+00;
17402  }
17403  if( w==33 )
17404  {
17405  r = -6.551e+00;
17406  }
17407  if( w==32 )
17408  {
17409  r = -6.692e+00;
17410  }
17411  if( w==31 )
17412  {
17413  r = -6.835e+00;
17414  }
17415  if( w==30 )
17416  {
17417  r = -6.981e+00;
17418  }
17419  if( w==29 )
17420  {
17421  r = -7.131e+00;
17422  }
17423  if( w==28 )
17424  {
17425  r = -7.283e+00;
17426  }
17427  if( w==27 )
17428  {
17429  r = -7.439e+00;
17430  }
17431  if( w==26 )
17432  {
17433  r = -7.599e+00;
17434  }
17435  if( w==25 )
17436  {
17437  r = -7.762e+00;
17438  }
17439  if( w==24 )
17440  {
17441  r = -7.928e+00;
17442  }
17443  if( w==23 )
17444  {
17445  r = -8.099e+00;
17446  }
17447  if( w==22 )
17448  {
17449  r = -8.274e+00;
17450  }
17451  if( w==21 )
17452  {
17453  r = -8.454e+00;
17454  }
17455  if( w==20 )
17456  {
17457  r = -8.640e+00;
17458  }
17459  if( w==19 )
17460  {
17461  r = -8.829e+00;
17462  }
17463  if( w==18 )
17464  {
17465  r = -9.023e+00;
17466  }
17467  if( w==17 )
17468  {
17469  r = -9.223e+00;
17470  }
17471  if( w==16 )
17472  {
17473  r = -9.426e+00;
17474  }
17475  if( w==15 )
17476  {
17477  r = -9.636e+00;
17478  }
17479  if( w==14 )
17480  {
17481  r = -9.856e+00;
17482  }
17483  if( w==13 )
17484  {
17485  r = -1.008e+01;
17486  }
17487  if( w==12 )
17488  {
17489  r = -1.031e+01;
17490  }
17491  if( w==11 )
17492  {
17493  r = -1.055e+01;
17494  }
17495  if( w==10 )
17496  {
17497  r = -1.079e+01;
17498  }
17499  if( w==9 )
17500  {
17501  r = -1.106e+01;
17502  }
17503  if( w==8 )
17504  {
17505  r = -1.134e+01;
17506  }
17507  if( w==7 )
17508  {
17509  r = -1.161e+01;
17510  }
17511  if( w==6 )
17512  {
17513  r = -1.192e+01;
17514  }
17515  if( w==5 )
17516  {
17517  r = -1.225e+01;
17518  }
17519  if( w==4 )
17520  {
17521  r = -1.261e+01;
17522  }
17523  if( w==3 )
17524  {
17525  r = -1.295e+01;
17526  }
17527  if( w==2 )
17528  {
17529  r = -1.346e+01;
17530  }
17531  if( w==1 )
17532  {
17533  r = -1.386e+01;
17534  }
17535  if( w<=0 )
17536  {
17537  r = -1.456e+01;
17538  }
17539  result = r;
17540  return result;
17541 }
17542 
17543 
17544 /*************************************************************************
17545 Tail(S, 22)
17546 *************************************************************************/
17547 static double wsr_w22(double s, ae_state *_state)
17548 {
17549  ae_int_t w;
17550  double r;
17551  double result;
17552 
17553 
17554  r = 0;
17555  w = ae_round(-3.080179e+01*s+1.265000e+02, _state);
17556  if( w>=126 )
17557  {
17558  r = -6.931e-01;
17559  }
17560  if( w==125 )
17561  {
17562  r = -7.189e-01;
17563  }
17564  if( w==124 )
17565  {
17566  r = -7.452e-01;
17567  }
17568  if( w==123 )
17569  {
17570  r = -7.722e-01;
17571  }
17572  if( w==122 )
17573  {
17574  r = -7.999e-01;
17575  }
17576  if( w==121 )
17577  {
17578  r = -8.283e-01;
17579  }
17580  if( w==120 )
17581  {
17582  r = -8.573e-01;
17583  }
17584  if( w==119 )
17585  {
17586  r = -8.871e-01;
17587  }
17588  if( w==118 )
17589  {
17590  r = -9.175e-01;
17591  }
17592  if( w==117 )
17593  {
17594  r = -9.486e-01;
17595  }
17596  if( w==116 )
17597  {
17598  r = -9.805e-01;
17599  }
17600  if( w==115 )
17601  {
17602  r = -1.013e+00;
17603  }
17604  if( w==114 )
17605  {
17606  r = -1.046e+00;
17607  }
17608  if( w==113 )
17609  {
17610  r = -1.080e+00;
17611  }
17612  if( w==112 )
17613  {
17614  r = -1.115e+00;
17615  }
17616  if( w==111 )
17617  {
17618  r = -1.151e+00;
17619  }
17620  if( w==110 )
17621  {
17622  r = -1.187e+00;
17623  }
17624  if( w==109 )
17625  {
17626  r = -1.224e+00;
17627  }
17628  if( w==108 )
17629  {
17630  r = -1.262e+00;
17631  }
17632  if( w==107 )
17633  {
17634  r = -1.301e+00;
17635  }
17636  if( w==106 )
17637  {
17638  r = -1.340e+00;
17639  }
17640  if( w==105 )
17641  {
17642  r = -1.381e+00;
17643  }
17644  if( w==104 )
17645  {
17646  r = -1.422e+00;
17647  }
17648  if( w==103 )
17649  {
17650  r = -1.464e+00;
17651  }
17652  if( w==102 )
17653  {
17654  r = -1.506e+00;
17655  }
17656  if( w==101 )
17657  {
17658  r = -1.550e+00;
17659  }
17660  if( w==100 )
17661  {
17662  r = -1.594e+00;
17663  }
17664  if( w==99 )
17665  {
17666  r = -1.640e+00;
17667  }
17668  if( w==98 )
17669  {
17670  r = -1.686e+00;
17671  }
17672  if( w==97 )
17673  {
17674  r = -1.733e+00;
17675  }
17676  if( w==96 )
17677  {
17678  r = -1.781e+00;
17679  }
17680  if( w==95 )
17681  {
17682  r = -1.830e+00;
17683  }
17684  if( w==94 )
17685  {
17686  r = -1.880e+00;
17687  }
17688  if( w==93 )
17689  {
17690  r = -1.930e+00;
17691  }
17692  if( w==92 )
17693  {
17694  r = -1.982e+00;
17695  }
17696  if( w==91 )
17697  {
17698  r = -2.034e+00;
17699  }
17700  if( w==90 )
17701  {
17702  r = -2.088e+00;
17703  }
17704  if( w==89 )
17705  {
17706  r = -2.142e+00;
17707  }
17708  if( w==88 )
17709  {
17710  r = -2.198e+00;
17711  }
17712  if( w==87 )
17713  {
17714  r = -2.254e+00;
17715  }
17716  if( w==86 )
17717  {
17718  r = -2.312e+00;
17719  }
17720  if( w==85 )
17721  {
17722  r = -2.370e+00;
17723  }
17724  if( w==84 )
17725  {
17726  r = -2.429e+00;
17727  }
17728  if( w==83 )
17729  {
17730  r = -2.490e+00;
17731  }
17732  if( w==82 )
17733  {
17734  r = -2.551e+00;
17735  }
17736  if( w==81 )
17737  {
17738  r = -2.614e+00;
17739  }
17740  if( w==80 )
17741  {
17742  r = -2.677e+00;
17743  }
17744  if( w==79 )
17745  {
17746  r = -2.742e+00;
17747  }
17748  if( w==78 )
17749  {
17750  r = -2.808e+00;
17751  }
17752  if( w==77 )
17753  {
17754  r = -2.875e+00;
17755  }
17756  if( w==76 )
17757  {
17758  r = -2.943e+00;
17759  }
17760  if( w==75 )
17761  {
17762  r = -3.012e+00;
17763  }
17764  if( w==74 )
17765  {
17766  r = -3.082e+00;
17767  }
17768  if( w==73 )
17769  {
17770  r = -3.153e+00;
17771  }
17772  if( w==72 )
17773  {
17774  r = -3.226e+00;
17775  }
17776  if( w==71 )
17777  {
17778  r = -3.300e+00;
17779  }
17780  if( w==70 )
17781  {
17782  r = -3.375e+00;
17783  }
17784  if( w==69 )
17785  {
17786  r = -3.451e+00;
17787  }
17788  if( w==68 )
17789  {
17790  r = -3.529e+00;
17791  }
17792  if( w==67 )
17793  {
17794  r = -3.607e+00;
17795  }
17796  if( w==66 )
17797  {
17798  r = -3.687e+00;
17799  }
17800  if( w==65 )
17801  {
17802  r = -3.769e+00;
17803  }
17804  if( w==64 )
17805  {
17806  r = -3.851e+00;
17807  }
17808  if( w==63 )
17809  {
17810  r = -3.935e+00;
17811  }
17812  if( w==62 )
17813  {
17814  r = -4.021e+00;
17815  }
17816  if( w==61 )
17817  {
17818  r = -4.108e+00;
17819  }
17820  if( w==60 )
17821  {
17822  r = -4.196e+00;
17823  }
17824  if( w==59 )
17825  {
17826  r = -4.285e+00;
17827  }
17828  if( w==58 )
17829  {
17830  r = -4.376e+00;
17831  }
17832  if( w==57 )
17833  {
17834  r = -4.469e+00;
17835  }
17836  if( w==56 )
17837  {
17838  r = -4.563e+00;
17839  }
17840  if( w==55 )
17841  {
17842  r = -4.659e+00;
17843  }
17844  if( w==54 )
17845  {
17846  r = -4.756e+00;
17847  }
17848  if( w==53 )
17849  {
17850  r = -4.855e+00;
17851  }
17852  if( w==52 )
17853  {
17854  r = -4.955e+00;
17855  }
17856  if( w==51 )
17857  {
17858  r = -5.057e+00;
17859  }
17860  if( w==50 )
17861  {
17862  r = -5.161e+00;
17863  }
17864  if( w==49 )
17865  {
17866  r = -5.266e+00;
17867  }
17868  if( w==48 )
17869  {
17870  r = -5.374e+00;
17871  }
17872  if( w==47 )
17873  {
17874  r = -5.483e+00;
17875  }
17876  if( w==46 )
17877  {
17878  r = -5.594e+00;
17879  }
17880  if( w==45 )
17881  {
17882  r = -5.706e+00;
17883  }
17884  if( w==44 )
17885  {
17886  r = -5.821e+00;
17887  }
17888  if( w==43 )
17889  {
17890  r = -5.938e+00;
17891  }
17892  if( w==42 )
17893  {
17894  r = -6.057e+00;
17895  }
17896  if( w==41 )
17897  {
17898  r = -6.177e+00;
17899  }
17900  if( w==40 )
17901  {
17902  r = -6.300e+00;
17903  }
17904  if( w==39 )
17905  {
17906  r = -6.426e+00;
17907  }
17908  if( w==38 )
17909  {
17910  r = -6.553e+00;
17911  }
17912  if( w==37 )
17913  {
17914  r = -6.683e+00;
17915  }
17916  if( w==36 )
17917  {
17918  r = -6.815e+00;
17919  }
17920  if( w==35 )
17921  {
17922  r = -6.949e+00;
17923  }
17924  if( w==34 )
17925  {
17926  r = -7.086e+00;
17927  }
17928  if( w==33 )
17929  {
17930  r = -7.226e+00;
17931  }
17932  if( w==32 )
17933  {
17934  r = -7.368e+00;
17935  }
17936  if( w==31 )
17937  {
17938  r = -7.513e+00;
17939  }
17940  if( w==30 )
17941  {
17942  r = -7.661e+00;
17943  }
17944  if( w==29 )
17945  {
17946  r = -7.813e+00;
17947  }
17948  if( w==28 )
17949  {
17950  r = -7.966e+00;
17951  }
17952  if( w==27 )
17953  {
17954  r = -8.124e+00;
17955  }
17956  if( w==26 )
17957  {
17958  r = -8.285e+00;
17959  }
17960  if( w==25 )
17961  {
17962  r = -8.449e+00;
17963  }
17964  if( w==24 )
17965  {
17966  r = -8.617e+00;
17967  }
17968  if( w==23 )
17969  {
17970  r = -8.789e+00;
17971  }
17972  if( w==22 )
17973  {
17974  r = -8.965e+00;
17975  }
17976  if( w==21 )
17977  {
17978  r = -9.147e+00;
17979  }
17980  if( w==20 )
17981  {
17982  r = -9.333e+00;
17983  }
17984  if( w==19 )
17985  {
17986  r = -9.522e+00;
17987  }
17988  if( w==18 )
17989  {
17990  r = -9.716e+00;
17991  }
17992  if( w==17 )
17993  {
17994  r = -9.917e+00;
17995  }
17996  if( w==16 )
17997  {
17998  r = -1.012e+01;
17999  }
18000  if( w==15 )
18001  {
18002  r = -1.033e+01;
18003  }
18004  if( w==14 )
18005  {
18006  r = -1.055e+01;
18007  }
18008  if( w==13 )
18009  {
18010  r = -1.077e+01;
18011  }
18012  if( w==12 )
18013  {
18014  r = -1.100e+01;
18015  }
18016  if( w==11 )
18017  {
18018  r = -1.124e+01;
18019  }
18020  if( w==10 )
18021  {
18022  r = -1.149e+01;
18023  }
18024  if( w==9 )
18025  {
18026  r = -1.175e+01;
18027  }
18028  if( w==8 )
18029  {
18030  r = -1.203e+01;
18031  }
18032  if( w==7 )
18033  {
18034  r = -1.230e+01;
18035  }
18036  if( w==6 )
18037  {
18038  r = -1.261e+01;
18039  }
18040  if( w==5 )
18041  {
18042  r = -1.295e+01;
18043  }
18044  if( w==4 )
18045  {
18046  r = -1.330e+01;
18047  }
18048  if( w==3 )
18049  {
18050  r = -1.364e+01;
18051  }
18052  if( w==2 )
18053  {
18054  r = -1.415e+01;
18055  }
18056  if( w==1 )
18057  {
18058  r = -1.456e+01;
18059  }
18060  if( w<=0 )
18061  {
18062  r = -1.525e+01;
18063  }
18064  result = r;
18065  return result;
18066 }
18067 
18068 
18069 /*************************************************************************
18070 Tail(S, 23)
18071 *************************************************************************/
18072 static double wsr_w23(double s, ae_state *_state)
18073 {
18074  ae_int_t w;
18075  double r;
18076  double result;
18077 
18078 
18079  r = 0;
18080  w = ae_round(-3.287856e+01*s+1.380000e+02, _state);
18081  if( w>=138 )
18082  {
18083  r = -6.813e-01;
18084  }
18085  if( w==137 )
18086  {
18087  r = -7.051e-01;
18088  }
18089  if( w==136 )
18090  {
18091  r = -7.295e-01;
18092  }
18093  if( w==135 )
18094  {
18095  r = -7.544e-01;
18096  }
18097  if( w==134 )
18098  {
18099  r = -7.800e-01;
18100  }
18101  if( w==133 )
18102  {
18103  r = -8.061e-01;
18104  }
18105  if( w==132 )
18106  {
18107  r = -8.328e-01;
18108  }
18109  if( w==131 )
18110  {
18111  r = -8.601e-01;
18112  }
18113  if( w==130 )
18114  {
18115  r = -8.880e-01;
18116  }
18117  if( w==129 )
18118  {
18119  r = -9.166e-01;
18120  }
18121  if( w==128 )
18122  {
18123  r = -9.457e-01;
18124  }
18125  if( w==127 )
18126  {
18127  r = -9.755e-01;
18128  }
18129  if( w==126 )
18130  {
18131  r = -1.006e+00;
18132  }
18133  if( w==125 )
18134  {
18135  r = -1.037e+00;
18136  }
18137  if( w==124 )
18138  {
18139  r = -1.069e+00;
18140  }
18141  if( w==123 )
18142  {
18143  r = -1.101e+00;
18144  }
18145  if( w==122 )
18146  {
18147  r = -1.134e+00;
18148  }
18149  if( w==121 )
18150  {
18151  r = -1.168e+00;
18152  }
18153  if( w==120 )
18154  {
18155  r = -1.202e+00;
18156  }
18157  if( w==119 )
18158  {
18159  r = -1.237e+00;
18160  }
18161  if( w==118 )
18162  {
18163  r = -1.273e+00;
18164  }
18165  if( w==117 )
18166  {
18167  r = -1.309e+00;
18168  }
18169  if( w==116 )
18170  {
18171  r = -1.347e+00;
18172  }
18173  if( w==115 )
18174  {
18175  r = -1.384e+00;
18176  }
18177  if( w==114 )
18178  {
18179  r = -1.423e+00;
18180  }
18181  if( w==113 )
18182  {
18183  r = -1.462e+00;
18184  }
18185  if( w==112 )
18186  {
18187  r = -1.502e+00;
18188  }
18189  if( w==111 )
18190  {
18191  r = -1.543e+00;
18192  }
18193  if( w==110 )
18194  {
18195  r = -1.585e+00;
18196  }
18197  if( w==109 )
18198  {
18199  r = -1.627e+00;
18200  }
18201  if( w==108 )
18202  {
18203  r = -1.670e+00;
18204  }
18205  if( w==107 )
18206  {
18207  r = -1.714e+00;
18208  }
18209  if( w==106 )
18210  {
18211  r = -1.758e+00;
18212  }
18213  if( w==105 )
18214  {
18215  r = -1.804e+00;
18216  }
18217  if( w==104 )
18218  {
18219  r = -1.850e+00;
18220  }
18221  if( w==103 )
18222  {
18223  r = -1.897e+00;
18224  }
18225  if( w==102 )
18226  {
18227  r = -1.944e+00;
18228  }
18229  if( w==101 )
18230  {
18231  r = -1.993e+00;
18232  }
18233  if( w==100 )
18234  {
18235  r = -2.042e+00;
18236  }
18237  if( w==99 )
18238  {
18239  r = -2.093e+00;
18240  }
18241  if( w==98 )
18242  {
18243  r = -2.144e+00;
18244  }
18245  if( w==97 )
18246  {
18247  r = -2.195e+00;
18248  }
18249  if( w==96 )
18250  {
18251  r = -2.248e+00;
18252  }
18253  if( w==95 )
18254  {
18255  r = -2.302e+00;
18256  }
18257  if( w==94 )
18258  {
18259  r = -2.356e+00;
18260  }
18261  if( w==93 )
18262  {
18263  r = -2.412e+00;
18264  }
18265  if( w==92 )
18266  {
18267  r = -2.468e+00;
18268  }
18269  if( w==91 )
18270  {
18271  r = -2.525e+00;
18272  }
18273  if( w==90 )
18274  {
18275  r = -2.583e+00;
18276  }
18277  if( w==89 )
18278  {
18279  r = -2.642e+00;
18280  }
18281  if( w==88 )
18282  {
18283  r = -2.702e+00;
18284  }
18285  if( w==87 )
18286  {
18287  r = -2.763e+00;
18288  }
18289  if( w==86 )
18290  {
18291  r = -2.825e+00;
18292  }
18293  if( w==85 )
18294  {
18295  r = -2.888e+00;
18296  }
18297  if( w==84 )
18298  {
18299  r = -2.951e+00;
18300  }
18301  if( w==83 )
18302  {
18303  r = -3.016e+00;
18304  }
18305  if( w==82 )
18306  {
18307  r = -3.082e+00;
18308  }
18309  if( w==81 )
18310  {
18311  r = -3.149e+00;
18312  }
18313  if( w==80 )
18314  {
18315  r = -3.216e+00;
18316  }
18317  if( w==79 )
18318  {
18319  r = -3.285e+00;
18320  }
18321  if( w==78 )
18322  {
18323  r = -3.355e+00;
18324  }
18325  if( w==77 )
18326  {
18327  r = -3.426e+00;
18328  }
18329  if( w==76 )
18330  {
18331  r = -3.498e+00;
18332  }
18333  if( w==75 )
18334  {
18335  r = -3.571e+00;
18336  }
18337  if( w==74 )
18338  {
18339  r = -3.645e+00;
18340  }
18341  if( w==73 )
18342  {
18343  r = -3.721e+00;
18344  }
18345  if( w==72 )
18346  {
18347  r = -3.797e+00;
18348  }
18349  if( w==71 )
18350  {
18351  r = -3.875e+00;
18352  }
18353  if( w==70 )
18354  {
18355  r = -3.953e+00;
18356  }
18357  if( w==69 )
18358  {
18359  r = -4.033e+00;
18360  }
18361  if( w==68 )
18362  {
18363  r = -4.114e+00;
18364  }
18365  if( w==67 )
18366  {
18367  r = -4.197e+00;
18368  }
18369  if( w==66 )
18370  {
18371  r = -4.280e+00;
18372  }
18373  if( w==65 )
18374  {
18375  r = -4.365e+00;
18376  }
18377  if( w==64 )
18378  {
18379  r = -4.451e+00;
18380  }
18381  if( w==63 )
18382  {
18383  r = -4.539e+00;
18384  }
18385  if( w==62 )
18386  {
18387  r = -4.628e+00;
18388  }
18389  if( w==61 )
18390  {
18391  r = -4.718e+00;
18392  }
18393  if( w==60 )
18394  {
18395  r = -4.809e+00;
18396  }
18397  if( w==59 )
18398  {
18399  r = -4.902e+00;
18400  }
18401  if( w==58 )
18402  {
18403  r = -4.996e+00;
18404  }
18405  if( w==57 )
18406  {
18407  r = -5.092e+00;
18408  }
18409  if( w==56 )
18410  {
18411  r = -5.189e+00;
18412  }
18413  if( w==55 )
18414  {
18415  r = -5.287e+00;
18416  }
18417  if( w==54 )
18418  {
18419  r = -5.388e+00;
18420  }
18421  if( w==53 )
18422  {
18423  r = -5.489e+00;
18424  }
18425  if( w==52 )
18426  {
18427  r = -5.592e+00;
18428  }
18429  if( w==51 )
18430  {
18431  r = -5.697e+00;
18432  }
18433  if( w==50 )
18434  {
18435  r = -5.804e+00;
18436  }
18437  if( w==49 )
18438  {
18439  r = -5.912e+00;
18440  }
18441  if( w==48 )
18442  {
18443  r = -6.022e+00;
18444  }
18445  if( w==47 )
18446  {
18447  r = -6.133e+00;
18448  }
18449  if( w==46 )
18450  {
18451  r = -6.247e+00;
18452  }
18453  if( w==45 )
18454  {
18455  r = -6.362e+00;
18456  }
18457  if( w==44 )
18458  {
18459  r = -6.479e+00;
18460  }
18461  if( w==43 )
18462  {
18463  r = -6.598e+00;
18464  }
18465  if( w==42 )
18466  {
18467  r = -6.719e+00;
18468  }
18469  if( w==41 )
18470  {
18471  r = -6.842e+00;
18472  }
18473  if( w==40 )
18474  {
18475  r = -6.967e+00;
18476  }
18477  if( w==39 )
18478  {
18479  r = -7.094e+00;
18480  }
18481  if( w==38 )
18482  {
18483  r = -7.224e+00;
18484  }
18485  if( w==37 )
18486  {
18487  r = -7.355e+00;
18488  }
18489  if( w==36 )
18490  {
18491  r = -7.489e+00;
18492  }
18493  if( w==35 )
18494  {
18495  r = -7.625e+00;
18496  }
18497  if( w==34 )
18498  {
18499  r = -7.764e+00;
18500  }
18501  if( w==33 )
18502  {
18503  r = -7.905e+00;
18504  }
18505  if( w==32 )
18506  {
18507  r = -8.049e+00;
18508  }
18509  if( w==31 )
18510  {
18511  r = -8.196e+00;
18512  }
18513  if( w==30 )
18514  {
18515  r = -8.345e+00;
18516  }
18517  if( w==29 )
18518  {
18519  r = -8.498e+00;
18520  }
18521  if( w==28 )
18522  {
18523  r = -8.653e+00;
18524  }
18525  if( w==27 )
18526  {
18527  r = -8.811e+00;
18528  }
18529  if( w==26 )
18530  {
18531  r = -8.974e+00;
18532  }
18533  if( w==25 )
18534  {
18535  r = -9.139e+00;
18536  }
18537  if( w==24 )
18538  {
18539  r = -9.308e+00;
18540  }
18541  if( w==23 )
18542  {
18543  r = -9.481e+00;
18544  }
18545  if( w==22 )
18546  {
18547  r = -9.658e+00;
18548  }
18549  if( w==21 )
18550  {
18551  r = -9.840e+00;
18552  }
18553  if( w==20 )
18554  {
18555  r = -1.003e+01;
18556  }
18557  if( w==19 )
18558  {
18559  r = -1.022e+01;
18560  }
18561  if( w==18 )
18562  {
18563  r = -1.041e+01;
18564  }
18565  if( w==17 )
18566  {
18567  r = -1.061e+01;
18568  }
18569  if( w==16 )
18570  {
18571  r = -1.081e+01;
18572  }
18573  if( w==15 )
18574  {
18575  r = -1.102e+01;
18576  }
18577  if( w==14 )
18578  {
18579  r = -1.124e+01;
18580  }
18581  if( w==13 )
18582  {
18583  r = -1.147e+01;
18584  }
18585  if( w==12 )
18586  {
18587  r = -1.169e+01;
18588  }
18589  if( w==11 )
18590  {
18591  r = -1.194e+01;
18592  }
18593  if( w==10 )
18594  {
18595  r = -1.218e+01;
18596  }
18597  if( w==9 )
18598  {
18599  r = -1.245e+01;
18600  }
18601  if( w==8 )
18602  {
18603  r = -1.272e+01;
18604  }
18605  if( w==7 )
18606  {
18607  r = -1.300e+01;
18608  }
18609  if( w==6 )
18610  {
18611  r = -1.330e+01;
18612  }
18613  if( w==5 )
18614  {
18615  r = -1.364e+01;
18616  }
18617  if( w==4 )
18618  {
18619  r = -1.400e+01;
18620  }
18621  if( w==3 )
18622  {
18623  r = -1.433e+01;
18624  }
18625  if( w==2 )
18626  {
18627  r = -1.484e+01;
18628  }
18629  if( w==1 )
18630  {
18631  r = -1.525e+01;
18632  }
18633  if( w<=0 )
18634  {
18635  r = -1.594e+01;
18636  }
18637  result = r;
18638  return result;
18639 }
18640 
18641 
18642 /*************************************************************************
18643 Tail(S, 24)
18644 *************************************************************************/
18645 static double wsr_w24(double s, ae_state *_state)
18646 {
18647  ae_int_t w;
18648  double r;
18649  double result;
18650 
18651 
18652  r = 0;
18653  w = ae_round(-3.500000e+01*s+1.500000e+02, _state);
18654  if( w>=150 )
18655  {
18656  r = -6.820e-01;
18657  }
18658  if( w==149 )
18659  {
18660  r = -7.044e-01;
18661  }
18662  if( w==148 )
18663  {
18664  r = -7.273e-01;
18665  }
18666  if( w==147 )
18667  {
18668  r = -7.507e-01;
18669  }
18670  if( w==146 )
18671  {
18672  r = -7.746e-01;
18673  }
18674  if( w==145 )
18675  {
18676  r = -7.990e-01;
18677  }
18678  if( w==144 )
18679  {
18680  r = -8.239e-01;
18681  }
18682  if( w==143 )
18683  {
18684  r = -8.494e-01;
18685  }
18686  if( w==142 )
18687  {
18688  r = -8.754e-01;
18689  }
18690  if( w==141 )
18691  {
18692  r = -9.020e-01;
18693  }
18694  if( w==140 )
18695  {
18696  r = -9.291e-01;
18697  }
18698  if( w==139 )
18699  {
18700  r = -9.567e-01;
18701  }
18702  if( w==138 )
18703  {
18704  r = -9.849e-01;
18705  }
18706  if( w==137 )
18707  {
18708  r = -1.014e+00;
18709  }
18710  if( w==136 )
18711  {
18712  r = -1.043e+00;
18713  }
18714  if( w==135 )
18715  {
18716  r = -1.073e+00;
18717  }
18718  if( w==134 )
18719  {
18720  r = -1.103e+00;
18721  }
18722  if( w==133 )
18723  {
18724  r = -1.135e+00;
18725  }
18726  if( w==132 )
18727  {
18728  r = -1.166e+00;
18729  }
18730  if( w==131 )
18731  {
18732  r = -1.198e+00;
18733  }
18734  if( w==130 )
18735  {
18736  r = -1.231e+00;
18737  }
18738  if( w==129 )
18739  {
18740  r = -1.265e+00;
18741  }
18742  if( w==128 )
18743  {
18744  r = -1.299e+00;
18745  }
18746  if( w==127 )
18747  {
18748  r = -1.334e+00;
18749  }
18750  if( w==126 )
18751  {
18752  r = -1.369e+00;
18753  }
18754  if( w==125 )
18755  {
18756  r = -1.405e+00;
18757  }
18758  if( w==124 )
18759  {
18760  r = -1.441e+00;
18761  }
18762  if( w==123 )
18763  {
18764  r = -1.479e+00;
18765  }
18766  if( w==122 )
18767  {
18768  r = -1.517e+00;
18769  }
18770  if( w==121 )
18771  {
18772  r = -1.555e+00;
18773  }
18774  if( w==120 )
18775  {
18776  r = -1.594e+00;
18777  }
18778  if( w==119 )
18779  {
18780  r = -1.634e+00;
18781  }
18782  if( w==118 )
18783  {
18784  r = -1.675e+00;
18785  }
18786  if( w==117 )
18787  {
18788  r = -1.716e+00;
18789  }
18790  if( w==116 )
18791  {
18792  r = -1.758e+00;
18793  }
18794  if( w==115 )
18795  {
18796  r = -1.800e+00;
18797  }
18798  if( w==114 )
18799  {
18800  r = -1.844e+00;
18801  }
18802  if( w==113 )
18803  {
18804  r = -1.888e+00;
18805  }
18806  if( w==112 )
18807  {
18808  r = -1.932e+00;
18809  }
18810  if( w==111 )
18811  {
18812  r = -1.978e+00;
18813  }
18814  if( w==110 )
18815  {
18816  r = -2.024e+00;
18817  }
18818  if( w==109 )
18819  {
18820  r = -2.070e+00;
18821  }
18822  if( w==108 )
18823  {
18824  r = -2.118e+00;
18825  }
18826  if( w==107 )
18827  {
18828  r = -2.166e+00;
18829  }
18830  if( w==106 )
18831  {
18832  r = -2.215e+00;
18833  }
18834  if( w==105 )
18835  {
18836  r = -2.265e+00;
18837  }
18838  if( w==104 )
18839  {
18840  r = -2.316e+00;
18841  }
18842  if( w==103 )
18843  {
18844  r = -2.367e+00;
18845  }
18846  if( w==102 )
18847  {
18848  r = -2.419e+00;
18849  }
18850  if( w==101 )
18851  {
18852  r = -2.472e+00;
18853  }
18854  if( w==100 )
18855  {
18856  r = -2.526e+00;
18857  }
18858  if( w==99 )
18859  {
18860  r = -2.580e+00;
18861  }
18862  if( w==98 )
18863  {
18864  r = -2.636e+00;
18865  }
18866  if( w==97 )
18867  {
18868  r = -2.692e+00;
18869  }
18870  if( w==96 )
18871  {
18872  r = -2.749e+00;
18873  }
18874  if( w==95 )
18875  {
18876  r = -2.806e+00;
18877  }
18878  if( w==94 )
18879  {
18880  r = -2.865e+00;
18881  }
18882  if( w==93 )
18883  {
18884  r = -2.925e+00;
18885  }
18886  if( w==92 )
18887  {
18888  r = -2.985e+00;
18889  }
18890  if( w==91 )
18891  {
18892  r = -3.046e+00;
18893  }
18894  if( w==90 )
18895  {
18896  r = -3.108e+00;
18897  }
18898  if( w==89 )
18899  {
18900  r = -3.171e+00;
18901  }
18902  if( w==88 )
18903  {
18904  r = -3.235e+00;
18905  }
18906  if( w==87 )
18907  {
18908  r = -3.300e+00;
18909  }
18910  if( w==86 )
18911  {
18912  r = -3.365e+00;
18913  }
18914  if( w==85 )
18915  {
18916  r = -3.432e+00;
18917  }
18918  if( w==84 )
18919  {
18920  r = -3.499e+00;
18921  }
18922  if( w==83 )
18923  {
18924  r = -3.568e+00;
18925  }
18926  if( w==82 )
18927  {
18928  r = -3.637e+00;
18929  }
18930  if( w==81 )
18931  {
18932  r = -3.708e+00;
18933  }
18934  if( w==80 )
18935  {
18936  r = -3.779e+00;
18937  }
18938  if( w==79 )
18939  {
18940  r = -3.852e+00;
18941  }
18942  if( w==78 )
18943  {
18944  r = -3.925e+00;
18945  }
18946  if( w==77 )
18947  {
18948  r = -4.000e+00;
18949  }
18950  if( w==76 )
18951  {
18952  r = -4.075e+00;
18953  }
18954  if( w==75 )
18955  {
18956  r = -4.151e+00;
18957  }
18958  if( w==74 )
18959  {
18960  r = -4.229e+00;
18961  }
18962  if( w==73 )
18963  {
18964  r = -4.308e+00;
18965  }
18966  if( w==72 )
18967  {
18968  r = -4.387e+00;
18969  }
18970  if( w==71 )
18971  {
18972  r = -4.468e+00;
18973  }
18974  if( w==70 )
18975  {
18976  r = -4.550e+00;
18977  }
18978  if( w==69 )
18979  {
18980  r = -4.633e+00;
18981  }
18982  if( w==68 )
18983  {
18984  r = -4.718e+00;
18985  }
18986  if( w==67 )
18987  {
18988  r = -4.803e+00;
18989  }
18990  if( w==66 )
18991  {
18992  r = -4.890e+00;
18993  }
18994  if( w==65 )
18995  {
18996  r = -4.978e+00;
18997  }
18998  if( w==64 )
18999  {
19000  r = -5.067e+00;
19001  }
19002  if( w==63 )
19003  {
19004  r = -5.157e+00;
19005  }
19006  if( w==62 )
19007  {
19008  r = -5.249e+00;
19009  }
19010  if( w==61 )
19011  {
19012  r = -5.342e+00;
19013  }
19014  if( w==60 )
19015  {
19016  r = -5.436e+00;
19017  }
19018  if( w==59 )
19019  {
19020  r = -5.531e+00;
19021  }
19022  if( w==58 )
19023  {
19024  r = -5.628e+00;
19025  }
19026  if( w==57 )
19027  {
19028  r = -5.727e+00;
19029  }
19030  if( w==56 )
19031  {
19032  r = -5.826e+00;
19033  }
19034  if( w==55 )
19035  {
19036  r = -5.927e+00;
19037  }
19038  if( w==54 )
19039  {
19040  r = -6.030e+00;
19041  }
19042  if( w==53 )
19043  {
19044  r = -6.134e+00;
19045  }
19046  if( w==52 )
19047  {
19048  r = -6.240e+00;
19049  }
19050  if( w==51 )
19051  {
19052  r = -6.347e+00;
19053  }
19054  if( w==50 )
19055  {
19056  r = -6.456e+00;
19057  }
19058  if( w==49 )
19059  {
19060  r = -6.566e+00;
19061  }
19062  if( w==48 )
19063  {
19064  r = -6.678e+00;
19065  }
19066  if( w==47 )
19067  {
19068  r = -6.792e+00;
19069  }
19070  if( w==46 )
19071  {
19072  r = -6.907e+00;
19073  }
19074  if( w==45 )
19075  {
19076  r = -7.025e+00;
19077  }
19078  if( w==44 )
19079  {
19080  r = -7.144e+00;
19081  }
19082  if( w==43 )
19083  {
19084  r = -7.265e+00;
19085  }
19086  if( w==42 )
19087  {
19088  r = -7.387e+00;
19089  }
19090  if( w==41 )
19091  {
19092  r = -7.512e+00;
19093  }
19094  if( w==40 )
19095  {
19096  r = -7.639e+00;
19097  }
19098  if( w==39 )
19099  {
19100  r = -7.768e+00;
19101  }
19102  if( w==38 )
19103  {
19104  r = -7.899e+00;
19105  }
19106  if( w==37 )
19107  {
19108  r = -8.032e+00;
19109  }
19110  if( w==36 )
19111  {
19112  r = -8.167e+00;
19113  }
19114  if( w==35 )
19115  {
19116  r = -8.305e+00;
19117  }
19118  if( w==34 )
19119  {
19120  r = -8.445e+00;
19121  }
19122  if( w==33 )
19123  {
19124  r = -8.588e+00;
19125  }
19126  if( w==32 )
19127  {
19128  r = -8.733e+00;
19129  }
19130  if( w==31 )
19131  {
19132  r = -8.881e+00;
19133  }
19134  if( w==30 )
19135  {
19136  r = -9.031e+00;
19137  }
19138  if( w==29 )
19139  {
19140  r = -9.185e+00;
19141  }
19142  if( w==28 )
19143  {
19144  r = -9.341e+00;
19145  }
19146  if( w==27 )
19147  {
19148  r = -9.501e+00;
19149  }
19150  if( w==26 )
19151  {
19152  r = -9.664e+00;
19153  }
19154  if( w==25 )
19155  {
19156  r = -9.830e+00;
19157  }
19158  if( w==24 )
19159  {
19160  r = -1.000e+01;
19161  }
19162  if( w==23 )
19163  {
19164  r = -1.017e+01;
19165  }
19166  if( w==22 )
19167  {
19168  r = -1.035e+01;
19169  }
19170  if( w==21 )
19171  {
19172  r = -1.053e+01;
19173  }
19174  if( w==20 )
19175  {
19176  r = -1.072e+01;
19177  }
19178  if( w==19 )
19179  {
19180  r = -1.091e+01;
19181  }
19182  if( w==18 )
19183  {
19184  r = -1.110e+01;
19185  }
19186  if( w==17 )
19187  {
19188  r = -1.130e+01;
19189  }
19190  if( w==16 )
19191  {
19192  r = -1.151e+01;
19193  }
19194  if( w==15 )
19195  {
19196  r = -1.172e+01;
19197  }
19198  if( w==14 )
19199  {
19200  r = -1.194e+01;
19201  }
19202  if( w==13 )
19203  {
19204  r = -1.216e+01;
19205  }
19206  if( w==12 )
19207  {
19208  r = -1.239e+01;
19209  }
19210  if( w==11 )
19211  {
19212  r = -1.263e+01;
19213  }
19214  if( w==10 )
19215  {
19216  r = -1.287e+01;
19217  }
19218  if( w==9 )
19219  {
19220  r = -1.314e+01;
19221  }
19222  if( w==8 )
19223  {
19224  r = -1.342e+01;
19225  }
19226  if( w==7 )
19227  {
19228  r = -1.369e+01;
19229  }
19230  if( w==6 )
19231  {
19232  r = -1.400e+01;
19233  }
19234  if( w==5 )
19235  {
19236  r = -1.433e+01;
19237  }
19238  if( w==4 )
19239  {
19240  r = -1.469e+01;
19241  }
19242  if( w==3 )
19243  {
19244  r = -1.503e+01;
19245  }
19246  if( w==2 )
19247  {
19248  r = -1.554e+01;
19249  }
19250  if( w==1 )
19251  {
19252  r = -1.594e+01;
19253  }
19254  if( w<=0 )
19255  {
19256  r = -1.664e+01;
19257  }
19258  result = r;
19259  return result;
19260 }
19261 
19262 
19263 /*************************************************************************
19264 Tail(S, 25)
19265 *************************************************************************/
19266 static double wsr_w25(double s, ae_state *_state)
19267 {
19268  double x;
19269  double tj;
19270  double tj1;
19271  double result;
19272 
19273 
19274  result = 0;
19275  x = ae_minreal(2*(s-0.000000e+00)/4.000000e+00-1, 1.0, _state);
19276  tj = 1;
19277  tj1 = x;
19278  wsr_wcheb(x, -5.150509e+00, &tj, &tj1, &result, _state);
19279  wsr_wcheb(x, -5.695528e+00, &tj, &tj1, &result, _state);
19280  wsr_wcheb(x, -1.437637e+00, &tj, &tj1, &result, _state);
19281  wsr_wcheb(x, -2.611906e-01, &tj, &tj1, &result, _state);
19282  wsr_wcheb(x, -7.625722e-02, &tj, &tj1, &result, _state);
19283  wsr_wcheb(x, -2.579892e-02, &tj, &tj1, &result, _state);
19284  wsr_wcheb(x, -1.086876e-02, &tj, &tj1, &result, _state);
19285  wsr_wcheb(x, -2.906543e-03, &tj, &tj1, &result, _state);
19286  wsr_wcheb(x, -2.354881e-03, &tj, &tj1, &result, _state);
19287  wsr_wcheb(x, 1.007195e-04, &tj, &tj1, &result, _state);
19288  wsr_wcheb(x, -8.437327e-04, &tj, &tj1, &result, _state);
19289  return result;
19290 }
19291 
19292 
19293 /*************************************************************************
19294 Tail(S, 26)
19295 *************************************************************************/
19296 static double wsr_w26(double s, ae_state *_state)
19297 {
19298  double x;
19299  double tj;
19300  double tj1;
19301  double result;
19302 
19303 
19304  result = 0;
19305  x = ae_minreal(2*(s-0.000000e+00)/4.000000e+00-1, 1.0, _state);
19306  tj = 1;
19307  tj1 = x;
19308  wsr_wcheb(x, -5.117622e+00, &tj, &tj1, &result, _state);
19309  wsr_wcheb(x, -5.635159e+00, &tj, &tj1, &result, _state);
19310  wsr_wcheb(x, -1.395167e+00, &tj, &tj1, &result, _state);
19311  wsr_wcheb(x, -2.382823e-01, &tj, &tj1, &result, _state);
19312  wsr_wcheb(x, -6.531987e-02, &tj, &tj1, &result, _state);
19313  wsr_wcheb(x, -2.060112e-02, &tj, &tj1, &result, _state);
19314  wsr_wcheb(x, -8.203697e-03, &tj, &tj1, &result, _state);
19315  wsr_wcheb(x, -1.516523e-03, &tj, &tj1, &result, _state);
19316  wsr_wcheb(x, -1.431364e-03, &tj, &tj1, &result, _state);
19317  wsr_wcheb(x, 6.384553e-04, &tj, &tj1, &result, _state);
19318  wsr_wcheb(x, -3.238369e-04, &tj, &tj1, &result, _state);
19319  return result;
19320 }
19321 
19322 
19323 /*************************************************************************
19324 Tail(S, 27)
19325 *************************************************************************/
19326 static double wsr_w27(double s, ae_state *_state)
19327 {
19328  double x;
19329  double tj;
19330  double tj1;
19331  double result;
19332 
19333 
19334  result = 0;
19335  x = ae_minreal(2*(s-0.000000e+00)/4.000000e+00-1, 1.0, _state);
19336  tj = 1;
19337  tj1 = x;
19338  wsr_wcheb(x, -5.089731e+00, &tj, &tj1, &result, _state);
19339  wsr_wcheb(x, -5.584248e+00, &tj, &tj1, &result, _state);
19340  wsr_wcheb(x, -1.359966e+00, &tj, &tj1, &result, _state);
19341  wsr_wcheb(x, -2.203696e-01, &tj, &tj1, &result, _state);
19342  wsr_wcheb(x, -5.753344e-02, &tj, &tj1, &result, _state);
19343  wsr_wcheb(x, -1.761891e-02, &tj, &tj1, &result, _state);
19344  wsr_wcheb(x, -7.096897e-03, &tj, &tj1, &result, _state);
19345  wsr_wcheb(x, -1.419108e-03, &tj, &tj1, &result, _state);
19346  wsr_wcheb(x, -1.581214e-03, &tj, &tj1, &result, _state);
19347  wsr_wcheb(x, 3.033766e-04, &tj, &tj1, &result, _state);
19348  wsr_wcheb(x, -5.901441e-04, &tj, &tj1, &result, _state);
19349  return result;
19350 }
19351 
19352 
19353 /*************************************************************************
19354 Tail(S, 28)
19355 *************************************************************************/
19356 static double wsr_w28(double s, ae_state *_state)
19357 {
19358  double x;
19359  double tj;
19360  double tj1;
19361  double result;
19362 
19363 
19364  result = 0;
19365  x = ae_minreal(2*(s-0.000000e+00)/4.000000e+00-1, 1.0, _state);
19366  tj = 1;
19367  tj1 = x;
19368  wsr_wcheb(x, -5.065046e+00, &tj, &tj1, &result, _state);
19369  wsr_wcheb(x, -5.539163e+00, &tj, &tj1, &result, _state);
19370  wsr_wcheb(x, -1.328939e+00, &tj, &tj1, &result, _state);
19371  wsr_wcheb(x, -2.046376e-01, &tj, &tj1, &result, _state);
19372  wsr_wcheb(x, -5.061515e-02, &tj, &tj1, &result, _state);
19373  wsr_wcheb(x, -1.469271e-02, &tj, &tj1, &result, _state);
19374  wsr_wcheb(x, -5.711578e-03, &tj, &tj1, &result, _state);
19375  wsr_wcheb(x, -8.389153e-04, &tj, &tj1, &result, _state);
19376  wsr_wcheb(x, -1.250575e-03, &tj, &tj1, &result, _state);
19377  wsr_wcheb(x, 4.047245e-04, &tj, &tj1, &result, _state);
19378  wsr_wcheb(x, -5.128555e-04, &tj, &tj1, &result, _state);
19379  return result;
19380 }
19381 
19382 
19383 /*************************************************************************
19384 Tail(S, 29)
19385 *************************************************************************/
19386 static double wsr_w29(double s, ae_state *_state)
19387 {
19388  double x;
19389  double tj;
19390  double tj1;
19391  double result;
19392 
19393 
19394  result = 0;
19395  x = ae_minreal(2*(s-0.000000e+00)/4.000000e+00-1, 1.0, _state);
19396  tj = 1;
19397  tj1 = x;
19398  wsr_wcheb(x, -5.043413e+00, &tj, &tj1, &result, _state);
19399  wsr_wcheb(x, -5.499756e+00, &tj, &tj1, &result, _state);
19400  wsr_wcheb(x, -1.302137e+00, &tj, &tj1, &result, _state);
19401  wsr_wcheb(x, -1.915129e-01, &tj, &tj1, &result, _state);
19402  wsr_wcheb(x, -4.516329e-02, &tj, &tj1, &result, _state);
19403  wsr_wcheb(x, -1.260064e-02, &tj, &tj1, &result, _state);
19404  wsr_wcheb(x, -4.817269e-03, &tj, &tj1, &result, _state);
19405  wsr_wcheb(x, -5.478130e-04, &tj, &tj1, &result, _state);
19406  wsr_wcheb(x, -1.111668e-03, &tj, &tj1, &result, _state);
19407  wsr_wcheb(x, 4.093451e-04, &tj, &tj1, &result, _state);
19408  wsr_wcheb(x, -5.135860e-04, &tj, &tj1, &result, _state);
19409  return result;
19410 }
19411 
19412 
19413 /*************************************************************************
19414 Tail(S, 30)
19415 *************************************************************************/
19416 static double wsr_w30(double s, ae_state *_state)
19417 {
19418  double x;
19419  double tj;
19420  double tj1;
19421  double result;
19422 
19423 
19424  result = 0;
19425  x = ae_minreal(2*(s-0.000000e+00)/4.000000e+00-1, 1.0, _state);
19426  tj = 1;
19427  tj1 = x;
19428  wsr_wcheb(x, -5.024071e+00, &tj, &tj1, &result, _state);
19429  wsr_wcheb(x, -5.464515e+00, &tj, &tj1, &result, _state);
19430  wsr_wcheb(x, -1.278342e+00, &tj, &tj1, &result, _state);
19431  wsr_wcheb(x, -1.800030e-01, &tj, &tj1, &result, _state);
19432  wsr_wcheb(x, -4.046294e-02, &tj, &tj1, &result, _state);
19433  wsr_wcheb(x, -1.076162e-02, &tj, &tj1, &result, _state);
19434  wsr_wcheb(x, -3.968677e-03, &tj, &tj1, &result, _state);
19435  wsr_wcheb(x, -1.911679e-04, &tj, &tj1, &result, _state);
19436  wsr_wcheb(x, -8.619185e-04, &tj, &tj1, &result, _state);
19437  wsr_wcheb(x, 5.125362e-04, &tj, &tj1, &result, _state);
19438  wsr_wcheb(x, -3.984370e-04, &tj, &tj1, &result, _state);
19439  return result;
19440 }
19441 
19442 
19443 /*************************************************************************
19444 Tail(S, 40)
19445 *************************************************************************/
19446 static double wsr_w40(double s, ae_state *_state)
19447 {
19448  double x;
19449  double tj;
19450  double tj1;
19451  double result;
19452 
19453 
19454  result = 0;
19455  x = ae_minreal(2*(s-0.000000e+00)/4.000000e+00-1, 1.0, _state);
19456  tj = 1;
19457  tj1 = x;
19458  wsr_wcheb(x, -4.904809e+00, &tj, &tj1, &result, _state);
19459  wsr_wcheb(x, -5.248327e+00, &tj, &tj1, &result, _state);
19460  wsr_wcheb(x, -1.136698e+00, &tj, &tj1, &result, _state);
19461  wsr_wcheb(x, -1.170982e-01, &tj, &tj1, &result, _state);
19462  wsr_wcheb(x, -1.824427e-02, &tj, &tj1, &result, _state);
19463  wsr_wcheb(x, -3.888648e-03, &tj, &tj1, &result, _state);
19464  wsr_wcheb(x, -1.344929e-03, &tj, &tj1, &result, _state);
19465  wsr_wcheb(x, 2.790407e-04, &tj, &tj1, &result, _state);
19466  wsr_wcheb(x, -4.619858e-04, &tj, &tj1, &result, _state);
19467  wsr_wcheb(x, 3.359121e-04, &tj, &tj1, &result, _state);
19468  wsr_wcheb(x, -2.883026e-04, &tj, &tj1, &result, _state);
19469  return result;
19470 }
19471 
19472 
19473 /*************************************************************************
19474 Tail(S, 60)
19475 *************************************************************************/
19476 static double wsr_w60(double s, ae_state *_state)
19477 {
19478  double x;
19479  double tj;
19480  double tj1;
19481  double result;
19482 
19483 
19484  result = 0;
19485  x = ae_minreal(2*(s-0.000000e+00)/4.000000e+00-1, 1.0, _state);
19486  tj = 1;
19487  tj1 = x;
19488  wsr_wcheb(x, -4.809656e+00, &tj, &tj1, &result, _state);
19489  wsr_wcheb(x, -5.077191e+00, &tj, &tj1, &result, _state);
19490  wsr_wcheb(x, -1.029402e+00, &tj, &tj1, &result, _state);
19491  wsr_wcheb(x, -7.507931e-02, &tj, &tj1, &result, _state);
19492  wsr_wcheb(x, -6.506226e-03, &tj, &tj1, &result, _state);
19493  wsr_wcheb(x, -1.391278e-03, &tj, &tj1, &result, _state);
19494  wsr_wcheb(x, -4.263635e-04, &tj, &tj1, &result, _state);
19495  wsr_wcheb(x, 2.302271e-04, &tj, &tj1, &result, _state);
19496  wsr_wcheb(x, -2.384348e-04, &tj, &tj1, &result, _state);
19497  wsr_wcheb(x, 1.865587e-04, &tj, &tj1, &result, _state);
19498  wsr_wcheb(x, -1.622355e-04, &tj, &tj1, &result, _state);
19499  return result;
19500 }
19501 
19502 
19503 /*************************************************************************
19504 Tail(S, 120)
19505 *************************************************************************/
19506 static double wsr_w120(double s, ae_state *_state)
19507 {
19508  double x;
19509  double tj;
19510  double tj1;
19511  double result;
19512 
19513 
19514  result = 0;
19515  x = ae_minreal(2*(s-0.000000e+00)/4.000000e+00-1, 1.0, _state);
19516  tj = 1;
19517  tj1 = x;
19518  wsr_wcheb(x, -4.729426e+00, &tj, &tj1, &result, _state);
19519  wsr_wcheb(x, -4.934426e+00, &tj, &tj1, &result, _state);
19520  wsr_wcheb(x, -9.433231e-01, &tj, &tj1, &result, _state);
19521  wsr_wcheb(x, -4.492504e-02, &tj, &tj1, &result, _state);
19522  wsr_wcheb(x, 1.673948e-05, &tj, &tj1, &result, _state);
19523  wsr_wcheb(x, -6.077014e-04, &tj, &tj1, &result, _state);
19524  wsr_wcheb(x, -7.215768e-05, &tj, &tj1, &result, _state);
19525  wsr_wcheb(x, 9.086734e-05, &tj, &tj1, &result, _state);
19526  wsr_wcheb(x, -8.447980e-05, &tj, &tj1, &result, _state);
19527  wsr_wcheb(x, 6.705028e-05, &tj, &tj1, &result, _state);
19528  wsr_wcheb(x, -5.828507e-05, &tj, &tj1, &result, _state);
19529  return result;
19530 }
19531 
19532 
19533 /*************************************************************************
19534 Tail(S, 200)
19535 *************************************************************************/
19536 static double wsr_w200(double s, ae_state *_state)
19537 {
19538  double x;
19539  double tj;
19540  double tj1;
19541  double result;
19542 
19543 
19544  result = 0;
19545  x = ae_minreal(2*(s-0.000000e+00)/4.000000e+00-1, 1.0, _state);
19546  tj = 1;
19547  tj1 = x;
19548  wsr_wcheb(x, -4.700240e+00, &tj, &tj1, &result, _state);
19549  wsr_wcheb(x, -4.883080e+00, &tj, &tj1, &result, _state);
19550  wsr_wcheb(x, -9.132168e-01, &tj, &tj1, &result, _state);
19551  wsr_wcheb(x, -3.512684e-02, &tj, &tj1, &result, _state);
19552  wsr_wcheb(x, 1.726342e-03, &tj, &tj1, &result, _state);
19553  wsr_wcheb(x, -5.189796e-04, &tj, &tj1, &result, _state);
19554  wsr_wcheb(x, -1.628659e-06, &tj, &tj1, &result, _state);
19555  wsr_wcheb(x, 4.261786e-05, &tj, &tj1, &result, _state);
19556  wsr_wcheb(x, -4.002498e-05, &tj, &tj1, &result, _state);
19557  wsr_wcheb(x, 3.146287e-05, &tj, &tj1, &result, _state);
19558  wsr_wcheb(x, -2.727576e-05, &tj, &tj1, &result, _state);
19559  return result;
19560 }
19561 
19562 
19563 /*************************************************************************
19564 Tail(S,N), S>=0
19565 *************************************************************************/
19566 static double wsr_wsigma(double s, ae_int_t n, ae_state *_state)
19567 {
19568  double f0;
19569  double f1;
19570  double f2;
19571  double f3;
19572  double f4;
19573  double x0;
19574  double x1;
19575  double x2;
19576  double x3;
19577  double x4;
19578  double x;
19579  double result;
19580 
19581 
19582  result = 0;
19583  if( n==5 )
19584  {
19585  result = wsr_w5(s, _state);
19586  }
19587  if( n==6 )
19588  {
19589  result = wsr_w6(s, _state);
19590  }
19591  if( n==7 )
19592  {
19593  result = wsr_w7(s, _state);
19594  }
19595  if( n==8 )
19596  {
19597  result = wsr_w8(s, _state);
19598  }
19599  if( n==9 )
19600  {
19601  result = wsr_w9(s, _state);
19602  }
19603  if( n==10 )
19604  {
19605  result = wsr_w10(s, _state);
19606  }
19607  if( n==11 )
19608  {
19609  result = wsr_w11(s, _state);
19610  }
19611  if( n==12 )
19612  {
19613  result = wsr_w12(s, _state);
19614  }
19615  if( n==13 )
19616  {
19617  result = wsr_w13(s, _state);
19618  }
19619  if( n==14 )
19620  {
19621  result = wsr_w14(s, _state);
19622  }
19623  if( n==15 )
19624  {
19625  result = wsr_w15(s, _state);
19626  }
19627  if( n==16 )
19628  {
19629  result = wsr_w16(s, _state);
19630  }
19631  if( n==17 )
19632  {
19633  result = wsr_w17(s, _state);
19634  }
19635  if( n==18 )
19636  {
19637  result = wsr_w18(s, _state);
19638  }
19639  if( n==19 )
19640  {
19641  result = wsr_w19(s, _state);
19642  }
19643  if( n==20 )
19644  {
19645  result = wsr_w20(s, _state);
19646  }
19647  if( n==21 )
19648  {
19649  result = wsr_w21(s, _state);
19650  }
19651  if( n==22 )
19652  {
19653  result = wsr_w22(s, _state);
19654  }
19655  if( n==23 )
19656  {
19657  result = wsr_w23(s, _state);
19658  }
19659  if( n==24 )
19660  {
19661  result = wsr_w24(s, _state);
19662  }
19663  if( n==25 )
19664  {
19665  result = wsr_w25(s, _state);
19666  }
19667  if( n==26 )
19668  {
19669  result = wsr_w26(s, _state);
19670  }
19671  if( n==27 )
19672  {
19673  result = wsr_w27(s, _state);
19674  }
19675  if( n==28 )
19676  {
19677  result = wsr_w28(s, _state);
19678  }
19679  if( n==29 )
19680  {
19681  result = wsr_w29(s, _state);
19682  }
19683  if( n==30 )
19684  {
19685  result = wsr_w30(s, _state);
19686  }
19687  if( n>30 )
19688  {
19689  x = 1.0/n;
19690  x0 = 1.0/30;
19691  f0 = wsr_w30(s, _state);
19692  x1 = 1.0/40;
19693  f1 = wsr_w40(s, _state);
19694  x2 = 1.0/60;
19695  f2 = wsr_w60(s, _state);
19696  x3 = 1.0/120;
19697  f3 = wsr_w120(s, _state);
19698  x4 = 1.0/200;
19699  f4 = wsr_w200(s, _state);
19700  f1 = ((x-x0)*f1-(x-x1)*f0)/(x1-x0);
19701  f2 = ((x-x0)*f2-(x-x2)*f0)/(x2-x0);
19702  f3 = ((x-x0)*f3-(x-x3)*f0)/(x3-x0);
19703  f4 = ((x-x0)*f4-(x-x4)*f0)/(x4-x0);
19704  f2 = ((x-x1)*f2-(x-x2)*f1)/(x2-x1);
19705  f3 = ((x-x1)*f3-(x-x3)*f1)/(x3-x1);
19706  f4 = ((x-x1)*f4-(x-x4)*f1)/(x4-x1);
19707  f3 = ((x-x2)*f3-(x-x3)*f2)/(x3-x2);
19708  f4 = ((x-x2)*f4-(x-x4)*f2)/(x4-x2);
19709  f4 = ((x-x3)*f4-(x-x4)*f3)/(x4-x3);
19710  result = f4;
19711  }
19712  return result;
19713 }
19714 
19715 
19716 
19717 }
19718 
void smp_covm(const real_2d_array &x, real_2d_array &c)
Definition: statistics.cpp:947
struct alglib_impl::ae_state ae_state
double log2(double x, ae_state *_state)
ae_bool ae_fp_greater_eq(double v1, double v2)
Definition: ap.cpp:1351
#define yc
double samplevariance(ae_vector *x, ae_int_t n, ae_state *_state)
void rmatrixgemm(const ae_int_t m, const ae_int_t n, const ae_int_t k, const double alpha, const real_2d_array &a, const ae_int_t ia, const ae_int_t ja, const ae_int_t optypea, const real_2d_array &b, const ae_int_t ib, const ae_int_t jb, const ae_int_t optypeb, const double beta, const real_2d_array &c, const ae_int_t ic, const ae_int_t jc)
Definition: linalg.cpp:590
void rmatrixsyrk(const ae_int_t n, const ae_int_t k, const double alpha, const real_2d_array &a, const ae_int_t ia, const ae_int_t ja, const ae_int_t optypea, const double beta, const real_2d_array &c, const ae_int_t ic, const ae_int_t jc, const bool isupper)
Definition: linalg.cpp:518
double binomialcdistribution(const ae_int_t k, const ae_int_t n, const double p)
ae_int_t cols
Definition: ap.h:445
ae_bool ae_shared_pool_init(void *_dst, ae_state *state, ae_bool make_automatic)
Definition: ap.cpp:2864
double studenttdistribution(const ae_int_t k, const double t)
void _pexec_covm2(ae_matrix *x, ae_matrix *y, ae_int_t n, ae_int_t m1, ae_int_t m2, ae_matrix *c, ae_state *_state)
void _pexec_spearmancorrm(ae_matrix *x, ae_int_t n, ae_int_t m, ae_matrix *c, ae_state *_state)
void smp_pearsoncorrm(const real_2d_array &x, real_2d_array &c)
void ae_shared_pool_retrieve(ae_shared_pool *pool, ae_smart_ptr *pptr, ae_state *state)
Definition: ap.cpp:3122
double ae_fabs(double x, ae_state *state)
Definition: ap.cpp:1520
void pearsoncorrm2(ae_matrix *x, ae_matrix *y, ae_int_t n, ae_int_t m1, ae_int_t m2, ae_matrix *c, ae_state *_state)
void _pexec_rankdata(ae_matrix *xy, ae_int_t npoints, ae_int_t nfeatures, ae_state *_state)
doublereal * c
#define ae_false
Definition: ap.h:196
union alglib_impl::ae_matrix::@12 ptr
double inttoreal(ae_int_t a, ae_state *_state)
void ae_frame_make(ae_state *state, ae_frame *tmp)
Definition: ap.cpp:402
static double * y
void tagsortfast(ae_vector *a, ae_vector *bufa, ae_int_t n, ae_state *_state)
ae_bool apservisfinitematrix(ae_matrix *x, ae_int_t m, ae_int_t n, ae_state *_state)
void rankdatacentered(ae_matrix *xy, ae_int_t npoints, ae_int_t nfeatures, ae_state *_state)
doublereal * w
void ftest(ae_vector *x, ae_int_t n, ae_vector *y, ae_int_t m, double *bothtails, double *lefttail, double *righttail, ae_state *_state)
double * p_double
Definition: ap.h:437
void rankdata(ae_matrix *xy, ae_int_t npoints, ae_int_t nfeatures, ae_state *_state)
void ae_shared_pool_recycle(ae_shared_pool *pool, ae_smart_ptr *pptr, ae_state *state)
Definition: ap.cpp:3192
void sampleadev(ae_vector *x, ae_int_t n, double *adev, ae_state *_state)
void onesamplevariancetest(ae_vector *x, ae_int_t n, double variance, double *bothtails, double *lefttail, double *righttail, ae_state *_state)
double samplemean(ae_vector *x, ae_int_t n, ae_state *_state)
void ae_state_clear(ae_state *state)
Definition: ap.cpp:373
const alglib_impl::ae_matrix * c_ptr() const
Definition: ap.cpp:6463
ae_bool ae_fp_eq(double v1, double v2)
Definition: ap.cpp:1313
void wilcoxonsignedranktest(ae_vector *x, ae_int_t n, double e, double *bothtails, double *lefttail, double *righttail, ae_state *_state)
void smp_pearsoncorrm2(const real_2d_array &x, const real_2d_array &y, real_2d_array &c)
void samplemoments(ae_vector *x, ae_int_t n, double *mean, double *variance, double *skewness, double *kurtosis, ae_state *_state)
void _pexec_spearmancorrm2(ae_matrix *x, ae_matrix *y, ae_int_t n, ae_int_t m1, ae_int_t m2, ae_matrix *c, ae_state *_state)
ae_bool ae_matrix_init_copy(ae_matrix *dst, ae_matrix *src, ae_state *state, ae_bool make_automatic)
Definition: ap.cpp:801
ae_bool ae_matrix_init(ae_matrix *dst, ae_int_t rows, ae_int_t cols, ae_datatype datatype, ae_state *state, ae_bool make_automatic)
Definition: ap.cpp:756
doublereal * x
double binomialdistribution(const ae_int_t k, const ae_int_t n, const double p)
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
void _apbuffers_destroy(void *_p)
void _pexec_pearsoncorrm(ae_matrix *x, ae_int_t n, ae_int_t m, ae_matrix *c, ae_state *_state)
void median(MultidimArray< T > &x, MultidimArray< T > &y, T &m)
Definition: filters.h:1055
void _pexec_covm(ae_matrix *x, ae_int_t n, ae_int_t m, ae_matrix *c, ae_state *_state)
void _pexec_pearsoncorrm2(ae_matrix *x, ae_matrix *y, ae_int_t n, ae_int_t m1, ae_int_t m2, ae_matrix *c, ae_state *_state)
double cov2(ae_vector *x, ae_vector *y, ae_int_t n, ae_state *_state)
double vv
void smp_spearmancorrm(const real_2d_array &x, real_2d_array &c)
ae_int_t ae_v_len(ae_int_t a, ae_int_t b)
Definition: ap.cpp:4562
void covm2(ae_matrix *x, ae_matrix *y, ae_int_t n, ae_int_t m1, ae_int_t m2, ae_matrix *c, ae_state *_state)
void mannwhitneyutest(ae_vector *x, ae_int_t n, ae_vector *y, ae_int_t m, double *bothtails, double *lefttail, double *righttail, ae_state *_state)
doublereal * b
void ae_shared_pool_set_seed(ae_shared_pool *dst, void *seed_object, ae_int_t size_of_object, ae_bool(*init)(void *dst, ae_state *state, ae_bool make_automatic), ae_bool(*init_copy)(void *dst, void *src, ae_state *state, ae_bool make_automatic), void(*destroy)(void *ptr), ae_state *state)
Definition: ap.cpp:3079
double v1
#define y0
#define x0
void pearsoncorrm(ae_matrix *x, ae_int_t n, ae_int_t m, ae_matrix *c, ae_state *_state)
void ae_v_move(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n)
Definition: ap.cpp:4371
ae_int_t rows
Definition: ap.h:444
ae_bool _apbuffers_init_copy(void *_dst, void *_src, ae_state *_state, ae_bool make_automatic)
void spearmancorrm(ae_matrix *x, ae_int_t n, ae_int_t m, ae_matrix *c, ae_state *_state)
ae_int_t length() const
Definition: ap.cpp:5882
void rmatrixtranspose(const ae_int_t m, const ae_int_t n, const real_2d_array &a, const ae_int_t ia, const ae_int_t ja, real_2d_array &b, const ae_int_t ib, const ae_int_t jb)
Definition: linalg.cpp:82
ae_bool ae_fp_less(double v1, double v2)
Definition: ap.cpp:1327
void rankx(ae_vector *x, ae_int_t n, ae_bool iscentered, apbuffers *buf, ae_state *_state)
void jarqueberatest(ae_vector *x, ae_int_t n, double *p, ae_state *_state)
ae_bool ae_smart_ptr_init(ae_smart_ptr *dst, void **subscriber, ae_state *state, ae_bool make_automatic)
Definition: ap.cpp:967
void samplepercentile(ae_vector *x, ae_int_t n, double p, double *v, ae_state *_state)
double samplekurtosis(ae_vector *x, ae_int_t n, ae_state *_state)
double incompletebeta(const double a, const double b, const double x)
#define ae_bool
Definition: ap.h:194
ae_bool ae_fp_neq(double v1, double v2)
Definition: ap.cpp:1321
ae_bool isfinitevector(ae_vector *x, ae_int_t n, ae_state *_state)
void studentttest1(ae_vector *x, ae_int_t n, double mean, double *bothtails, double *lefttail, double *righttail, ae_state *_state)
double spearmancorr2(ae_vector *x, ae_vector *y, ae_int_t n, ae_state *_state)
double ae_maxreal(double m1, double m2, ae_state *state)
Definition: ap.cpp:1577
ae_error_type
Definition: ap.h:201
ae_bool ae_vector_set_length(ae_vector *dst, ae_int_t newsize, ae_state *state)
Definition: ap.cpp:658
void ae_v_sub(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n)
Definition: ap.cpp:4506
void smp_covm2(const real_2d_array &x, const real_2d_array &y, real_2d_array &c)
struct alglib_impl::ae_vector ae_vector
ae_bool _apbuffers_init(void *_p, ae_state *_state, ae_bool make_automatic)
const alglib_impl::ae_vector * c_ptr() const
Definition: ap.cpp:5907
#define j
double ae_minreal(double m1, double m2, ae_state *state)
Definition: ap.cpp:1582
void unequalvariancettest(ae_vector *x, ae_int_t n, ae_vector *y, ae_int_t m, double *bothtails, double *lefttail, double *righttail, ae_state *_state)
struct alglib_impl::ae_shared_pool ae_shared_pool
double spearmanrankcorrelation(ae_vector *x, ae_vector *y, ae_int_t n, ae_state *_state)
void _pexec_rankdatacentered(ae_matrix *xy, ae_int_t npoints, ae_int_t nfeatures, ae_state *_state)
int m
double pearsoncorrelation(ae_vector *x, ae_vector *y, ae_int_t n, ae_state *_state)
struct alglib_impl::ae_matrix ae_matrix
void onesamplesigntest(ae_vector *x, ae_int_t n, double median, double *bothtails, double *lefttail, double *righttail, ae_state *_state)
ae_int_t ae_ifloor(double x, ae_state *state)
Definition: ap.cpp:1557
double ** pp_double
Definition: ap.h:455
void studentttest2(ae_vector *x, ae_int_t n, ae_vector *y, ae_int_t m, double *bothtails, double *lefttail, double *righttail, ae_state *_state)
void ae_state_init(ae_state *state)
Definition: ap.cpp:309
double pearsoncorr2(ae_vector *x, ae_vector *y, ae_int_t n, ae_state *_state)
double ae_sqrt(double x, ae_state *state)
Definition: ap.cpp:1535
void ae_assert(ae_bool cond, const char *msg, ae_state *state)
Definition: ap.cpp:1227
union alglib_impl::ae_vector::@11 ptr
ae_int_t rows() const
Definition: ap.cpp:6419
const char *volatile error_msg
Definition: ap.h:389
void smp_spearmancorrm2(const real_2d_array &x, const real_2d_array &y, real_2d_array &c)
void rmatrixenforcesymmetricity(const real_2d_array &a, const ae_int_t n, const bool isupper)
Definition: linalg.cpp:108
void covm(ae_matrix *x, ae_int_t n, ae_int_t m, ae_matrix *c, ae_state *_state)
double ae_exp(double x, ae_state *state)
Definition: ap.cpp:1689
void spearmanrankcorrelationsignificance(double r, ae_int_t n, double *bothtails, double *lefttail, double *righttail, ae_state *_state)
int mu
void smp_rankdatacentered(real_2d_array &xy)
ptrdiff_t ae_int_t
Definition: ap.h:186
double chisquaredistribution(const double v, const double x)
doublereal * u
ae_bool ae_vector_init(ae_vector *dst, ae_int_t size, ae_datatype datatype, ae_state *state, ae_bool make_automatic)
Definition: ap.cpp:580
ae_int_t ae_maxint(ae_int_t m1, ae_int_t m2, ae_state *state)
Definition: ap.cpp:1567
ae_bool ae_isfinite(double x, ae_state *state)
Definition: ap.cpp:1495
double ae_sqr(double x, ae_state *state)
Definition: ap.cpp:1530
void samplemedian(ae_vector *x, ae_int_t n, double *median, ae_state *_state)
ae_int_t * p_int
Definition: ap.h:436
void spearmancorrm2(ae_matrix *x, ae_matrix *y, ae_int_t n, ae_int_t m1, ae_int_t m2, ae_matrix *c, ae_state *_state)
void ae_v_addd(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n, double alpha)
Definition: ap.cpp:4479
ae_bool ae_vector_init_copy(ae_vector *dst, ae_vector *src, ae_state *state, ae_bool make_automatic)
Definition: ap.cpp:614
ae_bool ae_fp_less_eq(double v1, double v2)
Definition: ap.cpp:1335
ae_int_t ae_round(double x, ae_state *state)
Definition: ap.cpp:1547
alglib_impl::ae_int_t ae_int_t
Definition: ap.h:889
double sampleskewness(ae_vector *x, ae_int_t n, ae_state *_state)
void ae_frame_leave(ae_state *state)
Definition: ap.cpp:415
ae_bool * p_bool
Definition: ap.h:435
void ae_matrix_clear(ae_matrix *dst)
Definition: ap.cpp:891
#define ae_true
Definition: ap.h:195
int * n
ae_int_t cols() const
Definition: ap.cpp:6426
ae_bool ae_fp_greater(double v1, double v2)
Definition: ap.cpp:1343
ae_int_t cnt
Definition: ap.h:429
ae_bool ae_matrix_set_length(ae_matrix *dst, ae_int_t rows, ae_int_t cols, ae_state *state)
Definition: ap.cpp:854
doublereal * a
void pearsoncorrelationsignificance(double r, ae_int_t n, double *bothtails, double *lefttail, double *righttail, ae_state *_state)
double fdistribution(const ae_int_t a, const ae_int_t b, const double x)
int ir
ae_int_t ae_minint(ae_int_t m1, ae_int_t m2, ae_state *state)
Definition: ap.cpp:1572
void smp_rankdata(real_2d_array &xy)
#define xc