LCOV - code coverage report
Current view: top level - synthesis/MeasurementEquations/lbfgs - statistics.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 9003 0.0 %
Date: 2024-10-10 15:00:01 Functions: 0 266 0.0 %

          Line data    Source code
       1             : /*************************************************************************
       2             : ALGLIB 3.17.0 (source code generated 2020-12-27)
       3             : Copyright (c) Sergey Bochkanov (ALGLIB project).
       4             : 
       5             : >>> SOURCE LICENSE >>>
       6             : This program is free software; you can redistribute it and/or modify
       7             : it under the terms of the GNU General Public License as published by
       8             : the Free Software Foundation (www.fsf.org); either version 2 of the 
       9             : License, or (at your option) any later version.
      10             : 
      11             : This program is distributed in the hope that it will be useful,
      12             : but WITHOUT ANY WARRANTY; without even the implied warranty of
      13             : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14             : GNU General Public License for more details.
      15             : 
      16             : A copy of the GNU General Public License is available at
      17             : http://www.fsf.org/licensing/licenses
      18             : >>> END OF LICENSE >>>
      19             : *************************************************************************/
      20             : #ifdef _MSC_VER
      21             : #define _CRT_SECURE_NO_WARNINGS
      22             : #endif
      23             : #include "stdafx.h"
      24             : #include "statistics.h"
      25             : 
      26             : // disable some irrelevant warnings
      27             : #if (AE_COMPILER==AE_MSVC) && !defined(AE_ALL_WARNINGS)
      28             : #pragma warning(disable:4100)
      29             : #pragma warning(disable:4127)
      30             : #pragma warning(disable:4611)
      31             : #pragma warning(disable:4702)
      32             : #pragma warning(disable:4996)
      33             : #endif
      34             : 
      35             : /////////////////////////////////////////////////////////////////////////
      36             : //
      37             : // THIS SECTION CONTAINS IMPLEMENTATION OF C++ INTERFACE
      38             : //
      39             : /////////////////////////////////////////////////////////////////////////
      40             : namespace alglib
      41             : {
      42             : 
      43             : #if defined(AE_COMPILE_BASESTAT) || !defined(AE_PARTIAL_BUILD)
      44             : 
      45             : #endif
      46             : 
      47             : #if defined(AE_COMPILE_WSR) || !defined(AE_PARTIAL_BUILD)
      48             : 
      49             : #endif
      50             : 
      51             : #if defined(AE_COMPILE_STEST) || !defined(AE_PARTIAL_BUILD)
      52             : 
      53             : #endif
      54             : 
      55             : #if defined(AE_COMPILE_CORRELATIONTESTS) || !defined(AE_PARTIAL_BUILD)
      56             : 
      57             : #endif
      58             : 
      59             : #if defined(AE_COMPILE_STUDENTTTESTS) || !defined(AE_PARTIAL_BUILD)
      60             : 
      61             : #endif
      62             : 
      63             : #if defined(AE_COMPILE_MANNWHITNEYU) || !defined(AE_PARTIAL_BUILD)
      64             : 
      65             : #endif
      66             : 
      67             : #if defined(AE_COMPILE_JARQUEBERA) || !defined(AE_PARTIAL_BUILD)
      68             : 
      69             : #endif
      70             : 
      71             : #if defined(AE_COMPILE_VARIANCETESTS) || !defined(AE_PARTIAL_BUILD)
      72             : 
      73             : #endif
      74             : 
      75             : #if defined(AE_COMPILE_BASESTAT) || !defined(AE_PARTIAL_BUILD)
      76             : /*************************************************************************
      77             : Calculation of the distribution moments: mean, variance, skewness, kurtosis.
      78             : 
      79             : INPUT PARAMETERS:
      80             :     X       -   sample
      81             :     N       -   N>=0, sample size:
      82             :                 * if given, only leading N elements of X are processed
      83             :                 * if not given, automatically determined from size of X
      84             : 
      85             : OUTPUT PARAMETERS
      86             :     Mean    -   mean.
      87             :     Variance-   variance.
      88             :     Skewness-   skewness (if variance<>0; zero otherwise).
      89             :     Kurtosis-   kurtosis (if variance<>0; zero otherwise).
      90             : 
      91             : NOTE: variance is calculated by dividing sum of squares by N-1, not N.
      92             : 
      93             :   -- ALGLIB --
      94             :      Copyright 06.09.2006 by Bochkanov Sergey
      95             : *************************************************************************/
      96           0 : void samplemoments(const real_1d_array &x, const ae_int_t n, double &mean, double &variance, double &skewness, double &kurtosis, const xparams _xparams)
      97             : {
      98             :     jmp_buf _break_jump;
      99             :     alglib_impl::ae_state _alglib_env_state;
     100           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
     101           0 :     if( setjmp(_break_jump) )
     102             :     {
     103             : #if !defined(AE_NO_EXCEPTIONS)
     104           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
     105             : #else
     106             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
     107             :         return;
     108             : #endif
     109             :     }
     110           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
     111           0 :     if( _xparams.flags!=0x0 )
     112           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
     113           0 :     alglib_impl::samplemoments(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &mean, &variance, &skewness, &kurtosis, &_alglib_env_state);
     114           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
     115           0 :     return;
     116             : }
     117             : 
     118             : /*************************************************************************
     119             : Calculation of the distribution moments: mean, variance, skewness, kurtosis.
     120             : 
     121             : INPUT PARAMETERS:
     122             :     X       -   sample
     123             :     N       -   N>=0, sample size:
     124             :                 * if given, only leading N elements of X are processed
     125             :                 * if not given, automatically determined from size of X
     126             : 
     127             : OUTPUT PARAMETERS
     128             :     Mean    -   mean.
     129             :     Variance-   variance.
     130             :     Skewness-   skewness (if variance<>0; zero otherwise).
     131             :     Kurtosis-   kurtosis (if variance<>0; zero otherwise).
     132             : 
     133             : NOTE: variance is calculated by dividing sum of squares by N-1, not N.
     134             : 
     135             :   -- ALGLIB --
     136             :      Copyright 06.09.2006 by Bochkanov Sergey
     137             : *************************************************************************/
     138             : #if !defined(AE_NO_EXCEPTIONS)
     139           0 : void samplemoments(const real_1d_array &x, double &mean, double &variance, double &skewness, double &kurtosis, const xparams _xparams)
     140             : {
     141             :     jmp_buf _break_jump;
     142             :     alglib_impl::ae_state _alglib_env_state;    
     143             :     ae_int_t n;
     144             : 
     145           0 :     n = x.length();
     146           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
     147           0 :     if( setjmp(_break_jump) )
     148           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
     149           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
     150           0 :     if( _xparams.flags!=0x0 )
     151           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
     152           0 :     alglib_impl::samplemoments(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &mean, &variance, &skewness, &kurtosis, &_alglib_env_state);
     153             : 
     154           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
     155           0 :     return;
     156             : }
     157             : #endif
     158             : 
     159             : /*************************************************************************
     160             : Calculation of the mean.
     161             : 
     162             : INPUT PARAMETERS:
     163             :     X       -   sample
     164             :     N       -   N>=0, sample size:
     165             :                 * if given, only leading N elements of X are processed
     166             :                 * if not given, automatically determined from size of X
     167             : 
     168             : NOTE:
     169             : 
     170             : This function return result  which calculated by 'SampleMoments' function
     171             : and stored at 'Mean' variable.
     172             : 
     173             : 
     174             :   -- ALGLIB --
     175             :      Copyright 06.09.2006 by Bochkanov Sergey
     176             : *************************************************************************/
     177           0 : double samplemean(const real_1d_array &x, const ae_int_t n, const xparams _xparams)
     178             : {
     179             :     jmp_buf _break_jump;
     180             :     alglib_impl::ae_state _alglib_env_state;
     181           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
     182           0 :     if( setjmp(_break_jump) )
     183             :     {
     184             : #if !defined(AE_NO_EXCEPTIONS)
     185           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
     186             : #else
     187             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
     188             :         return 0;
     189             : #endif
     190             :     }
     191           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
     192           0 :     if( _xparams.flags!=0x0 )
     193           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
     194           0 :     double result = alglib_impl::samplemean(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &_alglib_env_state);
     195           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
     196           0 :     return *(reinterpret_cast<double*>(&result));
     197             : }
     198             : 
     199             : /*************************************************************************
     200             : Calculation of the mean.
     201             : 
     202             : INPUT PARAMETERS:
     203             :     X       -   sample
     204             :     N       -   N>=0, sample size:
     205             :                 * if given, only leading N elements of X are processed
     206             :                 * if not given, automatically determined from size of X
     207             : 
     208             : NOTE:
     209             : 
     210             : This function return result  which calculated by 'SampleMoments' function
     211             : and stored at 'Mean' variable.
     212             : 
     213             : 
     214             :   -- ALGLIB --
     215             :      Copyright 06.09.2006 by Bochkanov Sergey
     216             : *************************************************************************/
     217             : #if !defined(AE_NO_EXCEPTIONS)
     218           0 : double samplemean(const real_1d_array &x, const xparams _xparams)
     219             : {
     220             :     jmp_buf _break_jump;
     221             :     alglib_impl::ae_state _alglib_env_state;    
     222             :     ae_int_t n;
     223             : 
     224           0 :     n = x.length();
     225           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
     226           0 :     if( setjmp(_break_jump) )
     227           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
     228           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
     229           0 :     if( _xparams.flags!=0x0 )
     230           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
     231           0 :     double result = alglib_impl::samplemean(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &_alglib_env_state);
     232             : 
     233           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
     234           0 :     return *(reinterpret_cast<double*>(&result));
     235             : }
     236             : #endif
     237             : 
     238             : /*************************************************************************
     239             : Calculation of the variance.
     240             : 
     241             : INPUT PARAMETERS:
     242             :     X       -   sample
     243             :     N       -   N>=0, sample size:
     244             :                 * if given, only leading N elements of X are processed
     245             :                 * if not given, automatically determined from size of X
     246             : 
     247             : NOTE:
     248             : 
     249             : This function return result  which calculated by 'SampleMoments' function
     250             : and stored at 'Variance' variable.
     251             : 
     252             : 
     253             :   -- ALGLIB --
     254             :      Copyright 06.09.2006 by Bochkanov Sergey
     255             : *************************************************************************/
     256           0 : double samplevariance(const real_1d_array &x, const ae_int_t n, const xparams _xparams)
     257             : {
     258             :     jmp_buf _break_jump;
     259             :     alglib_impl::ae_state _alglib_env_state;
     260           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
     261           0 :     if( setjmp(_break_jump) )
     262             :     {
     263             : #if !defined(AE_NO_EXCEPTIONS)
     264           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
     265             : #else
     266             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
     267             :         return 0;
     268             : #endif
     269             :     }
     270           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
     271           0 :     if( _xparams.flags!=0x0 )
     272           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
     273           0 :     double result = alglib_impl::samplevariance(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &_alglib_env_state);
     274           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
     275           0 :     return *(reinterpret_cast<double*>(&result));
     276             : }
     277             : 
     278             : /*************************************************************************
     279             : Calculation of the variance.
     280             : 
     281             : INPUT PARAMETERS:
     282             :     X       -   sample
     283             :     N       -   N>=0, sample size:
     284             :                 * if given, only leading N elements of X are processed
     285             :                 * if not given, automatically determined from size of X
     286             : 
     287             : NOTE:
     288             : 
     289             : This function return result  which calculated by 'SampleMoments' function
     290             : and stored at 'Variance' variable.
     291             : 
     292             : 
     293             :   -- ALGLIB --
     294             :      Copyright 06.09.2006 by Bochkanov Sergey
     295             : *************************************************************************/
     296             : #if !defined(AE_NO_EXCEPTIONS)
     297           0 : double samplevariance(const real_1d_array &x, const xparams _xparams)
     298             : {
     299             :     jmp_buf _break_jump;
     300             :     alglib_impl::ae_state _alglib_env_state;    
     301             :     ae_int_t n;
     302             : 
     303           0 :     n = x.length();
     304           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
     305           0 :     if( setjmp(_break_jump) )
     306           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
     307           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
     308           0 :     if( _xparams.flags!=0x0 )
     309           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
     310           0 :     double result = alglib_impl::samplevariance(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &_alglib_env_state);
     311             : 
     312           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
     313           0 :     return *(reinterpret_cast<double*>(&result));
     314             : }
     315             : #endif
     316             : 
     317             : /*************************************************************************
     318             : Calculation of the skewness.
     319             : 
     320             : INPUT PARAMETERS:
     321             :     X       -   sample
     322             :     N       -   N>=0, sample size:
     323             :                 * if given, only leading N elements of X are processed
     324             :                 * if not given, automatically determined from size of X
     325             : 
     326             : NOTE:
     327             : 
     328             : This function return result  which calculated by 'SampleMoments' function
     329             : and stored at 'Skewness' variable.
     330             : 
     331             : 
     332             :   -- ALGLIB --
     333             :      Copyright 06.09.2006 by Bochkanov Sergey
     334             : *************************************************************************/
     335           0 : double sampleskewness(const real_1d_array &x, const ae_int_t n, const xparams _xparams)
     336             : {
     337             :     jmp_buf _break_jump;
     338             :     alglib_impl::ae_state _alglib_env_state;
     339           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
     340           0 :     if( setjmp(_break_jump) )
     341             :     {
     342             : #if !defined(AE_NO_EXCEPTIONS)
     343           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
     344             : #else
     345             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
     346             :         return 0;
     347             : #endif
     348             :     }
     349           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
     350           0 :     if( _xparams.flags!=0x0 )
     351           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
     352           0 :     double result = alglib_impl::sampleskewness(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &_alglib_env_state);
     353           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
     354           0 :     return *(reinterpret_cast<double*>(&result));
     355             : }
     356             : 
     357             : /*************************************************************************
     358             : Calculation of the skewness.
     359             : 
     360             : INPUT PARAMETERS:
     361             :     X       -   sample
     362             :     N       -   N>=0, sample size:
     363             :                 * if given, only leading N elements of X are processed
     364             :                 * if not given, automatically determined from size of X
     365             : 
     366             : NOTE:
     367             : 
     368             : This function return result  which calculated by 'SampleMoments' function
     369             : and stored at 'Skewness' variable.
     370             : 
     371             : 
     372             :   -- ALGLIB --
     373             :      Copyright 06.09.2006 by Bochkanov Sergey
     374             : *************************************************************************/
     375             : #if !defined(AE_NO_EXCEPTIONS)
     376           0 : double sampleskewness(const real_1d_array &x, const xparams _xparams)
     377             : {
     378             :     jmp_buf _break_jump;
     379             :     alglib_impl::ae_state _alglib_env_state;    
     380             :     ae_int_t n;
     381             : 
     382           0 :     n = x.length();
     383           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
     384           0 :     if( setjmp(_break_jump) )
     385           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
     386           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
     387           0 :     if( _xparams.flags!=0x0 )
     388           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
     389           0 :     double result = alglib_impl::sampleskewness(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &_alglib_env_state);
     390             : 
     391           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
     392           0 :     return *(reinterpret_cast<double*>(&result));
     393             : }
     394             : #endif
     395             : 
     396             : /*************************************************************************
     397             : Calculation of the kurtosis.
     398             : 
     399             : INPUT PARAMETERS:
     400             :     X       -   sample
     401             :     N       -   N>=0, sample size:
     402             :                 * if given, only leading N elements of X are processed
     403             :                 * if not given, automatically determined from size of X
     404             : 
     405             : NOTE:
     406             : 
     407             : This function return result  which calculated by 'SampleMoments' function
     408             : and stored at 'Kurtosis' variable.
     409             : 
     410             : 
     411             :   -- ALGLIB --
     412             :      Copyright 06.09.2006 by Bochkanov Sergey
     413             : *************************************************************************/
     414           0 : double samplekurtosis(const real_1d_array &x, const ae_int_t n, const xparams _xparams)
     415             : {
     416             :     jmp_buf _break_jump;
     417             :     alglib_impl::ae_state _alglib_env_state;
     418           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
     419           0 :     if( setjmp(_break_jump) )
     420             :     {
     421             : #if !defined(AE_NO_EXCEPTIONS)
     422           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
     423             : #else
     424             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
     425             :         return 0;
     426             : #endif
     427             :     }
     428           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
     429           0 :     if( _xparams.flags!=0x0 )
     430           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
     431           0 :     double result = alglib_impl::samplekurtosis(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &_alglib_env_state);
     432           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
     433           0 :     return *(reinterpret_cast<double*>(&result));
     434             : }
     435             : 
     436             : /*************************************************************************
     437             : Calculation of the kurtosis.
     438             : 
     439             : INPUT PARAMETERS:
     440             :     X       -   sample
     441             :     N       -   N>=0, sample size:
     442             :                 * if given, only leading N elements of X are processed
     443             :                 * if not given, automatically determined from size of X
     444             : 
     445             : NOTE:
     446             : 
     447             : This function return result  which calculated by 'SampleMoments' function
     448             : and stored at 'Kurtosis' variable.
     449             : 
     450             : 
     451             :   -- ALGLIB --
     452             :      Copyright 06.09.2006 by Bochkanov Sergey
     453             : *************************************************************************/
     454             : #if !defined(AE_NO_EXCEPTIONS)
     455           0 : double samplekurtosis(const real_1d_array &x, const xparams _xparams)
     456             : {
     457             :     jmp_buf _break_jump;
     458             :     alglib_impl::ae_state _alglib_env_state;    
     459             :     ae_int_t n;
     460             : 
     461           0 :     n = x.length();
     462           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
     463           0 :     if( setjmp(_break_jump) )
     464           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
     465           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
     466           0 :     if( _xparams.flags!=0x0 )
     467           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
     468           0 :     double result = alglib_impl::samplekurtosis(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &_alglib_env_state);
     469             : 
     470           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
     471           0 :     return *(reinterpret_cast<double*>(&result));
     472             : }
     473             : #endif
     474             : 
     475             : /*************************************************************************
     476             : ADev
     477             : 
     478             : Input parameters:
     479             :     X   -   sample
     480             :     N   -   N>=0, sample size:
     481             :             * if given, only leading N elements of X are processed
     482             :             * if not given, automatically determined from size of X
     483             : 
     484             : Output parameters:
     485             :     ADev-   ADev
     486             : 
     487             :   -- ALGLIB --
     488             :      Copyright 06.09.2006 by Bochkanov Sergey
     489             : *************************************************************************/
     490           0 : void sampleadev(const real_1d_array &x, const ae_int_t n, double &adev, const xparams _xparams)
     491             : {
     492             :     jmp_buf _break_jump;
     493             :     alglib_impl::ae_state _alglib_env_state;
     494           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
     495           0 :     if( setjmp(_break_jump) )
     496             :     {
     497             : #if !defined(AE_NO_EXCEPTIONS)
     498           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
     499             : #else
     500             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
     501             :         return;
     502             : #endif
     503             :     }
     504           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
     505           0 :     if( _xparams.flags!=0x0 )
     506           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
     507           0 :     alglib_impl::sampleadev(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &adev, &_alglib_env_state);
     508           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
     509           0 :     return;
     510             : }
     511             : 
     512             : /*************************************************************************
     513             : ADev
     514             : 
     515             : Input parameters:
     516             :     X   -   sample
     517             :     N   -   N>=0, sample size:
     518             :             * if given, only leading N elements of X are processed
     519             :             * if not given, automatically determined from size of X
     520             : 
     521             : Output parameters:
     522             :     ADev-   ADev
     523             : 
     524             :   -- ALGLIB --
     525             :      Copyright 06.09.2006 by Bochkanov Sergey
     526             : *************************************************************************/
     527             : #if !defined(AE_NO_EXCEPTIONS)
     528           0 : void sampleadev(const real_1d_array &x, double &adev, const xparams _xparams)
     529             : {
     530             :     jmp_buf _break_jump;
     531             :     alglib_impl::ae_state _alglib_env_state;    
     532             :     ae_int_t n;
     533             : 
     534           0 :     n = x.length();
     535           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
     536           0 :     if( setjmp(_break_jump) )
     537           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
     538           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
     539           0 :     if( _xparams.flags!=0x0 )
     540           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
     541           0 :     alglib_impl::sampleadev(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &adev, &_alglib_env_state);
     542             : 
     543           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
     544           0 :     return;
     545             : }
     546             : #endif
     547             : 
     548             : /*************************************************************************
     549             : Median calculation.
     550             : 
     551             : Input parameters:
     552             :     X   -   sample (array indexes: [0..N-1])
     553             :     N   -   N>=0, sample size:
     554             :             * if given, only leading N elements of X are processed
     555             :             * if not given, automatically determined from size of X
     556             : 
     557             : Output parameters:
     558             :     Median
     559             : 
     560             :   -- ALGLIB --
     561             :      Copyright 06.09.2006 by Bochkanov Sergey
     562             : *************************************************************************/
     563           0 : void samplemedian(const real_1d_array &x, const ae_int_t n, double &median, const xparams _xparams)
     564             : {
     565             :     jmp_buf _break_jump;
     566             :     alglib_impl::ae_state _alglib_env_state;
     567           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
     568           0 :     if( setjmp(_break_jump) )
     569             :     {
     570             : #if !defined(AE_NO_EXCEPTIONS)
     571           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
     572             : #else
     573             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
     574             :         return;
     575             : #endif
     576             :     }
     577           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
     578           0 :     if( _xparams.flags!=0x0 )
     579           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
     580           0 :     alglib_impl::samplemedian(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &median, &_alglib_env_state);
     581           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
     582           0 :     return;
     583             : }
     584             : 
     585             : /*************************************************************************
     586             : Median calculation.
     587             : 
     588             : Input parameters:
     589             :     X   -   sample (array indexes: [0..N-1])
     590             :     N   -   N>=0, sample size:
     591             :             * if given, only leading N elements of X are processed
     592             :             * if not given, automatically determined from size of X
     593             : 
     594             : Output parameters:
     595             :     Median
     596             : 
     597             :   -- ALGLIB --
     598             :      Copyright 06.09.2006 by Bochkanov Sergey
     599             : *************************************************************************/
     600             : #if !defined(AE_NO_EXCEPTIONS)
     601           0 : void samplemedian(const real_1d_array &x, double &median, const xparams _xparams)
     602             : {
     603             :     jmp_buf _break_jump;
     604             :     alglib_impl::ae_state _alglib_env_state;    
     605             :     ae_int_t n;
     606             : 
     607           0 :     n = x.length();
     608           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
     609           0 :     if( setjmp(_break_jump) )
     610           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
     611           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
     612           0 :     if( _xparams.flags!=0x0 )
     613           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
     614           0 :     alglib_impl::samplemedian(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &median, &_alglib_env_state);
     615             : 
     616           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
     617           0 :     return;
     618             : }
     619             : #endif
     620             : 
     621             : /*************************************************************************
     622             : Percentile calculation.
     623             : 
     624             : Input parameters:
     625             :     X   -   sample (array indexes: [0..N-1])
     626             :     N   -   N>=0, sample size:
     627             :             * if given, only leading N elements of X are processed
     628             :             * if not given, automatically determined from size of X
     629             :     P   -   percentile (0<=P<=1)
     630             : 
     631             : Output parameters:
     632             :     V   -   percentile
     633             : 
     634             :   -- ALGLIB --
     635             :      Copyright 01.03.2008 by Bochkanov Sergey
     636             : *************************************************************************/
     637           0 : void samplepercentile(const real_1d_array &x, const ae_int_t n, const double p, double &v, const xparams _xparams)
     638             : {
     639             :     jmp_buf _break_jump;
     640             :     alglib_impl::ae_state _alglib_env_state;
     641           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
     642           0 :     if( setjmp(_break_jump) )
     643             :     {
     644             : #if !defined(AE_NO_EXCEPTIONS)
     645           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
     646             : #else
     647             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
     648             :         return;
     649             : #endif
     650             :     }
     651           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
     652           0 :     if( _xparams.flags!=0x0 )
     653           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
     654           0 :     alglib_impl::samplepercentile(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, p, &v, &_alglib_env_state);
     655           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
     656           0 :     return;
     657             : }
     658             : 
     659             : /*************************************************************************
     660             : Percentile calculation.
     661             : 
     662             : Input parameters:
     663             :     X   -   sample (array indexes: [0..N-1])
     664             :     N   -   N>=0, sample size:
     665             :             * if given, only leading N elements of X are processed
     666             :             * if not given, automatically determined from size of X
     667             :     P   -   percentile (0<=P<=1)
     668             : 
     669             : Output parameters:
     670             :     V   -   percentile
     671             : 
     672             :   -- ALGLIB --
     673             :      Copyright 01.03.2008 by Bochkanov Sergey
     674             : *************************************************************************/
     675             : #if !defined(AE_NO_EXCEPTIONS)
     676           0 : void samplepercentile(const real_1d_array &x, const double p, double &v, const xparams _xparams)
     677             : {
     678             :     jmp_buf _break_jump;
     679             :     alglib_impl::ae_state _alglib_env_state;    
     680             :     ae_int_t n;
     681             : 
     682           0 :     n = x.length();
     683           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
     684           0 :     if( setjmp(_break_jump) )
     685           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
     686           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
     687           0 :     if( _xparams.flags!=0x0 )
     688           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
     689           0 :     alglib_impl::samplepercentile(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, p, &v, &_alglib_env_state);
     690             : 
     691           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
     692           0 :     return;
     693             : }
     694             : #endif
     695             : 
     696             : /*************************************************************************
     697             : 2-sample covariance
     698             : 
     699             : Input parameters:
     700             :     X       -   sample 1 (array indexes: [0..N-1])
     701             :     Y       -   sample 2 (array indexes: [0..N-1])
     702             :     N       -   N>=0, sample size:
     703             :                 * if given, only N leading elements of X/Y are processed
     704             :                 * if not given, automatically determined from input sizes
     705             : 
     706             : Result:
     707             :     covariance (zero for N=0 or N=1)
     708             : 
     709             :   -- ALGLIB --
     710             :      Copyright 28.10.2010 by Bochkanov Sergey
     711             : *************************************************************************/
     712           0 : double cov2(const real_1d_array &x, const real_1d_array &y, const ae_int_t n, const xparams _xparams)
     713             : {
     714             :     jmp_buf _break_jump;
     715             :     alglib_impl::ae_state _alglib_env_state;
     716           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
     717           0 :     if( setjmp(_break_jump) )
     718             :     {
     719             : #if !defined(AE_NO_EXCEPTIONS)
     720           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
     721             : #else
     722             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
     723             :         return 0;
     724             : #endif
     725             :     }
     726           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
     727           0 :     if( _xparams.flags!=0x0 )
     728           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
     729           0 :     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);
     730           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
     731           0 :     return *(reinterpret_cast<double*>(&result));
     732             : }
     733             : 
     734             : /*************************************************************************
     735             : 2-sample covariance
     736             : 
     737             : Input parameters:
     738             :     X       -   sample 1 (array indexes: [0..N-1])
     739             :     Y       -   sample 2 (array indexes: [0..N-1])
     740             :     N       -   N>=0, sample size:
     741             :                 * if given, only N leading elements of X/Y are processed
     742             :                 * if not given, automatically determined from input sizes
     743             : 
     744             : Result:
     745             :     covariance (zero for N=0 or N=1)
     746             : 
     747             :   -- ALGLIB --
     748             :      Copyright 28.10.2010 by Bochkanov Sergey
     749             : *************************************************************************/
     750             : #if !defined(AE_NO_EXCEPTIONS)
     751           0 : double cov2(const real_1d_array &x, const real_1d_array &y, const xparams _xparams)
     752             : {
     753             :     jmp_buf _break_jump;
     754             :     alglib_impl::ae_state _alglib_env_state;    
     755             :     ae_int_t n;
     756           0 :     if( (x.length()!=y.length()))
     757           0 :         _ALGLIB_CPP_EXCEPTION("Error while calling 'cov2': looks like one of arguments has wrong size");
     758           0 :     n = x.length();
     759           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
     760           0 :     if( setjmp(_break_jump) )
     761           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
     762           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
     763           0 :     if( _xparams.flags!=0x0 )
     764           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
     765           0 :     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);
     766             : 
     767           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
     768           0 :     return *(reinterpret_cast<double*>(&result));
     769             : }
     770             : #endif
     771             : 
     772             : /*************************************************************************
     773             : Pearson product-moment correlation coefficient
     774             : 
     775             : Input parameters:
     776             :     X       -   sample 1 (array indexes: [0..N-1])
     777             :     Y       -   sample 2 (array indexes: [0..N-1])
     778             :     N       -   N>=0, sample size:
     779             :                 * if given, only N leading elements of X/Y are processed
     780             :                 * if not given, automatically determined from input sizes
     781             : 
     782             : Result:
     783             :     Pearson product-moment correlation coefficient
     784             :     (zero for N=0 or N=1)
     785             : 
     786             :   -- ALGLIB --
     787             :      Copyright 28.10.2010 by Bochkanov Sergey
     788             : *************************************************************************/
     789           0 : double pearsoncorr2(const real_1d_array &x, const real_1d_array &y, const ae_int_t n, const xparams _xparams)
     790             : {
     791             :     jmp_buf _break_jump;
     792             :     alglib_impl::ae_state _alglib_env_state;
     793           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
     794           0 :     if( setjmp(_break_jump) )
     795             :     {
     796             : #if !defined(AE_NO_EXCEPTIONS)
     797           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
     798             : #else
     799             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
     800             :         return 0;
     801             : #endif
     802             :     }
     803           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
     804           0 :     if( _xparams.flags!=0x0 )
     805           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
     806           0 :     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);
     807           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
     808           0 :     return *(reinterpret_cast<double*>(&result));
     809             : }
     810             : 
     811             : /*************************************************************************
     812             : Pearson product-moment correlation coefficient
     813             : 
     814             : Input parameters:
     815             :     X       -   sample 1 (array indexes: [0..N-1])
     816             :     Y       -   sample 2 (array indexes: [0..N-1])
     817             :     N       -   N>=0, sample size:
     818             :                 * if given, only N leading elements of X/Y are processed
     819             :                 * if not given, automatically determined from input sizes
     820             : 
     821             : Result:
     822             :     Pearson product-moment correlation coefficient
     823             :     (zero for N=0 or N=1)
     824             : 
     825             :   -- ALGLIB --
     826             :      Copyright 28.10.2010 by Bochkanov Sergey
     827             : *************************************************************************/
     828             : #if !defined(AE_NO_EXCEPTIONS)
     829           0 : double pearsoncorr2(const real_1d_array &x, const real_1d_array &y, const xparams _xparams)
     830             : {
     831             :     jmp_buf _break_jump;
     832             :     alglib_impl::ae_state _alglib_env_state;    
     833             :     ae_int_t n;
     834           0 :     if( (x.length()!=y.length()))
     835           0 :         _ALGLIB_CPP_EXCEPTION("Error while calling 'pearsoncorr2': looks like one of arguments has wrong size");
     836           0 :     n = x.length();
     837           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
     838           0 :     if( setjmp(_break_jump) )
     839           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
     840           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
     841           0 :     if( _xparams.flags!=0x0 )
     842           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
     843           0 :     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);
     844             : 
     845           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
     846           0 :     return *(reinterpret_cast<double*>(&result));
     847             : }
     848             : #endif
     849             : 
     850             : /*************************************************************************
     851             : Spearman's rank correlation coefficient
     852             : 
     853             : Input parameters:
     854             :     X       -   sample 1 (array indexes: [0..N-1])
     855             :     Y       -   sample 2 (array indexes: [0..N-1])
     856             :     N       -   N>=0, sample size:
     857             :                 * if given, only N leading elements of X/Y are processed
     858             :                 * if not given, automatically determined from input sizes
     859             : 
     860             : Result:
     861             :     Spearman's rank correlation coefficient
     862             :     (zero for N=0 or N=1)
     863             : 
     864             :   -- ALGLIB --
     865             :      Copyright 09.04.2007 by Bochkanov Sergey
     866             : *************************************************************************/
     867           0 : double spearmancorr2(const real_1d_array &x, const real_1d_array &y, const ae_int_t n, const xparams _xparams)
     868             : {
     869             :     jmp_buf _break_jump;
     870             :     alglib_impl::ae_state _alglib_env_state;
     871           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
     872           0 :     if( setjmp(_break_jump) )
     873             :     {
     874             : #if !defined(AE_NO_EXCEPTIONS)
     875           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
     876             : #else
     877             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
     878             :         return 0;
     879             : #endif
     880             :     }
     881           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
     882           0 :     if( _xparams.flags!=0x0 )
     883           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
     884           0 :     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);
     885           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
     886           0 :     return *(reinterpret_cast<double*>(&result));
     887             : }
     888             : 
     889             : /*************************************************************************
     890             : Spearman's rank correlation coefficient
     891             : 
     892             : Input parameters:
     893             :     X       -   sample 1 (array indexes: [0..N-1])
     894             :     Y       -   sample 2 (array indexes: [0..N-1])
     895             :     N       -   N>=0, sample size:
     896             :                 * if given, only N leading elements of X/Y are processed
     897             :                 * if not given, automatically determined from input sizes
     898             : 
     899             : Result:
     900             :     Spearman's rank correlation coefficient
     901             :     (zero for N=0 or N=1)
     902             : 
     903             :   -- ALGLIB --
     904             :      Copyright 09.04.2007 by Bochkanov Sergey
     905             : *************************************************************************/
     906             : #if !defined(AE_NO_EXCEPTIONS)
     907           0 : double spearmancorr2(const real_1d_array &x, const real_1d_array &y, const xparams _xparams)
     908             : {
     909             :     jmp_buf _break_jump;
     910             :     alglib_impl::ae_state _alglib_env_state;    
     911             :     ae_int_t n;
     912           0 :     if( (x.length()!=y.length()))
     913           0 :         _ALGLIB_CPP_EXCEPTION("Error while calling 'spearmancorr2': looks like one of arguments has wrong size");
     914           0 :     n = x.length();
     915           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
     916           0 :     if( setjmp(_break_jump) )
     917           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
     918           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
     919           0 :     if( _xparams.flags!=0x0 )
     920           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
     921           0 :     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);
     922             : 
     923           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
     924           0 :     return *(reinterpret_cast<double*>(&result));
     925             : }
     926             : #endif
     927             : 
     928             : /*************************************************************************
     929             : Covariance matrix
     930             : 
     931             :   ! COMMERCIAL EDITION OF ALGLIB:
     932             :   !
     933             :   ! Commercial Edition of ALGLIB includes following important improvements
     934             :   ! of this function:
     935             :   ! * high-performance native backend with same C# interface (C# version)
     936             :   ! * multithreading support (C++ and C# versions)
     937             :   ! * hardware vendor (Intel) implementations of linear algebra primitives
     938             :   !   (C++ and C# versions, x86/x64 platform)
     939             :   !
     940             :   ! We recommend you to read 'Working with commercial version' section  of
     941             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
     942             :   ! related features provided by commercial edition of ALGLIB.
     943             : 
     944             : INPUT PARAMETERS:
     945             :     X   -   array[N,M], sample matrix:
     946             :             * J-th column corresponds to J-th variable
     947             :             * I-th row corresponds to I-th observation
     948             :     N   -   N>=0, number of observations:
     949             :             * if given, only leading N rows of X are used
     950             :             * if not given, automatically determined from input size
     951             :     M   -   M>0, number of variables:
     952             :             * if given, only leading M columns of X are used
     953             :             * if not given, automatically determined from input size
     954             : 
     955             : OUTPUT PARAMETERS:
     956             :     C   -   array[M,M], covariance matrix (zero if N=0 or N=1)
     957             : 
     958             :   -- ALGLIB --
     959             :      Copyright 28.10.2010 by Bochkanov Sergey
     960             : *************************************************************************/
     961           0 : void covm(const real_2d_array &x, const ae_int_t n, const ae_int_t m, real_2d_array &c, const xparams _xparams)
     962             : {
     963             :     jmp_buf _break_jump;
     964             :     alglib_impl::ae_state _alglib_env_state;
     965           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
     966           0 :     if( setjmp(_break_jump) )
     967             :     {
     968             : #if !defined(AE_NO_EXCEPTIONS)
     969           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
     970             : #else
     971             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
     972             :         return;
     973             : #endif
     974             :     }
     975           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
     976           0 :     if( _xparams.flags!=0x0 )
     977           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
     978           0 :     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);
     979           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
     980           0 :     return;
     981             : }
     982             : 
     983             : /*************************************************************************
     984             : Covariance matrix
     985             : 
     986             :   ! COMMERCIAL EDITION OF ALGLIB:
     987             :   !
     988             :   ! Commercial Edition of ALGLIB includes following important improvements
     989             :   ! of this function:
     990             :   ! * high-performance native backend with same C# interface (C# version)
     991             :   ! * multithreading support (C++ and C# versions)
     992             :   ! * hardware vendor (Intel) implementations of linear algebra primitives
     993             :   !   (C++ and C# versions, x86/x64 platform)
     994             :   !
     995             :   ! We recommend you to read 'Working with commercial version' section  of
     996             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
     997             :   ! related features provided by commercial edition of ALGLIB.
     998             : 
     999             : INPUT PARAMETERS:
    1000             :     X   -   array[N,M], sample matrix:
    1001             :             * J-th column corresponds to J-th variable
    1002             :             * I-th row corresponds to I-th observation
    1003             :     N   -   N>=0, number of observations:
    1004             :             * if given, only leading N rows of X are used
    1005             :             * if not given, automatically determined from input size
    1006             :     M   -   M>0, number of variables:
    1007             :             * if given, only leading M columns of X are used
    1008             :             * if not given, automatically determined from input size
    1009             : 
    1010             : OUTPUT PARAMETERS:
    1011             :     C   -   array[M,M], covariance matrix (zero if N=0 or N=1)
    1012             : 
    1013             :   -- ALGLIB --
    1014             :      Copyright 28.10.2010 by Bochkanov Sergey
    1015             : *************************************************************************/
    1016             : #if !defined(AE_NO_EXCEPTIONS)
    1017           0 : void covm(const real_2d_array &x, real_2d_array &c, const xparams _xparams)
    1018             : {
    1019             :     jmp_buf _break_jump;
    1020             :     alglib_impl::ae_state _alglib_env_state;    
    1021             :     ae_int_t n;
    1022             :     ae_int_t m;
    1023             : 
    1024           0 :     n = x.rows();
    1025           0 :     m = x.cols();
    1026           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    1027           0 :     if( setjmp(_break_jump) )
    1028           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    1029           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    1030           0 :     if( _xparams.flags!=0x0 )
    1031           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    1032           0 :     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);
    1033             : 
    1034           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    1035           0 :     return;
    1036             : }
    1037             : #endif
    1038             : 
    1039             : /*************************************************************************
    1040             : Pearson product-moment correlation matrix
    1041             : 
    1042             :   ! COMMERCIAL EDITION OF ALGLIB:
    1043             :   !
    1044             :   ! Commercial Edition of ALGLIB includes following important improvements
    1045             :   ! of this function:
    1046             :   ! * high-performance native backend with same C# interface (C# version)
    1047             :   ! * multithreading support (C++ and C# versions)
    1048             :   ! * hardware vendor (Intel) implementations of linear algebra primitives
    1049             :   !   (C++ and C# versions, x86/x64 platform)
    1050             :   !
    1051             :   ! We recommend you to read 'Working with commercial version' section  of
    1052             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
    1053             :   ! related features provided by commercial edition of ALGLIB.
    1054             : 
    1055             : INPUT PARAMETERS:
    1056             :     X   -   array[N,M], sample matrix:
    1057             :             * J-th column corresponds to J-th variable
    1058             :             * I-th row corresponds to I-th observation
    1059             :     N   -   N>=0, number of observations:
    1060             :             * if given, only leading N rows of X are used
    1061             :             * if not given, automatically determined from input size
    1062             :     M   -   M>0, number of variables:
    1063             :             * if given, only leading M columns of X are used
    1064             :             * if not given, automatically determined from input size
    1065             : 
    1066             : OUTPUT PARAMETERS:
    1067             :     C   -   array[M,M], correlation matrix (zero if N=0 or N=1)
    1068             : 
    1069             :   -- ALGLIB --
    1070             :      Copyright 28.10.2010 by Bochkanov Sergey
    1071             : *************************************************************************/
    1072           0 : void pearsoncorrm(const real_2d_array &x, const ae_int_t n, const ae_int_t m, real_2d_array &c, const xparams _xparams)
    1073             : {
    1074             :     jmp_buf _break_jump;
    1075             :     alglib_impl::ae_state _alglib_env_state;
    1076           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    1077           0 :     if( setjmp(_break_jump) )
    1078             :     {
    1079             : #if !defined(AE_NO_EXCEPTIONS)
    1080           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    1081             : #else
    1082             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
    1083             :         return;
    1084             : #endif
    1085             :     }
    1086           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    1087           0 :     if( _xparams.flags!=0x0 )
    1088           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    1089           0 :     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);
    1090           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    1091           0 :     return;
    1092             : }
    1093             : 
    1094             : /*************************************************************************
    1095             : Pearson product-moment correlation matrix
    1096             : 
    1097             :   ! COMMERCIAL EDITION OF ALGLIB:
    1098             :   !
    1099             :   ! Commercial Edition of ALGLIB includes following important improvements
    1100             :   ! of this function:
    1101             :   ! * high-performance native backend with same C# interface (C# version)
    1102             :   ! * multithreading support (C++ and C# versions)
    1103             :   ! * hardware vendor (Intel) implementations of linear algebra primitives
    1104             :   !   (C++ and C# versions, x86/x64 platform)
    1105             :   !
    1106             :   ! We recommend you to read 'Working with commercial version' section  of
    1107             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
    1108             :   ! related features provided by commercial edition of ALGLIB.
    1109             : 
    1110             : INPUT PARAMETERS:
    1111             :     X   -   array[N,M], sample matrix:
    1112             :             * J-th column corresponds to J-th variable
    1113             :             * I-th row corresponds to I-th observation
    1114             :     N   -   N>=0, number of observations:
    1115             :             * if given, only leading N rows of X are used
    1116             :             * if not given, automatically determined from input size
    1117             :     M   -   M>0, number of variables:
    1118             :             * if given, only leading M columns of X are used
    1119             :             * if not given, automatically determined from input size
    1120             : 
    1121             : OUTPUT PARAMETERS:
    1122             :     C   -   array[M,M], correlation matrix (zero if N=0 or N=1)
    1123             : 
    1124             :   -- ALGLIB --
    1125             :      Copyright 28.10.2010 by Bochkanov Sergey
    1126             : *************************************************************************/
    1127             : #if !defined(AE_NO_EXCEPTIONS)
    1128           0 : void pearsoncorrm(const real_2d_array &x, real_2d_array &c, const xparams _xparams)
    1129             : {
    1130             :     jmp_buf _break_jump;
    1131             :     alglib_impl::ae_state _alglib_env_state;    
    1132             :     ae_int_t n;
    1133             :     ae_int_t m;
    1134             : 
    1135           0 :     n = x.rows();
    1136           0 :     m = x.cols();
    1137           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    1138           0 :     if( setjmp(_break_jump) )
    1139           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    1140           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    1141           0 :     if( _xparams.flags!=0x0 )
    1142           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    1143           0 :     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);
    1144             : 
    1145           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    1146           0 :     return;
    1147             : }
    1148             : #endif
    1149             : 
    1150             : /*************************************************************************
    1151             : Spearman's rank correlation matrix
    1152             : 
    1153             :   ! COMMERCIAL EDITION OF ALGLIB:
    1154             :   !
    1155             :   ! Commercial Edition of ALGLIB includes following important improvements
    1156             :   ! of this function:
    1157             :   ! * high-performance native backend with same C# interface (C# version)
    1158             :   ! * multithreading support (C++ and C# versions)
    1159             :   ! * hardware vendor (Intel) implementations of linear algebra primitives
    1160             :   !   (C++ and C# versions, x86/x64 platform)
    1161             :   !
    1162             :   ! We recommend you to read 'Working with commercial version' section  of
    1163             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
    1164             :   ! related features provided by commercial edition of ALGLIB.
    1165             : 
    1166             : INPUT PARAMETERS:
    1167             :     X   -   array[N,M], sample matrix:
    1168             :             * J-th column corresponds to J-th variable
    1169             :             * I-th row corresponds to I-th observation
    1170             :     N   -   N>=0, number of observations:
    1171             :             * if given, only leading N rows of X are used
    1172             :             * if not given, automatically determined from input size
    1173             :     M   -   M>0, number of variables:
    1174             :             * if given, only leading M columns of X are used
    1175             :             * if not given, automatically determined from input size
    1176             : 
    1177             : OUTPUT PARAMETERS:
    1178             :     C   -   array[M,M], correlation matrix (zero if N=0 or N=1)
    1179             : 
    1180             :   -- ALGLIB --
    1181             :      Copyright 28.10.2010 by Bochkanov Sergey
    1182             : *************************************************************************/
    1183           0 : void spearmancorrm(const real_2d_array &x, const ae_int_t n, const ae_int_t m, real_2d_array &c, const xparams _xparams)
    1184             : {
    1185             :     jmp_buf _break_jump;
    1186             :     alglib_impl::ae_state _alglib_env_state;
    1187           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    1188           0 :     if( setjmp(_break_jump) )
    1189             :     {
    1190             : #if !defined(AE_NO_EXCEPTIONS)
    1191           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    1192             : #else
    1193             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
    1194             :         return;
    1195             : #endif
    1196             :     }
    1197           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    1198           0 :     if( _xparams.flags!=0x0 )
    1199           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    1200           0 :     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);
    1201           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    1202           0 :     return;
    1203             : }
    1204             : 
    1205             : /*************************************************************************
    1206             : Spearman's rank correlation matrix
    1207             : 
    1208             :   ! COMMERCIAL EDITION OF ALGLIB:
    1209             :   !
    1210             :   ! Commercial Edition of ALGLIB includes following important improvements
    1211             :   ! of this function:
    1212             :   ! * high-performance native backend with same C# interface (C# version)
    1213             :   ! * multithreading support (C++ and C# versions)
    1214             :   ! * hardware vendor (Intel) implementations of linear algebra primitives
    1215             :   !   (C++ and C# versions, x86/x64 platform)
    1216             :   !
    1217             :   ! We recommend you to read 'Working with commercial version' section  of
    1218             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
    1219             :   ! related features provided by commercial edition of ALGLIB.
    1220             : 
    1221             : INPUT PARAMETERS:
    1222             :     X   -   array[N,M], sample matrix:
    1223             :             * J-th column corresponds to J-th variable
    1224             :             * I-th row corresponds to I-th observation
    1225             :     N   -   N>=0, number of observations:
    1226             :             * if given, only leading N rows of X are used
    1227             :             * if not given, automatically determined from input size
    1228             :     M   -   M>0, number of variables:
    1229             :             * if given, only leading M columns of X are used
    1230             :             * if not given, automatically determined from input size
    1231             : 
    1232             : OUTPUT PARAMETERS:
    1233             :     C   -   array[M,M], correlation matrix (zero if N=0 or N=1)
    1234             : 
    1235             :   -- ALGLIB --
    1236             :      Copyright 28.10.2010 by Bochkanov Sergey
    1237             : *************************************************************************/
    1238             : #if !defined(AE_NO_EXCEPTIONS)
    1239           0 : void spearmancorrm(const real_2d_array &x, real_2d_array &c, const xparams _xparams)
    1240             : {
    1241             :     jmp_buf _break_jump;
    1242             :     alglib_impl::ae_state _alglib_env_state;    
    1243             :     ae_int_t n;
    1244             :     ae_int_t m;
    1245             : 
    1246           0 :     n = x.rows();
    1247           0 :     m = x.cols();
    1248           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    1249           0 :     if( setjmp(_break_jump) )
    1250           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    1251           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    1252           0 :     if( _xparams.flags!=0x0 )
    1253           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    1254           0 :     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);
    1255             : 
    1256           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    1257           0 :     return;
    1258             : }
    1259             : #endif
    1260             : 
    1261             : /*************************************************************************
    1262             : Cross-covariance matrix
    1263             : 
    1264             :   ! COMMERCIAL EDITION OF ALGLIB:
    1265             :   !
    1266             :   ! Commercial Edition of ALGLIB includes following important improvements
    1267             :   ! of this function:
    1268             :   ! * high-performance native backend with same C# interface (C# version)
    1269             :   ! * multithreading support (C++ and C# versions)
    1270             :   ! * hardware vendor (Intel) implementations of linear algebra primitives
    1271             :   !   (C++ and C# versions, x86/x64 platform)
    1272             :   !
    1273             :   ! We recommend you to read 'Working with commercial version' section  of
    1274             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
    1275             :   ! related features provided by commercial edition of ALGLIB.
    1276             : 
    1277             : INPUT PARAMETERS:
    1278             :     X   -   array[N,M1], sample matrix:
    1279             :             * J-th column corresponds to J-th variable
    1280             :             * I-th row corresponds to I-th observation
    1281             :     Y   -   array[N,M2], sample matrix:
    1282             :             * J-th column corresponds to J-th variable
    1283             :             * I-th row corresponds to I-th observation
    1284             :     N   -   N>=0, number of observations:
    1285             :             * if given, only leading N rows of X/Y are used
    1286             :             * if not given, automatically determined from input sizes
    1287             :     M1  -   M1>0, number of variables in X:
    1288             :             * if given, only leading M1 columns of X are used
    1289             :             * if not given, automatically determined from input size
    1290             :     M2  -   M2>0, number of variables in Y:
    1291             :             * if given, only leading M1 columns of X are used
    1292             :             * if not given, automatically determined from input size
    1293             : 
    1294             : OUTPUT PARAMETERS:
    1295             :     C   -   array[M1,M2], cross-covariance matrix (zero if N=0 or N=1)
    1296             : 
    1297             :   -- ALGLIB --
    1298             :      Copyright 28.10.2010 by Bochkanov Sergey
    1299             : *************************************************************************/
    1300           0 : 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, const xparams _xparams)
    1301             : {
    1302             :     jmp_buf _break_jump;
    1303             :     alglib_impl::ae_state _alglib_env_state;
    1304           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    1305           0 :     if( setjmp(_break_jump) )
    1306             :     {
    1307             : #if !defined(AE_NO_EXCEPTIONS)
    1308           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    1309             : #else
    1310             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
    1311             :         return;
    1312             : #endif
    1313             :     }
    1314           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    1315           0 :     if( _xparams.flags!=0x0 )
    1316           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    1317           0 :     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);
    1318           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    1319           0 :     return;
    1320             : }
    1321             : 
    1322             : /*************************************************************************
    1323             : Cross-covariance matrix
    1324             : 
    1325             :   ! COMMERCIAL EDITION OF ALGLIB:
    1326             :   !
    1327             :   ! Commercial Edition of ALGLIB includes following important improvements
    1328             :   ! of this function:
    1329             :   ! * high-performance native backend with same C# interface (C# version)
    1330             :   ! * multithreading support (C++ and C# versions)
    1331             :   ! * hardware vendor (Intel) implementations of linear algebra primitives
    1332             :   !   (C++ and C# versions, x86/x64 platform)
    1333             :   !
    1334             :   ! We recommend you to read 'Working with commercial version' section  of
    1335             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
    1336             :   ! related features provided by commercial edition of ALGLIB.
    1337             : 
    1338             : INPUT PARAMETERS:
    1339             :     X   -   array[N,M1], sample matrix:
    1340             :             * J-th column corresponds to J-th variable
    1341             :             * I-th row corresponds to I-th observation
    1342             :     Y   -   array[N,M2], sample matrix:
    1343             :             * J-th column corresponds to J-th variable
    1344             :             * I-th row corresponds to I-th observation
    1345             :     N   -   N>=0, number of observations:
    1346             :             * if given, only leading N rows of X/Y are used
    1347             :             * if not given, automatically determined from input sizes
    1348             :     M1  -   M1>0, number of variables in X:
    1349             :             * if given, only leading M1 columns of X are used
    1350             :             * if not given, automatically determined from input size
    1351             :     M2  -   M2>0, number of variables in Y:
    1352             :             * if given, only leading M1 columns of X are used
    1353             :             * if not given, automatically determined from input size
    1354             : 
    1355             : OUTPUT PARAMETERS:
    1356             :     C   -   array[M1,M2], cross-covariance matrix (zero if N=0 or N=1)
    1357             : 
    1358             :   -- ALGLIB --
    1359             :      Copyright 28.10.2010 by Bochkanov Sergey
    1360             : *************************************************************************/
    1361             : #if !defined(AE_NO_EXCEPTIONS)
    1362           0 : void covm2(const real_2d_array &x, const real_2d_array &y, real_2d_array &c, const xparams _xparams)
    1363             : {
    1364             :     jmp_buf _break_jump;
    1365             :     alglib_impl::ae_state _alglib_env_state;    
    1366             :     ae_int_t n;
    1367             :     ae_int_t m1;
    1368             :     ae_int_t m2;
    1369           0 :     if( (x.rows()!=y.rows()))
    1370           0 :         _ALGLIB_CPP_EXCEPTION("Error while calling 'covm2': looks like one of arguments has wrong size");
    1371           0 :     n = x.rows();
    1372           0 :     m1 = x.cols();
    1373           0 :     m2 = y.cols();
    1374           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    1375           0 :     if( setjmp(_break_jump) )
    1376           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    1377           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    1378           0 :     if( _xparams.flags!=0x0 )
    1379           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    1380           0 :     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);
    1381             : 
    1382           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    1383           0 :     return;
    1384             : }
    1385             : #endif
    1386             : 
    1387             : /*************************************************************************
    1388             : Pearson product-moment cross-correlation matrix
    1389             : 
    1390             :   ! COMMERCIAL EDITION OF ALGLIB:
    1391             :   !
    1392             :   ! Commercial Edition of ALGLIB includes following important improvements
    1393             :   ! of this function:
    1394             :   ! * high-performance native backend with same C# interface (C# version)
    1395             :   ! * multithreading support (C++ and C# versions)
    1396             :   ! * hardware vendor (Intel) implementations of linear algebra primitives
    1397             :   !   (C++ and C# versions, x86/x64 platform)
    1398             :   !
    1399             :   ! We recommend you to read 'Working with commercial version' section  of
    1400             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
    1401             :   ! related features provided by commercial edition of ALGLIB.
    1402             : 
    1403             : INPUT PARAMETERS:
    1404             :     X   -   array[N,M1], sample matrix:
    1405             :             * J-th column corresponds to J-th variable
    1406             :             * I-th row corresponds to I-th observation
    1407             :     Y   -   array[N,M2], sample matrix:
    1408             :             * J-th column corresponds to J-th variable
    1409             :             * I-th row corresponds to I-th observation
    1410             :     N   -   N>=0, number of observations:
    1411             :             * if given, only leading N rows of X/Y are used
    1412             :             * if not given, automatically determined from input sizes
    1413             :     M1  -   M1>0, number of variables in X:
    1414             :             * if given, only leading M1 columns of X are used
    1415             :             * if not given, automatically determined from input size
    1416             :     M2  -   M2>0, number of variables in Y:
    1417             :             * if given, only leading M1 columns of X are used
    1418             :             * if not given, automatically determined from input size
    1419             : 
    1420             : OUTPUT PARAMETERS:
    1421             :     C   -   array[M1,M2], cross-correlation matrix (zero if N=0 or N=1)
    1422             : 
    1423             :   -- ALGLIB --
    1424             :      Copyright 28.10.2010 by Bochkanov Sergey
    1425             : *************************************************************************/
    1426           0 : 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, const xparams _xparams)
    1427             : {
    1428             :     jmp_buf _break_jump;
    1429             :     alglib_impl::ae_state _alglib_env_state;
    1430           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    1431           0 :     if( setjmp(_break_jump) )
    1432             :     {
    1433             : #if !defined(AE_NO_EXCEPTIONS)
    1434           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    1435             : #else
    1436             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
    1437             :         return;
    1438             : #endif
    1439             :     }
    1440           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    1441           0 :     if( _xparams.flags!=0x0 )
    1442           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    1443           0 :     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);
    1444           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    1445           0 :     return;
    1446             : }
    1447             : 
    1448             : /*************************************************************************
    1449             : Pearson product-moment cross-correlation matrix
    1450             : 
    1451             :   ! COMMERCIAL EDITION OF ALGLIB:
    1452             :   !
    1453             :   ! Commercial Edition of ALGLIB includes following important improvements
    1454             :   ! of this function:
    1455             :   ! * high-performance native backend with same C# interface (C# version)
    1456             :   ! * multithreading support (C++ and C# versions)
    1457             :   ! * hardware vendor (Intel) implementations of linear algebra primitives
    1458             :   !   (C++ and C# versions, x86/x64 platform)
    1459             :   !
    1460             :   ! We recommend you to read 'Working with commercial version' section  of
    1461             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
    1462             :   ! related features provided by commercial edition of ALGLIB.
    1463             : 
    1464             : INPUT PARAMETERS:
    1465             :     X   -   array[N,M1], sample matrix:
    1466             :             * J-th column corresponds to J-th variable
    1467             :             * I-th row corresponds to I-th observation
    1468             :     Y   -   array[N,M2], sample matrix:
    1469             :             * J-th column corresponds to J-th variable
    1470             :             * I-th row corresponds to I-th observation
    1471             :     N   -   N>=0, number of observations:
    1472             :             * if given, only leading N rows of X/Y are used
    1473             :             * if not given, automatically determined from input sizes
    1474             :     M1  -   M1>0, number of variables in X:
    1475             :             * if given, only leading M1 columns of X are used
    1476             :             * if not given, automatically determined from input size
    1477             :     M2  -   M2>0, number of variables in Y:
    1478             :             * if given, only leading M1 columns of X are used
    1479             :             * if not given, automatically determined from input size
    1480             : 
    1481             : OUTPUT PARAMETERS:
    1482             :     C   -   array[M1,M2], cross-correlation matrix (zero if N=0 or N=1)
    1483             : 
    1484             :   -- ALGLIB --
    1485             :      Copyright 28.10.2010 by Bochkanov Sergey
    1486             : *************************************************************************/
    1487             : #if !defined(AE_NO_EXCEPTIONS)
    1488           0 : void pearsoncorrm2(const real_2d_array &x, const real_2d_array &y, real_2d_array &c, const xparams _xparams)
    1489             : {
    1490             :     jmp_buf _break_jump;
    1491             :     alglib_impl::ae_state _alglib_env_state;    
    1492             :     ae_int_t n;
    1493             :     ae_int_t m1;
    1494             :     ae_int_t m2;
    1495           0 :     if( (x.rows()!=y.rows()))
    1496           0 :         _ALGLIB_CPP_EXCEPTION("Error while calling 'pearsoncorrm2': looks like one of arguments has wrong size");
    1497           0 :     n = x.rows();
    1498           0 :     m1 = x.cols();
    1499           0 :     m2 = y.cols();
    1500           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    1501           0 :     if( setjmp(_break_jump) )
    1502           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    1503           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    1504           0 :     if( _xparams.flags!=0x0 )
    1505           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    1506           0 :     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             : 
    1508           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    1509           0 :     return;
    1510             : }
    1511             : #endif
    1512             : 
    1513             : /*************************************************************************
    1514             : Spearman's rank cross-correlation matrix
    1515             : 
    1516             :   ! COMMERCIAL EDITION OF ALGLIB:
    1517             :   !
    1518             :   ! Commercial Edition of ALGLIB includes following important improvements
    1519             :   ! of this function:
    1520             :   ! * high-performance native backend with same C# interface (C# version)
    1521             :   ! * multithreading support (C++ and C# versions)
    1522             :   ! * hardware vendor (Intel) implementations of linear algebra primitives
    1523             :   !   (C++ and C# versions, x86/x64 platform)
    1524             :   !
    1525             :   ! We recommend you to read 'Working with commercial version' section  of
    1526             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
    1527             :   ! related features provided by commercial edition of ALGLIB.
    1528             : 
    1529             : INPUT PARAMETERS:
    1530             :     X   -   array[N,M1], sample matrix:
    1531             :             * J-th column corresponds to J-th variable
    1532             :             * I-th row corresponds to I-th observation
    1533             :     Y   -   array[N,M2], sample matrix:
    1534             :             * J-th column corresponds to J-th variable
    1535             :             * I-th row corresponds to I-th observation
    1536             :     N   -   N>=0, number of observations:
    1537             :             * if given, only leading N rows of X/Y are used
    1538             :             * if not given, automatically determined from input sizes
    1539             :     M1  -   M1>0, number of variables in X:
    1540             :             * if given, only leading M1 columns of X are used
    1541             :             * if not given, automatically determined from input size
    1542             :     M2  -   M2>0, number of variables in Y:
    1543             :             * if given, only leading M1 columns of X are used
    1544             :             * if not given, automatically determined from input size
    1545             : 
    1546             : OUTPUT PARAMETERS:
    1547             :     C   -   array[M1,M2], cross-correlation matrix (zero if N=0 or N=1)
    1548             : 
    1549             :   -- ALGLIB --
    1550             :      Copyright 28.10.2010 by Bochkanov Sergey
    1551             : *************************************************************************/
    1552           0 : 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, const xparams _xparams)
    1553             : {
    1554             :     jmp_buf _break_jump;
    1555             :     alglib_impl::ae_state _alglib_env_state;
    1556           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    1557           0 :     if( setjmp(_break_jump) )
    1558             :     {
    1559             : #if !defined(AE_NO_EXCEPTIONS)
    1560           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    1561             : #else
    1562             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
    1563             :         return;
    1564             : #endif
    1565             :     }
    1566           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    1567           0 :     if( _xparams.flags!=0x0 )
    1568           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    1569           0 :     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);
    1570           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    1571           0 :     return;
    1572             : }
    1573             : 
    1574             : /*************************************************************************
    1575             : Spearman's rank cross-correlation matrix
    1576             : 
    1577             :   ! COMMERCIAL EDITION OF ALGLIB:
    1578             :   !
    1579             :   ! Commercial Edition of ALGLIB includes following important improvements
    1580             :   ! of this function:
    1581             :   ! * high-performance native backend with same C# interface (C# version)
    1582             :   ! * multithreading support (C++ and C# versions)
    1583             :   ! * hardware vendor (Intel) implementations of linear algebra primitives
    1584             :   !   (C++ and C# versions, x86/x64 platform)
    1585             :   !
    1586             :   ! We recommend you to read 'Working with commercial version' section  of
    1587             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
    1588             :   ! related features provided by commercial edition of ALGLIB.
    1589             : 
    1590             : INPUT PARAMETERS:
    1591             :     X   -   array[N,M1], sample matrix:
    1592             :             * J-th column corresponds to J-th variable
    1593             :             * I-th row corresponds to I-th observation
    1594             :     Y   -   array[N,M2], sample matrix:
    1595             :             * J-th column corresponds to J-th variable
    1596             :             * I-th row corresponds to I-th observation
    1597             :     N   -   N>=0, number of observations:
    1598             :             * if given, only leading N rows of X/Y are used
    1599             :             * if not given, automatically determined from input sizes
    1600             :     M1  -   M1>0, number of variables in X:
    1601             :             * if given, only leading M1 columns of X are used
    1602             :             * if not given, automatically determined from input size
    1603             :     M2  -   M2>0, number of variables in Y:
    1604             :             * if given, only leading M1 columns of X are used
    1605             :             * if not given, automatically determined from input size
    1606             : 
    1607             : OUTPUT PARAMETERS:
    1608             :     C   -   array[M1,M2], cross-correlation matrix (zero if N=0 or N=1)
    1609             : 
    1610             :   -- ALGLIB --
    1611             :      Copyright 28.10.2010 by Bochkanov Sergey
    1612             : *************************************************************************/
    1613             : #if !defined(AE_NO_EXCEPTIONS)
    1614           0 : void spearmancorrm2(const real_2d_array &x, const real_2d_array &y, real_2d_array &c, const xparams _xparams)
    1615             : {
    1616             :     jmp_buf _break_jump;
    1617             :     alglib_impl::ae_state _alglib_env_state;    
    1618             :     ae_int_t n;
    1619             :     ae_int_t m1;
    1620             :     ae_int_t m2;
    1621           0 :     if( (x.rows()!=y.rows()))
    1622           0 :         _ALGLIB_CPP_EXCEPTION("Error while calling 'spearmancorrm2': looks like one of arguments has wrong size");
    1623           0 :     n = x.rows();
    1624           0 :     m1 = x.cols();
    1625           0 :     m2 = y.cols();
    1626           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    1627           0 :     if( setjmp(_break_jump) )
    1628           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    1629           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    1630           0 :     if( _xparams.flags!=0x0 )
    1631           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    1632           0 :     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);
    1633             : 
    1634           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    1635           0 :     return;
    1636             : }
    1637             : #endif
    1638             : 
    1639             : /*************************************************************************
    1640             : This function replaces data in XY by their ranks:
    1641             : * XY is processed row-by-row
    1642             : * rows are processed separately
    1643             : * tied data are correctly handled (tied ranks are calculated)
    1644             : * ranking starts from 0, ends at NFeatures-1
    1645             : * sum of within-row values is equal to (NFeatures-1)*NFeatures/2
    1646             : 
    1647             :   ! COMMERCIAL EDITION OF ALGLIB:
    1648             :   !
    1649             :   ! Commercial Edition of ALGLIB includes following important improvements
    1650             :   ! of this function:
    1651             :   ! * high-performance native backend with same C# interface (C# version)
    1652             :   ! * multithreading support (C++ and C# versions)
    1653             :   !
    1654             :   ! We recommend you to read 'Working with commercial version' section  of
    1655             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
    1656             :   ! related features provided by commercial edition of ALGLIB.
    1657             : 
    1658             : INPUT PARAMETERS:
    1659             :     XY      -   array[NPoints,NFeatures], dataset
    1660             :     NPoints -   number of points
    1661             :     NFeatures-  number of features
    1662             : 
    1663             : OUTPUT PARAMETERS:
    1664             :     XY      -   data are replaced by their within-row ranks;
    1665             :                 ranking starts from 0, ends at NFeatures-1
    1666             : 
    1667             :   -- ALGLIB --
    1668             :      Copyright 18.04.2013 by Bochkanov Sergey
    1669             : *************************************************************************/
    1670           0 : void rankdata(const real_2d_array &xy, const ae_int_t npoints, const ae_int_t nfeatures, const xparams _xparams)
    1671             : {
    1672             :     jmp_buf _break_jump;
    1673             :     alglib_impl::ae_state _alglib_env_state;
    1674           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    1675           0 :     if( setjmp(_break_jump) )
    1676             :     {
    1677             : #if !defined(AE_NO_EXCEPTIONS)
    1678           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    1679             : #else
    1680             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
    1681             :         return;
    1682             : #endif
    1683             :     }
    1684           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    1685           0 :     if( _xparams.flags!=0x0 )
    1686           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    1687           0 :     alglib_impl::rankdata(const_cast<alglib_impl::ae_matrix*>(xy.c_ptr()), npoints, nfeatures, &_alglib_env_state);
    1688           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    1689           0 :     return;
    1690             : }
    1691             : 
    1692             : /*************************************************************************
    1693             : This function replaces data in XY by their ranks:
    1694             : * XY is processed row-by-row
    1695             : * rows are processed separately
    1696             : * tied data are correctly handled (tied ranks are calculated)
    1697             : * ranking starts from 0, ends at NFeatures-1
    1698             : * sum of within-row values is equal to (NFeatures-1)*NFeatures/2
    1699             : 
    1700             :   ! COMMERCIAL EDITION OF ALGLIB:
    1701             :   !
    1702             :   ! Commercial Edition of ALGLIB includes following important improvements
    1703             :   ! of this function:
    1704             :   ! * high-performance native backend with same C# interface (C# version)
    1705             :   ! * multithreading support (C++ and C# versions)
    1706             :   !
    1707             :   ! We recommend you to read 'Working with commercial version' section  of
    1708             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
    1709             :   ! related features provided by commercial edition of ALGLIB.
    1710             : 
    1711             : INPUT PARAMETERS:
    1712             :     XY      -   array[NPoints,NFeatures], dataset
    1713             :     NPoints -   number of points
    1714             :     NFeatures-  number of features
    1715             : 
    1716             : OUTPUT PARAMETERS:
    1717             :     XY      -   data are replaced by their within-row ranks;
    1718             :                 ranking starts from 0, ends at NFeatures-1
    1719             : 
    1720             :   -- ALGLIB --
    1721             :      Copyright 18.04.2013 by Bochkanov Sergey
    1722             : *************************************************************************/
    1723             : #if !defined(AE_NO_EXCEPTIONS)
    1724           0 : void rankdata(real_2d_array &xy, const xparams _xparams)
    1725             : {
    1726             :     jmp_buf _break_jump;
    1727             :     alglib_impl::ae_state _alglib_env_state;    
    1728             :     ae_int_t npoints;
    1729             :     ae_int_t nfeatures;
    1730             : 
    1731           0 :     npoints = xy.rows();
    1732           0 :     nfeatures = xy.cols();
    1733           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    1734           0 :     if( setjmp(_break_jump) )
    1735           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    1736           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    1737           0 :     if( _xparams.flags!=0x0 )
    1738           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    1739           0 :     alglib_impl::rankdata(const_cast<alglib_impl::ae_matrix*>(xy.c_ptr()), npoints, nfeatures, &_alglib_env_state);
    1740             : 
    1741           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    1742           0 :     return;
    1743             : }
    1744             : #endif
    1745             : 
    1746             : /*************************************************************************
    1747             : This function replaces data in XY by their CENTERED ranks:
    1748             : * XY is processed row-by-row
    1749             : * rows are processed separately
    1750             : * tied data are correctly handled (tied ranks are calculated)
    1751             : * centered ranks are just usual ranks, but centered in such way  that  sum
    1752             :   of within-row values is equal to 0.0.
    1753             : * centering is performed by subtracting mean from each row, i.e it changes
    1754             :   mean value, but does NOT change higher moments
    1755             : 
    1756             :   ! COMMERCIAL EDITION OF ALGLIB:
    1757             :   !
    1758             :   ! Commercial Edition of ALGLIB includes following important improvements
    1759             :   ! of this function:
    1760             :   ! * high-performance native backend with same C# interface (C# version)
    1761             :   ! * multithreading support (C++ and C# versions)
    1762             :   !
    1763             :   ! We recommend you to read 'Working with commercial version' section  of
    1764             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
    1765             :   ! related features provided by commercial edition of ALGLIB.
    1766             : 
    1767             : INPUT PARAMETERS:
    1768             :     XY      -   array[NPoints,NFeatures], dataset
    1769             :     NPoints -   number of points
    1770             :     NFeatures-  number of features
    1771             : 
    1772             : OUTPUT PARAMETERS:
    1773             :     XY      -   data are replaced by their within-row ranks;
    1774             :                 ranking starts from 0, ends at NFeatures-1
    1775             : 
    1776             :   -- ALGLIB --
    1777             :      Copyright 18.04.2013 by Bochkanov Sergey
    1778             : *************************************************************************/
    1779           0 : void rankdatacentered(const real_2d_array &xy, const ae_int_t npoints, const ae_int_t nfeatures, const xparams _xparams)
    1780             : {
    1781             :     jmp_buf _break_jump;
    1782             :     alglib_impl::ae_state _alglib_env_state;
    1783           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    1784           0 :     if( setjmp(_break_jump) )
    1785             :     {
    1786             : #if !defined(AE_NO_EXCEPTIONS)
    1787           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    1788             : #else
    1789             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
    1790             :         return;
    1791             : #endif
    1792             :     }
    1793           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    1794           0 :     if( _xparams.flags!=0x0 )
    1795           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    1796           0 :     alglib_impl::rankdatacentered(const_cast<alglib_impl::ae_matrix*>(xy.c_ptr()), npoints, nfeatures, &_alglib_env_state);
    1797           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    1798           0 :     return;
    1799             : }
    1800             : 
    1801             : /*************************************************************************
    1802             : This function replaces data in XY by their CENTERED ranks:
    1803             : * XY is processed row-by-row
    1804             : * rows are processed separately
    1805             : * tied data are correctly handled (tied ranks are calculated)
    1806             : * centered ranks are just usual ranks, but centered in such way  that  sum
    1807             :   of within-row values is equal to 0.0.
    1808             : * centering is performed by subtracting mean from each row, i.e it changes
    1809             :   mean value, but does NOT change higher moments
    1810             : 
    1811             :   ! COMMERCIAL EDITION OF ALGLIB:
    1812             :   !
    1813             :   ! Commercial Edition of ALGLIB includes following important improvements
    1814             :   ! of this function:
    1815             :   ! * high-performance native backend with same C# interface (C# version)
    1816             :   ! * multithreading support (C++ and C# versions)
    1817             :   !
    1818             :   ! We recommend you to read 'Working with commercial version' section  of
    1819             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
    1820             :   ! related features provided by commercial edition of ALGLIB.
    1821             : 
    1822             : INPUT PARAMETERS:
    1823             :     XY      -   array[NPoints,NFeatures], dataset
    1824             :     NPoints -   number of points
    1825             :     NFeatures-  number of features
    1826             : 
    1827             : OUTPUT PARAMETERS:
    1828             :     XY      -   data are replaced by their within-row ranks;
    1829             :                 ranking starts from 0, ends at NFeatures-1
    1830             : 
    1831             :   -- ALGLIB --
    1832             :      Copyright 18.04.2013 by Bochkanov Sergey
    1833             : *************************************************************************/
    1834             : #if !defined(AE_NO_EXCEPTIONS)
    1835           0 : void rankdatacentered(real_2d_array &xy, const xparams _xparams)
    1836             : {
    1837             :     jmp_buf _break_jump;
    1838             :     alglib_impl::ae_state _alglib_env_state;    
    1839             :     ae_int_t npoints;
    1840             :     ae_int_t nfeatures;
    1841             : 
    1842           0 :     npoints = xy.rows();
    1843           0 :     nfeatures = xy.cols();
    1844           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    1845           0 :     if( setjmp(_break_jump) )
    1846           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    1847           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    1848           0 :     if( _xparams.flags!=0x0 )
    1849           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    1850           0 :     alglib_impl::rankdatacentered(const_cast<alglib_impl::ae_matrix*>(xy.c_ptr()), npoints, nfeatures, &_alglib_env_state);
    1851             : 
    1852           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    1853           0 :     return;
    1854             : }
    1855             : #endif
    1856             : 
    1857             : /*************************************************************************
    1858             : Obsolete function, we recommend to use PearsonCorr2().
    1859             : 
    1860             :   -- ALGLIB --
    1861             :      Copyright 09.04.2007 by Bochkanov Sergey
    1862             : *************************************************************************/
    1863           0 : double pearsoncorrelation(const real_1d_array &x, const real_1d_array &y, const ae_int_t n, const xparams _xparams)
    1864             : {
    1865             :     jmp_buf _break_jump;
    1866             :     alglib_impl::ae_state _alglib_env_state;
    1867           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    1868           0 :     if( setjmp(_break_jump) )
    1869             :     {
    1870             : #if !defined(AE_NO_EXCEPTIONS)
    1871           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    1872             : #else
    1873             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
    1874             :         return 0;
    1875             : #endif
    1876             :     }
    1877           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    1878           0 :     if( _xparams.flags!=0x0 )
    1879           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    1880           0 :     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);
    1881           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    1882           0 :     return *(reinterpret_cast<double*>(&result));
    1883             : }
    1884             : 
    1885             : /*************************************************************************
    1886             : Obsolete function, we recommend to use SpearmanCorr2().
    1887             : 
    1888             :     -- ALGLIB --
    1889             :     Copyright 09.04.2007 by Bochkanov Sergey
    1890             : *************************************************************************/
    1891           0 : double spearmanrankcorrelation(const real_1d_array &x, const real_1d_array &y, const ae_int_t n, const xparams _xparams)
    1892             : {
    1893             :     jmp_buf _break_jump;
    1894             :     alglib_impl::ae_state _alglib_env_state;
    1895           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    1896           0 :     if( setjmp(_break_jump) )
    1897             :     {
    1898             : #if !defined(AE_NO_EXCEPTIONS)
    1899           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    1900             : #else
    1901             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
    1902             :         return 0;
    1903             : #endif
    1904             :     }
    1905           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    1906           0 :     if( _xparams.flags!=0x0 )
    1907           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    1908           0 :     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);
    1909           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    1910           0 :     return *(reinterpret_cast<double*>(&result));
    1911             : }
    1912             : #endif
    1913             : 
    1914             : #if defined(AE_COMPILE_WSR) || !defined(AE_PARTIAL_BUILD)
    1915             : /*************************************************************************
    1916             : Wilcoxon signed-rank test
    1917             : 
    1918             : This test checks three hypotheses about the median  of  the  given sample.
    1919             : The following tests are performed:
    1920             :     * two-tailed test (null hypothesis - the median is equal to the  given
    1921             :       value)
    1922             :     * left-tailed test (null hypothesis - the median is  greater  than  or
    1923             :       equal to the given value)
    1924             :     * right-tailed test (null hypothesis  -  the  median  is  less than or
    1925             :       equal to the given value)
    1926             : 
    1927             : Requirements:
    1928             :     * the scale of measurement should be ordinal, interval or  ratio (i.e.
    1929             :       the test could not be applied to nominal variables).
    1930             :     * the distribution should be continuous and symmetric relative to  its
    1931             :       median.
    1932             :     * number of distinct values in the X array should be greater than 4
    1933             : 
    1934             : The test is non-parametric and doesn't require distribution X to be normal
    1935             : 
    1936             : Input parameters:
    1937             :     X       -   sample. Array whose index goes from 0 to N-1.
    1938             :     N       -   size of the sample.
    1939             :     Median  -   assumed median value.
    1940             : 
    1941             : Output parameters:
    1942             :     BothTails   -   p-value for two-tailed test.
    1943             :                     If BothTails is less than the given significance level
    1944             :                     the null hypothesis is rejected.
    1945             :     LeftTail    -   p-value for left-tailed test.
    1946             :                     If LeftTail is less than the given significance level,
    1947             :                     the null hypothesis is rejected.
    1948             :     RightTail   -   p-value for right-tailed test.
    1949             :                     If RightTail is less than the given significance level
    1950             :                     the null hypothesis is rejected.
    1951             : 
    1952             : To calculate p-values, special approximation is used. This method lets  us
    1953             : calculate p-values with two decimal places in interval [0.0001, 1].
    1954             : 
    1955             : "Two decimal places" does not sound very impressive, but in  practice  the
    1956             : relative error of less than 1% is enough to make a decision.
    1957             : 
    1958             : There is no approximation outside the [0.0001, 1] interval. Therefore,  if
    1959             : the significance level outlies this interval, the test returns 0.0001.
    1960             : 
    1961             :   -- ALGLIB --
    1962             :      Copyright 08.09.2006 by Bochkanov Sergey
    1963             : *************************************************************************/
    1964           0 : void wilcoxonsignedranktest(const real_1d_array &x, const ae_int_t n, const double e, double &bothtails, double &lefttail, double &righttail, const xparams _xparams)
    1965             : {
    1966             :     jmp_buf _break_jump;
    1967             :     alglib_impl::ae_state _alglib_env_state;
    1968           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    1969           0 :     if( setjmp(_break_jump) )
    1970             :     {
    1971             : #if !defined(AE_NO_EXCEPTIONS)
    1972           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    1973             : #else
    1974             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
    1975             :         return;
    1976             : #endif
    1977             :     }
    1978           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    1979           0 :     if( _xparams.flags!=0x0 )
    1980           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    1981           0 :     alglib_impl::wilcoxonsignedranktest(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, e, &bothtails, &lefttail, &righttail, &_alglib_env_state);
    1982           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    1983           0 :     return;
    1984             : }
    1985             : #endif
    1986             : 
    1987             : #if defined(AE_COMPILE_STEST) || !defined(AE_PARTIAL_BUILD)
    1988             : /*************************************************************************
    1989             : Sign test
    1990             : 
    1991             : This test checks three hypotheses about the median of  the  given  sample.
    1992             : The following tests are performed:
    1993             :     * two-tailed test (null hypothesis - the median is equal to the  given
    1994             :       value)
    1995             :     * left-tailed test (null hypothesis - the median is  greater  than  or
    1996             :       equal to the given value)
    1997             :     * right-tailed test (null hypothesis - the  median  is  less  than  or
    1998             :       equal to the given value)
    1999             : 
    2000             : Requirements:
    2001             :     * the scale of measurement should be ordinal, interval or ratio  (i.e.
    2002             :       the test could not be applied to nominal variables).
    2003             : 
    2004             : The test is non-parametric and doesn't require distribution X to be normal
    2005             : 
    2006             : Input parameters:
    2007             :     X       -   sample. Array whose index goes from 0 to N-1.
    2008             :     N       -   size of the sample.
    2009             :     Median  -   assumed median value.
    2010             : 
    2011             : Output parameters:
    2012             :     BothTails   -   p-value for two-tailed test.
    2013             :                     If BothTails is less than the given significance level
    2014             :                     the null hypothesis is rejected.
    2015             :     LeftTail    -   p-value for left-tailed test.
    2016             :                     If LeftTail is less than the given significance level,
    2017             :                     the null hypothesis is rejected.
    2018             :     RightTail   -   p-value for right-tailed test.
    2019             :                     If RightTail is less than the given significance level
    2020             :                     the null hypothesis is rejected.
    2021             : 
    2022             : While   calculating   p-values   high-precision   binomial    distribution
    2023             : approximation is used, so significance levels have about 15 exact digits.
    2024             : 
    2025             :   -- ALGLIB --
    2026             :      Copyright 08.09.2006 by Bochkanov Sergey
    2027             : *************************************************************************/
    2028           0 : void onesamplesigntest(const real_1d_array &x, const ae_int_t n, const double median, double &bothtails, double &lefttail, double &righttail, const xparams _xparams)
    2029             : {
    2030             :     jmp_buf _break_jump;
    2031             :     alglib_impl::ae_state _alglib_env_state;
    2032           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    2033           0 :     if( setjmp(_break_jump) )
    2034             :     {
    2035             : #if !defined(AE_NO_EXCEPTIONS)
    2036           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    2037             : #else
    2038             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
    2039             :         return;
    2040             : #endif
    2041             :     }
    2042           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    2043           0 :     if( _xparams.flags!=0x0 )
    2044           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    2045           0 :     alglib_impl::onesamplesigntest(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, median, &bothtails, &lefttail, &righttail, &_alglib_env_state);
    2046           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    2047           0 :     return;
    2048             : }
    2049             : #endif
    2050             : 
    2051             : #if defined(AE_COMPILE_CORRELATIONTESTS) || !defined(AE_PARTIAL_BUILD)
    2052             : /*************************************************************************
    2053             : Pearson's correlation coefficient significance test
    2054             : 
    2055             : This test checks hypotheses about whether X  and  Y  are  samples  of  two
    2056             : continuous  distributions  having  zero  correlation  or   whether   their
    2057             : correlation is non-zero.
    2058             : 
    2059             : The following tests are performed:
    2060             :     * two-tailed test (null hypothesis - X and Y have zero correlation)
    2061             :     * left-tailed test (null hypothesis - the correlation  coefficient  is
    2062             :       greater than or equal to 0)
    2063             :     * right-tailed test (null hypothesis - the correlation coefficient  is
    2064             :       less than or equal to 0).
    2065             : 
    2066             : Requirements:
    2067             :     * the number of elements in each sample is not less than 5
    2068             :     * normality of distributions of X and Y.
    2069             : 
    2070             : Input parameters:
    2071             :     R   -   Pearson's correlation coefficient for X and Y
    2072             :     N   -   number of elements in samples, N>=5.
    2073             : 
    2074             : Output parameters:
    2075             :     BothTails   -   p-value for two-tailed test.
    2076             :                     If BothTails is less than the given significance level
    2077             :                     the null hypothesis is rejected.
    2078             :     LeftTail    -   p-value for left-tailed test.
    2079             :                     If LeftTail is less than the given significance level,
    2080             :                     the null hypothesis is rejected.
    2081             :     RightTail   -   p-value for right-tailed test.
    2082             :                     If RightTail is less than the given significance level
    2083             :                     the null hypothesis is rejected.
    2084             : 
    2085             :   -- ALGLIB --
    2086             :      Copyright 09.04.2007 by Bochkanov Sergey
    2087             : *************************************************************************/
    2088           0 : void pearsoncorrelationsignificance(const double r, const ae_int_t n, double &bothtails, double &lefttail, double &righttail, const xparams _xparams)
    2089             : {
    2090             :     jmp_buf _break_jump;
    2091             :     alglib_impl::ae_state _alglib_env_state;
    2092           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    2093           0 :     if( setjmp(_break_jump) )
    2094             :     {
    2095             : #if !defined(AE_NO_EXCEPTIONS)
    2096           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    2097             : #else
    2098             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
    2099             :         return;
    2100             : #endif
    2101             :     }
    2102           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    2103           0 :     if( _xparams.flags!=0x0 )
    2104           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    2105           0 :     alglib_impl::pearsoncorrelationsignificance(r, n, &bothtails, &lefttail, &righttail, &_alglib_env_state);
    2106           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    2107           0 :     return;
    2108             : }
    2109             : 
    2110             : /*************************************************************************
    2111             : Spearman's rank correlation coefficient significance test
    2112             : 
    2113             : This test checks hypotheses about whether X  and  Y  are  samples  of  two
    2114             : continuous  distributions  having  zero  correlation  or   whether   their
    2115             : correlation is non-zero.
    2116             : 
    2117             : The following tests are performed:
    2118             :     * two-tailed test (null hypothesis - X and Y have zero correlation)
    2119             :     * left-tailed test (null hypothesis - the correlation  coefficient  is
    2120             :       greater than or equal to 0)
    2121             :     * right-tailed test (null hypothesis - the correlation coefficient  is
    2122             :       less than or equal to 0).
    2123             : 
    2124             : Requirements:
    2125             :     * the number of elements in each sample is not less than 5.
    2126             : 
    2127             : The test is non-parametric and doesn't require distributions X and Y to be
    2128             : normal.
    2129             : 
    2130             : Input parameters:
    2131             :     R   -   Spearman's rank correlation coefficient for X and Y
    2132             :     N   -   number of elements in samples, 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             :   -- ALGLIB --
    2146             :      Copyright 09.04.2007 by Bochkanov Sergey
    2147             : *************************************************************************/
    2148           0 : void spearmanrankcorrelationsignificance(const double r, const ae_int_t n, double &bothtails, double &lefttail, double &righttail, const xparams _xparams)
    2149             : {
    2150             :     jmp_buf _break_jump;
    2151             :     alglib_impl::ae_state _alglib_env_state;
    2152           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    2153           0 :     if( setjmp(_break_jump) )
    2154             :     {
    2155             : #if !defined(AE_NO_EXCEPTIONS)
    2156           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    2157             : #else
    2158             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
    2159             :         return;
    2160             : #endif
    2161             :     }
    2162           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    2163           0 :     if( _xparams.flags!=0x0 )
    2164           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    2165           0 :     alglib_impl::spearmanrankcorrelationsignificance(r, n, &bothtails, &lefttail, &righttail, &_alglib_env_state);
    2166           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    2167           0 :     return;
    2168             : }
    2169             : #endif
    2170             : 
    2171             : #if defined(AE_COMPILE_STUDENTTTESTS) || !defined(AE_PARTIAL_BUILD)
    2172             : /*************************************************************************
    2173             : One-sample t-test
    2174             : 
    2175             : This test checks three hypotheses about the mean of the given sample.  The
    2176             : following tests are performed:
    2177             :     * two-tailed test (null hypothesis - the mean is equal  to  the  given
    2178             :       value)
    2179             :     * left-tailed test (null hypothesis - the  mean  is  greater  than  or
    2180             :       equal to the given value)
    2181             :     * right-tailed test (null hypothesis - the mean is less than or  equal
    2182             :       to the given value).
    2183             : 
    2184             : The test is based on the assumption that  a  given  sample  has  a  normal
    2185             : distribution and  an  unknown  dispersion.  If  the  distribution  sharply
    2186             : differs from normal, the test will work incorrectly.
    2187             : 
    2188             : INPUT PARAMETERS:
    2189             :     X       -   sample. Array whose index goes from 0 to N-1.
    2190             :     N       -   size of sample, N>=0
    2191             :     Mean    -   assumed value of the mean.
    2192             : 
    2193             : OUTPUT PARAMETERS:
    2194             :     BothTails   -   p-value for two-tailed test.
    2195             :                     If BothTails is less than the given significance level
    2196             :                     the null hypothesis is rejected.
    2197             :     LeftTail    -   p-value for left-tailed test.
    2198             :                     If LeftTail is less than the given significance level,
    2199             :                     the null hypothesis is rejected.
    2200             :     RightTail   -   p-value for right-tailed test.
    2201             :                     If RightTail is less than the given significance level
    2202             :                     the null hypothesis is rejected.
    2203             : 
    2204             : NOTE: this function correctly handles degenerate cases:
    2205             :       * when N=0, all p-values are set to 1.0
    2206             :       * when variance of X[] is exactly zero, p-values are set
    2207             :         to 1.0 or 0.0, depending on difference between sample mean and
    2208             :         value of mean being tested.
    2209             : 
    2210             : 
    2211             :   -- ALGLIB --
    2212             :      Copyright 08.09.2006 by Bochkanov Sergey
    2213             : *************************************************************************/
    2214           0 : void studentttest1(const real_1d_array &x, const ae_int_t n, const double mean, double &bothtails, double &lefttail, double &righttail, const xparams _xparams)
    2215             : {
    2216             :     jmp_buf _break_jump;
    2217             :     alglib_impl::ae_state _alglib_env_state;
    2218           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    2219           0 :     if( setjmp(_break_jump) )
    2220             :     {
    2221             : #if !defined(AE_NO_EXCEPTIONS)
    2222           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    2223             : #else
    2224             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
    2225             :         return;
    2226             : #endif
    2227             :     }
    2228           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    2229           0 :     if( _xparams.flags!=0x0 )
    2230           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    2231           0 :     alglib_impl::studentttest1(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, mean, &bothtails, &lefttail, &righttail, &_alglib_env_state);
    2232           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    2233           0 :     return;
    2234             : }
    2235             : 
    2236             : /*************************************************************************
    2237             : Two-sample pooled test
    2238             : 
    2239             : This test checks three hypotheses about the mean of the given samples. The
    2240             : following tests are performed:
    2241             :     * two-tailed test (null hypothesis - the means are equal)
    2242             :     * left-tailed test (null hypothesis - the mean of the first sample  is
    2243             :       greater than or equal to the mean of the second sample)
    2244             :     * right-tailed test (null hypothesis - the mean of the first sample is
    2245             :       less than or equal to the mean of the second sample).
    2246             : 
    2247             : Test is based on the following assumptions:
    2248             :     * given samples have normal distributions
    2249             :     * dispersions are equal
    2250             :     * samples are independent.
    2251             : 
    2252             : Input parameters:
    2253             :     X       -   sample 1. Array whose index goes from 0 to N-1.
    2254             :     N       -   size of sample.
    2255             :     Y       -   sample 2. Array whose index goes from 0 to M-1.
    2256             :     M       -   size of sample.
    2257             : 
    2258             : Output parameters:
    2259             :     BothTails   -   p-value for two-tailed test.
    2260             :                     If BothTails is less than the given significance level
    2261             :                     the null hypothesis is rejected.
    2262             :     LeftTail    -   p-value for left-tailed test.
    2263             :                     If LeftTail is less than the given significance level,
    2264             :                     the null hypothesis is rejected.
    2265             :     RightTail   -   p-value for right-tailed test.
    2266             :                     If RightTail is less than the given significance level
    2267             :                     the null hypothesis is rejected.
    2268             : 
    2269             : NOTE: this function correctly handles degenerate cases:
    2270             :       * when N=0 or M=0, all p-values are set to 1.0
    2271             :       * when both samples has exactly zero variance, p-values are set
    2272             :         to 1.0 or 0.0, depending on difference between means.
    2273             : 
    2274             :   -- ALGLIB --
    2275             :      Copyright 18.09.2006 by Bochkanov Sergey
    2276             : *************************************************************************/
    2277           0 : 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, const xparams _xparams)
    2278             : {
    2279             :     jmp_buf _break_jump;
    2280             :     alglib_impl::ae_state _alglib_env_state;
    2281           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    2282           0 :     if( setjmp(_break_jump) )
    2283             :     {
    2284             : #if !defined(AE_NO_EXCEPTIONS)
    2285           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    2286             : #else
    2287             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
    2288             :         return;
    2289             : #endif
    2290             :     }
    2291           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    2292           0 :     if( _xparams.flags!=0x0 )
    2293           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    2294           0 :     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);
    2295           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    2296           0 :     return;
    2297             : }
    2298             : 
    2299             : /*************************************************************************
    2300             : Two-sample unpooled test
    2301             : 
    2302             : This test checks three hypotheses about the mean of the given samples. The
    2303             : following tests are performed:
    2304             :     * two-tailed test (null hypothesis - the means are equal)
    2305             :     * left-tailed test (null hypothesis - the mean of the first sample  is
    2306             :       greater than or equal to the mean of the second sample)
    2307             :     * right-tailed test (null hypothesis - the mean of the first sample is
    2308             :       less than or equal to the mean of the second sample).
    2309             : 
    2310             : Test is based on the following assumptions:
    2311             :     * given samples have normal distributions
    2312             :     * samples are independent.
    2313             : Equality of variances is NOT required.
    2314             : 
    2315             : Input parameters:
    2316             :     X - sample 1. Array whose index goes from 0 to N-1.
    2317             :     N - size of the sample.
    2318             :     Y - sample 2. Array whose index goes from 0 to M-1.
    2319             :     M - size of the sample.
    2320             : 
    2321             : Output parameters:
    2322             :     BothTails   -   p-value for two-tailed test.
    2323             :                     If BothTails is less than the given significance level
    2324             :                     the null hypothesis is rejected.
    2325             :     LeftTail    -   p-value for left-tailed test.
    2326             :                     If LeftTail is less than the given significance level,
    2327             :                     the null hypothesis is rejected.
    2328             :     RightTail   -   p-value for right-tailed test.
    2329             :                     If RightTail is less than the given significance level
    2330             :                     the null hypothesis is rejected.
    2331             : 
    2332             : NOTE: this function correctly handles degenerate cases:
    2333             :       * when N=0 or M=0, all p-values are set to 1.0
    2334             :       * when both samples has zero variance, p-values are set
    2335             :         to 1.0 or 0.0, depending on difference between means.
    2336             :       * when only one sample has zero variance, test reduces to 1-sample
    2337             :         version.
    2338             : 
    2339             :   -- ALGLIB --
    2340             :      Copyright 18.09.2006 by Bochkanov Sergey
    2341             : *************************************************************************/
    2342           0 : 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, const xparams _xparams)
    2343             : {
    2344             :     jmp_buf _break_jump;
    2345             :     alglib_impl::ae_state _alglib_env_state;
    2346           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    2347           0 :     if( setjmp(_break_jump) )
    2348             :     {
    2349             : #if !defined(AE_NO_EXCEPTIONS)
    2350           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    2351             : #else
    2352             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
    2353             :         return;
    2354             : #endif
    2355             :     }
    2356           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    2357           0 :     if( _xparams.flags!=0x0 )
    2358           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    2359           0 :     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);
    2360           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    2361           0 :     return;
    2362             : }
    2363             : #endif
    2364             : 
    2365             : #if defined(AE_COMPILE_MANNWHITNEYU) || !defined(AE_PARTIAL_BUILD)
    2366             : /*************************************************************************
    2367             : Mann-Whitney U-test
    2368             : 
    2369             : This test checks hypotheses about whether X  and  Y  are  samples  of  two
    2370             : continuous distributions of the same shape  and  same  median  or  whether
    2371             : their medians are different.
    2372             : 
    2373             : The following tests are performed:
    2374             :     * two-tailed test (null hypothesis - the medians are equal)
    2375             :     * left-tailed test (null hypothesis - the median of the  first  sample
    2376             :       is greater than or equal to the median of the second sample)
    2377             :     * right-tailed test (null hypothesis - the median of the first  sample
    2378             :       is less than or equal to the median of the second sample).
    2379             : 
    2380             : Requirements:
    2381             :     * the samples are independent
    2382             :     * X and Y are continuous distributions (or discrete distributions well-
    2383             :       approximating continuous distributions)
    2384             :     * distributions of X and Y have the  same  shape.  The  only  possible
    2385             :       difference is their position (i.e. the value of the median)
    2386             :     * the number of elements in each sample is not less than 5
    2387             :     * the scale of measurement should be ordinal, interval or ratio  (i.e.
    2388             :       the test could not be applied to nominal variables).
    2389             : 
    2390             : The test is non-parametric and doesn't require distributions to be normal.
    2391             : 
    2392             : Input parameters:
    2393             :     X   -   sample 1. Array whose index goes from 0 to N-1.
    2394             :     N   -   size of the sample. N>=5
    2395             :     Y   -   sample 2. Array whose index goes from 0 to M-1.
    2396             :     M   -   size of the sample. M>=5
    2397             : 
    2398             : Output parameters:
    2399             :     BothTails   -   p-value for two-tailed test.
    2400             :                     If BothTails is less than the given significance level
    2401             :                     the null hypothesis is rejected.
    2402             :     LeftTail    -   p-value for left-tailed test.
    2403             :                     If LeftTail is less than the given significance level,
    2404             :                     the null hypothesis is rejected.
    2405             :     RightTail   -   p-value for right-tailed test.
    2406             :                     If RightTail is less than the given significance level
    2407             :                     the null hypothesis is rejected.
    2408             : 
    2409             : To calculate p-values, special approximation is used. This method lets  us
    2410             : calculate p-values with satisfactory  accuracy  in  interval  [0.0001, 1].
    2411             : There is no approximation outside the [0.0001, 1] interval. Therefore,  if
    2412             : the significance level outlies this interval, the test returns 0.0001.
    2413             : 
    2414             : Relative precision of approximation of p-value:
    2415             : 
    2416             : N          M          Max.err.   Rms.err.
    2417             : 5..10      N..10      1.4e-02    6.0e-04
    2418             : 5..10      N..100     2.2e-02    5.3e-06
    2419             : 10..15     N..15      1.0e-02    3.2e-04
    2420             : 10..15     N..100     1.0e-02    2.2e-05
    2421             : 15..100    N..100     6.1e-03    2.7e-06
    2422             : 
    2423             : For N,M>100 accuracy checks weren't put into  practice,  but  taking  into
    2424             : account characteristics of asymptotic approximation used, precision should
    2425             : not be sharply different from the values for interval [5, 100].
    2426             : 
    2427             : NOTE: P-value approximation was  optimized  for  0.0001<=p<=0.2500.  Thus,
    2428             :       P's outside of this interval are enforced to these bounds. Say,  you
    2429             :       may quite often get P equal to exactly 0.25 or 0.0001.
    2430             : 
    2431             :   -- ALGLIB --
    2432             :      Copyright 09.04.2007 by Bochkanov Sergey
    2433             : *************************************************************************/
    2434           0 : 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, const xparams _xparams)
    2435             : {
    2436             :     jmp_buf _break_jump;
    2437             :     alglib_impl::ae_state _alglib_env_state;
    2438           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    2439           0 :     if( setjmp(_break_jump) )
    2440             :     {
    2441             : #if !defined(AE_NO_EXCEPTIONS)
    2442           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    2443             : #else
    2444             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
    2445             :         return;
    2446             : #endif
    2447             :     }
    2448           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    2449           0 :     if( _xparams.flags!=0x0 )
    2450           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    2451           0 :     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);
    2452           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    2453           0 :     return;
    2454             : }
    2455             : #endif
    2456             : 
    2457             : #if defined(AE_COMPILE_JARQUEBERA) || !defined(AE_PARTIAL_BUILD)
    2458             : /*************************************************************************
    2459             : Jarque-Bera test
    2460             : 
    2461             : This test checks hypotheses about the fact that a  given  sample  X  is  a
    2462             : sample of normal random variable.
    2463             : 
    2464             : Requirements:
    2465             :     * the number of elements in the sample is not less than 5.
    2466             : 
    2467             : Input parameters:
    2468             :     X   -   sample. Array whose index goes from 0 to N-1.
    2469             :     N   -   size of the sample. N>=5
    2470             : 
    2471             : Output parameters:
    2472             :     P           -   p-value for the test
    2473             : 
    2474             : Accuracy of the approximation used (5<=N<=1951):
    2475             : 
    2476             : p-value             relative error (5<=N<=1951)
    2477             : [1, 0.1]            < 1%
    2478             : [0.1, 0.01]         < 2%
    2479             : [0.01, 0.001]       < 6%
    2480             : [0.001, 0]          wasn't measured
    2481             : 
    2482             : For N>1951 accuracy wasn't measured but it shouldn't be sharply  different
    2483             : from table values.
    2484             : 
    2485             :   -- ALGLIB --
    2486             :      Copyright 09.04.2007 by Bochkanov Sergey
    2487             : *************************************************************************/
    2488           0 : void jarqueberatest(const real_1d_array &x, const ae_int_t n, double &p, const xparams _xparams)
    2489             : {
    2490             :     jmp_buf _break_jump;
    2491             :     alglib_impl::ae_state _alglib_env_state;
    2492           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    2493           0 :     if( setjmp(_break_jump) )
    2494             :     {
    2495             : #if !defined(AE_NO_EXCEPTIONS)
    2496           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    2497             : #else
    2498             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
    2499             :         return;
    2500             : #endif
    2501             :     }
    2502           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    2503           0 :     if( _xparams.flags!=0x0 )
    2504           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    2505           0 :     alglib_impl::jarqueberatest(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, &p, &_alglib_env_state);
    2506           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    2507           0 :     return;
    2508             : }
    2509             : #endif
    2510             : 
    2511             : #if defined(AE_COMPILE_VARIANCETESTS) || !defined(AE_PARTIAL_BUILD)
    2512             : /*************************************************************************
    2513             : Two-sample F-test
    2514             : 
    2515             : This test checks three hypotheses about dispersions of the given  samples.
    2516             : The following tests are performed:
    2517             :     * two-tailed test (null hypothesis - the dispersions are equal)
    2518             :     * left-tailed test (null hypothesis  -  the  dispersion  of  the first
    2519             :       sample is greater than or equal to  the  dispersion  of  the  second
    2520             :       sample).
    2521             :     * right-tailed test (null hypothesis - the  dispersion  of  the  first
    2522             :       sample is less than or equal to the dispersion of the second sample)
    2523             : 
    2524             : The test is based on the following assumptions:
    2525             :     * the given samples have normal distributions
    2526             :     * the samples are independent.
    2527             : 
    2528             : Input parameters:
    2529             :     X   -   sample 1. Array whose index goes from 0 to N-1.
    2530             :     N   -   sample size.
    2531             :     Y   -   sample 2. Array whose index goes from 0 to M-1.
    2532             :     M   -   sample size.
    2533             : 
    2534             : Output parameters:
    2535             :     BothTails   -   p-value for two-tailed test.
    2536             :                     If BothTails is less than the given significance level
    2537             :                     the null hypothesis is rejected.
    2538             :     LeftTail    -   p-value for left-tailed test.
    2539             :                     If LeftTail is less than the given significance level,
    2540             :                     the null hypothesis is rejected.
    2541             :     RightTail   -   p-value for right-tailed test.
    2542             :                     If RightTail is less than the given significance level
    2543             :                     the null hypothesis is rejected.
    2544             : 
    2545             :   -- ALGLIB --
    2546             :      Copyright 19.09.2006 by Bochkanov Sergey
    2547             : *************************************************************************/
    2548           0 : 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, const xparams _xparams)
    2549             : {
    2550             :     jmp_buf _break_jump;
    2551             :     alglib_impl::ae_state _alglib_env_state;
    2552           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    2553           0 :     if( setjmp(_break_jump) )
    2554             :     {
    2555             : #if !defined(AE_NO_EXCEPTIONS)
    2556           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    2557             : #else
    2558             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
    2559             :         return;
    2560             : #endif
    2561             :     }
    2562           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    2563           0 :     if( _xparams.flags!=0x0 )
    2564           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    2565           0 :     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);
    2566           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    2567           0 :     return;
    2568             : }
    2569             : 
    2570             : /*************************************************************************
    2571             : One-sample chi-square test
    2572             : 
    2573             : This test checks three hypotheses about the dispersion of the given sample
    2574             : The following tests are performed:
    2575             :     * two-tailed test (null hypothesis - the dispersion equals  the  given
    2576             :       number)
    2577             :     * left-tailed test (null hypothesis - the dispersion is  greater  than
    2578             :       or equal to the given number)
    2579             :     * right-tailed test (null hypothesis  -  dispersion is  less  than  or
    2580             :       equal to the given number).
    2581             : 
    2582             : Test is based on the following assumptions:
    2583             :     * the given sample has a normal distribution.
    2584             : 
    2585             : Input parameters:
    2586             :     X           -   sample 1. Array whose index goes from 0 to N-1.
    2587             :     N           -   size of the sample.
    2588             :     Variance    -   dispersion value to compare with.
    2589             : 
    2590             : Output parameters:
    2591             :     BothTails   -   p-value for two-tailed test.
    2592             :                     If BothTails is less than the given significance level
    2593             :                     the null hypothesis is rejected.
    2594             :     LeftTail    -   p-value for left-tailed test.
    2595             :                     If LeftTail is less than the given significance level,
    2596             :                     the null hypothesis is rejected.
    2597             :     RightTail   -   p-value for right-tailed test.
    2598             :                     If RightTail is less than the given significance level
    2599             :                     the null hypothesis is rejected.
    2600             : 
    2601             :   -- ALGLIB --
    2602             :      Copyright 19.09.2006 by Bochkanov Sergey
    2603             : *************************************************************************/
    2604           0 : void onesamplevariancetest(const real_1d_array &x, const ae_int_t n, const double variance, double &bothtails, double &lefttail, double &righttail, const xparams _xparams)
    2605             : {
    2606             :     jmp_buf _break_jump;
    2607             :     alglib_impl::ae_state _alglib_env_state;
    2608           0 :     alglib_impl::ae_state_init(&_alglib_env_state);
    2609           0 :     if( setjmp(_break_jump) )
    2610             :     {
    2611             : #if !defined(AE_NO_EXCEPTIONS)
    2612           0 :         _ALGLIB_CPP_EXCEPTION(_alglib_env_state.error_msg);
    2613             : #else
    2614             :         _ALGLIB_SET_ERROR_FLAG(_alglib_env_state.error_msg);
    2615             :         return;
    2616             : #endif
    2617             :     }
    2618           0 :     ae_state_set_break_jump(&_alglib_env_state, &_break_jump);
    2619           0 :     if( _xparams.flags!=0x0 )
    2620           0 :         ae_state_set_flags(&_alglib_env_state, _xparams.flags);
    2621           0 :     alglib_impl::onesamplevariancetest(const_cast<alglib_impl::ae_vector*>(x.c_ptr()), n, variance, &bothtails, &lefttail, &righttail, &_alglib_env_state);
    2622           0 :     alglib_impl::ae_state_clear(&_alglib_env_state);
    2623           0 :     return;
    2624             : }
    2625             : #endif
    2626             : }
    2627             : 
    2628             : /////////////////////////////////////////////////////////////////////////
    2629             : //
    2630             : // THIS SECTION CONTAINS IMPLEMENTATION OF COMPUTATIONAL CORE
    2631             : //
    2632             : /////////////////////////////////////////////////////////////////////////
    2633             : namespace alglib_impl
    2634             : {
    2635             : #if defined(AE_COMPILE_BASESTAT) || !defined(AE_PARTIAL_BUILD)
    2636             : static void basestat_rankdatarec(/* Real    */ ae_matrix* xy,
    2637             :      ae_int_t i0,
    2638             :      ae_int_t i1,
    2639             :      ae_int_t nfeatures,
    2640             :      ae_bool iscentered,
    2641             :      ae_shared_pool* pool,
    2642             :      ae_int_t basecasecost,
    2643             :      ae_state *_state);
    2644             : ae_bool _trypexec_basestat_rankdatarec(/* Real    */ ae_matrix* xy,
    2645             :     ae_int_t i0,
    2646             :     ae_int_t i1,
    2647             :     ae_int_t nfeatures,
    2648             :     ae_bool iscentered,
    2649             :     ae_shared_pool* pool,
    2650             :     ae_int_t basecasecost, ae_state *_state);
    2651             : static void basestat_rankdatabasecase(/* Real    */ ae_matrix* xy,
    2652             :      ae_int_t i0,
    2653             :      ae_int_t i1,
    2654             :      ae_int_t nfeatures,
    2655             :      ae_bool iscentered,
    2656             :      apbuffers* buf0,
    2657             :      apbuffers* buf1,
    2658             :      ae_state *_state);
    2659             : ae_bool _trypexec_basestat_rankdatabasecase(/* Real    */ ae_matrix* xy,
    2660             :     ae_int_t i0,
    2661             :     ae_int_t i1,
    2662             :     ae_int_t nfeatures,
    2663             :     ae_bool iscentered,
    2664             :     apbuffers* buf0,
    2665             :     apbuffers* buf1, ae_state *_state);
    2666             : 
    2667             : 
    2668             : #endif
    2669             : #if defined(AE_COMPILE_WSR) || !defined(AE_PARTIAL_BUILD)
    2670             : static void wsr_wcheb(double x,
    2671             :      double c,
    2672             :      double* tj,
    2673             :      double* tj1,
    2674             :      double* r,
    2675             :      ae_state *_state);
    2676             : static double wsr_w5(double s, ae_state *_state);
    2677             : static double wsr_w6(double s, ae_state *_state);
    2678             : static double wsr_w7(double s, ae_state *_state);
    2679             : static double wsr_w8(double s, ae_state *_state);
    2680             : static double wsr_w9(double s, ae_state *_state);
    2681             : static double wsr_w10(double s, ae_state *_state);
    2682             : static double wsr_w11(double s, ae_state *_state);
    2683             : static double wsr_w12(double s, ae_state *_state);
    2684             : static double wsr_w13(double s, ae_state *_state);
    2685             : static double wsr_w14(double s, ae_state *_state);
    2686             : static double wsr_w15(double s, ae_state *_state);
    2687             : static double wsr_w16(double s, ae_state *_state);
    2688             : static double wsr_w17(double s, ae_state *_state);
    2689             : static double wsr_w18(double s, ae_state *_state);
    2690             : static double wsr_w19(double s, ae_state *_state);
    2691             : static double wsr_w20(double s, ae_state *_state);
    2692             : static double wsr_w21(double s, ae_state *_state);
    2693             : static double wsr_w22(double s, ae_state *_state);
    2694             : static double wsr_w23(double s, ae_state *_state);
    2695             : static double wsr_w24(double s, ae_state *_state);
    2696             : static double wsr_w25(double s, ae_state *_state);
    2697             : static double wsr_w26(double s, ae_state *_state);
    2698             : static double wsr_w27(double s, ae_state *_state);
    2699             : static double wsr_w28(double s, ae_state *_state);
    2700             : static double wsr_w29(double s, ae_state *_state);
    2701             : static double wsr_w30(double s, ae_state *_state);
    2702             : static double wsr_w40(double s, ae_state *_state);
    2703             : static double wsr_w60(double s, ae_state *_state);
    2704             : static double wsr_w120(double s, ae_state *_state);
    2705             : static double wsr_w200(double s, ae_state *_state);
    2706             : static double wsr_wsigma(double s, ae_int_t n, ae_state *_state);
    2707             : 
    2708             : 
    2709             : #endif
    2710             : #if defined(AE_COMPILE_STEST) || !defined(AE_PARTIAL_BUILD)
    2711             : 
    2712             : 
    2713             : #endif
    2714             : #if defined(AE_COMPILE_CORRELATIONTESTS) || !defined(AE_PARTIAL_BUILD)
    2715             : static double correlationtests_spearmantail5(double s, ae_state *_state);
    2716             : static double correlationtests_spearmantail6(double s, ae_state *_state);
    2717             : static double correlationtests_spearmantail7(double s, ae_state *_state);
    2718             : static double correlationtests_spearmantail8(double s, ae_state *_state);
    2719             : static double correlationtests_spearmantail9(double s, ae_state *_state);
    2720             : static double correlationtests_spearmantail(double t,
    2721             :      ae_int_t n,
    2722             :      ae_state *_state);
    2723             : 
    2724             : 
    2725             : #endif
    2726             : #if defined(AE_COMPILE_STUDENTTTESTS) || !defined(AE_PARTIAL_BUILD)
    2727             : 
    2728             : 
    2729             : #endif
    2730             : #if defined(AE_COMPILE_MANNWHITNEYU) || !defined(AE_PARTIAL_BUILD)
    2731             : static void mannwhitneyu_ucheb(double x,
    2732             :      double c,
    2733             :      double* tj,
    2734             :      double* tj1,
    2735             :      double* r,
    2736             :      ae_state *_state);
    2737             : static double mannwhitneyu_uninterpolate(double p1,
    2738             :      double p2,
    2739             :      double p3,
    2740             :      ae_int_t n,
    2741             :      ae_state *_state);
    2742             : static double mannwhitneyu_usigma000(ae_int_t n1,
    2743             :      ae_int_t n2,
    2744             :      ae_state *_state);
    2745             : static double mannwhitneyu_usigma075(ae_int_t n1,
    2746             :      ae_int_t n2,
    2747             :      ae_state *_state);
    2748             : static double mannwhitneyu_usigma150(ae_int_t n1,
    2749             :      ae_int_t n2,
    2750             :      ae_state *_state);
    2751             : static double mannwhitneyu_usigma225(ae_int_t n1,
    2752             :      ae_int_t n2,
    2753             :      ae_state *_state);
    2754             : static double mannwhitneyu_usigma300(ae_int_t n1,
    2755             :      ae_int_t n2,
    2756             :      ae_state *_state);
    2757             : static double mannwhitneyu_usigma333(ae_int_t n1,
    2758             :      ae_int_t n2,
    2759             :      ae_state *_state);
    2760             : static double mannwhitneyu_usigma367(ae_int_t n1,
    2761             :      ae_int_t n2,
    2762             :      ae_state *_state);
    2763             : static double mannwhitneyu_usigma400(ae_int_t n1,
    2764             :      ae_int_t n2,
    2765             :      ae_state *_state);
    2766             : static double mannwhitneyu_utbln5n5(double s, ae_state *_state);
    2767             : static double mannwhitneyu_utbln5n6(double s, ae_state *_state);
    2768             : static double mannwhitneyu_utbln5n7(double s, ae_state *_state);
    2769             : static double mannwhitneyu_utbln5n8(double s, ae_state *_state);
    2770             : static double mannwhitneyu_utbln5n9(double s, ae_state *_state);
    2771             : static double mannwhitneyu_utbln5n10(double s, ae_state *_state);
    2772             : static double mannwhitneyu_utbln5n11(double s, ae_state *_state);
    2773             : static double mannwhitneyu_utbln5n12(double s, ae_state *_state);
    2774             : static double mannwhitneyu_utbln5n13(double s, ae_state *_state);
    2775             : static double mannwhitneyu_utbln5n14(double s, ae_state *_state);
    2776             : static double mannwhitneyu_utbln5n15(double s, ae_state *_state);
    2777             : static double mannwhitneyu_utbln5n16(double s, ae_state *_state);
    2778             : static double mannwhitneyu_utbln5n17(double s, ae_state *_state);
    2779             : static double mannwhitneyu_utbln5n18(double s, ae_state *_state);
    2780             : static double mannwhitneyu_utbln5n19(double s, ae_state *_state);
    2781             : static double mannwhitneyu_utbln5n20(double s, ae_state *_state);
    2782             : static double mannwhitneyu_utbln5n21(double s, ae_state *_state);
    2783             : static double mannwhitneyu_utbln5n22(double s, ae_state *_state);
    2784             : static double mannwhitneyu_utbln5n23(double s, ae_state *_state);
    2785             : static double mannwhitneyu_utbln5n24(double s, ae_state *_state);
    2786             : static double mannwhitneyu_utbln5n25(double s, ae_state *_state);
    2787             : static double mannwhitneyu_utbln5n26(double s, ae_state *_state);
    2788             : static double mannwhitneyu_utbln5n27(double s, ae_state *_state);
    2789             : static double mannwhitneyu_utbln5n28(double s, ae_state *_state);
    2790             : static double mannwhitneyu_utbln5n29(double s, ae_state *_state);
    2791             : static double mannwhitneyu_utbln5n30(double s, ae_state *_state);
    2792             : static double mannwhitneyu_utbln5n100(double s, ae_state *_state);
    2793             : static double mannwhitneyu_utbln6n6(double s, ae_state *_state);
    2794             : static double mannwhitneyu_utbln6n7(double s, ae_state *_state);
    2795             : static double mannwhitneyu_utbln6n8(double s, ae_state *_state);
    2796             : static double mannwhitneyu_utbln6n9(double s, ae_state *_state);
    2797             : static double mannwhitneyu_utbln6n10(double s, ae_state *_state);
    2798             : static double mannwhitneyu_utbln6n11(double s, ae_state *_state);
    2799             : static double mannwhitneyu_utbln6n12(double s, ae_state *_state);
    2800             : static double mannwhitneyu_utbln6n13(double s, ae_state *_state);
    2801             : static double mannwhitneyu_utbln6n14(double s, ae_state *_state);
    2802             : static double mannwhitneyu_utbln6n15(double s, ae_state *_state);
    2803             : static double mannwhitneyu_utbln6n30(double s, ae_state *_state);
    2804             : static double mannwhitneyu_utbln6n100(double s, ae_state *_state);
    2805             : static double mannwhitneyu_utbln7n7(double s, ae_state *_state);
    2806             : static double mannwhitneyu_utbln7n8(double s, ae_state *_state);
    2807             : static double mannwhitneyu_utbln7n9(double s, ae_state *_state);
    2808             : static double mannwhitneyu_utbln7n10(double s, ae_state *_state);
    2809             : static double mannwhitneyu_utbln7n11(double s, ae_state *_state);
    2810             : static double mannwhitneyu_utbln7n12(double s, ae_state *_state);
    2811             : static double mannwhitneyu_utbln7n13(double s, ae_state *_state);
    2812             : static double mannwhitneyu_utbln7n14(double s, ae_state *_state);
    2813             : static double mannwhitneyu_utbln7n15(double s, ae_state *_state);
    2814             : static double mannwhitneyu_utbln7n30(double s, ae_state *_state);
    2815             : static double mannwhitneyu_utbln7n100(double s, ae_state *_state);
    2816             : static double mannwhitneyu_utbln8n8(double s, ae_state *_state);
    2817             : static double mannwhitneyu_utbln8n9(double s, ae_state *_state);
    2818             : static double mannwhitneyu_utbln8n10(double s, ae_state *_state);
    2819             : static double mannwhitneyu_utbln8n11(double s, ae_state *_state);
    2820             : static double mannwhitneyu_utbln8n12(double s, ae_state *_state);
    2821             : static double mannwhitneyu_utbln8n13(double s, ae_state *_state);
    2822             : static double mannwhitneyu_utbln8n14(double s, ae_state *_state);
    2823             : static double mannwhitneyu_utbln8n15(double s, ae_state *_state);
    2824             : static double mannwhitneyu_utbln8n30(double s, ae_state *_state);
    2825             : static double mannwhitneyu_utbln8n100(double s, ae_state *_state);
    2826             : static double mannwhitneyu_utbln9n9(double s, ae_state *_state);
    2827             : static double mannwhitneyu_utbln9n10(double s, ae_state *_state);
    2828             : static double mannwhitneyu_utbln9n11(double s, ae_state *_state);
    2829             : static double mannwhitneyu_utbln9n12(double s, ae_state *_state);
    2830             : static double mannwhitneyu_utbln9n13(double s, ae_state *_state);
    2831             : static double mannwhitneyu_utbln9n14(double s, ae_state *_state);
    2832             : static double mannwhitneyu_utbln9n15(double s, ae_state *_state);
    2833             : static double mannwhitneyu_utbln9n30(double s, ae_state *_state);
    2834             : static double mannwhitneyu_utbln9n100(double s, ae_state *_state);
    2835             : static double mannwhitneyu_utbln10n10(double s, ae_state *_state);
    2836             : static double mannwhitneyu_utbln10n11(double s, ae_state *_state);
    2837             : static double mannwhitneyu_utbln10n12(double s, ae_state *_state);
    2838             : static double mannwhitneyu_utbln10n13(double s, ae_state *_state);
    2839             : static double mannwhitneyu_utbln10n14(double s, ae_state *_state);
    2840             : static double mannwhitneyu_utbln10n15(double s, ae_state *_state);
    2841             : static double mannwhitneyu_utbln10n30(double s, ae_state *_state);
    2842             : static double mannwhitneyu_utbln10n100(double s, ae_state *_state);
    2843             : static double mannwhitneyu_utbln11n11(double s, ae_state *_state);
    2844             : static double mannwhitneyu_utbln11n12(double s, ae_state *_state);
    2845             : static double mannwhitneyu_utbln11n13(double s, ae_state *_state);
    2846             : static double mannwhitneyu_utbln11n14(double s, ae_state *_state);
    2847             : static double mannwhitneyu_utbln11n15(double s, ae_state *_state);
    2848             : static double mannwhitneyu_utbln11n30(double s, ae_state *_state);
    2849             : static double mannwhitneyu_utbln11n100(double s, ae_state *_state);
    2850             : static double mannwhitneyu_utbln12n12(double s, ae_state *_state);
    2851             : static double mannwhitneyu_utbln12n13(double s, ae_state *_state);
    2852             : static double mannwhitneyu_utbln12n14(double s, ae_state *_state);
    2853             : static double mannwhitneyu_utbln12n15(double s, ae_state *_state);
    2854             : static double mannwhitneyu_utbln12n30(double s, ae_state *_state);
    2855             : static double mannwhitneyu_utbln12n100(double s, ae_state *_state);
    2856             : static double mannwhitneyu_utbln13n13(double s, ae_state *_state);
    2857             : static double mannwhitneyu_utbln13n14(double s, ae_state *_state);
    2858             : static double mannwhitneyu_utbln13n15(double s, ae_state *_state);
    2859             : static double mannwhitneyu_utbln13n30(double s, ae_state *_state);
    2860             : static double mannwhitneyu_utbln13n100(double s, ae_state *_state);
    2861             : static double mannwhitneyu_utbln14n14(double s, ae_state *_state);
    2862             : static double mannwhitneyu_utbln14n15(double s, ae_state *_state);
    2863             : static double mannwhitneyu_utbln14n30(double s, ae_state *_state);
    2864             : static double mannwhitneyu_utbln14n100(double s, ae_state *_state);
    2865             : static double mannwhitneyu_usigma(double s,
    2866             :      ae_int_t n1,
    2867             :      ae_int_t n2,
    2868             :      ae_state *_state);
    2869             : 
    2870             : 
    2871             : #endif
    2872             : #if defined(AE_COMPILE_JARQUEBERA) || !defined(AE_PARTIAL_BUILD)
    2873             : static void jarquebera_jarqueberastatistic(/* Real    */ ae_vector* x,
    2874             :      ae_int_t n,
    2875             :      double* s,
    2876             :      ae_state *_state);
    2877             : static double jarquebera_jarqueberaapprox(ae_int_t n,
    2878             :      double s,
    2879             :      ae_state *_state);
    2880             : static double jarquebera_jbtbl5(double s, ae_state *_state);
    2881             : static double jarquebera_jbtbl6(double s, ae_state *_state);
    2882             : static double jarquebera_jbtbl7(double s, ae_state *_state);
    2883             : static double jarquebera_jbtbl8(double s, ae_state *_state);
    2884             : static double jarquebera_jbtbl9(double s, ae_state *_state);
    2885             : static double jarquebera_jbtbl10(double s, ae_state *_state);
    2886             : static double jarquebera_jbtbl11(double s, ae_state *_state);
    2887             : static double jarquebera_jbtbl12(double s, ae_state *_state);
    2888             : static double jarquebera_jbtbl13(double s, ae_state *_state);
    2889             : static double jarquebera_jbtbl14(double s, ae_state *_state);
    2890             : static double jarquebera_jbtbl15(double s, ae_state *_state);
    2891             : static double jarquebera_jbtbl16(double s, ae_state *_state);
    2892             : static double jarquebera_jbtbl17(double s, ae_state *_state);
    2893             : static double jarquebera_jbtbl18(double s, ae_state *_state);
    2894             : static double jarquebera_jbtbl19(double s, ae_state *_state);
    2895             : static double jarquebera_jbtbl20(double s, ae_state *_state);
    2896             : static double jarquebera_jbtbl30(double s, ae_state *_state);
    2897             : static double jarquebera_jbtbl50(double s, ae_state *_state);
    2898             : static double jarquebera_jbtbl65(double s, ae_state *_state);
    2899             : static double jarquebera_jbtbl100(double s, ae_state *_state);
    2900             : static double jarquebera_jbtbl130(double s, ae_state *_state);
    2901             : static double jarquebera_jbtbl200(double s, ae_state *_state);
    2902             : static double jarquebera_jbtbl301(double s, ae_state *_state);
    2903             : static double jarquebera_jbtbl501(double s, ae_state *_state);
    2904             : static double jarquebera_jbtbl701(double s, ae_state *_state);
    2905             : static double jarquebera_jbtbl1401(double s, ae_state *_state);
    2906             : static void jarquebera_jbcheb(double x,
    2907             :      double c,
    2908             :      double* tj,
    2909             :      double* tj1,
    2910             :      double* r,
    2911             :      ae_state *_state);
    2912             : 
    2913             : 
    2914             : #endif
    2915             : #if defined(AE_COMPILE_VARIANCETESTS) || !defined(AE_PARTIAL_BUILD)
    2916             : 
    2917             : 
    2918             : #endif
    2919             : 
    2920             : #if defined(AE_COMPILE_BASESTAT) || !defined(AE_PARTIAL_BUILD)
    2921             : 
    2922             : 
    2923             : /*************************************************************************
    2924             : Calculation of the distribution moments: mean, variance, skewness, kurtosis.
    2925             : 
    2926             : INPUT PARAMETERS:
    2927             :     X       -   sample
    2928             :     N       -   N>=0, sample size:
    2929             :                 * if given, only leading N elements of X are processed
    2930             :                 * if not given, automatically determined from size of X
    2931             :     
    2932             : OUTPUT PARAMETERS
    2933             :     Mean    -   mean.
    2934             :     Variance-   variance.
    2935             :     Skewness-   skewness (if variance<>0; zero otherwise).
    2936             :     Kurtosis-   kurtosis (if variance<>0; zero otherwise).
    2937             : 
    2938             : NOTE: variance is calculated by dividing sum of squares by N-1, not N.
    2939             : 
    2940             :   -- ALGLIB --
    2941             :      Copyright 06.09.2006 by Bochkanov Sergey
    2942             : *************************************************************************/
    2943           0 : void samplemoments(/* Real    */ ae_vector* x,
    2944             :      ae_int_t n,
    2945             :      double* mean,
    2946             :      double* variance,
    2947             :      double* skewness,
    2948             :      double* kurtosis,
    2949             :      ae_state *_state)
    2950             : {
    2951             :     ae_int_t i;
    2952             :     double v;
    2953             :     double v1;
    2954             :     double v2;
    2955             :     double stddev;
    2956             : 
    2957           0 :     *mean = 0;
    2958           0 :     *variance = 0;
    2959           0 :     *skewness = 0;
    2960           0 :     *kurtosis = 0;
    2961             : 
    2962           0 :     ae_assert(n>=0, "SampleMoments: N<0", _state);
    2963           0 :     ae_assert(x->cnt>=n, "SampleMoments: Length(X)<N!", _state);
    2964           0 :     ae_assert(isfinitevector(x, n, _state), "SampleMoments: X is not finite vector", _state);
    2965             :     
    2966             :     /*
    2967             :      * Init, special case 'N=0'
    2968             :      */
    2969           0 :     *mean = (double)(0);
    2970           0 :     *variance = (double)(0);
    2971           0 :     *skewness = (double)(0);
    2972           0 :     *kurtosis = (double)(0);
    2973           0 :     stddev = (double)(0);
    2974           0 :     if( n<=0 )
    2975             :     {
    2976           0 :         return;
    2977             :     }
    2978             :     
    2979             :     /*
    2980             :      * Mean
    2981             :      */
    2982           0 :     for(i=0; i<=n-1; i++)
    2983             :     {
    2984           0 :         *mean = *mean+x->ptr.p_double[i];
    2985             :     }
    2986           0 :     *mean = *mean/n;
    2987             :     
    2988             :     /*
    2989             :      * Variance (using corrected two-pass algorithm)
    2990             :      */
    2991           0 :     if( n!=1 )
    2992             :     {
    2993           0 :         v1 = (double)(0);
    2994           0 :         for(i=0; i<=n-1; i++)
    2995             :         {
    2996           0 :             v1 = v1+ae_sqr(x->ptr.p_double[i]-(*mean), _state);
    2997             :         }
    2998           0 :         v2 = (double)(0);
    2999           0 :         for(i=0; i<=n-1; i++)
    3000             :         {
    3001           0 :             v2 = v2+(x->ptr.p_double[i]-(*mean));
    3002             :         }
    3003           0 :         v2 = ae_sqr(v2, _state)/n;
    3004           0 :         *variance = (v1-v2)/(n-1);
    3005           0 :         if( ae_fp_less(*variance,(double)(0)) )
    3006             :         {
    3007           0 :             *variance = (double)(0);
    3008             :         }
    3009           0 :         stddev = ae_sqrt(*variance, _state);
    3010             :     }
    3011             :     
    3012             :     /*
    3013             :      * Skewness and kurtosis
    3014             :      */
    3015           0 :     if( ae_fp_neq(stddev,(double)(0)) )
    3016             :     {
    3017           0 :         for(i=0; i<=n-1; i++)
    3018             :         {
    3019           0 :             v = (x->ptr.p_double[i]-(*mean))/stddev;
    3020           0 :             v2 = ae_sqr(v, _state);
    3021           0 :             *skewness = *skewness+v2*v;
    3022           0 :             *kurtosis = *kurtosis+ae_sqr(v2, _state);
    3023             :         }
    3024           0 :         *skewness = *skewness/n;
    3025           0 :         *kurtosis = *kurtosis/n-3;
    3026             :     }
    3027             : }
    3028             : 
    3029             : 
    3030             : /*************************************************************************
    3031             : Calculation of the mean.
    3032             : 
    3033             : INPUT PARAMETERS:
    3034             :     X       -   sample
    3035             :     N       -   N>=0, sample size:
    3036             :                 * if given, only leading N elements of X are processed
    3037             :                 * if not given, automatically determined from size of X
    3038             : 
    3039             : NOTE:
    3040             :                 
    3041             : This function return result  which calculated by 'SampleMoments' function
    3042             : and stored at 'Mean' variable.
    3043             : 
    3044             : 
    3045             :   -- ALGLIB --
    3046             :      Copyright 06.09.2006 by Bochkanov Sergey
    3047             : *************************************************************************/
    3048           0 : double samplemean(/* Real    */ ae_vector* x,
    3049             :      ae_int_t n,
    3050             :      ae_state *_state)
    3051             : {
    3052             :     double mean;
    3053             :     double tmp0;
    3054             :     double tmp1;
    3055             :     double tmp2;
    3056             :     double result;
    3057             : 
    3058             : 
    3059           0 :     samplemoments(x, n, &mean, &tmp0, &tmp1, &tmp2, _state);
    3060           0 :     result = mean;
    3061           0 :     return result;
    3062             : }
    3063             : 
    3064             : 
    3065             : /*************************************************************************
    3066             : Calculation of the variance.
    3067             : 
    3068             : INPUT PARAMETERS:
    3069             :     X       -   sample
    3070             :     N       -   N>=0, sample size:
    3071             :                 * if given, only leading N elements of X are processed
    3072             :                 * if not given, automatically determined from size of X
    3073             : 
    3074             : NOTE:
    3075             :                 
    3076             : This function return result  which calculated by 'SampleMoments' function
    3077             : and stored at 'Variance' variable.
    3078             : 
    3079             : 
    3080             :   -- ALGLIB --
    3081             :      Copyright 06.09.2006 by Bochkanov Sergey
    3082             : *************************************************************************/
    3083           0 : double samplevariance(/* Real    */ ae_vector* x,
    3084             :      ae_int_t n,
    3085             :      ae_state *_state)
    3086             : {
    3087             :     double variance;
    3088             :     double tmp0;
    3089             :     double tmp1;
    3090             :     double tmp2;
    3091             :     double result;
    3092             : 
    3093             : 
    3094           0 :     samplemoments(x, n, &tmp0, &variance, &tmp1, &tmp2, _state);
    3095           0 :     result = variance;
    3096           0 :     return result;
    3097             : }
    3098             : 
    3099             : 
    3100             : /*************************************************************************
    3101             : Calculation of the skewness.
    3102             : 
    3103             : INPUT PARAMETERS:
    3104             :     X       -   sample
    3105             :     N       -   N>=0, sample size:
    3106             :                 * if given, only leading N elements of X are processed
    3107             :                 * if not given, automatically determined from size of X
    3108             : 
    3109             : NOTE:
    3110             :                 
    3111             : This function return result  which calculated by 'SampleMoments' function
    3112             : and stored at 'Skewness' variable.
    3113             : 
    3114             : 
    3115             :   -- ALGLIB --
    3116             :      Copyright 06.09.2006 by Bochkanov Sergey
    3117             : *************************************************************************/
    3118           0 : double sampleskewness(/* Real    */ ae_vector* x,
    3119             :      ae_int_t n,
    3120             :      ae_state *_state)
    3121             : {
    3122             :     double skewness;
    3123             :     double tmp0;
    3124             :     double tmp1;
    3125             :     double tmp2;
    3126             :     double result;
    3127             : 
    3128             : 
    3129           0 :     samplemoments(x, n, &tmp0, &tmp1, &skewness, &tmp2, _state);
    3130           0 :     result = skewness;
    3131           0 :     return result;
    3132             : }
    3133             : 
    3134             : 
    3135             : /*************************************************************************
    3136             : Calculation of the kurtosis.
    3137             : 
    3138             : INPUT PARAMETERS:
    3139             :     X       -   sample
    3140             :     N       -   N>=0, sample size:
    3141             :                 * if given, only leading N elements of X are processed
    3142             :                 * if not given, automatically determined from size of X
    3143             : 
    3144             : NOTE:
    3145             :                 
    3146             : This function return result  which calculated by 'SampleMoments' function
    3147             : and stored at 'Kurtosis' variable.
    3148             : 
    3149             : 
    3150             :   -- ALGLIB --
    3151             :      Copyright 06.09.2006 by Bochkanov Sergey
    3152             : *************************************************************************/
    3153           0 : double samplekurtosis(/* Real    */ ae_vector* x,
    3154             :      ae_int_t n,
    3155             :      ae_state *_state)
    3156             : {
    3157             :     double kurtosis;
    3158             :     double tmp0;
    3159             :     double tmp1;
    3160             :     double tmp2;
    3161             :     double result;
    3162             : 
    3163             : 
    3164           0 :     samplemoments(x, n, &tmp0, &tmp1, &tmp2, &kurtosis, _state);
    3165           0 :     result = kurtosis;
    3166           0 :     return result;
    3167             : }
    3168             : 
    3169             : 
    3170             : /*************************************************************************
    3171             : ADev
    3172             : 
    3173             : Input parameters:
    3174             :     X   -   sample
    3175             :     N   -   N>=0, sample size:
    3176             :             * if given, only leading N elements of X are processed
    3177             :             * if not given, automatically determined from size of X
    3178             :     
    3179             : Output parameters:
    3180             :     ADev-   ADev
    3181             : 
    3182             :   -- ALGLIB --
    3183             :      Copyright 06.09.2006 by Bochkanov Sergey
    3184             : *************************************************************************/
    3185           0 : void sampleadev(/* Real    */ ae_vector* x,
    3186             :      ae_int_t n,
    3187             :      double* adev,
    3188             :      ae_state *_state)
    3189             : {
    3190             :     ae_int_t i;
    3191             :     double mean;
    3192             : 
    3193           0 :     *adev = 0;
    3194             : 
    3195           0 :     ae_assert(n>=0, "SampleADev: N<0", _state);
    3196           0 :     ae_assert(x->cnt>=n, "SampleADev: Length(X)<N!", _state);
    3197           0 :     ae_assert(isfinitevector(x, n, _state), "SampleADev: X is not finite vector", _state);
    3198             :     
    3199             :     /*
    3200             :      * Init, handle N=0
    3201             :      */
    3202           0 :     mean = (double)(0);
    3203           0 :     *adev = (double)(0);
    3204           0 :     if( n<=0 )
    3205             :     {
    3206           0 :         return;
    3207             :     }
    3208             :     
    3209             :     /*
    3210             :      * Mean
    3211             :      */
    3212           0 :     for(i=0; i<=n-1; i++)
    3213             :     {
    3214           0 :         mean = mean+x->ptr.p_double[i];
    3215             :     }
    3216           0 :     mean = mean/n;
    3217             :     
    3218             :     /*
    3219             :      * ADev
    3220             :      */
    3221           0 :     for(i=0; i<=n-1; i++)
    3222             :     {
    3223           0 :         *adev = *adev+ae_fabs(x->ptr.p_double[i]-mean, _state);
    3224             :     }
    3225           0 :     *adev = *adev/n;
    3226             : }
    3227             : 
    3228             : 
    3229             : /*************************************************************************
    3230             : Median calculation.
    3231             : 
    3232             : Input parameters:
    3233             :     X   -   sample (array indexes: [0..N-1])
    3234             :     N   -   N>=0, sample size:
    3235             :             * if given, only leading N elements of X are processed
    3236             :             * if not given, automatically determined from size of X
    3237             : 
    3238             : Output parameters:
    3239             :     Median
    3240             : 
    3241             :   -- ALGLIB --
    3242             :      Copyright 06.09.2006 by Bochkanov Sergey
    3243             : *************************************************************************/
    3244           0 : void samplemedian(/* Real    */ ae_vector* x,
    3245             :      ae_int_t n,
    3246             :      double* median,
    3247             :      ae_state *_state)
    3248             : {
    3249             :     ae_frame _frame_block;
    3250             :     ae_vector _x;
    3251             :     ae_int_t i;
    3252             :     ae_int_t ir;
    3253             :     ae_int_t j;
    3254             :     ae_int_t l;
    3255             :     ae_int_t midp;
    3256             :     ae_int_t k;
    3257             :     double a;
    3258             :     double tval;
    3259             : 
    3260           0 :     ae_frame_make(_state, &_frame_block);
    3261           0 :     memset(&_x, 0, sizeof(_x));
    3262           0 :     ae_vector_init_copy(&_x, x, _state, ae_true);
    3263           0 :     x = &_x;
    3264           0 :     *median = 0;
    3265             : 
    3266           0 :     ae_assert(n>=0, "SampleMedian: N<0", _state);
    3267           0 :     ae_assert(x->cnt>=n, "SampleMedian: Length(X)<N!", _state);
    3268           0 :     ae_assert(isfinitevector(x, n, _state), "SampleMedian: X is not finite vector", _state);
    3269             :     
    3270             :     /*
    3271             :      * Some degenerate cases
    3272             :      */
    3273           0 :     *median = (double)(0);
    3274           0 :     if( n<=0 )
    3275             :     {
    3276           0 :         ae_frame_leave(_state);
    3277           0 :         return;
    3278             :     }
    3279           0 :     if( n==1 )
    3280             :     {
    3281           0 :         *median = x->ptr.p_double[0];
    3282           0 :         ae_frame_leave(_state);
    3283           0 :         return;
    3284             :     }
    3285           0 :     if( n==2 )
    3286             :     {
    3287           0 :         *median = 0.5*(x->ptr.p_double[0]+x->ptr.p_double[1]);
    3288           0 :         ae_frame_leave(_state);
    3289           0 :         return;
    3290             :     }
    3291             :     
    3292             :     /*
    3293             :      * Common case, N>=3.
    3294             :      * Choose X[(N-1)/2]
    3295             :      */
    3296           0 :     l = 0;
    3297           0 :     ir = n-1;
    3298           0 :     k = (n-1)/2;
    3299             :     for(;;)
    3300             :     {
    3301           0 :         if( ir<=l+1 )
    3302             :         {
    3303             :             
    3304             :             /*
    3305             :              * 1 or 2 elements in partition
    3306             :              */
    3307           0 :             if( ir==l+1&&ae_fp_less(x->ptr.p_double[ir],x->ptr.p_double[l]) )
    3308             :             {
    3309           0 :                 tval = x->ptr.p_double[l];
    3310           0 :                 x->ptr.p_double[l] = x->ptr.p_double[ir];
    3311           0 :                 x->ptr.p_double[ir] = tval;
    3312             :             }
    3313           0 :             break;
    3314             :         }
    3315             :         else
    3316             :         {
    3317           0 :             midp = (l+ir)/2;
    3318           0 :             tval = x->ptr.p_double[midp];
    3319           0 :             x->ptr.p_double[midp] = x->ptr.p_double[l+1];
    3320           0 :             x->ptr.p_double[l+1] = tval;
    3321           0 :             if( ae_fp_greater(x->ptr.p_double[l],x->ptr.p_double[ir]) )
    3322             :             {
    3323           0 :                 tval = x->ptr.p_double[l];
    3324           0 :                 x->ptr.p_double[l] = x->ptr.p_double[ir];
    3325           0 :                 x->ptr.p_double[ir] = tval;
    3326             :             }
    3327           0 :             if( ae_fp_greater(x->ptr.p_double[l+1],x->ptr.p_double[ir]) )
    3328             :             {
    3329           0 :                 tval = x->ptr.p_double[l+1];
    3330           0 :                 x->ptr.p_double[l+1] = x->ptr.p_double[ir];
    3331           0 :                 x->ptr.p_double[ir] = tval;
    3332             :             }
    3333           0 :             if( ae_fp_greater(x->ptr.p_double[l],x->ptr.p_double[l+1]) )
    3334             :             {
    3335           0 :                 tval = x->ptr.p_double[l];
    3336           0 :                 x->ptr.p_double[l] = x->ptr.p_double[l+1];
    3337           0 :                 x->ptr.p_double[l+1] = tval;
    3338             :             }
    3339           0 :             i = l+1;
    3340           0 :             j = ir;
    3341           0 :             a = x->ptr.p_double[l+1];
    3342           0 :             for(;;)
    3343             :             {
    3344             :                 do
    3345             :                 {
    3346           0 :                     i = i+1;
    3347             :                 }
    3348           0 :                 while(ae_fp_less(x->ptr.p_double[i],a));
    3349             :                 do
    3350             :                 {
    3351           0 :                     j = j-1;
    3352             :                 }
    3353           0 :                 while(ae_fp_greater(x->ptr.p_double[j],a));
    3354           0 :                 if( j<i )
    3355             :                 {
    3356           0 :                     break;
    3357             :                 }
    3358           0 :                 tval = x->ptr.p_double[i];
    3359           0 :                 x->ptr.p_double[i] = x->ptr.p_double[j];
    3360           0 :                 x->ptr.p_double[j] = tval;
    3361             :             }
    3362           0 :             x->ptr.p_double[l+1] = x->ptr.p_double[j];
    3363           0 :             x->ptr.p_double[j] = a;
    3364           0 :             if( j>=k )
    3365             :             {
    3366           0 :                 ir = j-1;
    3367             :             }
    3368           0 :             if( j<=k )
    3369             :             {
    3370           0 :                 l = i;
    3371             :             }
    3372             :         }
    3373             :     }
    3374             :     
    3375             :     /*
    3376             :      * If N is odd, return result
    3377             :      */
    3378           0 :     if( n%2==1 )
    3379             :     {
    3380           0 :         *median = x->ptr.p_double[k];
    3381           0 :         ae_frame_leave(_state);
    3382           0 :         return;
    3383             :     }
    3384           0 :     a = x->ptr.p_double[n-1];
    3385           0 :     for(i=k+1; i<=n-1; i++)
    3386             :     {
    3387           0 :         if( ae_fp_less(x->ptr.p_double[i],a) )
    3388             :         {
    3389           0 :             a = x->ptr.p_double[i];
    3390             :         }
    3391             :     }
    3392           0 :     *median = 0.5*(x->ptr.p_double[k]+a);
    3393           0 :     ae_frame_leave(_state);
    3394             : }
    3395             : 
    3396             : 
    3397             : /*************************************************************************
    3398             : Percentile calculation.
    3399             : 
    3400             : Input parameters:
    3401             :     X   -   sample (array indexes: [0..N-1])
    3402             :     N   -   N>=0, sample size:
    3403             :             * if given, only leading N elements of X are processed
    3404             :             * if not given, automatically determined from size of X
    3405             :     P   -   percentile (0<=P<=1)
    3406             : 
    3407             : Output parameters:
    3408             :     V   -   percentile
    3409             : 
    3410             :   -- ALGLIB --
    3411             :      Copyright 01.03.2008 by Bochkanov Sergey
    3412             : *************************************************************************/
    3413           0 : void samplepercentile(/* Real    */ ae_vector* x,
    3414             :      ae_int_t n,
    3415             :      double p,
    3416             :      double* v,
    3417             :      ae_state *_state)
    3418             : {
    3419             :     ae_frame _frame_block;
    3420             :     ae_vector _x;
    3421             :     ae_int_t i1;
    3422             :     double t;
    3423             :     ae_vector rbuf;
    3424             : 
    3425           0 :     ae_frame_make(_state, &_frame_block);
    3426           0 :     memset(&_x, 0, sizeof(_x));
    3427           0 :     memset(&rbuf, 0, sizeof(rbuf));
    3428           0 :     ae_vector_init_copy(&_x, x, _state, ae_true);
    3429           0 :     x = &_x;
    3430           0 :     *v = 0;
    3431           0 :     ae_vector_init(&rbuf, 0, DT_REAL, _state, ae_true);
    3432             : 
    3433           0 :     ae_assert(n>=0, "SamplePercentile: N<0", _state);
    3434           0 :     ae_assert(x->cnt>=n, "SamplePercentile: Length(X)<N!", _state);
    3435           0 :     ae_assert(isfinitevector(x, n, _state), "SamplePercentile: X is not finite vector", _state);
    3436           0 :     ae_assert(ae_isfinite(p, _state), "SamplePercentile: incorrect P!", _state);
    3437           0 :     ae_assert(ae_fp_greater_eq(p,(double)(0))&&ae_fp_less_eq(p,(double)(1)), "SamplePercentile: incorrect P!", _state);
    3438           0 :     tagsortfast(x, &rbuf, n, _state);
    3439           0 :     if( ae_fp_eq(p,(double)(0)) )
    3440             :     {
    3441           0 :         *v = x->ptr.p_double[0];
    3442           0 :         ae_frame_leave(_state);
    3443           0 :         return;
    3444             :     }
    3445           0 :     if( ae_fp_eq(p,(double)(1)) )
    3446             :     {
    3447           0 :         *v = x->ptr.p_double[n-1];
    3448           0 :         ae_frame_leave(_state);
    3449           0 :         return;
    3450             :     }
    3451           0 :     t = p*(n-1);
    3452           0 :     i1 = ae_ifloor(t, _state);
    3453           0 :     t = t-ae_ifloor(t, _state);
    3454           0 :     *v = x->ptr.p_double[i1]*(1-t)+x->ptr.p_double[i1+1]*t;
    3455           0 :     ae_frame_leave(_state);
    3456             : }
    3457             : 
    3458             : 
    3459             : /*************************************************************************
    3460             : 2-sample covariance
    3461             : 
    3462             : Input parameters:
    3463             :     X       -   sample 1 (array indexes: [0..N-1])
    3464             :     Y       -   sample 2 (array indexes: [0..N-1])
    3465             :     N       -   N>=0, sample size:
    3466             :                 * if given, only N leading elements of X/Y are processed
    3467             :                 * if not given, automatically determined from input sizes
    3468             : 
    3469             : Result:
    3470             :     covariance (zero for N=0 or N=1)
    3471             : 
    3472             :   -- ALGLIB --
    3473             :      Copyright 28.10.2010 by Bochkanov Sergey
    3474             : *************************************************************************/
    3475           0 : double cov2(/* Real    */ ae_vector* x,
    3476             :      /* Real    */ ae_vector* y,
    3477             :      ae_int_t n,
    3478             :      ae_state *_state)
    3479             : {
    3480             :     ae_int_t i;
    3481             :     double xmean;
    3482             :     double ymean;
    3483             :     double v;
    3484             :     double x0;
    3485             :     double y0;
    3486             :     double s;
    3487             :     ae_bool samex;
    3488             :     ae_bool samey;
    3489             :     double result;
    3490             : 
    3491             : 
    3492           0 :     ae_assert(n>=0, "Cov2: N<0", _state);
    3493           0 :     ae_assert(x->cnt>=n, "Cov2: Length(X)<N!", _state);
    3494           0 :     ae_assert(y->cnt>=n, "Cov2: Length(Y)<N!", _state);
    3495           0 :     ae_assert(isfinitevector(x, n, _state), "Cov2: X is not finite vector", _state);
    3496           0 :     ae_assert(isfinitevector(y, n, _state), "Cov2: Y is not finite vector", _state);
    3497             :     
    3498             :     /*
    3499             :      * Special case
    3500             :      */
    3501           0 :     if( n<=1 )
    3502             :     {
    3503           0 :         result = (double)(0);
    3504           0 :         return result;
    3505             :     }
    3506             :     
    3507             :     /*
    3508             :      * Calculate mean.
    3509             :      *
    3510             :      *
    3511             :      * Additonally we calculate SameX and SameY -
    3512             :      * flag variables which are set to True when
    3513             :      * all X[] (or Y[]) contain exactly same value.
    3514             :      *
    3515             :      * If at least one of them is True, we return zero
    3516             :      * (othwerwise we risk to get nonzero covariation
    3517             :      * because of roundoff).
    3518             :      */
    3519           0 :     xmean = (double)(0);
    3520           0 :     ymean = (double)(0);
    3521           0 :     samex = ae_true;
    3522           0 :     samey = ae_true;
    3523           0 :     x0 = x->ptr.p_double[0];
    3524           0 :     y0 = y->ptr.p_double[0];
    3525           0 :     v = (double)1/(double)n;
    3526           0 :     for(i=0; i<=n-1; i++)
    3527             :     {
    3528           0 :         s = x->ptr.p_double[i];
    3529           0 :         samex = samex&&ae_fp_eq(s,x0);
    3530           0 :         xmean = xmean+s*v;
    3531           0 :         s = y->ptr.p_double[i];
    3532           0 :         samey = samey&&ae_fp_eq(s,y0);
    3533           0 :         ymean = ymean+s*v;
    3534             :     }
    3535           0 :     if( samex||samey )
    3536             :     {
    3537           0 :         result = (double)(0);
    3538           0 :         return result;
    3539             :     }
    3540             :     
    3541             :     /*
    3542             :      * covariance
    3543             :      */
    3544           0 :     v = (double)1/(double)(n-1);
    3545           0 :     result = (double)(0);
    3546           0 :     for(i=0; i<=n-1; i++)
    3547             :     {
    3548           0 :         result = result+v*(x->ptr.p_double[i]-xmean)*(y->ptr.p_double[i]-ymean);
    3549             :     }
    3550           0 :     return result;
    3551             : }
    3552             : 
    3553             : 
    3554             : /*************************************************************************
    3555             : Pearson product-moment correlation coefficient
    3556             : 
    3557             : Input parameters:
    3558             :     X       -   sample 1 (array indexes: [0..N-1])
    3559             :     Y       -   sample 2 (array indexes: [0..N-1])
    3560             :     N       -   N>=0, sample size:
    3561             :                 * if given, only N leading elements of X/Y are processed
    3562             :                 * if not given, automatically determined from input sizes
    3563             : 
    3564             : Result:
    3565             :     Pearson product-moment correlation coefficient
    3566             :     (zero for N=0 or N=1)
    3567             : 
    3568             :   -- ALGLIB --
    3569             :      Copyright 28.10.2010 by Bochkanov Sergey
    3570             : *************************************************************************/
    3571           0 : double pearsoncorr2(/* Real    */ ae_vector* x,
    3572             :      /* Real    */ ae_vector* y,
    3573             :      ae_int_t n,
    3574             :      ae_state *_state)
    3575             : {
    3576             :     ae_int_t i;
    3577             :     double xmean;
    3578             :     double ymean;
    3579             :     double v;
    3580             :     double x0;
    3581             :     double y0;
    3582             :     double s;
    3583             :     ae_bool samex;
    3584             :     ae_bool samey;
    3585             :     double xv;
    3586             :     double yv;
    3587             :     double t1;
    3588             :     double t2;
    3589             :     double result;
    3590             : 
    3591             : 
    3592           0 :     ae_assert(n>=0, "PearsonCorr2: N<0", _state);
    3593           0 :     ae_assert(x->cnt>=n, "PearsonCorr2: Length(X)<N!", _state);
    3594           0 :     ae_assert(y->cnt>=n, "PearsonCorr2: Length(Y)<N!", _state);
    3595           0 :     ae_assert(isfinitevector(x, n, _state), "PearsonCorr2: X is not finite vector", _state);
    3596           0 :     ae_assert(isfinitevector(y, n, _state), "PearsonCorr2: Y is not finite vector", _state);
    3597             :     
    3598             :     /*
    3599             :      * Special case
    3600             :      */
    3601           0 :     if( n<=1 )
    3602             :     {
    3603           0 :         result = (double)(0);
    3604           0 :         return result;
    3605             :     }
    3606             :     
    3607             :     /*
    3608             :      * Calculate mean.
    3609             :      *
    3610             :      *
    3611             :      * Additonally we calculate SameX and SameY -
    3612             :      * flag variables which are set to True when
    3613             :      * all X[] (or Y[]) contain exactly same value.
    3614             :      *
    3615             :      * If at least one of them is True, we return zero
    3616             :      * (othwerwise we risk to get nonzero correlation
    3617             :      * because of roundoff).
    3618             :      */
    3619           0 :     xmean = (double)(0);
    3620           0 :     ymean = (double)(0);
    3621           0 :     samex = ae_true;
    3622           0 :     samey = ae_true;
    3623           0 :     x0 = x->ptr.p_double[0];
    3624           0 :     y0 = y->ptr.p_double[0];
    3625           0 :     v = (double)1/(double)n;
    3626           0 :     for(i=0; i<=n-1; i++)
    3627             :     {
    3628           0 :         s = x->ptr.p_double[i];
    3629           0 :         samex = samex&&ae_fp_eq(s,x0);
    3630           0 :         xmean = xmean+s*v;
    3631           0 :         s = y->ptr.p_double[i];
    3632           0 :         samey = samey&&ae_fp_eq(s,y0);
    3633           0 :         ymean = ymean+s*v;
    3634             :     }
    3635           0 :     if( samex||samey )
    3636             :     {
    3637           0 :         result = (double)(0);
    3638           0 :         return result;
    3639             :     }
    3640             :     
    3641             :     /*
    3642             :      * numerator and denominator
    3643             :      */
    3644           0 :     s = (double)(0);
    3645           0 :     xv = (double)(0);
    3646           0 :     yv = (double)(0);
    3647           0 :     for(i=0; i<=n-1; i++)
    3648             :     {
    3649           0 :         t1 = x->ptr.p_double[i]-xmean;
    3650           0 :         t2 = y->ptr.p_double[i]-ymean;
    3651           0 :         xv = xv+ae_sqr(t1, _state);
    3652           0 :         yv = yv+ae_sqr(t2, _state);
    3653           0 :         s = s+t1*t2;
    3654             :     }
    3655           0 :     if( ae_fp_eq(xv,(double)(0))||ae_fp_eq(yv,(double)(0)) )
    3656             :     {
    3657           0 :         result = (double)(0);
    3658             :     }
    3659             :     else
    3660             :     {
    3661           0 :         result = s/(ae_sqrt(xv, _state)*ae_sqrt(yv, _state));
    3662             :     }
    3663           0 :     return result;
    3664             : }
    3665             : 
    3666             : 
    3667             : /*************************************************************************
    3668             : Spearman's rank correlation coefficient
    3669             : 
    3670             : Input parameters:
    3671             :     X       -   sample 1 (array indexes: [0..N-1])
    3672             :     Y       -   sample 2 (array indexes: [0..N-1])
    3673             :     N       -   N>=0, sample size:
    3674             :                 * if given, only N leading elements of X/Y are processed
    3675             :                 * if not given, automatically determined from input sizes
    3676             : 
    3677             : Result:
    3678             :     Spearman's rank correlation coefficient
    3679             :     (zero for N=0 or N=1)
    3680             : 
    3681             :   -- ALGLIB --
    3682             :      Copyright 09.04.2007 by Bochkanov Sergey
    3683             : *************************************************************************/
    3684           0 : double spearmancorr2(/* Real    */ ae_vector* x,
    3685             :      /* Real    */ ae_vector* y,
    3686             :      ae_int_t n,
    3687             :      ae_state *_state)
    3688             : {
    3689             :     ae_frame _frame_block;
    3690             :     ae_vector _x;
    3691             :     ae_vector _y;
    3692             :     apbuffers buf;
    3693             :     double result;
    3694             : 
    3695           0 :     ae_frame_make(_state, &_frame_block);
    3696           0 :     memset(&_x, 0, sizeof(_x));
    3697           0 :     memset(&_y, 0, sizeof(_y));
    3698           0 :     memset(&buf, 0, sizeof(buf));
    3699           0 :     ae_vector_init_copy(&_x, x, _state, ae_true);
    3700           0 :     x = &_x;
    3701           0 :     ae_vector_init_copy(&_y, y, _state, ae_true);
    3702           0 :     y = &_y;
    3703           0 :     _apbuffers_init(&buf, _state, ae_true);
    3704             : 
    3705           0 :     ae_assert(n>=0, "SpearmanCorr2: N<0", _state);
    3706           0 :     ae_assert(x->cnt>=n, "SpearmanCorr2: Length(X)<N!", _state);
    3707           0 :     ae_assert(y->cnt>=n, "SpearmanCorr2: Length(Y)<N!", _state);
    3708           0 :     ae_assert(isfinitevector(x, n, _state), "SpearmanCorr2: X is not finite vector", _state);
    3709           0 :     ae_assert(isfinitevector(y, n, _state), "SpearmanCorr2: Y is not finite vector", _state);
    3710             :     
    3711             :     /*
    3712             :      * Special case
    3713             :      */
    3714           0 :     if( n<=1 )
    3715             :     {
    3716           0 :         result = (double)(0);
    3717           0 :         ae_frame_leave(_state);
    3718           0 :         return result;
    3719             :     }
    3720           0 :     rankx(x, n, ae_false, &buf, _state);
    3721           0 :     rankx(y, n, ae_false, &buf, _state);
    3722           0 :     result = pearsoncorr2(x, y, n, _state);
    3723           0 :     ae_frame_leave(_state);
    3724           0 :     return result;
    3725             : }
    3726             : 
    3727             : 
    3728             : /*************************************************************************
    3729             : Covariance matrix
    3730             : 
    3731             :   ! COMMERCIAL EDITION OF ALGLIB:
    3732             :   ! 
    3733             :   ! Commercial Edition of ALGLIB includes following important improvements
    3734             :   ! of this function:
    3735             :   ! * high-performance native backend with same C# interface (C# version)
    3736             :   ! * multithreading support (C++ and C# versions)
    3737             :   ! * hardware vendor (Intel) implementations of linear algebra primitives
    3738             :   !   (C++ and C# versions, x86/x64 platform)
    3739             :   ! 
    3740             :   ! We recommend you to read 'Working with commercial version' section  of
    3741             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
    3742             :   ! related features provided by commercial edition of ALGLIB.
    3743             : 
    3744             : INPUT PARAMETERS:
    3745             :     X   -   array[N,M], sample matrix:
    3746             :             * J-th column corresponds to J-th variable
    3747             :             * I-th row corresponds to I-th observation
    3748             :     N   -   N>=0, number of observations:
    3749             :             * if given, only leading N rows of X are used
    3750             :             * if not given, automatically determined from input size
    3751             :     M   -   M>0, number of variables:
    3752             :             * if given, only leading M columns of X are used
    3753             :             * if not given, automatically determined from input size
    3754             : 
    3755             : OUTPUT PARAMETERS:
    3756             :     C   -   array[M,M], covariance matrix (zero if N=0 or N=1)
    3757             : 
    3758             :   -- ALGLIB --
    3759             :      Copyright 28.10.2010 by Bochkanov Sergey
    3760             : *************************************************************************/
    3761           0 : void covm(/* Real    */ ae_matrix* x,
    3762             :      ae_int_t n,
    3763             :      ae_int_t m,
    3764             :      /* Real    */ ae_matrix* c,
    3765             :      ae_state *_state)
    3766             : {
    3767             :     ae_frame _frame_block;
    3768             :     ae_matrix _x;
    3769             :     ae_int_t i;
    3770             :     ae_int_t j;
    3771             :     double v;
    3772             :     ae_vector t;
    3773             :     ae_vector x0;
    3774             :     ae_vector same;
    3775             : 
    3776           0 :     ae_frame_make(_state, &_frame_block);
    3777           0 :     memset(&_x, 0, sizeof(_x));
    3778           0 :     memset(&t, 0, sizeof(t));
    3779           0 :     memset(&x0, 0, sizeof(x0));
    3780           0 :     memset(&same, 0, sizeof(same));
    3781           0 :     ae_matrix_init_copy(&_x, x, _state, ae_true);
    3782           0 :     x = &_x;
    3783           0 :     ae_matrix_clear(c);
    3784           0 :     ae_vector_init(&t, 0, DT_REAL, _state, ae_true);
    3785           0 :     ae_vector_init(&x0, 0, DT_REAL, _state, ae_true);
    3786           0 :     ae_vector_init(&same, 0, DT_BOOL, _state, ae_true);
    3787             : 
    3788           0 :     ae_assert(n>=0, "CovM: N<0", _state);
    3789           0 :     ae_assert(m>=1, "CovM: M<1", _state);
    3790           0 :     ae_assert(x->rows>=n, "CovM: Rows(X)<N!", _state);
    3791           0 :     ae_assert(x->cols>=m||n==0, "CovM: Cols(X)<M!", _state);
    3792           0 :     ae_assert(apservisfinitematrix(x, n, m, _state), "CovM: X contains infinite/NAN elements", _state);
    3793             :     
    3794             :     /*
    3795             :      * N<=1, return zero
    3796             :      */
    3797           0 :     if( n<=1 )
    3798             :     {
    3799           0 :         ae_matrix_set_length(c, m, m, _state);
    3800           0 :         for(i=0; i<=m-1; i++)
    3801             :         {
    3802           0 :             for(j=0; j<=m-1; j++)
    3803             :             {
    3804           0 :                 c->ptr.pp_double[i][j] = (double)(0);
    3805             :             }
    3806             :         }
    3807           0 :         ae_frame_leave(_state);
    3808           0 :         return;
    3809             :     }
    3810             :     
    3811             :     /*
    3812             :      * Calculate means,
    3813             :      * check for constant columns
    3814             :      */
    3815           0 :     ae_vector_set_length(&t, m, _state);
    3816           0 :     ae_vector_set_length(&x0, m, _state);
    3817           0 :     ae_vector_set_length(&same, m, _state);
    3818           0 :     ae_matrix_set_length(c, m, m, _state);
    3819           0 :     for(i=0; i<=m-1; i++)
    3820             :     {
    3821           0 :         t.ptr.p_double[i] = (double)(0);
    3822           0 :         same.ptr.p_bool[i] = ae_true;
    3823             :     }
    3824           0 :     ae_v_move(&x0.ptr.p_double[0], 1, &x->ptr.pp_double[0][0], 1, ae_v_len(0,m-1));
    3825           0 :     v = (double)1/(double)n;
    3826           0 :     for(i=0; i<=n-1; i++)
    3827             :     {
    3828           0 :         ae_v_addd(&t.ptr.p_double[0], 1, &x->ptr.pp_double[i][0], 1, ae_v_len(0,m-1), v);
    3829           0 :         for(j=0; j<=m-1; j++)
    3830             :         {
    3831           0 :             same.ptr.p_bool[j] = same.ptr.p_bool[j]&&ae_fp_eq(x->ptr.pp_double[i][j],x0.ptr.p_double[j]);
    3832             :         }
    3833             :     }
    3834             :     
    3835             :     /*
    3836             :      * * center variables;
    3837             :      * * if we have constant columns, these columns are
    3838             :      *   artificially zeroed (they must be zero in exact arithmetics,
    3839             :      *   but unfortunately floating point ops are not exact).
    3840             :      * * calculate upper half of symmetric covariance matrix
    3841             :      */
    3842           0 :     for(i=0; i<=n-1; i++)
    3843             :     {
    3844           0 :         ae_v_sub(&x->ptr.pp_double[i][0], 1, &t.ptr.p_double[0], 1, ae_v_len(0,m-1));
    3845           0 :         for(j=0; j<=m-1; j++)
    3846             :         {
    3847           0 :             if( same.ptr.p_bool[j] )
    3848             :             {
    3849           0 :                 x->ptr.pp_double[i][j] = (double)(0);
    3850             :             }
    3851             :         }
    3852             :     }
    3853           0 :     rmatrixsyrk(m, n, (double)1/(double)(n-1), x, 0, 0, 1, 0.0, c, 0, 0, ae_true, _state);
    3854           0 :     rmatrixenforcesymmetricity(c, m, ae_true, _state);
    3855           0 :     ae_frame_leave(_state);
    3856             : }
    3857             : 
    3858             : 
    3859             : /*************************************************************************
    3860             : Pearson product-moment correlation matrix
    3861             : 
    3862             :   ! COMMERCIAL EDITION OF ALGLIB:
    3863             :   ! 
    3864             :   ! Commercial Edition of ALGLIB includes following important improvements
    3865             :   ! of this function:
    3866             :   ! * high-performance native backend with same C# interface (C# version)
    3867             :   ! * multithreading support (C++ and C# versions)
    3868             :   ! * hardware vendor (Intel) implementations of linear algebra primitives
    3869             :   !   (C++ and C# versions, x86/x64 platform)
    3870             :   ! 
    3871             :   ! We recommend you to read 'Working with commercial version' section  of
    3872             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
    3873             :   ! related features provided by commercial edition of ALGLIB.
    3874             : 
    3875             : INPUT PARAMETERS:
    3876             :     X   -   array[N,M], sample matrix:
    3877             :             * J-th column corresponds to J-th variable
    3878             :             * I-th row corresponds to I-th observation
    3879             :     N   -   N>=0, number of observations:
    3880             :             * if given, only leading N rows of X are used
    3881             :             * if not given, automatically determined from input size
    3882             :     M   -   M>0, number of variables:
    3883             :             * if given, only leading M columns of X are used
    3884             :             * if not given, automatically determined from input size
    3885             : 
    3886             : OUTPUT PARAMETERS:
    3887             :     C   -   array[M,M], correlation matrix (zero if N=0 or N=1)
    3888             : 
    3889             :   -- ALGLIB --
    3890             :      Copyright 28.10.2010 by Bochkanov Sergey
    3891             : *************************************************************************/
    3892           0 : void pearsoncorrm(/* Real    */ ae_matrix* x,
    3893             :      ae_int_t n,
    3894             :      ae_int_t m,
    3895             :      /* Real    */ ae_matrix* c,
    3896             :      ae_state *_state)
    3897             : {
    3898             :     ae_frame _frame_block;
    3899             :     ae_vector t;
    3900             :     ae_int_t i;
    3901             :     ae_int_t j;
    3902             :     double v;
    3903             : 
    3904           0 :     ae_frame_make(_state, &_frame_block);
    3905           0 :     memset(&t, 0, sizeof(t));
    3906           0 :     ae_matrix_clear(c);
    3907           0 :     ae_vector_init(&t, 0, DT_REAL, _state, ae_true);
    3908             : 
    3909           0 :     ae_assert(n>=0, "PearsonCorrM: N<0", _state);
    3910           0 :     ae_assert(m>=1, "PearsonCorrM: M<1", _state);
    3911           0 :     ae_assert(x->rows>=n, "PearsonCorrM: Rows(X)<N!", _state);
    3912           0 :     ae_assert(x->cols>=m||n==0, "PearsonCorrM: Cols(X)<M!", _state);
    3913           0 :     ae_assert(apservisfinitematrix(x, n, m, _state), "PearsonCorrM: X contains infinite/NAN elements", _state);
    3914           0 :     ae_vector_set_length(&t, m, _state);
    3915           0 :     covm(x, n, m, c, _state);
    3916           0 :     for(i=0; i<=m-1; i++)
    3917             :     {
    3918           0 :         if( ae_fp_greater(c->ptr.pp_double[i][i],(double)(0)) )
    3919             :         {
    3920           0 :             t.ptr.p_double[i] = 1/ae_sqrt(c->ptr.pp_double[i][i], _state);
    3921             :         }
    3922             :         else
    3923             :         {
    3924           0 :             t.ptr.p_double[i] = 0.0;
    3925             :         }
    3926             :     }
    3927           0 :     for(i=0; i<=m-1; i++)
    3928             :     {
    3929           0 :         v = t.ptr.p_double[i];
    3930           0 :         for(j=0; j<=m-1; j++)
    3931             :         {
    3932           0 :             c->ptr.pp_double[i][j] = c->ptr.pp_double[i][j]*v*t.ptr.p_double[j];
    3933             :         }
    3934             :     }
    3935           0 :     ae_frame_leave(_state);
    3936           0 : }
    3937             : 
    3938             : 
    3939             : /*************************************************************************
    3940             : Spearman's rank correlation matrix
    3941             : 
    3942             :   ! COMMERCIAL EDITION OF ALGLIB:
    3943             :   ! 
    3944             :   ! Commercial Edition of ALGLIB includes following important improvements
    3945             :   ! of this function:
    3946             :   ! * high-performance native backend with same C# interface (C# version)
    3947             :   ! * multithreading support (C++ and C# versions)
    3948             :   ! * hardware vendor (Intel) implementations of linear algebra primitives
    3949             :   !   (C++ and C# versions, x86/x64 platform)
    3950             :   ! 
    3951             :   ! We recommend you to read 'Working with commercial version' section  of
    3952             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
    3953             :   ! related features provided by commercial edition of ALGLIB.
    3954             : 
    3955             : INPUT PARAMETERS:
    3956             :     X   -   array[N,M], sample matrix:
    3957             :             * J-th column corresponds to J-th variable
    3958             :             * I-th row corresponds to I-th observation
    3959             :     N   -   N>=0, number of observations:
    3960             :             * if given, only leading N rows of X are used
    3961             :             * if not given, automatically determined from input size
    3962             :     M   -   M>0, number of variables:
    3963             :             * if given, only leading M columns of X are used
    3964             :             * if not given, automatically determined from input size
    3965             : 
    3966             : OUTPUT PARAMETERS:
    3967             :     C   -   array[M,M], correlation matrix (zero if N=0 or N=1)
    3968             : 
    3969             :   -- ALGLIB --
    3970             :      Copyright 28.10.2010 by Bochkanov Sergey
    3971             : *************************************************************************/
    3972           0 : void spearmancorrm(/* Real    */ ae_matrix* x,
    3973             :      ae_int_t n,
    3974             :      ae_int_t m,
    3975             :      /* Real    */ ae_matrix* c,
    3976             :      ae_state *_state)
    3977             : {
    3978             :     ae_frame _frame_block;
    3979             :     ae_int_t i;
    3980             :     ae_int_t j;
    3981             :     apbuffers buf;
    3982             :     ae_matrix xc;
    3983             :     ae_vector t;
    3984             :     double v;
    3985             :     double vv;
    3986             :     double x0;
    3987             :     ae_bool b;
    3988             : 
    3989           0 :     ae_frame_make(_state, &_frame_block);
    3990           0 :     memset(&buf, 0, sizeof(buf));
    3991           0 :     memset(&xc, 0, sizeof(xc));
    3992           0 :     memset(&t, 0, sizeof(t));
    3993           0 :     ae_matrix_clear(c);
    3994           0 :     _apbuffers_init(&buf, _state, ae_true);
    3995           0 :     ae_matrix_init(&xc, 0, 0, DT_REAL, _state, ae_true);
    3996           0 :     ae_vector_init(&t, 0, DT_REAL, _state, ae_true);
    3997             : 
    3998           0 :     ae_assert(n>=0, "SpearmanCorrM: N<0", _state);
    3999           0 :     ae_assert(m>=1, "SpearmanCorrM: M<1", _state);
    4000           0 :     ae_assert(x->rows>=n, "SpearmanCorrM: Rows(X)<N!", _state);
    4001           0 :     ae_assert(x->cols>=m||n==0, "SpearmanCorrM: Cols(X)<M!", _state);
    4002           0 :     ae_assert(apservisfinitematrix(x, n, m, _state), "SpearmanCorrM: X contains infinite/NAN elements", _state);
    4003             :     
    4004             :     /*
    4005             :      * N<=1, return zero
    4006             :      */
    4007           0 :     if( n<=1 )
    4008             :     {
    4009           0 :         ae_matrix_set_length(c, m, m, _state);
    4010           0 :         for(i=0; i<=m-1; i++)
    4011             :         {
    4012           0 :             for(j=0; j<=m-1; j++)
    4013             :             {
    4014           0 :                 c->ptr.pp_double[i][j] = (double)(0);
    4015             :             }
    4016             :         }
    4017           0 :         ae_frame_leave(_state);
    4018           0 :         return;
    4019             :     }
    4020             :     
    4021             :     /*
    4022             :      * Allocate
    4023             :      */
    4024           0 :     ae_vector_set_length(&t, ae_maxint(n, m, _state), _state);
    4025           0 :     ae_matrix_set_length(c, m, m, _state);
    4026             :     
    4027             :     /*
    4028             :      * Replace data with ranks
    4029             :      */
    4030           0 :     ae_matrix_set_length(&xc, m, n, _state);
    4031           0 :     rmatrixtranspose(n, m, x, 0, 0, &xc, 0, 0, _state);
    4032           0 :     rankdata(&xc, m, n, _state);
    4033             :     
    4034             :     /*
    4035             :      * 1. Calculate means, check for constant columns
    4036             :      * 2. Center variables, constant  columns are
    4037             :      *   artificialy zeroed (they must be zero in exact arithmetics,
    4038             :      *   but unfortunately floating point is not exact).
    4039             :      */
    4040           0 :     for(i=0; i<=m-1; i++)
    4041             :     {
    4042             :         
    4043             :         /*
    4044             :          * Calculate:
    4045             :          * * V - mean value of I-th variable
    4046             :          * * B - True in case all variable values are same
    4047             :          */
    4048           0 :         v = (double)(0);
    4049           0 :         b = ae_true;
    4050           0 :         x0 = xc.ptr.pp_double[i][0];
    4051           0 :         for(j=0; j<=n-1; j++)
    4052             :         {
    4053           0 :             vv = xc.ptr.pp_double[i][j];
    4054           0 :             v = v+vv;
    4055           0 :             b = b&&ae_fp_eq(vv,x0);
    4056             :         }
    4057           0 :         v = v/n;
    4058             :         
    4059             :         /*
    4060             :          * Center/zero I-th variable
    4061             :          */
    4062           0 :         if( b )
    4063             :         {
    4064             :             
    4065             :             /*
    4066             :              * Zero
    4067             :              */
    4068           0 :             for(j=0; j<=n-1; j++)
    4069             :             {
    4070           0 :                 xc.ptr.pp_double[i][j] = 0.0;
    4071             :             }
    4072             :         }
    4073             :         else
    4074             :         {
    4075             :             
    4076             :             /*
    4077             :              * Center
    4078             :              */
    4079           0 :             for(j=0; j<=n-1; j++)
    4080             :             {
    4081           0 :                 xc.ptr.pp_double[i][j] = xc.ptr.pp_double[i][j]-v;
    4082             :             }
    4083             :         }
    4084             :     }
    4085             :     
    4086             :     /*
    4087             :      * Calculate upper half of symmetric covariance matrix
    4088             :      */
    4089           0 :     rmatrixsyrk(m, n, (double)1/(double)(n-1), &xc, 0, 0, 0, 0.0, c, 0, 0, ae_true, _state);
    4090             :     
    4091             :     /*
    4092             :      * Calculate Pearson coefficients (upper triangle)
    4093             :      */
    4094           0 :     for(i=0; i<=m-1; i++)
    4095             :     {
    4096           0 :         if( ae_fp_greater(c->ptr.pp_double[i][i],(double)(0)) )
    4097             :         {
    4098           0 :             t.ptr.p_double[i] = 1/ae_sqrt(c->ptr.pp_double[i][i], _state);
    4099             :         }
    4100             :         else
    4101             :         {
    4102           0 :             t.ptr.p_double[i] = 0.0;
    4103             :         }
    4104             :     }
    4105           0 :     for(i=0; i<=m-1; i++)
    4106             :     {
    4107           0 :         v = t.ptr.p_double[i];
    4108           0 :         for(j=i; j<=m-1; j++)
    4109             :         {
    4110           0 :             c->ptr.pp_double[i][j] = c->ptr.pp_double[i][j]*v*t.ptr.p_double[j];
    4111             :         }
    4112             :     }
    4113             :     
    4114             :     /*
    4115             :      * force symmetricity
    4116             :      */
    4117           0 :     rmatrixenforcesymmetricity(c, m, ae_true, _state);
    4118           0 :     ae_frame_leave(_state);
    4119             : }
    4120             : 
    4121             : 
    4122             : /*************************************************************************
    4123             : Cross-covariance matrix
    4124             : 
    4125             :   ! COMMERCIAL EDITION OF ALGLIB:
    4126             :   ! 
    4127             :   ! Commercial Edition of ALGLIB includes following important improvements
    4128             :   ! of this function:
    4129             :   ! * high-performance native backend with same C# interface (C# version)
    4130             :   ! * multithreading support (C++ and C# versions)
    4131             :   ! * hardware vendor (Intel) implementations of linear algebra primitives
    4132             :   !   (C++ and C# versions, x86/x64 platform)
    4133             :   ! 
    4134             :   ! We recommend you to read 'Working with commercial version' section  of
    4135             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
    4136             :   ! related features provided by commercial edition of ALGLIB.
    4137             : 
    4138             : INPUT PARAMETERS:
    4139             :     X   -   array[N,M1], sample matrix:
    4140             :             * J-th column corresponds to J-th variable
    4141             :             * I-th row corresponds to I-th observation
    4142             :     Y   -   array[N,M2], sample matrix:
    4143             :             * J-th column corresponds to J-th variable
    4144             :             * I-th row corresponds to I-th observation
    4145             :     N   -   N>=0, number of observations:
    4146             :             * if given, only leading N rows of X/Y are used
    4147             :             * if not given, automatically determined from input sizes
    4148             :     M1  -   M1>0, number of variables in X:
    4149             :             * if given, only leading M1 columns of X are used
    4150             :             * if not given, automatically determined from input size
    4151             :     M2  -   M2>0, number of variables in Y:
    4152             :             * if given, only leading M1 columns of X are used
    4153             :             * if not given, automatically determined from input size
    4154             : 
    4155             : OUTPUT PARAMETERS:
    4156             :     C   -   array[M1,M2], cross-covariance matrix (zero if N=0 or N=1)
    4157             : 
    4158             :   -- ALGLIB --
    4159             :      Copyright 28.10.2010 by Bochkanov Sergey
    4160             : *************************************************************************/
    4161           0 : void covm2(/* Real    */ ae_matrix* x,
    4162             :      /* Real    */ ae_matrix* y,
    4163             :      ae_int_t n,
    4164             :      ae_int_t m1,
    4165             :      ae_int_t m2,
    4166             :      /* Real    */ ae_matrix* c,
    4167             :      ae_state *_state)
    4168             : {
    4169             :     ae_frame _frame_block;
    4170             :     ae_matrix _x;
    4171             :     ae_matrix _y;
    4172             :     ae_int_t i;
    4173             :     ae_int_t j;
    4174             :     double v;
    4175             :     ae_vector t;
    4176             :     ae_vector x0;
    4177             :     ae_vector y0;
    4178             :     ae_vector samex;
    4179             :     ae_vector samey;
    4180             : 
    4181           0 :     ae_frame_make(_state, &_frame_block);
    4182           0 :     memset(&_x, 0, sizeof(_x));
    4183           0 :     memset(&_y, 0, sizeof(_y));
    4184           0 :     memset(&t, 0, sizeof(t));
    4185           0 :     memset(&x0, 0, sizeof(x0));
    4186           0 :     memset(&y0, 0, sizeof(y0));
    4187           0 :     memset(&samex, 0, sizeof(samex));
    4188           0 :     memset(&samey, 0, sizeof(samey));
    4189           0 :     ae_matrix_init_copy(&_x, x, _state, ae_true);
    4190           0 :     x = &_x;
    4191           0 :     ae_matrix_init_copy(&_y, y, _state, ae_true);
    4192           0 :     y = &_y;
    4193           0 :     ae_matrix_clear(c);
    4194           0 :     ae_vector_init(&t, 0, DT_REAL, _state, ae_true);
    4195           0 :     ae_vector_init(&x0, 0, DT_REAL, _state, ae_true);
    4196           0 :     ae_vector_init(&y0, 0, DT_REAL, _state, ae_true);
    4197           0 :     ae_vector_init(&samex, 0, DT_BOOL, _state, ae_true);
    4198           0 :     ae_vector_init(&samey, 0, DT_BOOL, _state, ae_true);
    4199             : 
    4200           0 :     ae_assert(n>=0, "CovM2: N<0", _state);
    4201           0 :     ae_assert(m1>=1, "CovM2: M1<1", _state);
    4202           0 :     ae_assert(m2>=1, "CovM2: M2<1", _state);
    4203           0 :     ae_assert(x->rows>=n, "CovM2: Rows(X)<N!", _state);
    4204           0 :     ae_assert(x->cols>=m1||n==0, "CovM2: Cols(X)<M1!", _state);
    4205           0 :     ae_assert(apservisfinitematrix(x, n, m1, _state), "CovM2: X contains infinite/NAN elements", _state);
    4206           0 :     ae_assert(y->rows>=n, "CovM2: Rows(Y)<N!", _state);
    4207           0 :     ae_assert(y->cols>=m2||n==0, "CovM2: Cols(Y)<M2!", _state);
    4208           0 :     ae_assert(apservisfinitematrix(y, n, m2, _state), "CovM2: X contains infinite/NAN elements", _state);
    4209             :     
    4210             :     /*
    4211             :      * N<=1, return zero
    4212             :      */
    4213           0 :     if( n<=1 )
    4214             :     {
    4215           0 :         ae_matrix_set_length(c, m1, m2, _state);
    4216           0 :         for(i=0; i<=m1-1; i++)
    4217             :         {
    4218           0 :             for(j=0; j<=m2-1; j++)
    4219             :             {
    4220           0 :                 c->ptr.pp_double[i][j] = (double)(0);
    4221             :             }
    4222             :         }
    4223           0 :         ae_frame_leave(_state);
    4224           0 :         return;
    4225             :     }
    4226             :     
    4227             :     /*
    4228             :      * Allocate
    4229             :      */
    4230           0 :     ae_vector_set_length(&t, ae_maxint(m1, m2, _state), _state);
    4231           0 :     ae_vector_set_length(&x0, m1, _state);
    4232           0 :     ae_vector_set_length(&y0, m2, _state);
    4233           0 :     ae_vector_set_length(&samex, m1, _state);
    4234           0 :     ae_vector_set_length(&samey, m2, _state);
    4235           0 :     ae_matrix_set_length(c, m1, m2, _state);
    4236             :     
    4237             :     /*
    4238             :      * * calculate means of X
    4239             :      * * center X
    4240             :      * * if we have constant columns, these columns are
    4241             :      *   artificially zeroed (they must be zero in exact arithmetics,
    4242             :      *   but unfortunately floating point ops are not exact).
    4243             :      */
    4244           0 :     for(i=0; i<=m1-1; i++)
    4245             :     {
    4246           0 :         t.ptr.p_double[i] = (double)(0);
    4247           0 :         samex.ptr.p_bool[i] = ae_true;
    4248             :     }
    4249           0 :     ae_v_move(&x0.ptr.p_double[0], 1, &x->ptr.pp_double[0][0], 1, ae_v_len(0,m1-1));
    4250           0 :     v = (double)1/(double)n;
    4251           0 :     for(i=0; i<=n-1; i++)
    4252             :     {
    4253           0 :         ae_v_addd(&t.ptr.p_double[0], 1, &x->ptr.pp_double[i][0], 1, ae_v_len(0,m1-1), v);
    4254           0 :         for(j=0; j<=m1-1; j++)
    4255             :         {
    4256           0 :             samex.ptr.p_bool[j] = samex.ptr.p_bool[j]&&ae_fp_eq(x->ptr.pp_double[i][j],x0.ptr.p_double[j]);
    4257             :         }
    4258             :     }
    4259           0 :     for(i=0; i<=n-1; i++)
    4260             :     {
    4261           0 :         ae_v_sub(&x->ptr.pp_double[i][0], 1, &t.ptr.p_double[0], 1, ae_v_len(0,m1-1));
    4262           0 :         for(j=0; j<=m1-1; j++)
    4263             :         {
    4264           0 :             if( samex.ptr.p_bool[j] )
    4265             :             {
    4266           0 :                 x->ptr.pp_double[i][j] = (double)(0);
    4267             :             }
    4268             :         }
    4269             :     }
    4270             :     
    4271             :     /*
    4272             :      * Repeat same steps for Y
    4273             :      */
    4274           0 :     for(i=0; i<=m2-1; i++)
    4275             :     {
    4276           0 :         t.ptr.p_double[i] = (double)(0);
    4277           0 :         samey.ptr.p_bool[i] = ae_true;
    4278             :     }
    4279           0 :     ae_v_move(&y0.ptr.p_double[0], 1, &y->ptr.pp_double[0][0], 1, ae_v_len(0,m2-1));
    4280           0 :     v = (double)1/(double)n;
    4281           0 :     for(i=0; i<=n-1; i++)
    4282             :     {
    4283           0 :         ae_v_addd(&t.ptr.p_double[0], 1, &y->ptr.pp_double[i][0], 1, ae_v_len(0,m2-1), v);
    4284           0 :         for(j=0; j<=m2-1; j++)
    4285             :         {
    4286           0 :             samey.ptr.p_bool[j] = samey.ptr.p_bool[j]&&ae_fp_eq(y->ptr.pp_double[i][j],y0.ptr.p_double[j]);
    4287             :         }
    4288             :     }
    4289           0 :     for(i=0; i<=n-1; i++)
    4290             :     {
    4291           0 :         ae_v_sub(&y->ptr.pp_double[i][0], 1, &t.ptr.p_double[0], 1, ae_v_len(0,m2-1));
    4292           0 :         for(j=0; j<=m2-1; j++)
    4293             :         {
    4294           0 :             if( samey.ptr.p_bool[j] )
    4295             :             {
    4296           0 :                 y->ptr.pp_double[i][j] = (double)(0);
    4297             :             }
    4298             :         }
    4299             :     }
    4300             :     
    4301             :     /*
    4302             :      * calculate cross-covariance matrix
    4303             :      */
    4304           0 :     rmatrixgemm(m1, m2, n, (double)1/(double)(n-1), x, 0, 0, 1, y, 0, 0, 0, 0.0, c, 0, 0, _state);
    4305           0 :     ae_frame_leave(_state);
    4306             : }
    4307             : 
    4308             : 
    4309             : /*************************************************************************
    4310             : Pearson product-moment cross-correlation matrix
    4311             : 
    4312             :   ! COMMERCIAL EDITION OF ALGLIB:
    4313             :   ! 
    4314             :   ! Commercial Edition of ALGLIB includes following important improvements
    4315             :   ! of this function:
    4316             :   ! * high-performance native backend with same C# interface (C# version)
    4317             :   ! * multithreading support (C++ and C# versions)
    4318             :   ! * hardware vendor (Intel) implementations of linear algebra primitives
    4319             :   !   (C++ and C# versions, x86/x64 platform)
    4320             :   ! 
    4321             :   ! We recommend you to read 'Working with commercial version' section  of
    4322             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
    4323             :   ! related features provided by commercial edition of ALGLIB.
    4324             : 
    4325             : INPUT PARAMETERS:
    4326             :     X   -   array[N,M1], sample matrix:
    4327             :             * J-th column corresponds to J-th variable
    4328             :             * I-th row corresponds to I-th observation
    4329             :     Y   -   array[N,M2], sample matrix:
    4330             :             * J-th column corresponds to J-th variable
    4331             :             * I-th row corresponds to I-th observation
    4332             :     N   -   N>=0, number of observations:
    4333             :             * if given, only leading N rows of X/Y are used
    4334             :             * if not given, automatically determined from input sizes
    4335             :     M1  -   M1>0, number of variables in X:
    4336             :             * if given, only leading M1 columns of X are used
    4337             :             * if not given, automatically determined from input size
    4338             :     M2  -   M2>0, number of variables in Y:
    4339             :             * if given, only leading M1 columns of X are used
    4340             :             * if not given, automatically determined from input size
    4341             : 
    4342             : OUTPUT PARAMETERS:
    4343             :     C   -   array[M1,M2], cross-correlation matrix (zero if N=0 or N=1)
    4344             : 
    4345             :   -- ALGLIB --
    4346             :      Copyright 28.10.2010 by Bochkanov Sergey
    4347             : *************************************************************************/
    4348           0 : void pearsoncorrm2(/* Real    */ ae_matrix* x,
    4349             :      /* Real    */ ae_matrix* y,
    4350             :      ae_int_t n,
    4351             :      ae_int_t m1,
    4352             :      ae_int_t m2,
    4353             :      /* Real    */ ae_matrix* c,
    4354             :      ae_state *_state)
    4355             : {
    4356             :     ae_frame _frame_block;
    4357             :     ae_matrix _x;
    4358             :     ae_matrix _y;
    4359             :     ae_int_t i;
    4360             :     ae_int_t j;
    4361             :     double v;
    4362             :     ae_vector t;
    4363             :     ae_vector x0;
    4364             :     ae_vector y0;
    4365             :     ae_vector sx;
    4366             :     ae_vector sy;
    4367             :     ae_vector samex;
    4368             :     ae_vector samey;
    4369             : 
    4370           0 :     ae_frame_make(_state, &_frame_block);
    4371           0 :     memset(&_x, 0, sizeof(_x));
    4372           0 :     memset(&_y, 0, sizeof(_y));
    4373           0 :     memset(&t, 0, sizeof(t));
    4374           0 :     memset(&x0, 0, sizeof(x0));
    4375           0 :     memset(&y0, 0, sizeof(y0));
    4376           0 :     memset(&sx, 0, sizeof(sx));
    4377           0 :     memset(&sy, 0, sizeof(sy));
    4378           0 :     memset(&samex, 0, sizeof(samex));
    4379           0 :     memset(&samey, 0, sizeof(samey));
    4380           0 :     ae_matrix_init_copy(&_x, x, _state, ae_true);
    4381           0 :     x = &_x;
    4382           0 :     ae_matrix_init_copy(&_y, y, _state, ae_true);
    4383           0 :     y = &_y;
    4384           0 :     ae_matrix_clear(c);
    4385           0 :     ae_vector_init(&t, 0, DT_REAL, _state, ae_true);
    4386           0 :     ae_vector_init(&x0, 0, DT_REAL, _state, ae_true);
    4387           0 :     ae_vector_init(&y0, 0, DT_REAL, _state, ae_true);
    4388           0 :     ae_vector_init(&sx, 0, DT_REAL, _state, ae_true);
    4389           0 :     ae_vector_init(&sy, 0, DT_REAL, _state, ae_true);
    4390           0 :     ae_vector_init(&samex, 0, DT_BOOL, _state, ae_true);
    4391           0 :     ae_vector_init(&samey, 0, DT_BOOL, _state, ae_true);
    4392             : 
    4393           0 :     ae_assert(n>=0, "PearsonCorrM2: N<0", _state);
    4394           0 :     ae_assert(m1>=1, "PearsonCorrM2: M1<1", _state);
    4395           0 :     ae_assert(m2>=1, "PearsonCorrM2: M2<1", _state);
    4396           0 :     ae_assert(x->rows>=n, "PearsonCorrM2: Rows(X)<N!", _state);
    4397           0 :     ae_assert(x->cols>=m1||n==0, "PearsonCorrM2: Cols(X)<M1!", _state);
    4398           0 :     ae_assert(apservisfinitematrix(x, n, m1, _state), "PearsonCorrM2: X contains infinite/NAN elements", _state);
    4399           0 :     ae_assert(y->rows>=n, "PearsonCorrM2: Rows(Y)<N!", _state);
    4400           0 :     ae_assert(y->cols>=m2||n==0, "PearsonCorrM2: Cols(Y)<M2!", _state);
    4401           0 :     ae_assert(apservisfinitematrix(y, n, m2, _state), "PearsonCorrM2: X contains infinite/NAN elements", _state);
    4402             :     
    4403             :     /*
    4404             :      * N<=1, return zero
    4405             :      */
    4406           0 :     if( n<=1 )
    4407             :     {
    4408           0 :         ae_matrix_set_length(c, m1, m2, _state);
    4409           0 :         for(i=0; i<=m1-1; i++)
    4410             :         {
    4411           0 :             for(j=0; j<=m2-1; j++)
    4412             :             {
    4413           0 :                 c->ptr.pp_double[i][j] = (double)(0);
    4414             :             }
    4415             :         }
    4416           0 :         ae_frame_leave(_state);
    4417           0 :         return;
    4418             :     }
    4419             :     
    4420             :     /*
    4421             :      * Allocate
    4422             :      */
    4423           0 :     ae_vector_set_length(&t, ae_maxint(m1, m2, _state), _state);
    4424           0 :     ae_vector_set_length(&x0, m1, _state);
    4425           0 :     ae_vector_set_length(&y0, m2, _state);
    4426           0 :     ae_vector_set_length(&sx, m1, _state);
    4427           0 :     ae_vector_set_length(&sy, m2, _state);
    4428           0 :     ae_vector_set_length(&samex, m1, _state);
    4429           0 :     ae_vector_set_length(&samey, m2, _state);
    4430           0 :     ae_matrix_set_length(c, m1, m2, _state);
    4431             :     
    4432             :     /*
    4433             :      * * calculate means of X
    4434             :      * * center X
    4435             :      * * if we have constant columns, these columns are
    4436             :      *   artificially zeroed (they must be zero in exact arithmetics,
    4437             :      *   but unfortunately floating point ops are not exact).
    4438             :      * * calculate column variances
    4439             :      */
    4440           0 :     for(i=0; i<=m1-1; i++)
    4441             :     {
    4442           0 :         t.ptr.p_double[i] = (double)(0);
    4443           0 :         samex.ptr.p_bool[i] = ae_true;
    4444           0 :         sx.ptr.p_double[i] = (double)(0);
    4445             :     }
    4446           0 :     ae_v_move(&x0.ptr.p_double[0], 1, &x->ptr.pp_double[0][0], 1, ae_v_len(0,m1-1));
    4447           0 :     v = (double)1/(double)n;
    4448           0 :     for(i=0; i<=n-1; i++)
    4449             :     {
    4450           0 :         ae_v_addd(&t.ptr.p_double[0], 1, &x->ptr.pp_double[i][0], 1, ae_v_len(0,m1-1), v);
    4451           0 :         for(j=0; j<=m1-1; j++)
    4452             :         {
    4453           0 :             samex.ptr.p_bool[j] = samex.ptr.p_bool[j]&&ae_fp_eq(x->ptr.pp_double[i][j],x0.ptr.p_double[j]);
    4454             :         }
    4455             :     }
    4456           0 :     for(i=0; i<=n-1; i++)
    4457             :     {
    4458           0 :         ae_v_sub(&x->ptr.pp_double[i][0], 1, &t.ptr.p_double[0], 1, ae_v_len(0,m1-1));
    4459           0 :         for(j=0; j<=m1-1; j++)
    4460             :         {
    4461           0 :             if( samex.ptr.p_bool[j] )
    4462             :             {
    4463           0 :                 x->ptr.pp_double[i][j] = (double)(0);
    4464             :             }
    4465           0 :             sx.ptr.p_double[j] = sx.ptr.p_double[j]+x->ptr.pp_double[i][j]*x->ptr.pp_double[i][j];
    4466             :         }
    4467             :     }
    4468           0 :     for(j=0; j<=m1-1; j++)
    4469             :     {
    4470           0 :         sx.ptr.p_double[j] = ae_sqrt(sx.ptr.p_double[j]/(n-1), _state);
    4471             :     }
    4472             :     
    4473             :     /*
    4474             :      * Repeat same steps for Y
    4475             :      */
    4476           0 :     for(i=0; i<=m2-1; i++)
    4477             :     {
    4478           0 :         t.ptr.p_double[i] = (double)(0);
    4479           0 :         samey.ptr.p_bool[i] = ae_true;
    4480           0 :         sy.ptr.p_double[i] = (double)(0);
    4481             :     }
    4482           0 :     ae_v_move(&y0.ptr.p_double[0], 1, &y->ptr.pp_double[0][0], 1, ae_v_len(0,m2-1));
    4483           0 :     v = (double)1/(double)n;
    4484           0 :     for(i=0; i<=n-1; i++)
    4485             :     {
    4486           0 :         ae_v_addd(&t.ptr.p_double[0], 1, &y->ptr.pp_double[i][0], 1, ae_v_len(0,m2-1), v);
    4487           0 :         for(j=0; j<=m2-1; j++)
    4488             :         {
    4489           0 :             samey.ptr.p_bool[j] = samey.ptr.p_bool[j]&&ae_fp_eq(y->ptr.pp_double[i][j],y0.ptr.p_double[j]);
    4490             :         }
    4491             :     }
    4492           0 :     for(i=0; i<=n-1; i++)
    4493             :     {
    4494           0 :         ae_v_sub(&y->ptr.pp_double[i][0], 1, &t.ptr.p_double[0], 1, ae_v_len(0,m2-1));
    4495           0 :         for(j=0; j<=m2-1; j++)
    4496             :         {
    4497           0 :             if( samey.ptr.p_bool[j] )
    4498             :             {
    4499           0 :                 y->ptr.pp_double[i][j] = (double)(0);
    4500             :             }
    4501           0 :             sy.ptr.p_double[j] = sy.ptr.p_double[j]+y->ptr.pp_double[i][j]*y->ptr.pp_double[i][j];
    4502             :         }
    4503             :     }
    4504           0 :     for(j=0; j<=m2-1; j++)
    4505             :     {
    4506           0 :         sy.ptr.p_double[j] = ae_sqrt(sy.ptr.p_double[j]/(n-1), _state);
    4507             :     }
    4508             :     
    4509             :     /*
    4510             :      * calculate cross-covariance matrix
    4511             :      */
    4512           0 :     rmatrixgemm(m1, m2, n, (double)1/(double)(n-1), x, 0, 0, 1, y, 0, 0, 0, 0.0, c, 0, 0, _state);
    4513             :     
    4514             :     /*
    4515             :      * Divide by standard deviations
    4516             :      */
    4517           0 :     for(i=0; i<=m1-1; i++)
    4518             :     {
    4519           0 :         if( ae_fp_neq(sx.ptr.p_double[i],(double)(0)) )
    4520             :         {
    4521           0 :             sx.ptr.p_double[i] = 1/sx.ptr.p_double[i];
    4522             :         }
    4523             :         else
    4524             :         {
    4525           0 :             sx.ptr.p_double[i] = 0.0;
    4526             :         }
    4527             :     }
    4528           0 :     for(i=0; i<=m2-1; i++)
    4529             :     {
    4530           0 :         if( ae_fp_neq(sy.ptr.p_double[i],(double)(0)) )
    4531             :         {
    4532           0 :             sy.ptr.p_double[i] = 1/sy.ptr.p_double[i];
    4533             :         }
    4534             :         else
    4535             :         {
    4536           0 :             sy.ptr.p_double[i] = 0.0;
    4537             :         }
    4538             :     }
    4539           0 :     for(i=0; i<=m1-1; i++)
    4540             :     {
    4541           0 :         v = sx.ptr.p_double[i];
    4542           0 :         for(j=0; j<=m2-1; j++)
    4543             :         {
    4544           0 :             c->ptr.pp_double[i][j] = c->ptr.pp_double[i][j]*v*sy.ptr.p_double[j];
    4545             :         }
    4546             :     }
    4547           0 :     ae_frame_leave(_state);
    4548             : }
    4549             : 
    4550             : 
    4551             : /*************************************************************************
    4552             : Spearman's rank cross-correlation matrix
    4553             : 
    4554             :   ! COMMERCIAL EDITION OF ALGLIB:
    4555             :   ! 
    4556             :   ! Commercial Edition of ALGLIB includes following important improvements
    4557             :   ! of this function:
    4558             :   ! * high-performance native backend with same C# interface (C# version)
    4559             :   ! * multithreading support (C++ and C# versions)
    4560             :   ! * hardware vendor (Intel) implementations of linear algebra primitives
    4561             :   !   (C++ and C# versions, x86/x64 platform)
    4562             :   ! 
    4563             :   ! We recommend you to read 'Working with commercial version' section  of
    4564             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
    4565             :   ! related features provided by commercial edition of ALGLIB.
    4566             : 
    4567             : INPUT PARAMETERS:
    4568             :     X   -   array[N,M1], sample matrix:
    4569             :             * J-th column corresponds to J-th variable
    4570             :             * I-th row corresponds to I-th observation
    4571             :     Y   -   array[N,M2], sample matrix:
    4572             :             * J-th column corresponds to J-th variable
    4573             :             * I-th row corresponds to I-th observation
    4574             :     N   -   N>=0, number of observations:
    4575             :             * if given, only leading N rows of X/Y are used
    4576             :             * if not given, automatically determined from input sizes
    4577             :     M1  -   M1>0, number of variables in X:
    4578             :             * if given, only leading M1 columns of X are used
    4579             :             * if not given, automatically determined from input size
    4580             :     M2  -   M2>0, number of variables in Y:
    4581             :             * if given, only leading M1 columns of X are used
    4582             :             * if not given, automatically determined from input size
    4583             : 
    4584             : OUTPUT PARAMETERS:
    4585             :     C   -   array[M1,M2], cross-correlation matrix (zero if N=0 or N=1)
    4586             : 
    4587             :   -- ALGLIB --
    4588             :      Copyright 28.10.2010 by Bochkanov Sergey
    4589             : *************************************************************************/
    4590           0 : void spearmancorrm2(/* Real    */ ae_matrix* x,
    4591             :      /* Real    */ ae_matrix* y,
    4592             :      ae_int_t n,
    4593             :      ae_int_t m1,
    4594             :      ae_int_t m2,
    4595             :      /* Real    */ ae_matrix* c,
    4596             :      ae_state *_state)
    4597             : {
    4598             :     ae_frame _frame_block;
    4599             :     ae_int_t i;
    4600             :     ae_int_t j;
    4601             :     double v;
    4602             :     double v2;
    4603             :     double vv;
    4604             :     ae_bool b;
    4605             :     ae_vector t;
    4606             :     double x0;
    4607             :     double y0;
    4608             :     ae_vector sx;
    4609             :     ae_vector sy;
    4610             :     ae_matrix xc;
    4611             :     ae_matrix yc;
    4612             :     apbuffers buf;
    4613             : 
    4614           0 :     ae_frame_make(_state, &_frame_block);
    4615           0 :     memset(&t, 0, sizeof(t));
    4616           0 :     memset(&sx, 0, sizeof(sx));
    4617           0 :     memset(&sy, 0, sizeof(sy));
    4618           0 :     memset(&xc, 0, sizeof(xc));
    4619           0 :     memset(&yc, 0, sizeof(yc));
    4620           0 :     memset(&buf, 0, sizeof(buf));
    4621           0 :     ae_matrix_clear(c);
    4622           0 :     ae_vector_init(&t, 0, DT_REAL, _state, ae_true);
    4623           0 :     ae_vector_init(&sx, 0, DT_REAL, _state, ae_true);
    4624           0 :     ae_vector_init(&sy, 0, DT_REAL, _state, ae_true);
    4625           0 :     ae_matrix_init(&xc, 0, 0, DT_REAL, _state, ae_true);
    4626           0 :     ae_matrix_init(&yc, 0, 0, DT_REAL, _state, ae_true);
    4627           0 :     _apbuffers_init(&buf, _state, ae_true);
    4628             : 
    4629           0 :     ae_assert(n>=0, "SpearmanCorrM2: N<0", _state);
    4630           0 :     ae_assert(m1>=1, "SpearmanCorrM2: M1<1", _state);
    4631           0 :     ae_assert(m2>=1, "SpearmanCorrM2: M2<1", _state);
    4632           0 :     ae_assert(x->rows>=n, "SpearmanCorrM2: Rows(X)<N!", _state);
    4633           0 :     ae_assert(x->cols>=m1||n==0, "SpearmanCorrM2: Cols(X)<M1!", _state);
    4634           0 :     ae_assert(apservisfinitematrix(x, n, m1, _state), "SpearmanCorrM2: X contains infinite/NAN elements", _state);
    4635           0 :     ae_assert(y->rows>=n, "SpearmanCorrM2: Rows(Y)<N!", _state);
    4636           0 :     ae_assert(y->cols>=m2||n==0, "SpearmanCorrM2: Cols(Y)<M2!", _state);
    4637           0 :     ae_assert(apservisfinitematrix(y, n, m2, _state), "SpearmanCorrM2: X contains infinite/NAN elements", _state);
    4638             :     
    4639             :     /*
    4640             :      * N<=1, return zero
    4641             :      */
    4642           0 :     if( n<=1 )
    4643             :     {
    4644           0 :         ae_matrix_set_length(c, m1, m2, _state);
    4645           0 :         for(i=0; i<=m1-1; i++)
    4646             :         {
    4647           0 :             for(j=0; j<=m2-1; j++)
    4648             :             {
    4649           0 :                 c->ptr.pp_double[i][j] = (double)(0);
    4650             :             }
    4651             :         }
    4652           0 :         ae_frame_leave(_state);
    4653           0 :         return;
    4654             :     }
    4655             :     
    4656             :     /*
    4657             :      * Allocate
    4658             :      */
    4659           0 :     ae_vector_set_length(&t, ae_maxint(ae_maxint(m1, m2, _state), n, _state), _state);
    4660           0 :     ae_vector_set_length(&sx, m1, _state);
    4661           0 :     ae_vector_set_length(&sy, m2, _state);
    4662           0 :     ae_matrix_set_length(c, m1, m2, _state);
    4663             :     
    4664             :     /*
    4665             :      * Replace data with ranks
    4666             :      */
    4667           0 :     ae_matrix_set_length(&xc, m1, n, _state);
    4668           0 :     ae_matrix_set_length(&yc, m2, n, _state);
    4669           0 :     rmatrixtranspose(n, m1, x, 0, 0, &xc, 0, 0, _state);
    4670           0 :     rmatrixtranspose(n, m2, y, 0, 0, &yc, 0, 0, _state);
    4671           0 :     rankdata(&xc, m1, n, _state);
    4672           0 :     rankdata(&yc, m2, n, _state);
    4673             :     
    4674             :     /*
    4675             :      * 1. Calculate means, variances, check for constant columns
    4676             :      * 2. Center variables, constant  columns are
    4677             :      *   artificialy zeroed (they must be zero in exact arithmetics,
    4678             :      *   but unfortunately floating point is not exact).
    4679             :      *
    4680             :      * Description of variables:
    4681             :      * * V - mean value of I-th variable
    4682             :      * * V2- variance
    4683             :      * * VV-temporary
    4684             :      * * B - True in case all variable values are same
    4685             :      */
    4686           0 :     for(i=0; i<=m1-1; i++)
    4687             :     {
    4688           0 :         v = (double)(0);
    4689           0 :         v2 = 0.0;
    4690           0 :         b = ae_true;
    4691           0 :         x0 = xc.ptr.pp_double[i][0];
    4692           0 :         for(j=0; j<=n-1; j++)
    4693             :         {
    4694           0 :             vv = xc.ptr.pp_double[i][j];
    4695           0 :             v = v+vv;
    4696           0 :             b = b&&ae_fp_eq(vv,x0);
    4697             :         }
    4698           0 :         v = v/n;
    4699           0 :         if( b )
    4700             :         {
    4701           0 :             for(j=0; j<=n-1; j++)
    4702             :             {
    4703           0 :                 xc.ptr.pp_double[i][j] = 0.0;
    4704             :             }
    4705             :         }
    4706             :         else
    4707             :         {
    4708           0 :             for(j=0; j<=n-1; j++)
    4709             :             {
    4710           0 :                 vv = xc.ptr.pp_double[i][j];
    4711           0 :                 xc.ptr.pp_double[i][j] = vv-v;
    4712           0 :                 v2 = v2+(vv-v)*(vv-v);
    4713             :             }
    4714             :         }
    4715           0 :         sx.ptr.p_double[i] = ae_sqrt(v2/(n-1), _state);
    4716             :     }
    4717           0 :     for(i=0; i<=m2-1; i++)
    4718             :     {
    4719           0 :         v = (double)(0);
    4720           0 :         v2 = 0.0;
    4721           0 :         b = ae_true;
    4722           0 :         y0 = yc.ptr.pp_double[i][0];
    4723           0 :         for(j=0; j<=n-1; j++)
    4724             :         {
    4725           0 :             vv = yc.ptr.pp_double[i][j];
    4726           0 :             v = v+vv;
    4727           0 :             b = b&&ae_fp_eq(vv,y0);
    4728             :         }
    4729           0 :         v = v/n;
    4730           0 :         if( b )
    4731             :         {
    4732           0 :             for(j=0; j<=n-1; j++)
    4733             :             {
    4734           0 :                 yc.ptr.pp_double[i][j] = 0.0;
    4735             :             }
    4736             :         }
    4737             :         else
    4738             :         {
    4739           0 :             for(j=0; j<=n-1; j++)
    4740             :             {
    4741           0 :                 vv = yc.ptr.pp_double[i][j];
    4742           0 :                 yc.ptr.pp_double[i][j] = vv-v;
    4743           0 :                 v2 = v2+(vv-v)*(vv-v);
    4744             :             }
    4745             :         }
    4746           0 :         sy.ptr.p_double[i] = ae_sqrt(v2/(n-1), _state);
    4747             :     }
    4748             :     
    4749             :     /*
    4750             :      * calculate cross-covariance matrix
    4751             :      */
    4752           0 :     rmatrixgemm(m1, m2, n, (double)1/(double)(n-1), &xc, 0, 0, 0, &yc, 0, 0, 1, 0.0, c, 0, 0, _state);
    4753             :     
    4754             :     /*
    4755             :      * Divide by standard deviations
    4756             :      */
    4757           0 :     for(i=0; i<=m1-1; i++)
    4758             :     {
    4759           0 :         if( ae_fp_neq(sx.ptr.p_double[i],(double)(0)) )
    4760             :         {
    4761           0 :             sx.ptr.p_double[i] = 1/sx.ptr.p_double[i];
    4762             :         }
    4763             :         else
    4764             :         {
    4765           0 :             sx.ptr.p_double[i] = 0.0;
    4766             :         }
    4767             :     }
    4768           0 :     for(i=0; i<=m2-1; i++)
    4769             :     {
    4770           0 :         if( ae_fp_neq(sy.ptr.p_double[i],(double)(0)) )
    4771             :         {
    4772           0 :             sy.ptr.p_double[i] = 1/sy.ptr.p_double[i];
    4773             :         }
    4774             :         else
    4775             :         {
    4776           0 :             sy.ptr.p_double[i] = 0.0;
    4777             :         }
    4778             :     }
    4779           0 :     for(i=0; i<=m1-1; i++)
    4780             :     {
    4781           0 :         v = sx.ptr.p_double[i];
    4782           0 :         for(j=0; j<=m2-1; j++)
    4783             :         {
    4784           0 :             c->ptr.pp_double[i][j] = c->ptr.pp_double[i][j]*v*sy.ptr.p_double[j];
    4785             :         }
    4786             :     }
    4787           0 :     ae_frame_leave(_state);
    4788             : }
    4789             : 
    4790             : 
    4791             : /*************************************************************************
    4792             : This function replaces data in XY by their ranks:
    4793             : * XY is processed row-by-row
    4794             : * rows are processed separately
    4795             : * tied data are correctly handled (tied ranks are calculated)
    4796             : * ranking starts from 0, ends at NFeatures-1
    4797             : * sum of within-row values is equal to (NFeatures-1)*NFeatures/2
    4798             : 
    4799             :   ! COMMERCIAL EDITION OF ALGLIB:
    4800             :   ! 
    4801             :   ! Commercial Edition of ALGLIB includes following important improvements
    4802             :   ! of this function:
    4803             :   ! * high-performance native backend with same C# interface (C# version)
    4804             :   ! * multithreading support (C++ and C# versions)
    4805             :   ! 
    4806             :   ! We recommend you to read 'Working with commercial version' section  of
    4807             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
    4808             :   ! related features provided by commercial edition of ALGLIB.
    4809             : 
    4810             : INPUT PARAMETERS:
    4811             :     XY      -   array[NPoints,NFeatures], dataset
    4812             :     NPoints -   number of points
    4813             :     NFeatures-  number of features
    4814             : 
    4815             : OUTPUT PARAMETERS:
    4816             :     XY      -   data are replaced by their within-row ranks;
    4817             :                 ranking starts from 0, ends at NFeatures-1
    4818             : 
    4819             :   -- ALGLIB --
    4820             :      Copyright 18.04.2013 by Bochkanov Sergey
    4821             : *************************************************************************/
    4822           0 : void rankdata(/* Real    */ ae_matrix* xy,
    4823             :      ae_int_t npoints,
    4824             :      ae_int_t nfeatures,
    4825             :      ae_state *_state)
    4826             : {
    4827             :     ae_frame _frame_block;
    4828             :     apbuffers buf0;
    4829             :     apbuffers buf1;
    4830             :     ae_int_t basecasecost;
    4831             :     ae_shared_pool pool;
    4832             : 
    4833           0 :     ae_frame_make(_state, &_frame_block);
    4834           0 :     memset(&buf0, 0, sizeof(buf0));
    4835           0 :     memset(&buf1, 0, sizeof(buf1));
    4836           0 :     memset(&pool, 0, sizeof(pool));
    4837           0 :     _apbuffers_init(&buf0, _state, ae_true);
    4838           0 :     _apbuffers_init(&buf1, _state, ae_true);
    4839           0 :     ae_shared_pool_init(&pool, _state, ae_true);
    4840             : 
    4841           0 :     ae_assert(npoints>=0, "RankData: NPoints<0", _state);
    4842           0 :     ae_assert(nfeatures>=1, "RankData: NFeatures<1", _state);
    4843           0 :     ae_assert(xy->rows>=npoints, "RankData: Rows(XY)<NPoints", _state);
    4844           0 :     ae_assert(xy->cols>=nfeatures||npoints==0, "RankData: Cols(XY)<NFeatures", _state);
    4845           0 :     ae_assert(apservisfinitematrix(xy, npoints, nfeatures, _state), "RankData: XY contains infinite/NAN elements", _state);
    4846             :     
    4847             :     /*
    4848             :      * Basecase cost is a maximum cost of basecase problems.
    4849             :      * Problems harded than that cost will be split.
    4850             :      *
    4851             :      * Problem cost is assumed to be NPoints*NFeatures*log2(NFeatures),
    4852             :      * which is proportional, but NOT equal to number of FLOPs required
    4853             :      * to solve problem.
    4854             :      *
    4855             :      * Try to use serial code for basecase problems, no SMP functionality, no shared pools.
    4856             :      */
    4857           0 :     basecasecost = 10000;
    4858           0 :     if( ae_fp_less(rmul3((double)(npoints), (double)(nfeatures), logbase2((double)(nfeatures), _state), _state),(double)(basecasecost)) )
    4859             :     {
    4860           0 :         basestat_rankdatabasecase(xy, 0, npoints, nfeatures, ae_false, &buf0, &buf1, _state);
    4861           0 :         ae_frame_leave(_state);
    4862           0 :         return;
    4863             :     }
    4864             :     
    4865             :     /*
    4866             :      * Parallel code
    4867             :      */
    4868           0 :     ae_shared_pool_set_seed(&pool, &buf0, sizeof(buf0), _apbuffers_init, _apbuffers_init_copy, _apbuffers_destroy, _state);
    4869           0 :     basestat_rankdatarec(xy, 0, npoints, nfeatures, ae_false, &pool, basecasecost, _state);
    4870           0 :     ae_frame_leave(_state);
    4871             : }
    4872             : 
    4873             : 
    4874             : /*************************************************************************
    4875             : Serial stub for GPL edition.
    4876             : *************************************************************************/
    4877           0 : ae_bool _trypexec_rankdata(/* Real    */ ae_matrix* xy,
    4878             :     ae_int_t npoints,
    4879             :     ae_int_t nfeatures,
    4880             :     ae_state *_state)
    4881             : {
    4882           0 :     return ae_false;
    4883             : }
    4884             : 
    4885             : 
    4886             : /*************************************************************************
    4887             : This function replaces data in XY by their CENTERED ranks:
    4888             : * XY is processed row-by-row
    4889             : * rows are processed separately
    4890             : * tied data are correctly handled (tied ranks are calculated)
    4891             : * centered ranks are just usual ranks, but centered in such way  that  sum
    4892             :   of within-row values is equal to 0.0.
    4893             : * centering is performed by subtracting mean from each row, i.e it changes
    4894             :   mean value, but does NOT change higher moments
    4895             : 
    4896             :   ! COMMERCIAL EDITION OF ALGLIB:
    4897             :   ! 
    4898             :   ! Commercial Edition of ALGLIB includes following important improvements
    4899             :   ! of this function:
    4900             :   ! * high-performance native backend with same C# interface (C# version)
    4901             :   ! * multithreading support (C++ and C# versions)
    4902             :   ! 
    4903             :   ! We recommend you to read 'Working with commercial version' section  of
    4904             :   ! ALGLIB Reference Manual in order to find out how to  use  performance-
    4905             :   ! related features provided by commercial edition of ALGLIB.
    4906             : 
    4907             : INPUT PARAMETERS:
    4908             :     XY      -   array[NPoints,NFeatures], dataset
    4909             :     NPoints -   number of points
    4910             :     NFeatures-  number of features
    4911             : 
    4912             : OUTPUT PARAMETERS:
    4913             :     XY      -   data are replaced by their within-row ranks;
    4914             :                 ranking starts from 0, ends at NFeatures-1
    4915             : 
    4916             :   -- ALGLIB --
    4917             :      Copyright 18.04.2013 by Bochkanov Sergey
    4918             : *************************************************************************/
    4919           0 : void rankdatacentered(/* Real    */ ae_matrix* xy,
    4920             :      ae_int_t npoints,
    4921             :      ae_int_t nfeatures,
    4922             :      ae_state *_state)
    4923             : {
    4924             :     ae_frame _frame_block;
    4925             :     apbuffers buf0;
    4926             :     apbuffers buf1;
    4927             :     ae_int_t basecasecost;
    4928             :     ae_shared_pool pool;
    4929             : 
    4930           0 :     ae_frame_make(_state, &_frame_block);
    4931           0 :     memset(&buf0, 0, sizeof(buf0));
    4932           0 :     memset(&buf1, 0, sizeof(buf1));
    4933           0 :     memset(&pool, 0, sizeof(pool));
    4934           0 :     _apbuffers_init(&buf0, _state, ae_true);
    4935           0 :     _apbuffers_init(&buf1, _state, ae_true);
    4936           0 :     ae_shared_pool_init(&pool, _state, ae_true);
    4937             : 
    4938           0 :     ae_assert(npoints>=0, "RankData: NPoints<0", _state);
    4939           0 :     ae_assert(nfeatures>=1, "RankData: NFeatures<1", _state);
    4940           0 :     ae_assert(xy->rows>=npoints, "RankData: Rows(XY)<NPoints", _state);
    4941           0 :     ae_assert(xy->cols>=nfeatures||npoints==0, "RankData: Cols(XY)<NFeatures", _state);
    4942           0 :     ae_assert(apservisfinitematrix(xy, npoints, nfeatures, _state), "RankData: XY contains infinite/NAN elements", _state);
    4943             :     
    4944             :     /*
    4945             :      * Basecase cost is a maximum cost of basecase problems.
    4946             :      * Problems harded than that cost will be split.
    4947             :      *
    4948             :      * Problem cost is assumed to be NPoints*NFeatures*log2(NFeatures),
    4949             :      * which is proportional, but NOT equal to number of FLOPs required
    4950             :      * to solve problem.
    4951             :      *
    4952             :      * Try to use serial code, no SMP functionality, no shared pools.
    4953             :      */
    4954           0 :     basecasecost = 10000;
    4955           0 :     if( ae_fp_less(rmul3((double)(npoints), (double)(nfeatures), logbase2((double)(nfeatures), _state), _state),(double)(basecasecost)) )
    4956             :     {
    4957           0 :         basestat_rankdatabasecase(xy, 0, npoints, nfeatures, ae_true, &buf0, &buf1, _state);
    4958           0 :         ae_frame_leave(_state);
    4959           0 :         return;
    4960             :     }
    4961             :     
    4962             :     /*
    4963             :      * Parallel code
    4964             :      */
    4965           0 :     ae_shared_pool_set_seed(&pool, &buf0, sizeof(buf0), _apbuffers_init, _apbuffers_init_copy, _apbuffers_destroy, _state);
    4966           0 :     basestat_rankdatarec(xy, 0, npoints, nfeatures, ae_true, &pool, basecasecost, _state);
    4967           0 :     ae_frame_leave(_state);
    4968             : }
    4969             : 
    4970             : 
    4971             : /*************************************************************************
    4972             : Serial stub for GPL edition.
    4973             : *************************************************************************/
    4974           0 : ae_bool _trypexec_rankdatacentered(/* Real    */ ae_matrix* xy,
    4975             :     ae_int_t npoints,
    4976             :     ae_int_t nfeatures,
    4977             :     ae_state *_state)
    4978             : {
    4979           0 :     return ae_false;
    4980             : }
    4981             : 
    4982             : 
    4983             : /*************************************************************************
    4984             : Obsolete function, we recommend to use PearsonCorr2().
    4985             : 
    4986             :   -- ALGLIB --
    4987             :      Copyright 09.04.2007 by Bochkanov Sergey
    4988             : *************************************************************************/
    4989           0 : double pearsoncorrelation(/* Real    */ ae_vector* x,
    4990             :      /* Real    */ ae_vector* y,
    4991             :      ae_int_t n,
    4992             :      ae_state *_state)
    4993             : {
    4994             :     double result;
    4995             : 
    4996             : 
    4997           0 :     result = pearsoncorr2(x, y, n, _state);
    4998           0 :     return result;
    4999             : }
    5000             : 
    5001             : 
    5002             : /*************************************************************************
    5003             : Obsolete function, we recommend to use SpearmanCorr2().
    5004             : 
    5005             :     -- ALGLIB --
    5006             :     Copyright 09.04.2007 by Bochkanov Sergey
    5007             : *************************************************************************/
    5008           0 : double spearmanrankcorrelation(/* Real    */ ae_vector* x,
    5009             :      /* Real    */ ae_vector* y,
    5010             :      ae_int_t n,
    5011             :      ae_state *_state)
    5012             : {
    5013             :     double result;
    5014             : 
    5015             : 
    5016           0 :     result = spearmancorr2(x, y, n, _state);
    5017           0 :     return result;
    5018             : }
    5019             : 
    5020             : 
    5021             : /*************************************************************************
    5022             : Recurrent code for RankData(), splits problem into  subproblems  or  calls
    5023             : basecase code (depending on problem complexity).
    5024             : 
    5025             : INPUT PARAMETERS:
    5026             :     XY      -   array[NPoints,NFeatures], dataset
    5027             :     I0      -   index of first row to process
    5028             :     I1      -   index of past-the-last row to process;
    5029             :                 this function processes half-interval [I0,I1).
    5030             :     NFeatures-  number of features
    5031             :     IsCentered- whether ranks are centered or not:
    5032             :                 * True      -   ranks are centered in such way that  their
    5033             :                                 within-row sum is zero
    5034             :                 * False     -   ranks are not centered
    5035             :     Pool    -   shared pool which holds temporary buffers
    5036             :                 (APBuffers structure)
    5037             :     BasecaseCost-minimum cost of the problem which will be split
    5038             : 
    5039             : OUTPUT PARAMETERS:
    5040             :     XY      -   data in [I0,I1) are replaced by their within-row ranks;
    5041             :                 ranking starts from 0, ends at NFeatures-1
    5042             : 
    5043             :   -- ALGLIB --
    5044             :      Copyright 18.04.2013 by Bochkanov Sergey
    5045             : *************************************************************************/
    5046           0 : static void basestat_rankdatarec(/* Real    */ ae_matrix* xy,
    5047             :      ae_int_t i0,
    5048             :      ae_int_t i1,
    5049             :      ae_int_t nfeatures,
    5050             :      ae_bool iscentered,
    5051             :      ae_shared_pool* pool,
    5052             :      ae_int_t basecasecost,
    5053             :      ae_state *_state)
    5054             : {
    5055             :     ae_frame _frame_block;
    5056             :     apbuffers *buf0;
    5057             :     ae_smart_ptr _buf0;
    5058             :     apbuffers *buf1;
    5059             :     ae_smart_ptr _buf1;
    5060             :     double problemcost;
    5061             :     ae_int_t im;
    5062             : 
    5063           0 :     ae_frame_make(_state, &_frame_block);
    5064           0 :     memset(&_buf0, 0, sizeof(_buf0));
    5065           0 :     memset(&_buf1, 0, sizeof(_buf1));
    5066           0 :     ae_smart_ptr_init(&_buf0, (void**)&buf0, _state, ae_true);
    5067           0 :     ae_smart_ptr_init(&_buf1, (void**)&buf1, _state, ae_true);
    5068             : 
    5069           0 :     ae_assert(i1>=i0, "RankDataRec: internal error", _state);
    5070             :     
    5071             :     /*
    5072             :      * Try to activate parallelism
    5073             :      */
    5074           0 :     if( i1-i0>=4&&ae_fp_greater_eq(rmul3((double)(i1-i0), (double)(nfeatures), logbase2((double)(nfeatures), _state), _state),smpactivationlevel(_state)) )
    5075             :     {
    5076           0 :         if( _trypexec_basestat_rankdatarec(xy,i0,i1,nfeatures,iscentered,pool,basecasecost, _state) )
    5077             :         {
    5078           0 :             ae_frame_leave(_state);
    5079           0 :             return;
    5080             :         }
    5081             :     }
    5082             :     
    5083             :     /*
    5084             :      * Recursively split problem, if it is too large
    5085             :      */
    5086           0 :     problemcost = rmul3((double)(i1-i0), (double)(nfeatures), logbase2((double)(nfeatures), _state), _state);
    5087           0 :     if( i1-i0>=2&&ae_fp_greater(problemcost,spawnlevel(_state)) )
    5088             :     {
    5089           0 :         im = (i1+i0)/2;
    5090           0 :         basestat_rankdatarec(xy, i0, im, nfeatures, iscentered, pool, basecasecost, _state);
    5091           0 :         basestat_rankdatarec(xy, im, i1, nfeatures, iscentered, pool, basecasecost, _state);
    5092           0 :         ae_frame_leave(_state);
    5093           0 :         return;
    5094             :     }
    5095             :     
    5096             :     /*
    5097             :      * Retrieve buffers from pool, call serial code, return buffers to pool
    5098             :      */
    5099           0 :     ae_shared_pool_retrieve(pool, &_buf0, _state);
    5100           0 :     ae_shared_pool_retrieve(pool, &_buf1, _state);
    5101           0 :     basestat_rankdatabasecase(xy, i0, i1, nfeatures, iscentered, buf0, buf1, _state);
    5102           0 :     ae_shared_pool_recycle(pool, &_buf0, _state);
    5103           0 :     ae_shared_pool_recycle(pool, &_buf1, _state);
    5104           0 :     ae_frame_leave(_state);
    5105             : }
    5106             : 
    5107             : 
    5108             : /*************************************************************************
    5109             : Serial stub for GPL edition.
    5110             : *************************************************************************/
    5111           0 : ae_bool _trypexec_basestat_rankdatarec(/* Real    */ ae_matrix* xy,
    5112             :     ae_int_t i0,
    5113             :     ae_int_t i1,
    5114             :     ae_int_t nfeatures,
    5115             :     ae_bool iscentered,
    5116             :     ae_shared_pool* pool,
    5117             :     ae_int_t basecasecost,
    5118             :     ae_state *_state)
    5119             : {
    5120           0 :     return ae_false;
    5121             : }
    5122             : 
    5123             : 
    5124             : /*************************************************************************
    5125             : Basecase code for RankData(), performs actual work on subset of data using
    5126             : temporary buffer passed as parameter.
    5127             : 
    5128             : INPUT PARAMETERS:
    5129             :     XY      -   array[NPoints,NFeatures], dataset
    5130             :     I0      -   index of first row to process
    5131             :     I1      -   index of past-the-last row to process;
    5132             :                 this function processes half-interval [I0,I1).
    5133             :     NFeatures-  number of features
    5134             :     IsCentered- whether ranks are centered or not:
    5135             :                 * True      -   ranks are centered in such way that  their
    5136             :                                 within-row sum is zero
    5137             :                 * False     -   ranks are not centered
    5138             :     Buf0    -   temporary buffers, may be empty (this function automatically
    5139             :                 allocates/reuses buffers).
    5140             :     Buf1    -   temporary buffers, may be empty (this function automatically
    5141             :                 allocates/reuses buffers).
    5142             : 
    5143             : OUTPUT PARAMETERS:
    5144             :     XY      -   data in [I0,I1) are replaced by their within-row ranks;
    5145             :                 ranking starts from 0, ends at NFeatures-1
    5146             : 
    5147             :   -- ALGLIB --
    5148             :      Copyright 18.04.2013 by Bochkanov Sergey
    5149             : *************************************************************************/
    5150           0 : static void basestat_rankdatabasecase(/* Real    */ ae_matrix* xy,
    5151             :      ae_int_t i0,
    5152             :      ae_int_t i1,
    5153             :      ae_int_t nfeatures,
    5154             :      ae_bool iscentered,
    5155             :      apbuffers* buf0,
    5156             :      apbuffers* buf1,
    5157             :      ae_state *_state)
    5158             : {
    5159             :     ae_int_t i;
    5160             : 
    5161             : 
    5162           0 :     ae_assert(i1>=i0, "RankDataBasecase: internal error", _state);
    5163           0 :     if( buf1->ra0.cnt<nfeatures )
    5164             :     {
    5165           0 :         ae_vector_set_length(&buf1->ra0, nfeatures, _state);
    5166             :     }
    5167           0 :     for(i=i0; i<=i1-1; i++)
    5168             :     {
    5169           0 :         ae_v_move(&buf1->ra0.ptr.p_double[0], 1, &xy->ptr.pp_double[i][0], 1, ae_v_len(0,nfeatures-1));
    5170           0 :         rankx(&buf1->ra0, nfeatures, iscentered, buf0, _state);
    5171           0 :         ae_v_move(&xy->ptr.pp_double[i][0], 1, &buf1->ra0.ptr.p_double[0], 1, ae_v_len(0,nfeatures-1));
    5172             :     }
    5173           0 : }
    5174             : 
    5175             : 
    5176             : /*************************************************************************
    5177             : Serial stub for GPL edition.
    5178             : *************************************************************************/
    5179           0 : ae_bool _trypexec_basestat_rankdatabasecase(/* Real    */ ae_matrix* xy,
    5180             :     ae_int_t i0,
    5181             :     ae_int_t i1,
    5182             :     ae_int_t nfeatures,
    5183             :     ae_bool iscentered,
    5184             :     apbuffers* buf0,
    5185             :     apbuffers* buf1,
    5186             :     ae_state *_state)
    5187             : {
    5188           0 :     return ae_false;
    5189             : }
    5190             : 
    5191             : 
    5192             : #endif
    5193             : #if defined(AE_COMPILE_WSR) || !defined(AE_PARTIAL_BUILD)
    5194             : 
    5195             : 
    5196             : /*************************************************************************
    5197             : Wilcoxon signed-rank test
    5198             : 
    5199             : This test checks three hypotheses about the median  of  the  given sample.
    5200             : The following tests are performed:
    5201             :     * two-tailed test (null hypothesis - the median is equal to the  given
    5202             :       value)
    5203             :     * left-tailed test (null hypothesis - the median is  greater  than  or
    5204             :       equal to the given value)
    5205             :     * right-tailed test (null hypothesis  -  the  median  is  less than or
    5206             :       equal to the given value)
    5207             : 
    5208             : Requirements:
    5209             :     * the scale of measurement should be ordinal, interval or  ratio (i.e.
    5210             :       the test could not be applied to nominal variables).
    5211             :     * the distribution should be continuous and symmetric relative to  its
    5212             :       median.
    5213             :     * number of distinct values in the X array should be greater than 4
    5214             : 
    5215             : The test is non-parametric and doesn't require distribution X to be normal
    5216             : 
    5217             : Input parameters:
    5218             :     X       -   sample. Array whose index goes from 0 to N-1.
    5219             :     N       -   size of the sample.
    5220             :     Median  -   assumed median value.
    5221             : 
    5222             : Output parameters:
    5223             :     BothTails   -   p-value for two-tailed test.
    5224             :                     If BothTails is less than the given significance level
    5225             :                     the null hypothesis is rejected.
    5226             :     LeftTail    -   p-value for left-tailed test.
    5227             :                     If LeftTail is less than the given significance level,
    5228             :                     the null hypothesis is rejected.
    5229             :     RightTail   -   p-value for right-tailed test.
    5230             :                     If RightTail is less than the given significance level
    5231             :                     the null hypothesis is rejected.
    5232             : 
    5233             : To calculate p-values, special approximation is used. This method lets  us
    5234             : calculate p-values with two decimal places in interval [0.0001, 1].
    5235             : 
    5236             : "Two decimal places" does not sound very impressive, but in  practice  the
    5237             : relative error of less than 1% is enough to make a decision.
    5238             : 
    5239             : There is no approximation outside the [0.0001, 1] interval. Therefore,  if
    5240             : the significance level outlies this interval, the test returns 0.0001.
    5241             : 
    5242             :   -- ALGLIB --
    5243             :      Copyright 08.09.2006 by Bochkanov Sergey
    5244             : *************************************************************************/
    5245           0 : void wilcoxonsignedranktest(/* Real    */ ae_vector* x,
    5246             :      ae_int_t n,
    5247             :      double e,
    5248             :      double* bothtails,
    5249             :      double* lefttail,
    5250             :      double* righttail,
    5251             :      ae_state *_state)
    5252             : {
    5253             :     ae_frame _frame_block;
    5254             :     ae_vector _x;
    5255             :     ae_int_t i;
    5256             :     ae_int_t j;
    5257             :     ae_int_t k;
    5258             :     ae_int_t t;
    5259             :     double tmp;
    5260             :     ae_int_t tmpi;
    5261             :     ae_int_t ns;
    5262             :     ae_vector r;
    5263             :     ae_vector c;
    5264             :     double w;
    5265             :     double p;
    5266             :     double mp;
    5267             :     double s;
    5268             :     double sigma;
    5269             :     double mu;
    5270             : 
    5271           0 :     ae_frame_make(_state, &_frame_block);
    5272           0 :     memset(&_x, 0, sizeof(_x));
    5273           0 :     memset(&r, 0, sizeof(r));
    5274           0 :     memset(&c, 0, sizeof(c));
    5275           0 :     ae_vector_init_copy(&_x, x, _state, ae_true);
    5276           0 :     x = &_x;
    5277           0 :     *bothtails = 0;
    5278           0 :     *lefttail = 0;
    5279           0 :     *righttail = 0;
    5280           0 :     ae_vector_init(&r, 0, DT_REAL, _state, ae_true);
    5281           0 :     ae_vector_init(&c, 0, DT_INT, _state, ae_true);
    5282             : 
    5283             :     
    5284             :     /*
    5285             :      * Prepare
    5286             :      */
    5287           0 :     if( n<5 )
    5288             :     {
    5289           0 :         *bothtails = 1.0;
    5290           0 :         *lefttail = 1.0;
    5291           0 :         *righttail = 1.0;
    5292           0 :         ae_frame_leave(_state);
    5293           0 :         return;
    5294             :     }
    5295           0 :     ns = 0;
    5296           0 :     for(i=0; i<=n-1; i++)
    5297             :     {
    5298           0 :         if( ae_fp_eq(x->ptr.p_double[i],e) )
    5299             :         {
    5300           0 :             continue;
    5301             :         }
    5302           0 :         x->ptr.p_double[ns] = x->ptr.p_double[i];
    5303           0 :         ns = ns+1;
    5304             :     }
    5305           0 :     if( ns<5 )
    5306             :     {
    5307           0 :         *bothtails = 1.0;
    5308           0 :         *lefttail = 1.0;
    5309           0 :         *righttail = 1.0;
    5310           0 :         ae_frame_leave(_state);
    5311           0 :         return;
    5312             :     }
    5313           0 :     ae_vector_set_length(&r, ns-1+1, _state);
    5314           0 :     ae_vector_set_length(&c, ns-1+1, _state);
    5315           0 :     for(i=0; i<=ns-1; i++)
    5316             :     {
    5317           0 :         r.ptr.p_double[i] = ae_fabs(x->ptr.p_double[i]-e, _state);
    5318           0 :         c.ptr.p_int[i] = i;
    5319             :     }
    5320             :     
    5321             :     /*
    5322             :      * sort {R, C}
    5323             :      */
    5324           0 :     if( ns!=1 )
    5325             :     {
    5326           0 :         i = 2;
    5327             :         do
    5328             :         {
    5329           0 :             t = i;
    5330           0 :             while(t!=1)
    5331             :             {
    5332           0 :                 k = t/2;
    5333           0 :                 if( ae_fp_greater_eq(r.ptr.p_double[k-1],r.ptr.p_double[t-1]) )
    5334             :                 {
    5335           0 :                     t = 1;
    5336             :                 }
    5337             :                 else
    5338             :                 {
    5339           0 :                     tmp = r.ptr.p_double[k-1];
    5340           0 :                     r.ptr.p_double[k-1] = r.ptr.p_double[t-1];
    5341           0 :                     r.ptr.p_double[t-1] = tmp;
    5342           0 :                     tmpi = c.ptr.p_int[k-1];
    5343           0 :                     c.ptr.p_int[k-1] = c.ptr.p_int[t-1];
    5344           0 :                     c.ptr.p_int[t-1] = tmpi;
    5345           0 :                     t = k;
    5346             :                 }
    5347             :             }
    5348           0 :             i = i+1;
    5349             :         }
    5350           0 :         while(i<=ns);
    5351           0 :         i = ns-1;
    5352             :         do
    5353             :         {
    5354           0 :             tmp = r.ptr.p_double[i];
    5355           0 :             r.ptr.p_double[i] = r.ptr.p_double[0];
    5356           0 :             r.ptr.p_double[0] = tmp;
    5357           0 :             tmpi = c.ptr.p_int[i];
    5358           0 :             c.ptr.p_int[i] = c.ptr.p_int[0];
    5359           0 :             c.ptr.p_int[0] = tmpi;
    5360           0 :             t = 1;
    5361           0 :             while(t!=0)
    5362             :             {
    5363           0 :                 k = 2*t;
    5364           0 :                 if( k>i )
    5365             :                 {
    5366           0 :                     t = 0;
    5367             :                 }
    5368             :                 else
    5369             :                 {
    5370           0 :                     if( k<i )
    5371             :                     {
    5372           0 :                         if( ae_fp_greater(r.ptr.p_double[k],r.ptr.p_double[k-1]) )
    5373             :                         {
    5374           0 :                             k = k+1;
    5375             :                         }
    5376             :                     }
    5377           0 :                     if( ae_fp_greater_eq(r.ptr.p_double[t-1],r.ptr.p_double[k-1]) )
    5378             :                     {
    5379           0 :                         t = 0;
    5380             :                     }
    5381             :                     else
    5382             :                     {
    5383           0 :                         tmp = r.ptr.p_double[k-1];
    5384           0 :                         r.ptr.p_double[k-1] = r.ptr.p_double[t-1];
    5385           0 :                         r.ptr.p_double[t-1] = tmp;
    5386           0 :                         tmpi = c.ptr.p_int[k-1];
    5387           0 :                         c.ptr.p_int[k-1] = c.ptr.p_int[t-1];
    5388           0 :                         c.ptr.p_int[t-1] = tmpi;
    5389           0 :                         t = k;
    5390             :                     }
    5391             :                 }
    5392             :             }
    5393           0 :             i = i-1;
    5394             :         }
    5395           0 :         while(i>=1);
    5396             :     }
    5397             :     
    5398             :     /*
    5399             :      * compute tied ranks
    5400             :      */
    5401           0 :     i = 0;
    5402           0 :     while(i<=ns-1)
    5403             :     {
    5404           0 :         j = i+1;
    5405           0 :         while(j<=ns-1)
    5406             :         {
    5407           0 :             if( ae_fp_neq(r.ptr.p_double[j],r.ptr.p_double[i]) )
    5408             :             {
    5409           0 :                 break;
    5410             :             }
    5411           0 :             j = j+1;
    5412             :         }
    5413           0 :         for(k=i; k<=j-1; k++)
    5414             :         {
    5415           0 :             r.ptr.p_double[k] = 1+(double)(i+j-1)/(double)2;
    5416             :         }
    5417           0 :         i = j;
    5418             :     }
    5419             :     
    5420             :     /*
    5421             :      * Compute W+
    5422             :      */
    5423           0 :     w = (double)(0);
    5424           0 :     for(i=0; i<=ns-1; i++)
    5425             :     {
    5426           0 :         if( ae_fp_greater(x->ptr.p_double[c.ptr.p_int[i]],e) )
    5427             :         {
    5428           0 :             w = w+r.ptr.p_double[i];
    5429             :         }
    5430             :     }
    5431             :     
    5432             :     /*
    5433             :      * Result
    5434             :      */
    5435           0 :     mu = rmul2((double)(ns), (double)(ns+1), _state)/4;
    5436           0 :     sigma = ae_sqrt(mu*(2*ns+1)/6, _state);
    5437           0 :     s = (w-mu)/sigma;
    5438           0 :     if( ae_fp_less_eq(s,(double)(0)) )
    5439             :     {
    5440           0 :         p = ae_exp(wsr_wsigma(-(w-mu)/sigma, ns, _state), _state);
    5441           0 :         mp = 1-ae_exp(wsr_wsigma(-(w-1-mu)/sigma, ns, _state), _state);
    5442             :     }
    5443             :     else
    5444             :     {
    5445           0 :         mp = ae_exp(wsr_wsigma((w-mu)/sigma, ns, _state), _state);
    5446           0 :         p = 1-ae_exp(wsr_wsigma((w+1-mu)/sigma, ns, _state), _state);
    5447             :     }
    5448           0 :     *lefttail = ae_maxreal(p, 1.0E-4, _state);
    5449           0 :     *righttail = ae_maxreal(mp, 1.0E-4, _state);
    5450           0 :     *bothtails = 2*ae_minreal(*lefttail, *righttail, _state);
    5451           0 :     ae_frame_leave(_state);
    5452             : }
    5453             : 
    5454             : 
    5455             : /*************************************************************************
    5456             : Sequential Chebyshev interpolation.
    5457             : *************************************************************************/
    5458           0 : static void wsr_wcheb(double x,
    5459             :      double c,
    5460             :      double* tj,
    5461             :      double* tj1,
    5462             :      double* r,
    5463             :      ae_state *_state)
    5464             : {
    5465             :     double t;
    5466             : 
    5467             : 
    5468           0 :     *r = *r+c*(*tj);
    5469           0 :     t = 2*x*(*tj1)-(*tj);
    5470           0 :     *tj = *tj1;
    5471           0 :     *tj1 = t;
    5472           0 : }
    5473             : 
    5474             : 
    5475             : /*************************************************************************
    5476             : Tail(S, 5)
    5477             : *************************************************************************/
    5478           0 : static double wsr_w5(double s, ae_state *_state)
    5479             : {
    5480             :     ae_int_t w;
    5481             :     double r;
    5482             :     double result;
    5483             : 
    5484             : 
    5485           0 :     r = (double)(0);
    5486           0 :     w = ae_round(-3.708099e+00*s+7.500000e+00, _state);
    5487           0 :     if( w>=7 )
    5488             :     {
    5489           0 :         r = -6.931e-01;
    5490             :     }
    5491           0 :     if( w==6 )
    5492             :     {
    5493           0 :         r = -9.008e-01;
    5494             :     }
    5495           0 :     if( w==5 )
    5496             :     {
    5497           0 :         r = -1.163e+00;
    5498             :     }
    5499           0 :     if( w==4 )
    5500             :     {
    5501           0 :         r = -1.520e+00;
    5502             :     }
    5503           0 :     if( w==3 )
    5504             :     {
    5505           0 :         r = -1.856e+00;
    5506             :     }
    5507           0 :     if( w==2 )
    5508             :     {
    5509           0 :         r = -2.367e+00;
    5510             :     }
    5511           0 :     if( w==1 )
    5512             :     {
    5513           0 :         r = -2.773e+00;
    5514             :     }
    5515           0 :     if( w<=0 )
    5516             :     {
    5517           0 :         r = -3.466e+00;
    5518             :     }
    5519           0 :     result = r;
    5520           0 :     return result;
    5521             : }
    5522             : 
    5523             : 
    5524             : /*************************************************************************
    5525             : Tail(S, 6)
    5526             : *************************************************************************/
    5527           0 : static double wsr_w6(double s, ae_state *_state)
    5528             : {
    5529             :     ae_int_t w;
    5530             :     double r;
    5531             :     double result;
    5532             : 
    5533             : 
    5534           0 :     r = (double)(0);
    5535           0 :     w = ae_round(-4.769696e+00*s+1.050000e+01, _state);
    5536           0 :     if( w>=10 )
    5537             :     {
    5538           0 :         r = -6.931e-01;
    5539             :     }
    5540           0 :     if( w==9 )
    5541             :     {
    5542           0 :         r = -8.630e-01;
    5543             :     }
    5544           0 :     if( w==8 )
    5545             :     {
    5546           0 :         r = -1.068e+00;
    5547             :     }
    5548           0 :     if( w==7 )
    5549             :     {
    5550           0 :         r = -1.269e+00;
    5551             :     }
    5552           0 :     if( w==6 )
    5553             :     {
    5554           0 :         r = -1.520e+00;
    5555             :     }
    5556           0 :     if( w==5 )
    5557             :     {
    5558           0 :         r = -1.856e+00;
    5559             :     }
    5560           0 :     if( w==4 )
    5561             :     {
    5562           0 :         r = -2.213e+00;
    5563             :     }
    5564           0 :     if( w==3 )
    5565             :     {
    5566           0 :         r = -2.549e+00;
    5567             :     }
    5568           0 :     if( w==2 )
    5569             :     {
    5570           0 :         r = -3.060e+00;
    5571             :     }
    5572           0 :     if( w==1 )
    5573             :     {
    5574           0 :         r = -3.466e+00;
    5575             :     }
    5576           0 :     if( w<=0 )
    5577             :     {
    5578           0 :         r = -4.159e+00;
    5579             :     }
    5580           0 :     result = r;
    5581           0 :     return result;
    5582             : }
    5583             : 
    5584             : 
    5585             : /*************************************************************************
    5586             : Tail(S, 7)
    5587             : *************************************************************************/
    5588           0 : static double wsr_w7(double s, ae_state *_state)
    5589             : {
    5590             :     ae_int_t w;
    5591             :     double r;
    5592             :     double result;
    5593             : 
    5594             : 
    5595           0 :     r = (double)(0);
    5596           0 :     w = ae_round(-5.916080e+00*s+1.400000e+01, _state);
    5597           0 :     if( w>=14 )
    5598             :     {
    5599           0 :         r = -6.325e-01;
    5600             :     }
    5601           0 :     if( w==13 )
    5602             :     {
    5603           0 :         r = -7.577e-01;
    5604             :     }
    5605           0 :     if( w==12 )
    5606             :     {
    5607           0 :         r = -9.008e-01;
    5608             :     }
    5609           0 :     if( w==11 )
    5610             :     {
    5611           0 :         r = -1.068e+00;
    5612             :     }
    5613           0 :     if( w==10 )
    5614             :     {
    5615           0 :         r = -1.241e+00;
    5616             :     }
    5617           0 :     if( w==9 )
    5618             :     {
    5619           0 :         r = -1.451e+00;
    5620             :     }
    5621           0 :     if( w==8 )
    5622             :     {
    5623           0 :         r = -1.674e+00;
    5624             :     }
    5625           0 :     if( w==7 )
    5626             :     {
    5627           0 :         r = -1.908e+00;
    5628             :     }
    5629           0 :     if( w==6 )
    5630             :     {
    5631           0 :         r = -2.213e+00;
    5632             :     }
    5633           0 :     if( w==5 )
    5634             :     {
    5635           0 :         r = -2.549e+00;
    5636             :     }
    5637           0 :     if( w==4 )
    5638             :     {
    5639           0 :         r = -2.906e+00;
    5640             :     }
    5641           0 :     if( w==3 )
    5642             :     {
    5643           0 :         r = -3.243e+00;
    5644             :     }
    5645           0 :     if( w==2 )
    5646             :     {
    5647           0 :         r = -3.753e+00;
    5648             :     }
    5649           0 :     if( w==1 )
    5650             :     {
    5651           0 :         r = -4.159e+00;
    5652             :     }
    5653           0 :     if( w<=0 )
    5654             :     {
    5655           0 :         r = -4.852e+00;
    5656             :     }
    5657           0 :     result = r;
    5658           0 :     return result;
    5659             : }
    5660             : 
    5661             : 
    5662             : /*************************************************************************
    5663             : Tail(S, 8)
    5664             : *************************************************************************/
    5665           0 : static double wsr_w8(double s, ae_state *_state)
    5666             : {
    5667             :     ae_int_t w;
    5668             :     double r;
    5669             :     double result;
    5670             : 
    5671             : 
    5672           0 :     r = (double)(0);
    5673           0 :     w = ae_round(-7.141428e+00*s+1.800000e+01, _state);
    5674           0 :     if( w>=18 )
    5675             :     {
    5676           0 :         r = -6.399e-01;
    5677             :     }
    5678           0 :     if( w==17 )
    5679             :     {
    5680           0 :         r = -7.494e-01;
    5681             :     }
    5682           0 :     if( w==16 )
    5683             :     {
    5684           0 :         r = -8.630e-01;
    5685             :     }
    5686           0 :     if( w==15 )
    5687             :     {
    5688           0 :         r = -9.913e-01;
    5689             :     }
    5690           0 :     if( w==14 )
    5691             :     {
    5692           0 :         r = -1.138e+00;
    5693             :     }
    5694           0 :     if( w==13 )
    5695             :     {
    5696           0 :         r = -1.297e+00;
    5697             :     }
    5698           0 :     if( w==12 )
    5699             :     {
    5700           0 :         r = -1.468e+00;
    5701             :     }
    5702           0 :     if( w==11 )
    5703             :     {
    5704           0 :         r = -1.653e+00;
    5705             :     }
    5706           0 :     if( w==10 )
    5707             :     {
    5708           0 :         r = -1.856e+00;
    5709             :     }
    5710           0 :     if( w==9 )
    5711             :     {
    5712           0 :         r = -2.079e+00;
    5713             :     }
    5714           0 :     if( w==8 )
    5715             :     {
    5716           0 :         r = -2.326e+00;
    5717             :     }
    5718           0 :     if( w==7 )
    5719             :     {
    5720           0 :         r = -2.601e+00;
    5721             :     }
    5722           0 :     if( w==6 )
    5723             :     {
    5724           0 :         r = -2.906e+00;
    5725             :     }
    5726           0 :     if( w==5 )
    5727             :     {
    5728           0 :         r = -3.243e+00;
    5729             :     }
    5730           0 :     if( w==4 )
    5731             :     {
    5732           0 :         r = -3.599e+00;
    5733             :     }
    5734           0 :     if( w==3 )
    5735             :     {
    5736           0 :         r = -3.936e+00;
    5737             :     }
    5738           0 :     if( w==2 )
    5739             :     {
    5740           0 :         r = -4.447e+00;
    5741             :     }
    5742           0 :     if( w==1 )
    5743             :     {
    5744           0 :         r = -4.852e+00;
    5745             :     }
    5746           0 :     if( w<=0 )
    5747             :     {
    5748           0 :         r = -5.545e+00;
    5749             :     }
    5750           0 :     result = r;
    5751           0 :     return result;
    5752             : }
    5753             : 
    5754             : 
    5755             : /*************************************************************************
    5756             : Tail(S, 9)
    5757             : *************************************************************************/
    5758           0 : static double wsr_w9(double s, ae_state *_state)
    5759             : {
    5760             :     ae_int_t w;
    5761             :     double r;
    5762             :     double result;
    5763             : 
    5764             : 
    5765           0 :     r = (double)(0);
    5766           0 :     w = ae_round(-8.440972e+00*s+2.250000e+01, _state);
    5767           0 :     if( w>=22 )
    5768             :     {
    5769           0 :         r = -6.931e-01;
    5770             :     }
    5771           0 :     if( w==21 )
    5772             :     {
    5773           0 :         r = -7.873e-01;
    5774             :     }
    5775           0 :     if( w==20 )
    5776             :     {
    5777           0 :         r = -8.912e-01;
    5778             :     }
    5779           0 :     if( w==19 )
    5780             :     {
    5781           0 :         r = -1.002e+00;
    5782             :     }
    5783           0 :     if( w==18 )
    5784             :     {
    5785           0 :         r = -1.120e+00;
    5786             :     }
    5787           0 :     if( w==17 )
    5788             :     {
    5789           0 :         r = -1.255e+00;
    5790             :     }
    5791           0 :     if( w==16 )
    5792             :     {
    5793           0 :         r = -1.394e+00;
    5794             :     }
    5795           0 :     if( w==15 )
    5796             :     {
    5797           0 :         r = -1.547e+00;
    5798             :     }
    5799           0 :     if( w==14 )
    5800             :     {
    5801           0 :         r = -1.717e+00;
    5802             :     }
    5803           0 :     if( w==13 )
    5804             :     {
    5805           0 :         r = -1.895e+00;
    5806             :     }
    5807           0 :     if( w==12 )
    5808             :     {
    5809           0 :         r = -2.079e+00;
    5810             :     }
    5811           0 :     if( w==11 )
    5812             :     {
    5813           0 :         r = -2.287e+00;
    5814             :     }
    5815           0 :     if( w==10 )
    5816             :     {
    5817           0 :         r = -2.501e+00;
    5818             :     }
    5819           0 :     if( w==9 )
    5820             :     {
    5821           0 :         r = -2.742e+00;
    5822             :     }
    5823           0 :     if( w==8 )
    5824             :     {
    5825           0 :         r = -3.019e+00;
    5826             :     }
    5827           0 :     if( w==7 )
    5828             :     {
    5829           0 :         r = -3.294e+00;
    5830             :     }
    5831           0 :     if( w==6 )
    5832             :     {
    5833           0 :         r = -3.599e+00;
    5834             :     }
    5835           0 :     if( w==5 )
    5836             :     {
    5837           0 :         r = -3.936e+00;
    5838             :     }
    5839           0 :     if( w==4 )
    5840             :     {
    5841           0 :         r = -4.292e+00;
    5842             :     }
    5843           0 :     if( w==3 )
    5844             :     {
    5845           0 :         r = -4.629e+00;
    5846             :     }
    5847           0 :     if( w==2 )
    5848             :     {
    5849           0 :         r = -5.140e+00;
    5850             :     }
    5851           0 :     if( w==1 )
    5852             :     {
    5853           0 :         r = -5.545e+00;
    5854             :     }
    5855           0 :     if( w<=0 )
    5856             :     {
    5857           0 :         r = -6.238e+00;
    5858             :     }
    5859           0 :     result = r;
    5860           0 :     return result;
    5861             : }
    5862             : 
    5863             : 
    5864             : /*************************************************************************
    5865             : Tail(S, 10)
    5866             : *************************************************************************/
    5867           0 : static double wsr_w10(double s, ae_state *_state)
    5868             : {
    5869             :     ae_int_t w;
    5870             :     double r;
    5871             :     double result;
    5872             : 
    5873             : 
    5874           0 :     r = (double)(0);
    5875           0 :     w = ae_round(-9.810708e+00*s+2.750000e+01, _state);
    5876           0 :     if( w>=27 )
    5877             :     {
    5878           0 :         r = -6.931e-01;
    5879             :     }
    5880           0 :     if( w==26 )
    5881             :     {
    5882           0 :         r = -7.745e-01;
    5883             :     }
    5884           0 :     if( w==25 )
    5885             :     {
    5886           0 :         r = -8.607e-01;
    5887             :     }
    5888           0 :     if( w==24 )
    5889             :     {
    5890           0 :         r = -9.551e-01;
    5891             :     }
    5892           0 :     if( w==23 )
    5893             :     {
    5894           0 :         r = -1.057e+00;
    5895             :     }
    5896           0 :     if( w==22 )
    5897             :     {
    5898           0 :         r = -1.163e+00;
    5899             :     }
    5900           0 :     if( w==21 )
    5901             :     {
    5902           0 :         r = -1.279e+00;
    5903             :     }
    5904           0 :     if( w==20 )
    5905             :     {
    5906           0 :         r = -1.402e+00;
    5907             :     }
    5908           0 :     if( w==19 )
    5909             :     {
    5910           0 :         r = -1.533e+00;
    5911             :     }
    5912           0 :     if( w==18 )
    5913             :     {
    5914           0 :         r = -1.674e+00;
    5915             :     }
    5916           0 :     if( w==17 )
    5917             :     {
    5918           0 :         r = -1.826e+00;
    5919             :     }
    5920           0 :     if( w==16 )
    5921             :     {
    5922           0 :         r = -1.983e+00;
    5923             :     }
    5924           0 :     if( w==15 )
    5925             :     {
    5926           0 :         r = -2.152e+00;
    5927             :     }
    5928           0 :     if( w==14 )
    5929             :     {
    5930           0 :         r = -2.336e+00;
    5931             :     }
    5932           0 :     if( w==13 )
    5933             :     {
    5934           0 :         r = -2.525e+00;
    5935             :     }
    5936           0 :     if( w==12 )
    5937             :     {
    5938           0 :         r = -2.727e+00;
    5939             :     }
    5940           0 :     if( w==11 )
    5941             :     {
    5942           0 :         r = -2.942e+00;
    5943             :     }
    5944           0 :     if( w==10 )
    5945             :     {
    5946           0 :         r = -3.170e+00;
    5947             :     }
    5948           0 :     if( w==9 )
    5949             :     {
    5950           0 :         r = -3.435e+00;
    5951             :     }
    5952           0 :     if( w==8 )
    5953             :     {
    5954           0 :         r = -3.713e+00;
    5955             :     }
    5956           0 :     if( w==7 )
    5957             :     {
    5958           0 :         r = -3.987e+00;
    5959             :     }
    5960           0 :     if( w==6 )
    5961             :     {
    5962           0 :         r = -4.292e+00;
    5963             :     }
    5964           0 :     if( w==5 )
    5965             :     {
    5966           0 :         r = -4.629e+00;
    5967             :     }
    5968           0 :     if( w==4 )
    5969             :     {
    5970           0 :         r = -4.986e+00;
    5971             :     }
    5972           0 :     if( w==3 )
    5973             :     {
    5974           0 :         r = -5.322e+00;
    5975             :     }
    5976           0 :     if( w==2 )
    5977             :     {
    5978           0 :         r = -5.833e+00;
    5979             :     }
    5980           0 :     if( w==1 )
    5981             :     {
    5982           0 :         r = -6.238e+00;
    5983             :     }
    5984           0 :     if( w<=0 )
    5985             :     {
    5986           0 :         r = -6.931e+00;
    5987             :     }
    5988           0 :     result = r;
    5989           0 :     return result;
    5990             : }
    5991             : 
    5992             : 
    5993             : /*************************************************************************
    5994             : Tail(S, 11)
    5995             : *************************************************************************/
    5996           0 : static double wsr_w11(double s, ae_state *_state)
    5997             : {
    5998             :     ae_int_t w;
    5999             :     double r;
    6000             :     double result;
    6001             : 
    6002             : 
    6003           0 :     r = (double)(0);
    6004           0 :     w = ae_round(-1.124722e+01*s+3.300000e+01, _state);
    6005           0 :     if( w>=33 )
    6006             :     {
    6007           0 :         r = -6.595e-01;
    6008             :     }
    6009           0 :     if( w==32 )
    6010             :     {
    6011           0 :         r = -7.279e-01;
    6012             :     }
    6013           0 :     if( w==31 )
    6014             :     {
    6015           0 :         r = -8.002e-01;
    6016             :     }
    6017           0 :     if( w==30 )
    6018             :     {
    6019           0 :         r = -8.782e-01;
    6020             :     }
    6021           0 :     if( w==29 )
    6022             :     {
    6023           0 :         r = -9.615e-01;
    6024             :     }
    6025           0 :     if( w==28 )
    6026             :     {
    6027           0 :         r = -1.050e+00;
    6028             :     }
    6029           0 :     if( w==27 )
    6030             :     {
    6031           0 :         r = -1.143e+00;
    6032             :     }
    6033           0 :     if( w==26 )
    6034             :     {
    6035           0 :         r = -1.243e+00;
    6036             :     }
    6037           0 :     if( w==25 )
    6038             :     {
    6039           0 :         r = -1.348e+00;
    6040             :     }
    6041           0 :     if( w==24 )
    6042             :     {
    6043           0 :         r = -1.459e+00;
    6044             :     }
    6045           0 :     if( w==23 )
    6046             :     {
    6047           0 :         r = -1.577e+00;
    6048             :     }
    6049           0 :     if( w==22 )
    6050             :     {
    6051           0 :         r = -1.700e+00;
    6052             :     }
    6053           0 :     if( w==21 )
    6054             :     {
    6055           0 :         r = -1.832e+00;
    6056             :     }
    6057           0 :     if( w==20 )
    6058             :     {
    6059           0 :         r = -1.972e+00;
    6060             :     }
    6061           0 :     if( w==19 )
    6062             :     {
    6063           0 :         r = -2.119e+00;
    6064             :     }
    6065           0 :     if( w==18 )
    6066             :     {
    6067           0 :         r = -2.273e+00;
    6068             :     }
    6069           0 :     if( w==17 )
    6070             :     {
    6071           0 :         r = -2.437e+00;
    6072             :     }
    6073           0 :     if( w==16 )
    6074             :     {
    6075           0 :         r = -2.607e+00;
    6076             :     }
    6077           0 :     if( w==15 )
    6078             :     {
    6079           0 :         r = -2.788e+00;
    6080             :     }
    6081           0 :     if( w==14 )
    6082             :     {
    6083           0 :         r = -2.980e+00;
    6084             :     }
    6085           0 :     if( w==13 )
    6086             :     {
    6087           0 :         r = -3.182e+00;
    6088             :     }
    6089           0 :     if( w==12 )
    6090             :     {
    6091           0 :         r = -3.391e+00;
    6092             :     }
    6093           0 :     if( w==11 )
    6094             :     {
    6095           0 :         r = -3.617e+00;
    6096             :     }
    6097           0 :     if( w==10 )
    6098             :     {
    6099           0 :         r = -3.863e+00;
    6100             :     }
    6101           0 :     if( w==9 )
    6102             :     {
    6103           0 :         r = -4.128e+00;
    6104             :     }
    6105           0 :     if( w==8 )
    6106             :     {
    6107           0 :         r = -4.406e+00;
    6108             :     }
    6109           0 :     if( w==7 )
    6110             :     {
    6111           0 :         r = -4.680e+00;
    6112             :     }
    6113           0 :     if( w==6 )
    6114             :     {
    6115           0 :         r = -4.986e+00;
    6116             :     }
    6117           0 :     if( w==5 )
    6118             :     {
    6119           0 :         r = -5.322e+00;
    6120             :     }
    6121           0 :     if( w==4 )
    6122             :     {
    6123           0 :         r = -5.679e+00;
    6124             :     }
    6125           0 :     if( w==3 )
    6126             :     {
    6127           0 :         r = -6.015e+00;
    6128             :     }
    6129           0 :     if( w==2 )
    6130             :     {
    6131           0 :         r = -6.526e+00;
    6132             :     }
    6133           0 :     if( w==1 )
    6134             :     {
    6135           0 :         r = -6.931e+00;
    6136             :     }
    6137           0 :     if( w<=0 )
    6138             :     {
    6139           0 :         r = -7.625e+00;
    6140             :     }
    6141           0 :     result = r;
    6142           0 :     return result;
    6143             : }
    6144             : 
    6145             : 
    6146             : /*************************************************************************
    6147             : Tail(S, 12)
    6148             : *************************************************************************/
    6149           0 : static double wsr_w12(double s, ae_state *_state)
    6150             : {
    6151             :     ae_int_t w;
    6152             :     double r;
    6153             :     double result;
    6154             : 
    6155             : 
    6156           0 :     r = (double)(0);
    6157           0 :     w = ae_round(-1.274755e+01*s+3.900000e+01, _state);
    6158           0 :     if( w>=39 )
    6159             :     {
    6160           0 :         r = -6.633e-01;
    6161             :     }
    6162           0 :     if( w==38 )
    6163             :     {
    6164           0 :         r = -7.239e-01;
    6165             :     }
    6166           0 :     if( w==37 )
    6167             :     {
    6168           0 :         r = -7.878e-01;
    6169             :     }
    6170           0 :     if( w==36 )
    6171             :     {
    6172           0 :         r = -8.556e-01;
    6173             :     }
    6174           0 :     if( w==35 )
    6175             :     {
    6176           0 :         r = -9.276e-01;
    6177             :     }
    6178           0 :     if( w==34 )
    6179             :     {
    6180           0 :         r = -1.003e+00;
    6181             :     }
    6182           0 :     if( w==33 )
    6183             :     {
    6184           0 :         r = -1.083e+00;
    6185             :     }
    6186           0 :     if( w==32 )
    6187             :     {
    6188           0 :         r = -1.168e+00;
    6189             :     }
    6190           0 :     if( w==31 )
    6191             :     {
    6192           0 :         r = -1.256e+00;
    6193             :     }
    6194           0 :     if( w==30 )
    6195             :     {
    6196           0 :         r = -1.350e+00;
    6197             :     }
    6198           0 :     if( w==29 )
    6199             :     {
    6200           0 :         r = -1.449e+00;
    6201             :     }
    6202           0 :     if( w==28 )
    6203             :     {
    6204           0 :         r = -1.552e+00;
    6205             :     }
    6206           0 :     if( w==27 )
    6207             :     {
    6208           0 :         r = -1.660e+00;
    6209             :     }
    6210           0 :     if( w==26 )
    6211             :     {
    6212           0 :         r = -1.774e+00;
    6213             :     }
    6214           0 :     if( w==25 )
    6215             :     {
    6216           0 :         r = -1.893e+00;
    6217             :     }
    6218           0 :     if( w==24 )
    6219             :     {
    6220           0 :         r = -2.017e+00;
    6221             :     }
    6222           0 :     if( w==23 )
    6223             :     {
    6224           0 :         r = -2.148e+00;
    6225             :     }
    6226           0 :     if( w==22 )
    6227             :     {
    6228           0 :         r = -2.285e+00;
    6229             :     }
    6230           0 :     if( w==21 )
    6231             :     {
    6232           0 :         r = -2.429e+00;
    6233             :     }
    6234           0 :     if( w==20 )
    6235             :     {
    6236           0 :         r = -2.581e+00;
    6237             :     }
    6238           0 :     if( w==19 )
    6239             :     {
    6240           0 :         r = -2.738e+00;
    6241             :     }
    6242           0 :     if( w==18 )
    6243             :     {
    6244           0 :         r = -2.902e+00;
    6245             :     }
    6246           0 :     if( w==17 )
    6247             :     {
    6248           0 :         r = -3.076e+00;
    6249             :     }
    6250           0 :     if( w==16 )
    6251             :     {
    6252           0 :         r = -3.255e+00;
    6253             :     }
    6254           0 :     if( w==15 )
    6255             :     {
    6256           0 :         r = -3.443e+00;
    6257             :     }
    6258           0 :     if( w==14 )
    6259             :     {
    6260           0 :         r = -3.645e+00;
    6261             :     }
    6262           0 :     if( w==13 )
    6263             :     {
    6264           0 :         r = -3.852e+00;
    6265             :     }
    6266           0 :     if( w==12 )
    6267             :     {
    6268           0 :         r = -4.069e+00;
    6269             :     }
    6270           0 :     if( w==11 )
    6271             :     {
    6272           0 :         r = -4.310e+00;
    6273             :     }
    6274           0 :     if( w==10 )
    6275             :     {
    6276           0 :         r = -4.557e+00;
    6277             :     }
    6278           0 :     if( w==9 )
    6279             :     {
    6280           0 :         r = -4.821e+00;
    6281             :     }
    6282           0 :     if( w==8 )
    6283             :     {
    6284           0 :         r = -5.099e+00;
    6285             :     }
    6286           0 :     if( w==7 )
    6287             :     {
    6288           0 :         r = -5.373e+00;
    6289             :     }
    6290           0 :     if( w==6 )
    6291             :     {
    6292           0 :         r = -5.679e+00;
    6293             :     }
    6294           0 :     if( w==5 )
    6295             :     {
    6296           0 :         r = -6.015e+00;
    6297             :     }
    6298           0 :     if( w==4 )
    6299             :     {
    6300           0 :         r = -6.372e+00;
    6301             :     }
    6302           0 :     if( w==3 )
    6303             :     {
    6304           0 :         r = -6.708e+00;
    6305             :     }
    6306           0 :     if( w==2 )
    6307             :     {
    6308           0 :         r = -7.219e+00;
    6309             :     }
    6310           0 :     if( w==1 )
    6311             :     {
    6312           0 :         r = -7.625e+00;
    6313             :     }
    6314           0 :     if( w<=0 )
    6315             :     {
    6316           0 :         r = -8.318e+00;
    6317             :     }
    6318           0 :     result = r;
    6319           0 :     return result;
    6320             : }
    6321             : 
    6322             : 
    6323             : /*************************************************************************
    6324             : Tail(S, 13)
    6325             : *************************************************************************/
    6326           0 : static double wsr_w13(double s, ae_state *_state)
    6327             : {
    6328             :     ae_int_t w;
    6329             :     double r;
    6330             :     double result;
    6331             : 
    6332             : 
    6333           0 :     r = (double)(0);
    6334           0 :     w = ae_round(-1.430909e+01*s+4.550000e+01, _state);
    6335           0 :     if( w>=45 )
    6336             :     {
    6337           0 :         r = -6.931e-01;
    6338             :     }
    6339           0 :     if( w==44 )
    6340             :     {
    6341           0 :         r = -7.486e-01;
    6342             :     }
    6343           0 :     if( w==43 )
    6344             :     {
    6345           0 :         r = -8.068e-01;
    6346             :     }
    6347           0 :     if( w==42 )
    6348             :     {
    6349           0 :         r = -8.683e-01;
    6350             :     }
    6351           0 :     if( w==41 )
    6352             :     {
    6353           0 :         r = -9.328e-01;
    6354             :     }
    6355           0 :     if( w==40 )
    6356             :     {
    6357           0 :         r = -1.001e+00;
    6358             :     }
    6359           0 :     if( w==39 )
    6360             :     {
    6361           0 :         r = -1.072e+00;
    6362             :     }
    6363           0 :     if( w==38 )
    6364             :     {
    6365           0 :         r = -1.146e+00;
    6366             :     }
    6367           0 :     if( w==37 )
    6368             :     {
    6369           0 :         r = -1.224e+00;
    6370             :     }
    6371           0 :     if( w==36 )
    6372             :     {
    6373           0 :         r = -1.306e+00;
    6374             :     }
    6375           0 :     if( w==35 )
    6376             :     {
    6377           0 :         r = -1.392e+00;
    6378             :     }
    6379           0 :     if( w==34 )
    6380             :     {
    6381           0 :         r = -1.481e+00;
    6382             :     }
    6383           0 :     if( w==33 )
    6384             :     {
    6385           0 :         r = -1.574e+00;
    6386             :     }
    6387           0 :     if( w==32 )
    6388             :     {
    6389           0 :         r = -1.672e+00;
    6390             :     }
    6391           0 :     if( w==31 )
    6392             :     {
    6393           0 :         r = -1.773e+00;
    6394             :     }
    6395           0 :     if( w==30 )
    6396             :     {
    6397           0 :         r = -1.879e+00;
    6398             :     }
    6399           0 :     if( w==29 )
    6400             :     {
    6401           0 :         r = -1.990e+00;
    6402             :     }
    6403           0 :     if( w==28 )
    6404             :     {
    6405           0 :         r = -2.104e+00;
    6406             :     }
    6407           0 :     if( w==27 )
    6408             :     {
    6409           0 :         r = -2.224e+00;
    6410             :     }
    6411           0 :     if( w==26 )
    6412             :     {
    6413           0 :         r = -2.349e+00;
    6414             :     }
    6415           0 :     if( w==25 )
    6416             :     {
    6417           0 :         r = -2.479e+00;
    6418             :     }
    6419           0 :     if( w==24 )
    6420             :     {
    6421           0 :         r = -2.614e+00;
    6422             :     }
    6423           0 :     if( w==23 )
    6424             :     {
    6425           0 :         r = -2.755e+00;
    6426             :     }
    6427           0 :     if( w==22 )
    6428             :     {
    6429           0 :         r = -2.902e+00;
    6430             :     }
    6431           0 :     if( w==21 )
    6432             :     {
    6433           0 :         r = -3.055e+00;
    6434             :     }
    6435           0 :     if( w==20 )
    6436             :     {
    6437           0 :         r = -3.215e+00;
    6438             :     }
    6439           0 :     if( w==19 )
    6440             :     {
    6441           0 :         r = -3.380e+00;
    6442             :     }
    6443           0 :     if( w==18 )
    6444             :     {
    6445           0 :         r = -3.551e+00;
    6446             :     }
    6447           0 :     if( w==17 )
    6448             :     {
    6449           0 :         r = -3.733e+00;
    6450             :     }
    6451           0 :     if( w==16 )
    6452             :     {
    6453           0 :         r = -3.917e+00;
    6454             :     }
    6455           0 :     if( w==15 )
    6456             :     {
    6457           0 :         r = -4.113e+00;
    6458             :     }
    6459           0 :     if( w==14 )
    6460             :     {
    6461           0 :         r = -4.320e+00;
    6462             :     }
    6463           0 :     if( w==13 )
    6464             :     {
    6465           0 :         r = -4.534e+00;
    6466             :     }
    6467           0 :     if( w==12 )
    6468             :     {
    6469           0 :         r = -4.762e+00;
    6470             :     }
    6471           0 :     if( w==11 )
    6472             :     {
    6473           0 :         r = -5.004e+00;
    6474             :     }
    6475           0 :     if( w==10 )
    6476             :     {
    6477           0 :         r = -5.250e+00;
    6478             :     }
    6479           0 :     if( w==9 )
    6480             :     {
    6481           0 :         r = -5.514e+00;
    6482             :     }
    6483           0 :     if( w==8 )
    6484             :     {
    6485           0 :         r = -5.792e+00;
    6486             :     }
    6487           0 :     if( w==7 )
    6488             :     {
    6489           0 :         r = -6.066e+00;
    6490             :     }
    6491           0 :     if( w==6 )
    6492             :     {
    6493           0 :         r = -6.372e+00;
    6494             :     }
    6495           0 :     if( w==5 )
    6496             :     {
    6497           0 :         r = -6.708e+00;
    6498             :     }
    6499           0 :     if( w==4 )
    6500             :     {
    6501           0 :         r = -7.065e+00;
    6502             :     }
    6503           0 :     if( w==3 )
    6504             :     {
    6505           0 :         r = -7.401e+00;
    6506             :     }
    6507           0 :     if( w==2 )
    6508             :     {
    6509           0 :         r = -7.912e+00;
    6510             :     }
    6511           0 :     if( w==1 )
    6512             :     {
    6513           0 :         r = -8.318e+00;
    6514             :     }
    6515           0 :     if( w<=0 )
    6516             :     {
    6517           0 :         r = -9.011e+00;
    6518             :     }
    6519           0 :     result = r;
    6520           0 :     return result;
    6521             : }
    6522             : 
    6523             : 
    6524             : /*************************************************************************
    6525             : Tail(S, 14)
    6526             : *************************************************************************/
    6527           0 : static double wsr_w14(double s, ae_state *_state)
    6528             : {
    6529             :     ae_int_t w;
    6530             :     double r;
    6531             :     double result;
    6532             : 
    6533             : 
    6534           0 :     r = (double)(0);
    6535           0 :     w = ae_round(-1.592953e+01*s+5.250000e+01, _state);
    6536           0 :     if( w>=52 )
    6537             :     {
    6538           0 :         r = -6.931e-01;
    6539             :     }
    6540           0 :     if( w==51 )
    6541             :     {
    6542           0 :         r = -7.428e-01;
    6543             :     }
    6544           0 :     if( w==50 )
    6545             :     {
    6546           0 :         r = -7.950e-01;
    6547             :     }
    6548           0 :     if( w==49 )
    6549             :     {
    6550           0 :         r = -8.495e-01;
    6551             :     }
    6552           0 :     if( w==48 )
    6553             :     {
    6554           0 :         r = -9.067e-01;
    6555             :     }
    6556           0 :     if( w==47 )
    6557             :     {
    6558           0 :         r = -9.664e-01;
    6559             :     }
    6560           0 :     if( w==46 )
    6561             :     {
    6562           0 :         r = -1.029e+00;
    6563             :     }
    6564           0 :     if( w==45 )
    6565             :     {
    6566           0 :         r = -1.094e+00;
    6567             :     }
    6568           0 :     if( w==44 )
    6569             :     {
    6570           0 :         r = -1.162e+00;
    6571             :     }
    6572           0 :     if( w==43 )
    6573             :     {
    6574           0 :         r = -1.233e+00;
    6575             :     }
    6576           0 :     if( w==42 )
    6577             :     {
    6578           0 :         r = -1.306e+00;
    6579             :     }
    6580           0 :     if( w==41 )
    6581             :     {
    6582           0 :         r = -1.383e+00;
    6583             :     }
    6584           0 :     if( w==40 )
    6585             :     {
    6586           0 :         r = -1.463e+00;
    6587             :     }
    6588           0 :     if( w==39 )
    6589             :     {
    6590           0 :         r = -1.546e+00;
    6591             :     }
    6592           0 :     if( w==38 )
    6593             :     {
    6594           0 :         r = -1.632e+00;
    6595             :     }
    6596           0 :     if( w==37 )
    6597             :     {
    6598           0 :         r = -1.722e+00;
    6599             :     }
    6600           0 :     if( w==36 )
    6601             :     {
    6602           0 :         r = -1.815e+00;
    6603             :     }
    6604           0 :     if( w==35 )
    6605             :     {
    6606           0 :         r = -1.911e+00;
    6607             :     }
    6608           0 :     if( w==34 )
    6609             :     {
    6610           0 :         r = -2.011e+00;
    6611             :     }
    6612           0 :     if( w==33 )
    6613             :     {
    6614           0 :         r = -2.115e+00;
    6615             :     }
    6616           0 :     if( w==32 )
    6617             :     {
    6618           0 :         r = -2.223e+00;
    6619             :     }
    6620           0 :     if( w==31 )
    6621             :     {
    6622           0 :         r = -2.334e+00;
    6623             :     }
    6624           0 :     if( w==30 )
    6625             :     {
    6626           0 :         r = -2.450e+00;
    6627             :     }
    6628           0 :     if( w==29 )
    6629             :     {
    6630           0 :         r = -2.570e+00;
    6631             :     }
    6632           0 :     if( w==28 )
    6633             :     {
    6634           0 :         r = -2.694e+00;
    6635             :     }
    6636           0 :     if( w==27 )
    6637             :     {
    6638           0 :         r = -2.823e+00;
    6639             :     }
    6640           0 :     if( w==26 )
    6641             :     {
    6642           0 :         r = -2.956e+00;
    6643             :     }
    6644           0 :     if( w==25 )
    6645             :     {
    6646           0 :         r = -3.095e+00;
    6647             :     }
    6648           0 :     if( w==24 )
    6649             :     {
    6650           0 :         r = -3.238e+00;
    6651             :     }
    6652           0 :     if( w==23 )
    6653             :     {
    6654           0 :         r = -3.387e+00;
    6655             :     }
    6656           0 :     if( w==22 )
    6657             :     {
    6658           0 :         r = -3.541e+00;
    6659             :     }
    6660           0 :     if( w==21 )
    6661             :     {
    6662           0 :         r = -3.700e+00;
    6663             :     }
    6664           0 :     if( w==20 )
    6665             :     {
    6666           0 :         r = -3.866e+00;
    6667             :     }
    6668           0 :     if( w==19 )
    6669             :     {
    6670           0 :         r = -4.038e+00;
    6671             :     }
    6672           0 :     if( w==18 )
    6673             :     {
    6674           0 :         r = -4.215e+00;
    6675             :     }
    6676           0 :     if( w==17 )
    6677             :     {
    6678           0 :         r = -4.401e+00;
    6679             :     }
    6680           0 :     if( w==16 )
    6681             :     {
    6682           0 :         r = -4.592e+00;
    6683             :     }
    6684           0 :     if( w==15 )
    6685             :     {
    6686           0 :         r = -4.791e+00;
    6687             :     }
    6688           0 :     if( w==14 )
    6689             :     {
    6690           0 :         r = -5.004e+00;
    6691             :     }
    6692           0 :     if( w==13 )
    6693             :     {
    6694           0 :         r = -5.227e+00;
    6695             :     }
    6696           0 :     if( w==12 )
    6697             :     {
    6698           0 :         r = -5.456e+00;
    6699             :     }
    6700           0 :     if( w==11 )
    6701             :     {
    6702           0 :         r = -5.697e+00;
    6703             :     }
    6704           0 :     if( w==10 )
    6705             :     {
    6706           0 :         r = -5.943e+00;
    6707             :     }
    6708           0 :     if( w==9 )
    6709             :     {
    6710           0 :         r = -6.208e+00;
    6711             :     }
    6712           0 :     if( w==8 )
    6713             :     {
    6714           0 :         r = -6.485e+00;
    6715             :     }
    6716           0 :     if( w==7 )
    6717             :     {
    6718           0 :         r = -6.760e+00;
    6719             :     }
    6720           0 :     if( w==6 )
    6721             :     {
    6722           0 :         r = -7.065e+00;
    6723             :     }
    6724           0 :     if( w==5 )
    6725             :     {
    6726           0 :         r = -7.401e+00;
    6727             :     }
    6728           0 :     if( w==4 )
    6729             :     {
    6730           0 :         r = -7.758e+00;
    6731             :     }
    6732           0 :     if( w==3 )
    6733             :     {
    6734           0 :         r = -8.095e+00;
    6735             :     }
    6736           0 :     if( w==2 )
    6737             :     {
    6738           0 :         r = -8.605e+00;
    6739             :     }
    6740           0 :     if( w==1 )
    6741             :     {
    6742           0 :         r = -9.011e+00;
    6743             :     }
    6744           0 :     if( w<=0 )
    6745             :     {
    6746           0 :         r = -9.704e+00;
    6747             :     }
    6748           0 :     result = r;
    6749           0 :     return result;
    6750             : }
    6751             : 
    6752             : 
    6753             : /*************************************************************************
    6754             : Tail(S, 15)
    6755             : *************************************************************************/
    6756           0 : static double wsr_w15(double s, ae_state *_state)
    6757             : {
    6758             :     ae_int_t w;
    6759             :     double r;
    6760             :     double result;
    6761             : 
    6762             : 
    6763           0 :     r = (double)(0);
    6764           0 :     w = ae_round(-1.760682e+01*s+6.000000e+01, _state);
    6765           0 :     if( w>=60 )
    6766             :     {
    6767           0 :         r = -6.714e-01;
    6768             :     }
    6769           0 :     if( w==59 )
    6770             :     {
    6771           0 :         r = -7.154e-01;
    6772             :     }
    6773           0 :     if( w==58 )
    6774             :     {
    6775           0 :         r = -7.613e-01;
    6776             :     }
    6777           0 :     if( w==57 )
    6778             :     {
    6779           0 :         r = -8.093e-01;
    6780             :     }
    6781           0 :     if( w==56 )
    6782             :     {
    6783           0 :         r = -8.593e-01;
    6784             :     }
    6785           0 :     if( w==55 )
    6786             :     {
    6787           0 :         r = -9.114e-01;
    6788             :     }
    6789           0 :     if( w==54 )
    6790             :     {
    6791           0 :         r = -9.656e-01;
    6792             :     }
    6793           0 :     if( w==53 )
    6794             :     {
    6795           0 :         r = -1.022e+00;
    6796             :     }
    6797           0 :     if( w==52 )
    6798             :     {
    6799           0 :         r = -1.081e+00;
    6800             :     }
    6801           0 :     if( w==51 )
    6802             :     {
    6803           0 :         r = -1.142e+00;
    6804             :     }
    6805           0 :     if( w==50 )
    6806             :     {
    6807           0 :         r = -1.205e+00;
    6808             :     }
    6809           0 :     if( w==49 )
    6810             :     {
    6811           0 :         r = -1.270e+00;
    6812             :     }
    6813           0 :     if( w==48 )
    6814             :     {
    6815           0 :         r = -1.339e+00;
    6816             :     }
    6817           0 :     if( w==47 )
    6818             :     {
    6819           0 :         r = -1.409e+00;
    6820             :     }
    6821           0 :     if( w==46 )
    6822             :     {
    6823           0 :         r = -1.482e+00;
    6824             :     }
    6825           0 :     if( w==45 )
    6826             :     {
    6827           0 :         r = -1.558e+00;
    6828             :     }
    6829           0 :     if( w==44 )
    6830             :     {
    6831           0 :         r = -1.636e+00;
    6832             :     }
    6833           0 :     if( w==43 )
    6834             :     {
    6835           0 :         r = -1.717e+00;
    6836             :     }
    6837           0 :     if( w==42 )
    6838             :     {
    6839           0 :         r = -1.801e+00;
    6840             :     }
    6841           0 :     if( w==41 )
    6842             :     {
    6843           0 :         r = -1.888e+00;
    6844             :     }
    6845           0 :     if( w==40 )
    6846             :     {
    6847           0 :         r = -1.977e+00;
    6848             :     }
    6849           0 :     if( w==39 )
    6850             :     {
    6851           0 :         r = -2.070e+00;
    6852             :     }
    6853           0 :     if( w==38 )
    6854             :     {
    6855           0 :         r = -2.166e+00;
    6856             :     }
    6857           0 :     if( w==37 )
    6858             :     {
    6859           0 :         r = -2.265e+00;
    6860             :     }
    6861           0 :     if( w==36 )
    6862             :     {
    6863           0 :         r = -2.366e+00;
    6864             :     }
    6865           0 :     if( w==35 )
    6866             :     {
    6867           0 :         r = -2.472e+00;
    6868             :     }
    6869           0 :     if( w==34 )
    6870             :     {
    6871           0 :         r = -2.581e+00;
    6872             :     }
    6873           0 :     if( w==33 )
    6874             :     {
    6875           0 :         r = -2.693e+00;
    6876             :     }
    6877           0 :     if( w==32 )
    6878             :     {
    6879           0 :         r = -2.809e+00;
    6880             :     }
    6881           0 :     if( w==31 )
    6882             :     {
    6883           0 :         r = -2.928e+00;
    6884             :     }
    6885           0 :     if( w==30 )
    6886             :     {
    6887           0 :         r = -3.051e+00;
    6888             :     }
    6889           0 :     if( w==29 )
    6890             :     {
    6891           0 :         r = -3.179e+00;
    6892             :     }
    6893           0 :     if( w==28 )
    6894             :     {
    6895           0 :         r = -3.310e+00;
    6896             :     }
    6897           0 :     if( w==27 )
    6898             :     {
    6899           0 :         r = -3.446e+00;
    6900             :     }
    6901           0 :     if( w==26 )
    6902             :     {
    6903           0 :         r = -3.587e+00;
    6904             :     }
    6905           0 :     if( w==25 )
    6906             :     {
    6907           0 :         r = -3.732e+00;
    6908             :     }
    6909           0 :     if( w==24 )
    6910             :     {
    6911           0 :         r = -3.881e+00;
    6912             :     }
    6913           0 :     if( w==23 )
    6914             :     {
    6915           0 :         r = -4.036e+00;
    6916             :     }
    6917           0 :     if( w==22 )
    6918             :     {
    6919           0 :         r = -4.195e+00;
    6920             :     }
    6921           0 :     if( w==21 )
    6922             :     {
    6923           0 :         r = -4.359e+00;
    6924             :     }
    6925           0 :     if( w==20 )
    6926             :     {
    6927           0 :         r = -4.531e+00;
    6928             :     }
    6929           0 :     if( w==19 )
    6930             :     {
    6931           0 :         r = -4.707e+00;
    6932             :     }
    6933           0 :     if( w==18 )
    6934             :     {
    6935           0 :         r = -4.888e+00;
    6936             :     }
    6937           0 :     if( w==17 )
    6938             :     {
    6939           0 :         r = -5.079e+00;
    6940             :     }
    6941           0 :     if( w==16 )
    6942             :     {
    6943           0 :         r = -5.273e+00;
    6944             :     }
    6945           0 :     if( w==15 )
    6946             :     {
    6947           0 :         r = -5.477e+00;
    6948             :     }
    6949           0 :     if( w==14 )
    6950             :     {
    6951           0 :         r = -5.697e+00;
    6952             :     }
    6953           0 :     if( w==13 )
    6954             :     {
    6955           0 :         r = -5.920e+00;
    6956             :     }
    6957           0 :     if( w==12 )
    6958             :     {
    6959           0 :         r = -6.149e+00;
    6960             :     }
    6961           0 :     if( w==11 )
    6962             :     {
    6963           0 :         r = -6.390e+00;
    6964             :     }
    6965           0 :     if( w==10 )
    6966             :     {
    6967           0 :         r = -6.636e+00;
    6968             :     }
    6969           0 :     if( w==9 )
    6970             :     {
    6971           0 :         r = -6.901e+00;
    6972             :     }
    6973           0 :     if( w==8 )
    6974             :     {
    6975           0 :         r = -7.178e+00;
    6976             :     }
    6977           0 :     if( w==7 )
    6978             :     {
    6979           0 :         r = -7.453e+00;
    6980             :     }
    6981           0 :     if( w==6 )
    6982             :     {
    6983           0 :         r = -7.758e+00;
    6984             :     }
    6985           0 :     if( w==5 )
    6986             :     {
    6987           0 :         r = -8.095e+00;
    6988             :     }
    6989           0 :     if( w==4 )
    6990             :     {
    6991           0 :         r = -8.451e+00;
    6992             :     }
    6993           0 :     if( w==3 )
    6994             :     {
    6995           0 :         r = -8.788e+00;
    6996             :     }
    6997           0 :     if( w==2 )
    6998             :     {
    6999           0 :         r = -9.299e+00;
    7000             :     }
    7001           0 :     if( w==1 )
    7002             :     {
    7003           0 :         r = -9.704e+00;
    7004             :     }
    7005           0 :     if( w<=0 )
    7006             :     {
    7007           0 :         r = -1.040e+01;
    7008             :     }
    7009           0 :     result = r;
    7010           0 :     return result;
    7011             : }
    7012             : 
    7013             : 
    7014             : /*************************************************************************
    7015             : Tail(S, 16)
    7016             : *************************************************************************/
    7017           0 : static double wsr_w16(double s, ae_state *_state)
    7018             : {
    7019             :     ae_int_t w;
    7020             :     double r;
    7021             :     double result;
    7022             : 
    7023             : 
    7024           0 :     r = (double)(0);
    7025           0 :     w = ae_round(-1.933908e+01*s+6.800000e+01, _state);
    7026           0 :     if( w>=68 )
    7027             :     {
    7028           0 :         r = -6.733e-01;
    7029             :     }
    7030           0 :     if( w==67 )
    7031             :     {
    7032           0 :         r = -7.134e-01;
    7033             :     }
    7034           0 :     if( w==66 )
    7035             :     {
    7036           0 :         r = -7.551e-01;
    7037             :     }
    7038           0 :     if( w==65 )
    7039             :     {
    7040           0 :         r = -7.986e-01;
    7041             :     }
    7042           0 :     if( w==64 )
    7043             :     {
    7044           0 :         r = -8.437e-01;
    7045             :     }
    7046           0 :     if( w==63 )
    7047             :     {
    7048           0 :         r = -8.905e-01;
    7049             :     }
    7050           0 :     if( w==62 )
    7051             :     {
    7052           0 :         r = -9.391e-01;
    7053             :     }
    7054           0 :     if( w==61 )
    7055             :     {
    7056           0 :         r = -9.895e-01;
    7057             :     }
    7058           0 :     if( w==60 )
    7059             :     {
    7060           0 :         r = -1.042e+00;
    7061             :     }
    7062           0 :     if( w==59 )
    7063             :     {
    7064           0 :         r = -1.096e+00;
    7065             :     }
    7066           0 :     if( w==58 )
    7067             :     {
    7068           0 :         r = -1.152e+00;
    7069             :     }
    7070           0 :     if( w==57 )
    7071             :     {
    7072           0 :         r = -1.210e+00;
    7073             :     }
    7074           0 :     if( w==56 )
    7075             :     {
    7076           0 :         r = -1.270e+00;
    7077             :     }
    7078           0 :     if( w==55 )
    7079             :     {
    7080           0 :         r = -1.331e+00;
    7081             :     }
    7082           0 :     if( w==54 )
    7083             :     {
    7084           0 :         r = -1.395e+00;
    7085             :     }
    7086           0 :     if( w==53 )
    7087             :     {
    7088           0 :         r = -1.462e+00;
    7089             :     }
    7090           0 :     if( w==52 )
    7091             :     {
    7092           0 :         r = -1.530e+00;
    7093             :     }
    7094           0 :     if( w==51 )
    7095             :     {
    7096           0 :         r = -1.600e+00;
    7097             :     }
    7098           0 :     if( w==50 )
    7099             :     {
    7100           0 :         r = -1.673e+00;
    7101             :     }
    7102           0 :     if( w==49 )
    7103             :     {
    7104           0 :         r = -1.748e+00;
    7105             :     }
    7106           0 :     if( w==48 )
    7107             :     {
    7108           0 :         r = -1.825e+00;
    7109             :     }
    7110           0 :     if( w==47 )
    7111             :     {
    7112           0 :         r = -1.904e+00;
    7113             :     }
    7114           0 :     if( w==46 )
    7115             :     {
    7116           0 :         r = -1.986e+00;
    7117             :     }
    7118           0 :     if( w==45 )
    7119             :     {
    7120           0 :         r = -2.071e+00;
    7121             :     }
    7122           0 :     if( w==44 )
    7123             :     {
    7124           0 :         r = -2.158e+00;
    7125             :     }
    7126           0 :     if( w==43 )
    7127             :     {
    7128           0 :         r = -2.247e+00;
    7129             :     }
    7130           0 :     if( w==42 )
    7131             :     {
    7132           0 :         r = -2.339e+00;
    7133             :     }
    7134           0 :     if( w==41 )
    7135             :     {
    7136           0 :         r = -2.434e+00;
    7137             :     }
    7138           0 :     if( w==40 )
    7139             :     {
    7140           0 :         r = -2.532e+00;
    7141             :     }
    7142           0 :     if( w==39 )
    7143             :     {
    7144           0 :         r = -2.632e+00;
    7145             :     }
    7146           0 :     if( w==38 )
    7147             :     {
    7148           0 :         r = -2.735e+00;
    7149             :     }
    7150           0 :     if( w==37 )
    7151             :     {
    7152           0 :         r = -2.842e+00;
    7153             :     }
    7154           0 :     if( w==36 )
    7155             :     {
    7156           0 :         r = -2.951e+00;
    7157             :     }
    7158           0 :     if( w==35 )
    7159             :     {
    7160           0 :         r = -3.064e+00;
    7161             :     }
    7162           0 :     if( w==34 )
    7163             :     {
    7164           0 :         r = -3.179e+00;
    7165             :     }
    7166           0 :     if( w==33 )
    7167             :     {
    7168           0 :         r = -3.298e+00;
    7169             :     }
    7170           0 :     if( w==32 )
    7171             :     {
    7172           0 :         r = -3.420e+00;
    7173             :     }
    7174           0 :     if( w==31 )
    7175             :     {
    7176           0 :         r = -3.546e+00;
    7177             :     }
    7178           0 :     if( w==30 )
    7179             :     {
    7180           0 :         r = -3.676e+00;
    7181             :     }
    7182           0 :     if( w==29 )
    7183             :     {
    7184           0 :         r = -3.810e+00;
    7185             :     }
    7186           0 :     if( w==28 )
    7187             :     {
    7188           0 :         r = -3.947e+00;
    7189             :     }
    7190           0 :     if( w==27 )
    7191             :     {
    7192           0 :         r = -4.088e+00;
    7193             :     }
    7194           0 :     if( w==26 )
    7195             :     {
    7196           0 :         r = -4.234e+00;
    7197             :     }
    7198           0 :     if( w==25 )
    7199             :     {
    7200           0 :         r = -4.383e+00;
    7201             :     }
    7202           0 :     if( w==24 )
    7203             :     {
    7204           0 :         r = -4.538e+00;
    7205             :     }
    7206           0 :     if( w==23 )
    7207             :     {
    7208           0 :         r = -4.697e+00;
    7209             :     }
    7210           0 :     if( w==22 )
    7211             :     {
    7212           0 :         r = -4.860e+00;
    7213             :     }
    7214           0 :     if( w==21 )
    7215             :     {
    7216           0 :         r = -5.029e+00;
    7217             :     }
    7218           0 :     if( w==20 )
    7219             :     {
    7220           0 :         r = -5.204e+00;
    7221             :     }
    7222           0 :     if( w==19 )
    7223             :     {
    7224           0 :         r = -5.383e+00;
    7225             :     }
    7226           0 :     if( w==18 )
    7227             :     {
    7228           0 :         r = -5.569e+00;
    7229             :     }
    7230           0 :     if( w==17 )
    7231             :     {
    7232           0 :         r = -5.762e+00;
    7233             :     }
    7234           0 :     if( w==16 )
    7235             :     {
    7236           0 :         r = -5.960e+00;
    7237             :     }
    7238           0 :     if( w==15 )
    7239             :     {
    7240           0 :         r = -6.170e+00;
    7241             :     }
    7242           0 :     if( w==14 )
    7243             :     {
    7244           0 :         r = -6.390e+00;
    7245             :     }
    7246           0 :     if( w==13 )
    7247             :     {
    7248           0 :         r = -6.613e+00;
    7249             :     }
    7250           0 :     if( w==12 )
    7251             :     {
    7252           0 :         r = -6.842e+00;
    7253             :     }
    7254           0 :     if( w==11 )
    7255             :     {
    7256           0 :         r = -7.083e+00;
    7257             :     }
    7258           0 :     if( w==10 )
    7259             :     {
    7260           0 :         r = -7.329e+00;
    7261             :     }
    7262           0 :     if( w==9 )
    7263             :     {
    7264           0 :         r = -7.594e+00;
    7265             :     }
    7266           0 :     if( w==8 )
    7267             :     {
    7268           0 :         r = -7.871e+00;
    7269             :     }
    7270           0 :     if( w==7 )
    7271             :     {
    7272           0 :         r = -8.146e+00;
    7273             :     }
    7274           0 :     if( w==6 )
    7275             :     {
    7276           0 :         r = -8.451e+00;
    7277             :     }
    7278           0 :     if( w==5 )
    7279             :     {
    7280           0 :         r = -8.788e+00;
    7281             :     }
    7282           0 :     if( w==4 )
    7283             :     {
    7284           0 :         r = -9.144e+00;
    7285             :     }
    7286           0 :     if( w==3 )
    7287             :     {
    7288           0 :         r = -9.481e+00;
    7289             :     }
    7290           0 :     if( w==2 )
    7291             :     {
    7292           0 :         r = -9.992e+00;
    7293             :     }
    7294           0 :     if( w==1 )
    7295             :     {
    7296           0 :         r = -1.040e+01;
    7297             :     }
    7298           0 :     if( w<=0 )
    7299             :     {
    7300           0 :         r = -1.109e+01;
    7301             :     }
    7302           0 :     result = r;
    7303           0 :     return result;
    7304             : }
    7305             : 
    7306             : 
    7307             : /*************************************************************************
    7308             : Tail(S, 17)
    7309             : *************************************************************************/
    7310           0 : static double wsr_w17(double s, ae_state *_state)
    7311             : {
    7312             :     ae_int_t w;
    7313             :     double r;
    7314             :     double result;
    7315             : 
    7316             : 
    7317           0 :     r = (double)(0);
    7318           0 :     w = ae_round(-2.112463e+01*s+7.650000e+01, _state);
    7319           0 :     if( w>=76 )
    7320             :     {
    7321           0 :         r = -6.931e-01;
    7322             :     }
    7323           0 :     if( w==75 )
    7324             :     {
    7325           0 :         r = -7.306e-01;
    7326             :     }
    7327           0 :     if( w==74 )
    7328             :     {
    7329           0 :         r = -7.695e-01;
    7330             :     }
    7331           0 :     if( w==73 )
    7332             :     {
    7333           0 :         r = -8.097e-01;
    7334             :     }
    7335           0 :     if( w==72 )
    7336             :     {
    7337           0 :         r = -8.514e-01;
    7338             :     }
    7339           0 :     if( w==71 )
    7340             :     {
    7341           0 :         r = -8.946e-01;
    7342             :     }
    7343           0 :     if( w==70 )
    7344             :     {
    7345           0 :         r = -9.392e-01;
    7346             :     }
    7347           0 :     if( w==69 )
    7348             :     {
    7349           0 :         r = -9.853e-01;
    7350             :     }
    7351           0 :     if( w==68 )
    7352             :     {
    7353           0 :         r = -1.033e+00;
    7354             :     }
    7355           0 :     if( w==67 )
    7356             :     {
    7357           0 :         r = -1.082e+00;
    7358             :     }
    7359           0 :     if( w==66 )
    7360             :     {
    7361           0 :         r = -1.133e+00;
    7362             :     }
    7363           0 :     if( w==65 )
    7364             :     {
    7365           0 :         r = -1.185e+00;
    7366             :     }
    7367           0 :     if( w==64 )
    7368             :     {
    7369           0 :         r = -1.240e+00;
    7370             :     }
    7371           0 :     if( w==63 )
    7372             :     {
    7373           0 :         r = -1.295e+00;
    7374             :     }
    7375           0 :     if( w==62 )
    7376             :     {
    7377           0 :         r = -1.353e+00;
    7378             :     }
    7379           0 :     if( w==61 )
    7380             :     {
    7381           0 :         r = -1.412e+00;
    7382             :     }
    7383           0 :     if( w==60 )
    7384             :     {
    7385           0 :         r = -1.473e+00;
    7386             :     }
    7387           0 :     if( w==59 )
    7388             :     {
    7389           0 :         r = -1.536e+00;
    7390             :     }
    7391           0 :     if( w==58 )
    7392             :     {
    7393           0 :         r = -1.600e+00;
    7394             :     }
    7395           0 :     if( w==57 )
    7396             :     {
    7397           0 :         r = -1.666e+00;
    7398             :     }
    7399           0 :     if( w==56 )
    7400             :     {
    7401           0 :         r = -1.735e+00;
    7402             :     }
    7403           0 :     if( w==55 )
    7404             :     {
    7405           0 :         r = -1.805e+00;
    7406             :     }
    7407           0 :     if( w==54 )
    7408             :     {
    7409           0 :         r = -1.877e+00;
    7410             :     }
    7411           0 :     if( w==53 )
    7412             :     {
    7413           0 :         r = -1.951e+00;
    7414             :     }
    7415           0 :     if( w==52 )
    7416             :     {
    7417           0 :         r = -2.028e+00;
    7418             :     }
    7419           0 :     if( w==51 )
    7420             :     {
    7421           0 :         r = -2.106e+00;
    7422             :     }
    7423           0 :     if( w==50 )
    7424             :     {
    7425           0 :         r = -2.186e+00;
    7426             :     }
    7427           0 :     if( w==49 )
    7428             :     {
    7429           0 :         r = -2.269e+00;
    7430             :     }
    7431           0 :     if( w==48 )
    7432             :     {
    7433           0 :         r = -2.353e+00;
    7434             :     }
    7435           0 :     if( w==47 )
    7436             :     {
    7437           0 :         r = -2.440e+00;
    7438             :     }
    7439           0 :     if( w==46 )
    7440             :     {
    7441           0 :         r = -2.530e+00;
    7442             :     }
    7443           0 :     if( w==45 )
    7444             :     {
    7445           0 :         r = -2.621e+00;
    7446             :     }
    7447           0 :     if( w==44 )
    7448             :     {
    7449           0 :         r = -2.715e+00;
    7450             :     }
    7451           0 :     if( w==43 )
    7452             :     {
    7453           0 :         r = -2.812e+00;
    7454             :     }
    7455           0 :     if( w==42 )
    7456             :     {
    7457           0 :         r = -2.911e+00;
    7458             :     }
    7459           0 :     if( w==41 )
    7460             :     {
    7461           0 :         r = -3.012e+00;
    7462             :     }
    7463           0 :     if( w==40 )
    7464             :     {
    7465           0 :         r = -3.116e+00;
    7466             :     }
    7467           0 :     if( w==39 )
    7468             :     {
    7469           0 :         r = -3.223e+00;
    7470             :     }
    7471           0 :     if( w==38 )
    7472             :     {
    7473           0 :         r = -3.332e+00;
    7474             :     }
    7475           0 :     if( w==37 )
    7476             :     {
    7477           0 :         r = -3.445e+00;
    7478             :     }
    7479           0 :     if( w==36 )
    7480             :     {
    7481           0 :         r = -3.560e+00;
    7482             :     }
    7483           0 :     if( w==35 )
    7484             :     {
    7485           0 :         r = -3.678e+00;
    7486             :     }
    7487           0 :     if( w==34 )
    7488             :     {
    7489           0 :         r = -3.799e+00;
    7490             :     }
    7491           0 :     if( w==33 )
    7492             :     {
    7493           0 :         r = -3.924e+00;
    7494             :     }
    7495           0 :     if( w==32 )
    7496             :     {
    7497           0 :         r = -4.052e+00;
    7498             :     }
    7499           0 :     if( w==31 )
    7500             :     {
    7501           0 :         r = -4.183e+00;
    7502             :     }
    7503           0 :     if( w==30 )
    7504             :     {
    7505           0 :         r = -4.317e+00;
    7506             :     }
    7507           0 :     if( w==29 )
    7508             :     {
    7509           0 :         r = -4.456e+00;
    7510             :     }
    7511           0 :     if( w==28 )
    7512             :     {
    7513           0 :         r = -4.597e+00;
    7514             :     }
    7515           0 :     if( w==27 )
    7516             :     {
    7517           0 :         r = -4.743e+00;
    7518             :     }
    7519           0 :     if( w==26 )
    7520             :     {
    7521           0 :         r = -4.893e+00;
    7522             :     }
    7523           0 :     if( w==25 )
    7524             :     {
    7525           0 :         r = -5.047e+00;
    7526             :     }
    7527           0 :     if( w==24 )
    7528             :     {
    7529           0 :         r = -5.204e+00;
    7530             :     }
    7531           0 :     if( w==23 )
    7532             :     {
    7533           0 :         r = -5.367e+00;
    7534             :     }
    7535           0 :     if( w==22 )
    7536             :     {
    7537           0 :         r = -5.534e+00;
    7538             :     }
    7539           0 :     if( w==21 )
    7540             :     {
    7541           0 :         r = -5.706e+00;
    7542             :     }
    7543           0 :     if( w==20 )
    7544             :     {
    7545           0 :         r = -5.884e+00;
    7546             :     }
    7547           0 :     if( w==19 )
    7548             :     {
    7549           0 :         r = -6.066e+00;
    7550             :     }
    7551           0 :     if( w==18 )
    7552             :     {
    7553           0 :         r = -6.254e+00;
    7554             :     }
    7555           0 :     if( w==17 )
    7556             :     {
    7557           0 :         r = -6.451e+00;
    7558             :     }
    7559           0 :     if( w==16 )
    7560             :     {
    7561           0 :         r = -6.654e+00;
    7562             :     }
    7563           0 :     if( w==15 )
    7564             :     {
    7565           0 :         r = -6.864e+00;
    7566             :     }
    7567           0 :     if( w==14 )
    7568             :     {
    7569           0 :         r = -7.083e+00;
    7570             :     }
    7571           0 :     if( w==13 )
    7572             :     {
    7573           0 :         r = -7.306e+00;
    7574             :     }
    7575           0 :     if( w==12 )
    7576             :     {
    7577           0 :         r = -7.535e+00;
    7578             :     }
    7579           0 :     if( w==11 )
    7580             :     {
    7581           0 :         r = -7.776e+00;
    7582             :     }
    7583           0 :     if( w==10 )
    7584             :     {
    7585           0 :         r = -8.022e+00;
    7586             :     }
    7587           0 :     if( w==9 )
    7588             :     {
    7589           0 :         r = -8.287e+00;
    7590             :     }
    7591           0 :     if( w==8 )
    7592             :     {
    7593           0 :         r = -8.565e+00;
    7594             :     }
    7595           0 :     if( w==7 )
    7596             :     {
    7597           0 :         r = -8.839e+00;
    7598             :     }
    7599           0 :     if( w==6 )
    7600             :     {
    7601           0 :         r = -9.144e+00;
    7602             :     }
    7603           0 :     if( w==5 )
    7604             :     {
    7605           0 :         r = -9.481e+00;
    7606             :     }
    7607           0 :     if( w==4 )
    7608             :     {
    7609           0 :         r = -9.838e+00;
    7610             :     }
    7611           0 :     if( w==3 )
    7612             :     {
    7613           0 :         r = -1.017e+01;
    7614             :     }
    7615           0 :     if( w==2 )
    7616             :     {
    7617           0 :         r = -1.068e+01;
    7618             :     }
    7619           0 :     if( w==1 )
    7620             :     {
    7621           0 :         r = -1.109e+01;
    7622             :     }
    7623           0 :     if( w<=0 )
    7624             :     {
    7625           0 :         r = -1.178e+01;
    7626             :     }
    7627           0 :     result = r;
    7628           0 :     return result;
    7629             : }
    7630             : 
    7631             : 
    7632             : /*************************************************************************
    7633             : Tail(S, 18)
    7634             : *************************************************************************/
    7635           0 : static double wsr_w18(double s, ae_state *_state)
    7636             : {
    7637             :     ae_int_t w;
    7638             :     double r;
    7639             :     double result;
    7640             : 
    7641             : 
    7642           0 :     r = (double)(0);
    7643           0 :     w = ae_round(-2.296193e+01*s+8.550000e+01, _state);
    7644           0 :     if( w>=85 )
    7645             :     {
    7646           0 :         r = -6.931e-01;
    7647             :     }
    7648           0 :     if( w==84 )
    7649             :     {
    7650           0 :         r = -7.276e-01;
    7651             :     }
    7652           0 :     if( w==83 )
    7653             :     {
    7654           0 :         r = -7.633e-01;
    7655             :     }
    7656           0 :     if( w==82 )
    7657             :     {
    7658           0 :         r = -8.001e-01;
    7659             :     }
    7660           0 :     if( w==81 )
    7661             :     {
    7662           0 :         r = -8.381e-01;
    7663             :     }
    7664           0 :     if( w==80 )
    7665             :     {
    7666           0 :         r = -8.774e-01;
    7667             :     }
    7668           0 :     if( w==79 )
    7669             :     {
    7670           0 :         r = -9.179e-01;
    7671             :     }
    7672           0 :     if( w==78 )
    7673             :     {
    7674           0 :         r = -9.597e-01;
    7675             :     }
    7676           0 :     if( w==77 )
    7677             :     {
    7678           0 :         r = -1.003e+00;
    7679             :     }
    7680           0 :     if( w==76 )
    7681             :     {
    7682           0 :         r = -1.047e+00;
    7683             :     }
    7684           0 :     if( w==75 )
    7685             :     {
    7686           0 :         r = -1.093e+00;
    7687             :     }
    7688           0 :     if( w==74 )
    7689             :     {
    7690           0 :         r = -1.140e+00;
    7691             :     }
    7692           0 :     if( w==73 )
    7693             :     {
    7694           0 :         r = -1.188e+00;
    7695             :     }
    7696           0 :     if( w==72 )
    7697             :     {
    7698           0 :         r = -1.238e+00;
    7699             :     }
    7700           0 :     if( w==71 )
    7701             :     {
    7702           0 :         r = -1.289e+00;
    7703             :     }
    7704           0 :     if( w==70 )
    7705             :     {
    7706           0 :         r = -1.342e+00;
    7707             :     }
    7708           0 :     if( w==69 )
    7709             :     {
    7710           0 :         r = -1.396e+00;
    7711             :     }
    7712           0 :     if( w==68 )
    7713             :     {
    7714           0 :         r = -1.452e+00;
    7715             :     }
    7716           0 :     if( w==67 )
    7717             :     {
    7718           0 :         r = -1.509e+00;
    7719             :     }
    7720           0 :     if( w==66 )
    7721             :     {
    7722           0 :         r = -1.568e+00;
    7723             :     }
    7724           0 :     if( w==65 )
    7725             :     {
    7726           0 :         r = -1.628e+00;
    7727             :     }
    7728           0 :     if( w==64 )
    7729             :     {
    7730           0 :         r = -1.690e+00;
    7731             :     }
    7732           0 :     if( w==63 )
    7733             :     {
    7734           0 :         r = -1.753e+00;
    7735             :     }
    7736           0 :     if( w==62 )
    7737             :     {
    7738           0 :         r = -1.818e+00;
    7739             :     }
    7740           0 :     if( w==61 )
    7741             :     {
    7742           0 :         r = -1.885e+00;
    7743             :     }
    7744           0 :     if( w==60 )
    7745             :     {
    7746           0 :         r = -1.953e+00;
    7747             :     }
    7748           0 :     if( w==59 )
    7749             :     {
    7750           0 :         r = -2.023e+00;
    7751             :     }
    7752           0 :     if( w==58 )
    7753             :     {
    7754           0 :         r = -2.095e+00;
    7755             :     }
    7756           0 :     if( w==57 )
    7757             :     {
    7758           0 :         r = -2.168e+00;
    7759             :     }
    7760           0 :     if( w==56 )
    7761             :     {
    7762           0 :         r = -2.244e+00;
    7763             :     }
    7764           0 :     if( w==55 )
    7765             :     {
    7766           0 :         r = -2.321e+00;
    7767             :     }
    7768           0 :     if( w==54 )
    7769             :     {
    7770           0 :         r = -2.400e+00;
    7771             :     }
    7772           0 :     if( w==53 )
    7773             :     {
    7774           0 :         r = -2.481e+00;
    7775             :     }
    7776           0 :     if( w==52 )
    7777             :     {
    7778           0 :         r = -2.564e+00;
    7779             :     }
    7780           0 :     if( w==51 )
    7781             :     {
    7782           0 :         r = -2.648e+00;
    7783             :     }
    7784           0 :     if( w==50 )
    7785             :     {
    7786           0 :         r = -2.735e+00;
    7787             :     }
    7788           0 :     if( w==49 )
    7789             :     {
    7790           0 :         r = -2.824e+00;
    7791             :     }
    7792           0 :     if( w==48 )
    7793             :     {
    7794           0 :         r = -2.915e+00;
    7795             :     }
    7796           0 :     if( w==47 )
    7797             :     {
    7798           0 :         r = -3.008e+00;
    7799             :     }
    7800           0 :     if( w==46 )
    7801             :     {
    7802           0 :         r = -3.104e+00;
    7803             :     }
    7804           0 :     if( w==45 )
    7805             :     {
    7806           0 :         r = -3.201e+00;
    7807             :     }
    7808           0 :     if( w==44 )
    7809             :     {
    7810           0 :         r = -3.301e+00;
    7811             :     }
    7812           0 :     if( w==43 )
    7813             :     {
    7814           0 :         r = -3.403e+00;
    7815             :     }
    7816           0 :     if( w==42 )
    7817             :     {
    7818           0 :         r = -3.508e+00;
    7819             :     }
    7820           0 :     if( w==41 )
    7821             :     {
    7822           0 :         r = -3.615e+00;
    7823             :     }
    7824           0 :     if( w==40 )
    7825             :     {
    7826           0 :         r = -3.724e+00;
    7827             :     }
    7828           0 :     if( w==39 )
    7829             :     {
    7830           0 :         r = -3.836e+00;
    7831             :     }
    7832           0 :     if( w==38 )
    7833             :     {
    7834           0 :         r = -3.950e+00;
    7835             :     }
    7836           0 :     if( w==37 )
    7837             :     {
    7838           0 :         r = -4.068e+00;
    7839             :     }
    7840           0 :     if( w==36 )
    7841             :     {
    7842           0 :         r = -4.188e+00;
    7843             :     }
    7844           0 :     if( w==35 )
    7845             :     {
    7846           0 :         r = -4.311e+00;
    7847             :     }
    7848           0 :     if( w==34 )
    7849             :     {
    7850           0 :         r = -4.437e+00;
    7851             :     }
    7852           0 :     if( w==33 )
    7853             :     {
    7854           0 :         r = -4.565e+00;
    7855             :     }
    7856           0 :     if( w==32 )
    7857             :     {
    7858           0 :         r = -4.698e+00;
    7859             :     }
    7860           0 :     if( w==31 )
    7861             :     {
    7862           0 :         r = -4.833e+00;
    7863             :     }
    7864           0 :     if( w==30 )
    7865             :     {
    7866           0 :         r = -4.971e+00;
    7867             :     }
    7868           0 :     if( w==29 )
    7869             :     {
    7870           0 :         r = -5.113e+00;
    7871             :     }
    7872           0 :     if( w==28 )
    7873             :     {
    7874           0 :         r = -5.258e+00;
    7875             :     }
    7876           0 :     if( w==27 )
    7877             :     {
    7878           0 :         r = -5.408e+00;
    7879             :     }
    7880           0 :     if( w==26 )
    7881             :     {
    7882           0 :         r = -5.561e+00;
    7883             :     }
    7884           0 :     if( w==25 )
    7885             :     {
    7886           0 :         r = -5.717e+00;
    7887             :     }
    7888           0 :     if( w==24 )
    7889             :     {
    7890           0 :         r = -5.878e+00;
    7891             :     }
    7892           0 :     if( w==23 )
    7893             :     {
    7894           0 :         r = -6.044e+00;
    7895             :     }
    7896           0 :     if( w==22 )
    7897             :     {
    7898           0 :         r = -6.213e+00;
    7899             :     }
    7900           0 :     if( w==21 )
    7901             :     {
    7902           0 :         r = -6.388e+00;
    7903             :     }
    7904           0 :     if( w==20 )
    7905             :     {
    7906           0 :         r = -6.569e+00;
    7907             :     }
    7908           0 :     if( w==19 )
    7909             :     {
    7910           0 :         r = -6.753e+00;
    7911             :     }
    7912           0 :     if( w==18 )
    7913             :     {
    7914           0 :         r = -6.943e+00;
    7915             :     }
    7916           0 :     if( w==17 )
    7917             :     {
    7918           0 :         r = -7.144e+00;
    7919             :     }
    7920           0 :     if( w==16 )
    7921             :     {
    7922           0 :         r = -7.347e+00;
    7923             :     }
    7924           0 :     if( w==15 )
    7925             :     {
    7926           0 :         r = -7.557e+00;
    7927             :     }
    7928           0 :     if( w==14 )
    7929             :     {
    7930           0 :         r = -7.776e+00;
    7931             :     }
    7932           0 :     if( w==13 )
    7933             :     {
    7934           0 :         r = -7.999e+00;
    7935             :     }
    7936           0 :     if( w==12 )
    7937             :     {
    7938           0 :         r = -8.228e+00;
    7939             :     }
    7940           0 :     if( w==11 )
    7941             :     {
    7942           0 :         r = -8.469e+00;
    7943             :     }
    7944           0 :     if( w==10 )
    7945             :     {
    7946           0 :         r = -8.715e+00;
    7947             :     }
    7948           0 :     if( w==9 )
    7949             :     {
    7950           0 :         r = -8.980e+00;
    7951             :     }
    7952           0 :     if( w==8 )
    7953             :     {
    7954           0 :         r = -9.258e+00;
    7955             :     }
    7956           0 :     if( w==7 )
    7957             :     {
    7958           0 :         r = -9.532e+00;
    7959             :     }
    7960           0 :     if( w==6 )
    7961             :     {
    7962           0 :         r = -9.838e+00;
    7963             :     }
    7964           0 :     if( w==5 )
    7965             :     {
    7966           0 :         r = -1.017e+01;
    7967             :     }
    7968           0 :     if( w==4 )
    7969             :     {
    7970           0 :         r = -1.053e+01;
    7971             :     }
    7972           0 :     if( w==3 )
    7973             :     {
    7974           0 :         r = -1.087e+01;
    7975             :     }
    7976           0 :     if( w==2 )
    7977             :     {
    7978           0 :         r = -1.138e+01;
    7979             :     }
    7980           0 :     if( w==1 )
    7981             :     {
    7982           0 :         r = -1.178e+01;
    7983             :     }
    7984           0 :     if( w<=0 )
    7985             :     {
    7986           0 :         r = -1.248e+01;
    7987             :     }
    7988           0 :     result = r;
    7989           0 :     return result;
    7990             : }
    7991             : 
    7992             : 
    7993             : /*************************************************************************
    7994             : Tail(S, 19)
    7995             : *************************************************************************/
    7996           0 : static double wsr_w19(double s, ae_state *_state)
    7997             : {
    7998             :     ae_int_t w;
    7999             :     double r;
    8000             :     double result;
    8001             : 
    8002             : 
    8003           0 :     r = (double)(0);
    8004           0 :     w = ae_round(-2.484955e+01*s+9.500000e+01, _state);
    8005           0 :     if( w>=95 )
    8006             :     {
    8007           0 :         r = -6.776e-01;
    8008             :     }
    8009           0 :     if( w==94 )
    8010             :     {
    8011           0 :         r = -7.089e-01;
    8012             :     }
    8013           0 :     if( w==93 )
    8014             :     {
    8015           0 :         r = -7.413e-01;
    8016             :     }
    8017           0 :     if( w==92 )
    8018             :     {
    8019           0 :         r = -7.747e-01;
    8020             :     }
    8021           0 :     if( w==91 )
    8022             :     {
    8023           0 :         r = -8.090e-01;
    8024             :     }
    8025           0 :     if( w==90 )
    8026             :     {
    8027           0 :         r = -8.445e-01;
    8028             :     }
    8029           0 :     if( w==89 )
    8030             :     {
    8031           0 :         r = -8.809e-01;
    8032             :     }
    8033           0 :     if( w==88 )
    8034             :     {
    8035           0 :         r = -9.185e-01;
    8036             :     }
    8037           0 :     if( w==87 )
    8038             :     {
    8039           0 :         r = -9.571e-01;
    8040             :     }
    8041           0 :     if( w==86 )
    8042             :     {
    8043           0 :         r = -9.968e-01;
    8044             :     }
    8045           0 :     if( w==85 )
    8046             :     {
    8047           0 :         r = -1.038e+00;
    8048             :     }
    8049           0 :     if( w==84 )
    8050             :     {
    8051           0 :         r = -1.080e+00;
    8052             :     }
    8053           0 :     if( w==83 )
    8054             :     {
    8055           0 :         r = -1.123e+00;
    8056             :     }
    8057           0 :     if( w==82 )
    8058             :     {
    8059           0 :         r = -1.167e+00;
    8060             :     }
    8061           0 :     if( w==81 )
    8062             :     {
    8063           0 :         r = -1.213e+00;
    8064             :     }
    8065           0 :     if( w==80 )
    8066             :     {
    8067           0 :         r = -1.259e+00;
    8068             :     }
    8069           0 :     if( w==79 )
    8070             :     {
    8071           0 :         r = -1.307e+00;
    8072             :     }
    8073           0 :     if( w==78 )
    8074             :     {
    8075           0 :         r = -1.356e+00;
    8076             :     }
    8077           0 :     if( w==77 )
    8078             :     {
    8079           0 :         r = -1.407e+00;
    8080             :     }
    8081           0 :     if( w==76 )
    8082             :     {
    8083           0 :         r = -1.458e+00;
    8084             :     }
    8085           0 :     if( w==75 )
    8086             :     {
    8087           0 :         r = -1.511e+00;
    8088             :     }
    8089           0 :     if( w==74 )
    8090             :     {
    8091           0 :         r = -1.565e+00;
    8092             :     }
    8093           0 :     if( w==73 )
    8094             :     {
    8095           0 :         r = -1.621e+00;
    8096             :     }
    8097           0 :     if( w==72 )
    8098             :     {
    8099           0 :         r = -1.678e+00;
    8100             :     }
    8101           0 :     if( w==71 )
    8102             :     {
    8103           0 :         r = -1.736e+00;
    8104             :     }
    8105           0 :     if( w==70 )
    8106             :     {
    8107           0 :         r = -1.796e+00;
    8108             :     }
    8109           0 :     if( w==69 )
    8110             :     {
    8111           0 :         r = -1.857e+00;
    8112             :     }
    8113           0 :     if( w==68 )
    8114             :     {
    8115           0 :         r = -1.919e+00;
    8116             :     }
    8117           0 :     if( w==67 )
    8118             :     {
    8119           0 :         r = -1.983e+00;
    8120             :     }
    8121           0 :     if( w==66 )
    8122             :     {
    8123           0 :         r = -2.048e+00;
    8124             :     }
    8125           0 :     if( w==65 )
    8126             :     {
    8127           0 :         r = -2.115e+00;
    8128             :     }
    8129           0 :     if( w==64 )
    8130             :     {
    8131           0 :         r = -2.183e+00;
    8132             :     }
    8133           0 :     if( w==63 )
    8134             :     {
    8135           0 :         r = -2.253e+00;
    8136             :     }
    8137           0 :     if( w==62 )
    8138             :     {
    8139           0 :         r = -2.325e+00;
    8140             :     }
    8141           0 :     if( w==61 )
    8142             :     {
    8143           0 :         r = -2.398e+00;
    8144             :     }
    8145           0 :     if( w==60 )
    8146             :     {
    8147           0 :         r = -2.472e+00;
    8148             :     }
    8149           0 :     if( w==59 )
    8150             :     {
    8151           0 :         r = -2.548e+00;
    8152             :     }
    8153           0 :     if( w==58 )
    8154             :     {
    8155           0 :         r = -2.626e+00;
    8156             :     }
    8157           0 :     if( w==57 )
    8158             :     {
    8159           0 :         r = -2.706e+00;
    8160             :     }
    8161           0 :     if( w==56 )
    8162             :     {
    8163           0 :         r = -2.787e+00;
    8164             :     }
    8165           0 :     if( w==55 )
    8166             :     {
    8167           0 :         r = -2.870e+00;
    8168             :     }
    8169           0 :     if( w==54 )
    8170             :     {
    8171           0 :         r = -2.955e+00;
    8172             :     }
    8173           0 :     if( w==53 )
    8174             :     {
    8175           0 :         r = -3.042e+00;
    8176             :     }
    8177           0 :     if( w==52 )
    8178             :     {
    8179           0 :         r = -3.130e+00;
    8180             :     }
    8181           0 :     if( w==51 )
    8182             :     {
    8183           0 :         r = -3.220e+00;
    8184             :     }
    8185           0 :     if( w==50 )
    8186             :     {
    8187           0 :         r = -3.313e+00;
    8188             :     }
    8189           0 :     if( w==49 )
    8190             :     {
    8191           0 :         r = -3.407e+00;
    8192             :     }
    8193           0 :     if( w==48 )
    8194             :     {
    8195           0 :         r = -3.503e+00;
    8196             :     }
    8197           0 :     if( w==47 )
    8198             :     {
    8199           0 :         r = -3.601e+00;
    8200             :     }
    8201           0 :     if( w==46 )
    8202             :     {
    8203           0 :         r = -3.702e+00;
    8204             :     }
    8205           0 :     if( w==45 )
    8206             :     {
    8207           0 :         r = -3.804e+00;
    8208             :     }
    8209           0 :     if( w==44 )
    8210             :     {
    8211           0 :         r = -3.909e+00;
    8212             :     }
    8213           0 :     if( w==43 )
    8214             :     {
    8215           0 :         r = -4.015e+00;
    8216             :     }
    8217           0 :     if( w==42 )
    8218             :     {
    8219           0 :         r = -4.125e+00;
    8220             :     }
    8221           0 :     if( w==41 )
    8222             :     {
    8223           0 :         r = -4.236e+00;
    8224             :     }
    8225           0 :     if( w==40 )
    8226             :     {
    8227           0 :         r = -4.350e+00;
    8228             :     }
    8229           0 :     if( w==39 )
    8230             :     {
    8231           0 :         r = -4.466e+00;
    8232             :     }
    8233           0 :     if( w==38 )
    8234             :     {
    8235           0 :         r = -4.585e+00;
    8236             :     }
    8237           0 :     if( w==37 )
    8238             :     {
    8239           0 :         r = -4.706e+00;
    8240             :     }
    8241           0 :     if( w==36 )
    8242             :     {
    8243           0 :         r = -4.830e+00;
    8244             :     }
    8245           0 :     if( w==35 )
    8246             :     {
    8247           0 :         r = -4.957e+00;
    8248             :     }
    8249           0 :     if( w==34 )
    8250             :     {
    8251           0 :         r = -5.086e+00;
    8252             :     }
    8253           0 :     if( w==33 )
    8254             :     {
    8255           0 :         r = -5.219e+00;
    8256             :     }
    8257           0 :     if( w==32 )
    8258             :     {
    8259           0 :         r = -5.355e+00;
    8260             :     }
    8261           0 :     if( w==31 )
    8262             :     {
    8263           0 :         r = -5.493e+00;
    8264             :     }
    8265           0 :     if( w==30 )
    8266             :     {
    8267           0 :         r = -5.634e+00;
    8268             :     }
    8269           0 :     if( w==29 )
    8270             :     {
    8271           0 :         r = -5.780e+00;
    8272             :     }
    8273           0 :     if( w==28 )
    8274             :     {
    8275           0 :         r = -5.928e+00;
    8276             :     }
    8277           0 :     if( w==27 )
    8278             :     {
    8279           0 :         r = -6.080e+00;
    8280             :     }
    8281           0 :     if( w==26 )
    8282             :     {
    8283           0 :         r = -6.235e+00;
    8284             :     }
    8285           0 :     if( w==25 )
    8286             :     {
    8287           0 :         r = -6.394e+00;
    8288             :     }
    8289           0 :     if( w==24 )
    8290             :     {
    8291           0 :         r = -6.558e+00;
    8292             :     }
    8293           0 :     if( w==23 )
    8294             :     {
    8295           0 :         r = -6.726e+00;
    8296             :     }
    8297           0 :     if( w==22 )
    8298             :     {
    8299           0 :         r = -6.897e+00;
    8300             :     }
    8301           0 :     if( w==21 )
    8302             :     {
    8303           0 :         r = -7.074e+00;
    8304             :     }
    8305           0 :     if( w==20 )
    8306             :     {
    8307           0 :         r = -7.256e+00;
    8308             :     }
    8309           0 :     if( w==19 )
    8310             :     {
    8311           0 :         r = -7.443e+00;
    8312             :     }
    8313           0 :     if( w==18 )
    8314             :     {
    8315           0 :         r = -7.636e+00;
    8316             :     }
    8317           0 :     if( w==17 )
    8318             :     {
    8319           0 :         r = -7.837e+00;
    8320             :     }
    8321           0 :     if( w==16 )
    8322             :     {
    8323           0 :         r = -8.040e+00;
    8324             :     }
    8325           0 :     if( w==15 )
    8326             :     {
    8327           0 :         r = -8.250e+00;
    8328             :     }
    8329           0 :     if( w==14 )
    8330             :     {
    8331           0 :         r = -8.469e+00;
    8332             :     }
    8333           0 :     if( w==13 )
    8334             :     {
    8335           0 :         r = -8.692e+00;
    8336             :     }
    8337           0 :     if( w==12 )
    8338             :     {
    8339           0 :         r = -8.921e+00;
    8340             :     }
    8341           0 :     if( w==11 )
    8342             :     {
    8343           0 :         r = -9.162e+00;
    8344             :     }
    8345           0 :     if( w==10 )
    8346             :     {
    8347           0 :         r = -9.409e+00;
    8348             :     }
    8349           0 :     if( w==9 )
    8350             :     {
    8351           0 :         r = -9.673e+00;
    8352             :     }
    8353           0 :     if( w==8 )
    8354             :     {
    8355           0 :         r = -9.951e+00;
    8356             :     }
    8357           0 :     if( w==7 )
    8358             :     {
    8359           0 :         r = -1.023e+01;
    8360             :     }
    8361           0 :     if( w==6 )
    8362             :     {
    8363           0 :         r = -1.053e+01;
    8364             :     }
    8365           0 :     if( w==5 )
    8366             :     {
    8367           0 :         r = -1.087e+01;
    8368             :     }
    8369           0 :     if( w==4 )
    8370             :     {
    8371           0 :         r = -1.122e+01;
    8372             :     }
    8373           0 :     if( w==3 )
    8374             :     {
    8375           0 :         r = -1.156e+01;
    8376             :     }
    8377           0 :     if( w==2 )
    8378             :     {
    8379           0 :         r = -1.207e+01;
    8380             :     }
    8381           0 :     if( w==1 )
    8382             :     {
    8383           0 :         r = -1.248e+01;
    8384             :     }
    8385           0 :     if( w<=0 )
    8386             :     {
    8387           0 :         r = -1.317e+01;
    8388             :     }
    8389           0 :     result = r;
    8390           0 :     return result;
    8391             : }
    8392             : 
    8393             : 
    8394             : /*************************************************************************
    8395             : Tail(S, 20)
    8396             : *************************************************************************/
    8397           0 : static double wsr_w20(double s, ae_state *_state)
    8398             : {
    8399             :     ae_int_t w;
    8400             :     double r;
    8401             :     double result;
    8402             : 
    8403             : 
    8404           0 :     r = (double)(0);
    8405           0 :     w = ae_round(-2.678619e+01*s+1.050000e+02, _state);
    8406           0 :     if( w>=105 )
    8407             :     {
    8408           0 :         r = -6.787e-01;
    8409             :     }
    8410           0 :     if( w==104 )
    8411             :     {
    8412           0 :         r = -7.078e-01;
    8413             :     }
    8414           0 :     if( w==103 )
    8415             :     {
    8416           0 :         r = -7.378e-01;
    8417             :     }
    8418           0 :     if( w==102 )
    8419             :     {
    8420           0 :         r = -7.686e-01;
    8421             :     }
    8422           0 :     if( w==101 )
    8423             :     {
    8424           0 :         r = -8.004e-01;
    8425             :     }
    8426           0 :     if( w==100 )
    8427             :     {
    8428           0 :         r = -8.330e-01;
    8429             :     }
    8430           0 :     if( w==99 )
    8431             :     {
    8432           0 :         r = -8.665e-01;
    8433             :     }
    8434           0 :     if( w==98 )
    8435             :     {
    8436           0 :         r = -9.010e-01;
    8437             :     }
    8438           0 :     if( w==97 )
    8439             :     {
    8440           0 :         r = -9.363e-01;
    8441             :     }
    8442           0 :     if( w==96 )
    8443             :     {
    8444           0 :         r = -9.726e-01;
    8445             :     }
    8446           0 :     if( w==95 )
    8447             :     {
    8448           0 :         r = -1.010e+00;
    8449             :     }
    8450           0 :     if( w==94 )
    8451             :     {
    8452           0 :         r = -1.048e+00;
    8453             :     }
    8454           0 :     if( w==93 )
    8455             :     {
    8456           0 :         r = -1.087e+00;
    8457             :     }
    8458           0 :     if( w==92 )
    8459             :     {
    8460           0 :         r = -1.128e+00;
    8461             :     }
    8462           0 :     if( w==91 )
    8463             :     {
    8464           0 :         r = -1.169e+00;
    8465             :     }
    8466           0 :     if( w==90 )
    8467             :     {
    8468           0 :         r = -1.211e+00;
    8469             :     }
    8470           0 :     if( w==89 )
    8471             :     {
    8472           0 :         r = -1.254e+00;
    8473             :     }
    8474           0 :     if( w==88 )
    8475             :     {
    8476           0 :         r = -1.299e+00;
    8477             :     }
    8478           0 :     if( w==87 )
    8479             :     {
    8480           0 :         r = -1.344e+00;
    8481             :     }
    8482           0 :     if( w==86 )
    8483             :     {
    8484           0 :         r = -1.390e+00;
    8485             :     }
    8486           0 :     if( w==85 )
    8487             :     {
    8488           0 :         r = -1.438e+00;
    8489             :     }
    8490           0 :     if( w==84 )
    8491             :     {
    8492           0 :         r = -1.486e+00;
    8493             :     }
    8494           0 :     if( w==83 )
    8495             :     {
    8496           0 :         r = -1.536e+00;
    8497             :     }
    8498           0 :     if( w==82 )
    8499             :     {
    8500           0 :         r = -1.587e+00;
    8501             :     }
    8502           0 :     if( w==81 )
    8503             :     {
    8504           0 :         r = -1.639e+00;
    8505             :     }
    8506           0 :     if( w==80 )
    8507             :     {
    8508           0 :         r = -1.692e+00;
    8509             :     }
    8510           0 :     if( w==79 )
    8511             :     {
    8512           0 :         r = -1.746e+00;
    8513             :     }
    8514           0 :     if( w==78 )
    8515             :     {
    8516           0 :         r = -1.802e+00;
    8517             :     }
    8518           0 :     if( w==77 )
    8519             :     {
    8520           0 :         r = -1.859e+00;
    8521             :     }
    8522           0 :     if( w==76 )
    8523             :     {
    8524           0 :         r = -1.916e+00;
    8525             :     }
    8526           0 :     if( w==75 )
    8527             :     {
    8528           0 :         r = -1.976e+00;
    8529             :     }
    8530           0 :     if( w==74 )
    8531             :     {
    8532           0 :         r = -2.036e+00;
    8533             :     }
    8534           0 :     if( w==73 )
    8535             :     {
    8536           0 :         r = -2.098e+00;
    8537             :     }
    8538           0 :     if( w==72 )
    8539             :     {
    8540           0 :         r = -2.161e+00;
    8541             :     }
    8542           0 :     if( w==71 )
    8543             :     {
    8544           0 :         r = -2.225e+00;
    8545             :     }
    8546           0 :     if( w==70 )
    8547             :     {
    8548           0 :         r = -2.290e+00;
    8549             :     }
    8550           0 :     if( w==69 )
    8551             :     {
    8552           0 :         r = -2.357e+00;
    8553             :     }
    8554           0 :     if( w==68 )
    8555             :     {
    8556           0 :         r = -2.426e+00;
    8557             :     }
    8558           0 :     if( w==67 )
    8559             :     {
    8560           0 :         r = -2.495e+00;
    8561             :     }
    8562           0 :     if( w==66 )
    8563             :     {
    8564           0 :         r = -2.566e+00;
    8565             :     }
    8566           0 :     if( w==65 )
    8567             :     {
    8568           0 :         r = -2.639e+00;
    8569             :     }
    8570           0 :     if( w==64 )
    8571             :     {
    8572           0 :         r = -2.713e+00;
    8573             :     }
    8574           0 :     if( w==63 )
    8575             :     {
    8576           0 :         r = -2.788e+00;
    8577             :     }
    8578           0 :     if( w==62 )
    8579             :     {
    8580           0 :         r = -2.865e+00;
    8581             :     }
    8582           0 :     if( w==61 )
    8583             :     {
    8584           0 :         r = -2.943e+00;
    8585             :     }
    8586           0 :     if( w==60 )
    8587             :     {
    8588           0 :         r = -3.023e+00;
    8589             :     }
    8590           0 :     if( w==59 )
    8591             :     {
    8592           0 :         r = -3.104e+00;
    8593             :     }
    8594           0 :     if( w==58 )
    8595             :     {
    8596           0 :         r = -3.187e+00;
    8597             :     }
    8598           0 :     if( w==57 )
    8599             :     {
    8600           0 :         r = -3.272e+00;
    8601             :     }
    8602           0 :     if( w==56 )
    8603             :     {
    8604           0 :         r = -3.358e+00;
    8605             :     }
    8606           0 :     if( w==55 )
    8607             :     {
    8608           0 :         r = -3.446e+00;
    8609             :     }
    8610           0 :     if( w==54 )
    8611             :     {
    8612           0 :         r = -3.536e+00;
    8613             :     }
    8614           0 :     if( w==53 )
    8615             :     {
    8616           0 :         r = -3.627e+00;
    8617             :     }
    8618           0 :     if( w==52 )
    8619             :     {
    8620           0 :         r = -3.721e+00;
    8621             :     }
    8622           0 :     if( w==51 )
    8623             :     {
    8624           0 :         r = -3.815e+00;
    8625             :     }
    8626           0 :     if( w==50 )
    8627             :     {
    8628           0 :         r = -3.912e+00;
    8629             :     }
    8630           0 :     if( w==49 )
    8631             :     {
    8632           0 :         r = -4.011e+00;
    8633             :     }
    8634           0 :     if( w==48 )
    8635             :     {
    8636           0 :         r = -4.111e+00;
    8637             :     }
    8638           0 :     if( w==47 )
    8639             :     {
    8640           0 :         r = -4.214e+00;
    8641             :     }
    8642           0 :     if( w==46 )
    8643             :     {
    8644           0 :         r = -4.318e+00;
    8645             :     }
    8646           0 :     if( w==45 )
    8647             :     {
    8648           0 :         r = -4.425e+00;
    8649             :     }
    8650           0 :     if( w==44 )
    8651             :     {
    8652           0 :         r = -4.534e+00;
    8653             :     }
    8654           0 :     if( w==43 )
    8655             :     {
    8656           0 :         r = -4.644e+00;
    8657             :     }
    8658           0 :     if( w==42 )
    8659             :     {
    8660           0 :         r = -4.757e+00;
    8661             :     }
    8662           0 :     if( w==41 )
    8663             :     {
    8664           0 :         r = -4.872e+00;
    8665             :     }
    8666           0 :     if( w==40 )
    8667             :     {
    8668           0 :         r = -4.990e+00;
    8669             :     }
    8670           0 :     if( w==39 )
    8671             :     {
    8672           0 :         r = -5.109e+00;
    8673             :     }
    8674           0 :     if( w==38 )
    8675             :     {
    8676           0 :         r = -5.232e+00;
    8677             :     }
    8678           0 :     if( w==37 )
    8679             :     {
    8680           0 :         r = -5.356e+00;
    8681             :     }
    8682           0 :     if( w==36 )
    8683             :     {
    8684           0 :         r = -5.484e+00;
    8685             :     }
    8686           0 :     if( w==35 )
    8687             :     {
    8688           0 :         r = -5.614e+00;
    8689             :     }
    8690           0 :     if( w==34 )
    8691             :     {
    8692           0 :         r = -5.746e+00;
    8693             :     }
    8694           0 :     if( w==33 )
    8695             :     {
    8696           0 :         r = -5.882e+00;
    8697             :     }
    8698           0 :     if( w==32 )
    8699             :     {
    8700           0 :         r = -6.020e+00;
    8701             :     }
    8702           0 :     if( w==31 )
    8703             :     {
    8704           0 :         r = -6.161e+00;
    8705             :     }
    8706           0 :     if( w==30 )
    8707             :     {
    8708           0 :         r = -6.305e+00;
    8709             :     }
    8710           0 :     if( w==29 )
    8711             :     {
    8712           0 :         r = -6.453e+00;
    8713             :     }
    8714           0 :     if( w==28 )
    8715             :     {
    8716           0 :         r = -6.603e+00;
    8717             :     }
    8718           0 :     if( w==27 )
    8719             :     {
    8720           0 :         r = -6.757e+00;
    8721             :     }
    8722           0 :     if( w==26 )
    8723             :     {
    8724           0 :         r = -6.915e+00;
    8725             :     }
    8726           0 :     if( w==25 )
    8727             :     {
    8728           0 :         r = -7.076e+00;
    8729             :     }
    8730           0 :     if( w==24 )
    8731             :     {
    8732           0 :         r = -7.242e+00;
    8733             :     }
    8734           0 :     if( w==23 )
    8735             :     {
    8736           0 :         r = -7.411e+00;
    8737             :     }
    8738           0 :     if( w==22 )
    8739             :     {
    8740           0 :         r = -7.584e+00;
    8741             :     }
    8742           0 :     if( w==21 )
    8743             :     {
    8744           0 :         r = -7.763e+00;
    8745             :     }
    8746           0 :     if( w==20 )
    8747             :     {
    8748           0 :         r = -7.947e+00;
    8749             :     }
    8750           0 :     if( w==19 )
    8751             :     {
    8752           0 :         r = -8.136e+00;
    8753             :     }
    8754           0 :     if( w==18 )
    8755             :     {
    8756           0 :         r = -8.330e+00;
    8757             :     }
    8758           0 :     if( w==17 )
    8759             :     {
    8760           0 :         r = -8.530e+00;
    8761             :     }
    8762           0 :     if( w==16 )
    8763             :     {
    8764           0 :         r = -8.733e+00;
    8765             :     }
    8766           0 :     if( w==15 )
    8767             :     {
    8768           0 :         r = -8.943e+00;
    8769             :     }
    8770           0 :     if( w==14 )
    8771             :     {
    8772           0 :         r = -9.162e+00;
    8773             :     }
    8774           0 :     if( w==13 )
    8775             :     {
    8776           0 :         r = -9.386e+00;
    8777             :     }
    8778           0 :     if( w==12 )
    8779             :     {
    8780           0 :         r = -9.614e+00;
    8781             :     }
    8782           0 :     if( w==11 )
    8783             :     {
    8784           0 :         r = -9.856e+00;
    8785             :     }
    8786           0 :     if( w==10 )
    8787             :     {
    8788           0 :         r = -1.010e+01;
    8789             :     }
    8790           0 :     if( w==9 )
    8791             :     {
    8792           0 :         r = -1.037e+01;
    8793             :     }
    8794           0 :     if( w==8 )
    8795             :     {
    8796           0 :         r = -1.064e+01;
    8797             :     }
    8798           0 :     if( w==7 )
    8799             :     {
    8800           0 :         r = -1.092e+01;
    8801             :     }
    8802           0 :     if( w==6 )
    8803             :     {
    8804           0 :         r = -1.122e+01;
    8805             :     }
    8806           0 :     if( w==5 )
    8807             :     {
    8808           0 :         r = -1.156e+01;
    8809             :     }
    8810           0 :     if( w==4 )
    8811             :     {
    8812           0 :         r = -1.192e+01;
    8813             :     }
    8814           0 :     if( w==3 )
    8815             :     {
    8816           0 :         r = -1.225e+01;
    8817             :     }
    8818           0 :     if( w==2 )
    8819             :     {
    8820           0 :         r = -1.276e+01;
    8821             :     }
    8822           0 :     if( w==1 )
    8823             :     {
    8824           0 :         r = -1.317e+01;
    8825             :     }
    8826           0 :     if( w<=0 )
    8827             :     {
    8828           0 :         r = -1.386e+01;
    8829             :     }
    8830           0 :     result = r;
    8831           0 :     return result;
    8832             : }
    8833             : 
    8834             : 
    8835             : /*************************************************************************
    8836             : Tail(S, 21)
    8837             : *************************************************************************/
    8838           0 : static double wsr_w21(double s, ae_state *_state)
    8839             : {
    8840             :     ae_int_t w;
    8841             :     double r;
    8842             :     double result;
    8843             : 
    8844             : 
    8845           0 :     r = (double)(0);
    8846           0 :     w = ae_round(-2.877064e+01*s+1.155000e+02, _state);
    8847           0 :     if( w>=115 )
    8848             :     {
    8849           0 :         r = -6.931e-01;
    8850             :     }
    8851           0 :     if( w==114 )
    8852             :     {
    8853           0 :         r = -7.207e-01;
    8854             :     }
    8855           0 :     if( w==113 )
    8856             :     {
    8857           0 :         r = -7.489e-01;
    8858             :     }
    8859           0 :     if( w==112 )
    8860             :     {
    8861           0 :         r = -7.779e-01;
    8862             :     }
    8863           0 :     if( w==111 )
    8864             :     {
    8865           0 :         r = -8.077e-01;
    8866             :     }
    8867           0 :     if( w==110 )
    8868             :     {
    8869           0 :         r = -8.383e-01;
    8870             :     }
    8871           0 :     if( w==109 )
    8872             :     {
    8873           0 :         r = -8.697e-01;
    8874             :     }
    8875           0 :     if( w==108 )
    8876             :     {
    8877           0 :         r = -9.018e-01;
    8878             :     }
    8879           0 :     if( w==107 )
    8880             :     {
    8881           0 :         r = -9.348e-01;
    8882             :     }
    8883           0 :     if( w==106 )
    8884             :     {
    8885           0 :         r = -9.685e-01;
    8886             :     }
    8887           0 :     if( w==105 )
    8888             :     {
    8889           0 :         r = -1.003e+00;
    8890             :     }
    8891           0 :     if( w==104 )
    8892             :     {
    8893           0 :         r = -1.039e+00;
    8894             :     }
    8895           0 :     if( w==103 )
    8896             :     {
    8897           0 :         r = -1.075e+00;
    8898             :     }
    8899           0 :     if( w==102 )
    8900             :     {
    8901           0 :         r = -1.112e+00;
    8902             :     }
    8903           0 :     if( w==101 )
    8904             :     {
    8905           0 :         r = -1.150e+00;
    8906             :     }
    8907           0 :     if( w==100 )
    8908             :     {
    8909           0 :         r = -1.189e+00;
    8910             :     }
    8911           0 :     if( w==99 )
    8912             :     {
    8913           0 :         r = -1.229e+00;
    8914             :     }
    8915           0 :     if( w==98 )
    8916             :     {
    8917           0 :         r = -1.269e+00;
    8918             :     }
    8919           0 :     if( w==97 )
    8920             :     {
    8921           0 :         r = -1.311e+00;
    8922             :     }
    8923           0 :     if( w==96 )
    8924             :     {
    8925           0 :         r = -1.353e+00;
    8926             :     }
    8927           0 :     if( w==95 )
    8928             :     {
    8929           0 :         r = -1.397e+00;
    8930             :     }
    8931           0 :     if( w==94 )
    8932             :     {
    8933           0 :         r = -1.441e+00;
    8934             :     }
    8935           0 :     if( w==93 )
    8936             :     {
    8937           0 :         r = -1.486e+00;
    8938             :     }
    8939           0 :     if( w==92 )
    8940             :     {
    8941           0 :         r = -1.533e+00;
    8942             :     }
    8943           0 :     if( w==91 )
    8944             :     {
    8945           0 :         r = -1.580e+00;
    8946             :     }
    8947           0 :     if( w==90 )
    8948             :     {
    8949           0 :         r = -1.628e+00;
    8950             :     }
    8951           0 :     if( w==89 )
    8952             :     {
    8953           0 :         r = -1.677e+00;
    8954             :     }
    8955           0 :     if( w==88 )
    8956             :     {
    8957           0 :         r = -1.728e+00;
    8958             :     }
    8959           0 :     if( w==87 )
    8960             :     {
    8961           0 :         r = -1.779e+00;
    8962             :     }
    8963           0 :     if( w==86 )
    8964             :     {
    8965           0 :         r = -1.831e+00;
    8966             :     }
    8967           0 :     if( w==85 )
    8968             :     {
    8969           0 :         r = -1.884e+00;
    8970             :     }
    8971           0 :     if( w==84 )
    8972             :     {
    8973           0 :         r = -1.939e+00;
    8974             :     }
    8975           0 :     if( w==83 )
    8976             :     {
    8977           0 :         r = -1.994e+00;
    8978             :     }
    8979           0 :     if( w==82 )
    8980             :     {
    8981           0 :         r = -2.051e+00;
    8982             :     }
    8983           0 :     if( w==81 )
    8984             :     {
    8985           0 :         r = -2.108e+00;
    8986             :     }
    8987           0 :     if( w==80 )
    8988             :     {
    8989           0 :         r = -2.167e+00;
    8990             :     }
    8991           0 :     if( w==79 )
    8992             :     {
    8993           0 :         r = -2.227e+00;
    8994             :     }
    8995           0 :     if( w==78 )
    8996             :     {
    8997           0 :         r = -2.288e+00;
    8998             :     }
    8999           0 :     if( w==77 )
    9000             :     {
    9001           0 :         r = -2.350e+00;
    9002             :     }
    9003           0 :     if( w==76 )
    9004             :     {
    9005           0 :         r = -2.414e+00;
    9006             :     }
    9007           0 :     if( w==75 )
    9008             :     {
    9009           0 :         r = -2.478e+00;
    9010             :     }
    9011           0 :     if( w==74 )
    9012             :     {
    9013           0 :         r = -2.544e+00;
    9014             :     }
    9015           0 :     if( w==73 )
    9016             :     {
    9017           0 :         r = -2.611e+00;
    9018             :     }
    9019           0 :     if( w==72 )
    9020             :     {
    9021           0 :         r = -2.679e+00;
    9022             :     }
    9023           0 :     if( w==71 )
    9024             :     {
    9025           0 :         r = -2.748e+00;
    9026             :     }
    9027           0 :     if( w==70 )
    9028             :     {
    9029           0 :         r = -2.819e+00;
    9030             :     }
    9031           0 :     if( w==69 )
    9032             :     {
    9033           0 :         r = -2.891e+00;
    9034             :     }
    9035           0 :     if( w==68 )
    9036             :     {
    9037           0 :         r = -2.964e+00;
    9038             :     }
    9039           0 :     if( w==67 )
    9040             :     {
    9041           0 :         r = -3.039e+00;
    9042             :     }
    9043           0 :     if( w==66 )
    9044             :     {
    9045           0 :         r = -3.115e+00;
    9046             :     }
    9047           0 :     if( w==65 )
    9048             :     {
    9049           0 :         r = -3.192e+00;
    9050             :     }
    9051           0 :     if( w==64 )
    9052             :     {
    9053           0 :         r = -3.270e+00;
    9054             :     }
    9055           0 :     if( w==63 )
    9056             :     {
    9057           0 :         r = -3.350e+00;
    9058             :     }
    9059           0 :     if( w==62 )
    9060             :     {
    9061           0 :         r = -3.432e+00;
    9062             :     }
    9063           0 :     if( w==61 )
    9064             :     {
    9065           0 :         r = -3.515e+00;
    9066             :     }
    9067           0 :     if( w==60 )
    9068             :     {
    9069           0 :         r = -3.599e+00;
    9070             :     }
    9071           0 :     if( w==59 )
    9072             :     {
    9073           0 :         r = -3.685e+00;
    9074             :     }
    9075           0 :     if( w==58 )
    9076             :     {
    9077           0 :         r = -3.772e+00;
    9078             :     }
    9079           0 :     if( w==57 )
    9080             :     {
    9081           0 :         r = -3.861e+00;
    9082             :     }
    9083           0 :     if( w==56 )
    9084             :     {
    9085           0 :         r = -3.952e+00;
    9086             :     }
    9087           0 :     if( w==55 )
    9088             :     {
    9089           0 :         r = -4.044e+00;
    9090             :     }
    9091           0 :     if( w==54 )
    9092             :     {
    9093           0 :         r = -4.138e+00;
    9094             :     }
    9095           0 :     if( w==53 )
    9096             :     {
    9097           0 :         r = -4.233e+00;
    9098             :     }
    9099           0 :     if( w==52 )
    9100             :     {
    9101           0 :         r = -4.330e+00;
    9102             :     }
    9103           0 :     if( w==51 )
    9104             :     {
    9105           0 :         r = -4.429e+00;
    9106             :     }
    9107           0 :     if( w==50 )
    9108             :     {
    9109           0 :         r = -4.530e+00;
    9110             :     }
    9111           0 :     if( w==49 )
    9112             :     {
    9113           0 :         r = -4.632e+00;
    9114             :     }
    9115           0 :     if( w==48 )
    9116             :     {
    9117           0 :         r = -4.736e+00;
    9118             :     }
    9119           0 :     if( w==47 )
    9120             :     {
    9121           0 :         r = -4.842e+00;
    9122             :     }
    9123           0 :     if( w==46 )
    9124             :     {
    9125           0 :         r = -4.950e+00;
    9126             :     }
    9127           0 :     if( w==45 )
    9128             :     {
    9129           0 :         r = -5.060e+00;
    9130             :     }
    9131           0 :     if( w==44 )
    9132             :     {
    9133           0 :         r = -5.172e+00;
    9134             :     }
    9135           0 :     if( w==43 )
    9136             :     {
    9137           0 :         r = -5.286e+00;
    9138             :     }
    9139           0 :     if( w==42 )
    9140             :     {
    9141           0 :         r = -5.402e+00;
    9142             :     }
    9143           0 :     if( w==41 )
    9144             :     {
    9145           0 :         r = -5.520e+00;
    9146             :     }
    9147           0 :     if( w==40 )
    9148             :     {
    9149           0 :         r = -5.641e+00;
    9150             :     }
    9151           0 :     if( w==39 )
    9152             :     {
    9153           0 :         r = -5.763e+00;
    9154             :     }
    9155           0 :     if( w==38 )
    9156             :     {
    9157           0 :         r = -5.889e+00;
    9158             :     }
    9159           0 :     if( w==37 )
    9160             :     {
    9161           0 :         r = -6.016e+00;
    9162             :     }
    9163           0 :     if( w==36 )
    9164             :     {
    9165           0 :         r = -6.146e+00;
    9166             :     }
    9167           0 :     if( w==35 )
    9168             :     {
    9169           0 :         r = -6.278e+00;
    9170             :     }
    9171           0 :     if( w==34 )
    9172             :     {
    9173           0 :         r = -6.413e+00;
    9174             :     }
    9175           0 :     if( w==33 )
    9176             :     {
    9177           0 :         r = -6.551e+00;
    9178             :     }
    9179           0 :     if( w==32 )
    9180             :     {
    9181           0 :         r = -6.692e+00;
    9182             :     }
    9183           0 :     if( w==31 )
    9184             :     {
    9185           0 :         r = -6.835e+00;
    9186             :     }
    9187           0 :     if( w==30 )
    9188             :     {
    9189           0 :         r = -6.981e+00;
    9190             :     }
    9191           0 :     if( w==29 )
    9192             :     {
    9193           0 :         r = -7.131e+00;
    9194             :     }
    9195           0 :     if( w==28 )
    9196             :     {
    9197           0 :         r = -7.283e+00;
    9198             :     }
    9199           0 :     if( w==27 )
    9200             :     {
    9201           0 :         r = -7.439e+00;
    9202             :     }
    9203           0 :     if( w==26 )
    9204             :     {
    9205           0 :         r = -7.599e+00;
    9206             :     }
    9207           0 :     if( w==25 )
    9208             :     {
    9209           0 :         r = -7.762e+00;
    9210             :     }
    9211           0 :     if( w==24 )
    9212             :     {
    9213           0 :         r = -7.928e+00;
    9214             :     }
    9215           0 :     if( w==23 )
    9216             :     {
    9217           0 :         r = -8.099e+00;
    9218             :     }
    9219           0 :     if( w==22 )
    9220             :     {
    9221           0 :         r = -8.274e+00;
    9222             :     }
    9223           0 :     if( w==21 )
    9224             :     {
    9225           0 :         r = -8.454e+00;
    9226             :     }
    9227           0 :     if( w==20 )
    9228             :     {
    9229           0 :         r = -8.640e+00;
    9230             :     }
    9231           0 :     if( w==19 )
    9232             :     {
    9233           0 :         r = -8.829e+00;
    9234             :     }
    9235           0 :     if( w==18 )
    9236             :     {
    9237           0 :         r = -9.023e+00;
    9238             :     }
    9239           0 :     if( w==17 )
    9240             :     {
    9241           0 :         r = -9.223e+00;
    9242             :     }
    9243           0 :     if( w==16 )
    9244             :     {
    9245           0 :         r = -9.426e+00;
    9246             :     }
    9247           0 :     if( w==15 )
    9248             :     {
    9249           0 :         r = -9.636e+00;
    9250             :     }
    9251           0 :     if( w==14 )
    9252             :     {
    9253           0 :         r = -9.856e+00;
    9254             :     }
    9255           0 :     if( w==13 )
    9256             :     {
    9257           0 :         r = -1.008e+01;
    9258             :     }
    9259           0 :     if( w==12 )
    9260             :     {
    9261           0 :         r = -1.031e+01;
    9262             :     }
    9263           0 :     if( w==11 )
    9264             :     {
    9265           0 :         r = -1.055e+01;
    9266             :     }
    9267           0 :     if( w==10 )
    9268             :     {
    9269           0 :         r = -1.079e+01;
    9270             :     }
    9271           0 :     if( w==9 )
    9272             :     {
    9273           0 :         r = -1.106e+01;
    9274             :     }
    9275           0 :     if( w==8 )
    9276             :     {
    9277           0 :         r = -1.134e+01;
    9278             :     }
    9279           0 :     if( w==7 )
    9280             :     {
    9281           0 :         r = -1.161e+01;
    9282             :     }
    9283           0 :     if( w==6 )
    9284             :     {
    9285           0 :         r = -1.192e+01;
    9286             :     }
    9287           0 :     if( w==5 )
    9288             :     {
    9289           0 :         r = -1.225e+01;
    9290             :     }
    9291           0 :     if( w==4 )
    9292             :     {
    9293           0 :         r = -1.261e+01;
    9294             :     }
    9295           0 :     if( w==3 )
    9296             :     {
    9297           0 :         r = -1.295e+01;
    9298             :     }
    9299           0 :     if( w==2 )
    9300             :     {
    9301           0 :         r = -1.346e+01;
    9302             :     }
    9303           0 :     if( w==1 )
    9304             :     {
    9305           0 :         r = -1.386e+01;
    9306             :     }
    9307           0 :     if( w<=0 )
    9308             :     {
    9309           0 :         r = -1.456e+01;
    9310             :     }
    9311           0 :     result = r;
    9312           0 :     return result;
    9313             : }
    9314             : 
    9315             : 
    9316             : /*************************************************************************
    9317             : Tail(S, 22)
    9318             : *************************************************************************/
    9319           0 : static double wsr_w22(double s, ae_state *_state)
    9320             : {
    9321             :     ae_int_t w;
    9322             :     double r;
    9323             :     double result;
    9324             : 
    9325             : 
    9326           0 :     r = (double)(0);
    9327           0 :     w = ae_round(-3.080179e+01*s+1.265000e+02, _state);
    9328           0 :     if( w>=126 )
    9329             :     {
    9330           0 :         r = -6.931e-01;
    9331             :     }
    9332           0 :     if( w==125 )
    9333             :     {
    9334           0 :         r = -7.189e-01;
    9335             :     }
    9336           0 :     if( w==124 )
    9337             :     {
    9338           0 :         r = -7.452e-01;
    9339             :     }
    9340           0 :     if( w==123 )
    9341             :     {
    9342           0 :         r = -7.722e-01;
    9343             :     }
    9344           0 :     if( w==122 )
    9345             :     {
    9346           0 :         r = -7.999e-01;
    9347             :     }
    9348           0 :     if( w==121 )
    9349             :     {
    9350           0 :         r = -8.283e-01;
    9351             :     }
    9352           0 :     if( w==120 )
    9353             :     {
    9354           0 :         r = -8.573e-01;
    9355             :     }
    9356           0 :     if( w==119 )
    9357             :     {
    9358           0 :         r = -8.871e-01;
    9359             :     }
    9360           0 :     if( w==118 )
    9361             :     {
    9362           0 :         r = -9.175e-01;
    9363             :     }
    9364           0 :     if( w==117 )
    9365             :     {
    9366           0 :         r = -9.486e-01;
    9367             :     }
    9368           0 :     if( w==116 )
    9369             :     {
    9370           0 :         r = -9.805e-01;
    9371             :     }
    9372           0 :     if( w==115 )
    9373             :     {
    9374           0 :         r = -1.013e+00;
    9375             :     }
    9376           0 :     if( w==114 )
    9377             :     {
    9378           0 :         r = -1.046e+00;
    9379             :     }
    9380           0 :     if( w==113 )
    9381             :     {
    9382           0 :         r = -1.080e+00;
    9383             :     }
    9384           0 :     if( w==112 )
    9385             :     {
    9386           0 :         r = -1.115e+00;
    9387             :     }
    9388           0 :     if( w==111 )
    9389             :     {
    9390           0 :         r = -1.151e+00;
    9391             :     }
    9392           0 :     if( w==110 )
    9393             :     {
    9394           0 :         r = -1.187e+00;
    9395             :     }
    9396           0 :     if( w==109 )
    9397             :     {
    9398           0 :         r = -1.224e+00;
    9399             :     }
    9400           0 :     if( w==108 )
    9401             :     {
    9402           0 :         r = -1.262e+00;
    9403             :     }
    9404           0 :     if( w==107 )
    9405             :     {
    9406           0 :         r = -1.301e+00;
    9407             :     }
    9408           0 :     if( w==106 )
    9409             :     {
    9410           0 :         r = -1.340e+00;
    9411             :     }
    9412           0 :     if( w==105 )
    9413             :     {
    9414           0 :         r = -1.381e+00;
    9415             :     }
    9416           0 :     if( w==104 )
    9417             :     {
    9418           0 :         r = -1.422e+00;
    9419             :     }
    9420           0 :     if( w==103 )
    9421             :     {
    9422           0 :         r = -1.464e+00;
    9423             :     }
    9424           0 :     if( w==102 )
    9425             :     {
    9426           0 :         r = -1.506e+00;
    9427             :     }
    9428           0 :     if( w==101 )
    9429             :     {
    9430           0 :         r = -1.550e+00;
    9431             :     }
    9432           0 :     if( w==100 )
    9433             :     {
    9434           0 :         r = -1.594e+00;
    9435             :     }
    9436           0 :     if( w==99 )
    9437             :     {
    9438           0 :         r = -1.640e+00;
    9439             :     }
    9440           0 :     if( w==98 )
    9441             :     {
    9442           0 :         r = -1.686e+00;
    9443             :     }
    9444           0 :     if( w==97 )
    9445             :     {
    9446           0 :         r = -1.733e+00;
    9447             :     }
    9448           0 :     if( w==96 )
    9449             :     {
    9450           0 :         r = -1.781e+00;
    9451             :     }
    9452           0 :     if( w==95 )
    9453             :     {
    9454           0 :         r = -1.830e+00;
    9455             :     }
    9456           0 :     if( w==94 )
    9457             :     {
    9458           0 :         r = -1.880e+00;
    9459             :     }
    9460           0 :     if( w==93 )
    9461             :     {
    9462           0 :         r = -1.930e+00;
    9463             :     }
    9464           0 :     if( w==92 )
    9465             :     {
    9466           0 :         r = -1.982e+00;
    9467             :     }
    9468           0 :     if( w==91 )
    9469             :     {
    9470           0 :         r = -2.034e+00;
    9471             :     }
    9472           0 :     if( w==90 )
    9473             :     {
    9474           0 :         r = -2.088e+00;
    9475             :     }
    9476           0 :     if( w==89 )
    9477             :     {
    9478           0 :         r = -2.142e+00;
    9479             :     }
    9480           0 :     if( w==88 )
    9481             :     {
    9482           0 :         r = -2.198e+00;
    9483             :     }
    9484           0 :     if( w==87 )
    9485             :     {
    9486           0 :         r = -2.254e+00;
    9487             :     }
    9488           0 :     if( w==86 )
    9489             :     {
    9490           0 :         r = -2.312e+00;
    9491             :     }
    9492           0 :     if( w==85 )
    9493             :     {
    9494           0 :         r = -2.370e+00;
    9495             :     }
    9496           0 :     if( w==84 )
    9497             :     {
    9498           0 :         r = -2.429e+00;
    9499             :     }
    9500           0 :     if( w==83 )
    9501             :     {
    9502           0 :         r = -2.490e+00;
    9503             :     }
    9504           0 :     if( w==82 )
    9505             :     {
    9506           0 :         r = -2.551e+00;
    9507             :     }
    9508           0 :     if( w==81 )
    9509             :     {
    9510           0 :         r = -2.614e+00;
    9511             :     }
    9512           0 :     if( w==80 )
    9513             :     {
    9514           0 :         r = -2.677e+00;
    9515             :     }
    9516           0 :     if( w==79 )
    9517             :     {
    9518           0 :         r = -2.742e+00;
    9519             :     }
    9520           0 :     if( w==78 )
    9521             :     {
    9522           0 :         r = -2.808e+00;
    9523             :     }
    9524           0 :     if( w==77 )
    9525             :     {
    9526           0 :         r = -2.875e+00;
    9527             :     }
    9528           0 :     if( w==76 )
    9529             :     {
    9530           0 :         r = -2.943e+00;
    9531             :     }
    9532           0 :     if( w==75 )
    9533             :     {
    9534           0 :         r = -3.012e+00;
    9535             :     }
    9536           0 :     if( w==74 )
    9537             :     {
    9538           0 :         r = -3.082e+00;
    9539             :     }
    9540           0 :     if( w==73 )
    9541             :     {
    9542           0 :         r = -3.153e+00;
    9543             :     }
    9544           0 :     if( w==72 )
    9545             :     {
    9546           0 :         r = -3.226e+00;
    9547             :     }
    9548           0 :     if( w==71 )
    9549             :     {
    9550           0 :         r = -3.300e+00;
    9551             :     }
    9552           0 :     if( w==70 )
    9553             :     {
    9554           0 :         r = -3.375e+00;
    9555             :     }
    9556           0 :     if( w==69 )
    9557             :     {
    9558           0 :         r = -3.451e+00;
    9559             :     }
    9560           0 :     if( w==68 )
    9561             :     {
    9562           0 :         r = -3.529e+00;
    9563             :     }
    9564           0 :     if( w==67 )
    9565             :     {
    9566           0 :         r = -3.607e+00;
    9567             :     }
    9568           0 :     if( w==66 )
    9569             :     {
    9570           0 :         r = -3.687e+00;
    9571             :     }
    9572           0 :     if( w==65 )
    9573             :     {
    9574           0 :         r = -3.769e+00;
    9575             :     }
    9576           0 :     if( w==64 )
    9577             :     {
    9578           0 :         r = -3.851e+00;
    9579             :     }
    9580           0 :     if( w==63 )
    9581             :     {
    9582           0 :         r = -3.935e+00;
    9583             :     }
    9584           0 :     if( w==62 )
    9585             :     {
    9586           0 :         r = -4.021e+00;
    9587             :     }
    9588           0 :     if( w==61 )
    9589             :     {
    9590           0 :         r = -4.108e+00;
    9591             :     }
    9592           0 :     if( w==60 )
    9593             :     {
    9594           0 :         r = -4.196e+00;
    9595             :     }
    9596           0 :     if( w==59 )
    9597             :     {
    9598           0 :         r = -4.285e+00;
    9599             :     }
    9600           0 :     if( w==58 )
    9601             :     {
    9602           0 :         r = -4.376e+00;
    9603             :     }
    9604           0 :     if( w==57 )
    9605             :     {
    9606           0 :         r = -4.469e+00;
    9607             :     }
    9608           0 :     if( w==56 )
    9609             :     {
    9610           0 :         r = -4.563e+00;
    9611             :     }
    9612           0 :     if( w==55 )
    9613             :     {
    9614           0 :         r = -4.659e+00;
    9615             :     }
    9616           0 :     if( w==54 )
    9617             :     {
    9618           0 :         r = -4.756e+00;
    9619             :     }
    9620           0 :     if( w==53 )
    9621             :     {
    9622           0 :         r = -4.855e+00;
    9623             :     }
    9624           0 :     if( w==52 )
    9625             :     {
    9626           0 :         r = -4.955e+00;
    9627             :     }
    9628           0 :     if( w==51 )
    9629             :     {
    9630           0 :         r = -5.057e+00;
    9631             :     }
    9632           0 :     if( w==50 )
    9633             :     {
    9634           0 :         r = -5.161e+00;
    9635             :     }
    9636           0 :     if( w==49 )
    9637             :     {
    9638           0 :         r = -5.266e+00;
    9639             :     }
    9640           0 :     if( w==48 )
    9641             :     {
    9642           0 :         r = -5.374e+00;
    9643             :     }
    9644           0 :     if( w==47 )
    9645             :     {
    9646           0 :         r = -5.483e+00;
    9647             :     }
    9648           0 :     if( w==46 )
    9649             :     {
    9650           0 :         r = -5.594e+00;
    9651             :     }
    9652           0 :     if( w==45 )
    9653             :     {
    9654           0 :         r = -5.706e+00;
    9655             :     }
    9656           0 :     if( w==44 )
    9657             :     {
    9658           0 :         r = -5.821e+00;
    9659             :     }
    9660           0 :     if( w==43 )
    9661             :     {
    9662           0 :         r = -5.938e+00;
    9663             :     }
    9664           0 :     if( w==42 )
    9665             :     {
    9666           0 :         r = -6.057e+00;
    9667             :     }
    9668           0 :     if( w==41 )
    9669             :     {
    9670           0 :         r = -6.177e+00;
    9671             :     }
    9672           0 :     if( w==40 )
    9673             :     {
    9674           0 :         r = -6.300e+00;
    9675             :     }
    9676           0 :     if( w==39 )
    9677             :     {
    9678           0 :         r = -6.426e+00;
    9679             :     }
    9680           0 :     if( w==38 )
    9681             :     {
    9682           0 :         r = -6.553e+00;
    9683             :     }
    9684           0 :     if( w==37 )
    9685             :     {
    9686           0 :         r = -6.683e+00;
    9687             :     }
    9688           0 :     if( w==36 )
    9689             :     {
    9690           0 :         r = -6.815e+00;
    9691             :     }
    9692           0 :     if( w==35 )
    9693             :     {
    9694           0 :         r = -6.949e+00;
    9695             :     }
    9696           0 :     if( w==34 )
    9697             :     {
    9698           0 :         r = -7.086e+00;
    9699             :     }
    9700           0 :     if( w==33 )
    9701             :     {
    9702           0 :         r = -7.226e+00;
    9703             :     }
    9704           0 :     if( w==32 )
    9705             :     {
    9706           0 :         r = -7.368e+00;
    9707             :     }
    9708           0 :     if( w==31 )
    9709             :     {
    9710           0 :         r = -7.513e+00;
    9711             :     }
    9712           0 :     if( w==30 )
    9713             :     {
    9714           0 :         r = -7.661e+00;
    9715             :     }
    9716           0 :     if( w==29 )
    9717             :     {
    9718           0 :         r = -7.813e+00;
    9719             :     }
    9720           0 :     if( w==28 )
    9721             :     {
    9722           0 :         r = -7.966e+00;
    9723             :     }
    9724           0 :     if( w==27 )
    9725             :     {
    9726           0 :         r = -8.124e+00;
    9727             :     }
    9728           0 :     if( w==26 )
    9729             :     {
    9730           0 :         r = -8.285e+00;
    9731             :     }
    9732           0 :     if( w==25 )
    9733             :     {
    9734           0 :         r = -8.449e+00;
    9735             :     }
    9736           0 :     if( w==24 )
    9737             :     {
    9738           0 :         r = -8.617e+00;
    9739             :     }
    9740           0 :     if( w==23 )
    9741             :     {
    9742           0 :         r = -8.789e+00;
    9743             :     }
    9744           0 :     if( w==22 )
    9745             :     {
    9746           0 :         r = -8.965e+00;
    9747             :     }
    9748           0 :     if( w==21 )
    9749             :     {
    9750           0 :         r = -9.147e+00;
    9751             :     }
    9752           0 :     if( w==20 )
    9753             :     {
    9754           0 :         r = -9.333e+00;
    9755             :     }
    9756           0 :     if( w==19 )
    9757             :     {
    9758           0 :         r = -9.522e+00;
    9759             :     }
    9760           0 :     if( w==18 )
    9761             :     {
    9762           0 :         r = -9.716e+00;
    9763             :     }
    9764           0 :     if( w==17 )
    9765             :     {
    9766           0 :         r = -9.917e+00;
    9767             :     }
    9768           0 :     if( w==16 )
    9769             :     {
    9770           0 :         r = -1.012e+01;
    9771             :     }
    9772           0 :     if( w==15 )
    9773             :     {
    9774           0 :         r = -1.033e+01;
    9775             :     }
    9776           0 :     if( w==14 )
    9777             :     {
    9778           0 :         r = -1.055e+01;
    9779             :     }
    9780           0 :     if( w==13 )
    9781             :     {
    9782           0 :         r = -1.077e+01;
    9783             :     }
    9784           0 :     if( w==12 )
    9785             :     {
    9786           0 :         r = -1.100e+01;
    9787             :     }
    9788           0 :     if( w==11 )
    9789             :     {
    9790           0 :         r = -1.124e+01;
    9791             :     }
    9792           0 :     if( w==10 )
    9793             :     {
    9794           0 :         r = -1.149e+01;
    9795             :     }
    9796           0 :     if( w==9 )
    9797             :     {
    9798           0 :         r = -1.175e+01;
    9799             :     }
    9800           0 :     if( w==8 )
    9801             :     {
    9802           0 :         r = -1.203e+01;
    9803             :     }
    9804           0 :     if( w==7 )
    9805             :     {
    9806           0 :         r = -1.230e+01;
    9807             :     }
    9808           0 :     if( w==6 )
    9809             :     {
    9810           0 :         r = -1.261e+01;
    9811             :     }
    9812           0 :     if( w==5 )
    9813             :     {
    9814           0 :         r = -1.295e+01;
    9815             :     }
    9816           0 :     if( w==4 )
    9817             :     {
    9818           0 :         r = -1.330e+01;
    9819             :     }
    9820           0 :     if( w==3 )
    9821             :     {
    9822           0 :         r = -1.364e+01;
    9823             :     }
    9824           0 :     if( w==2 )
    9825             :     {
    9826           0 :         r = -1.415e+01;
    9827             :     }
    9828           0 :     if( w==1 )
    9829             :     {
    9830           0 :         r = -1.456e+01;
    9831             :     }
    9832           0 :     if( w<=0 )
    9833             :     {
    9834           0 :         r = -1.525e+01;
    9835             :     }
    9836           0 :     result = r;
    9837           0 :     return result;
    9838             : }
    9839             : 
    9840             : 
    9841             : /*************************************************************************
    9842             : Tail(S, 23)
    9843             : *************************************************************************/
    9844           0 : static double wsr_w23(double s, ae_state *_state)
    9845             : {
    9846             :     ae_int_t w;
    9847             :     double r;
    9848             :     double result;
    9849             : 
    9850             : 
    9851           0 :     r = (double)(0);
    9852           0 :     w = ae_round(-3.287856e+01*s+1.380000e+02, _state);
    9853           0 :     if( w>=138 )
    9854             :     {
    9855           0 :         r = -6.813e-01;
    9856             :     }
    9857           0 :     if( w==137 )
    9858             :     {
    9859           0 :         r = -7.051e-01;
    9860             :     }
    9861           0 :     if( w==136 )
    9862             :     {
    9863           0 :         r = -7.295e-01;
    9864             :     }
    9865           0 :     if( w==135 )
    9866             :     {
    9867           0 :         r = -7.544e-01;
    9868             :     }
    9869           0 :     if( w==134 )
    9870             :     {
    9871           0 :         r = -7.800e-01;
    9872             :     }
    9873           0 :     if( w==133 )
    9874             :     {
    9875           0 :         r = -8.061e-01;
    9876             :     }
    9877           0 :     if( w==132 )
    9878             :     {
    9879           0 :         r = -8.328e-01;
    9880             :     }
    9881           0 :     if( w==131 )
    9882             :     {
    9883           0 :         r = -8.601e-01;
    9884             :     }
    9885           0 :     if( w==130 )
    9886             :     {
    9887           0 :         r = -8.880e-01;
    9888             :     }
    9889           0 :     if( w==129 )
    9890             :     {
    9891           0 :         r = -9.166e-01;
    9892             :     }
    9893           0 :     if( w==128 )
    9894             :     {
    9895           0 :         r = -9.457e-01;
    9896             :     }
    9897           0 :     if( w==127 )
    9898             :     {
    9899           0 :         r = -9.755e-01;
    9900             :     }
    9901           0 :     if( w==126 )
    9902             :     {
    9903           0 :         r = -1.006e+00;
    9904             :     }
    9905           0 :     if( w==125 )
    9906             :     {
    9907           0 :         r = -1.037e+00;
    9908             :     }
    9909           0 :     if( w==124 )
    9910             :     {
    9911           0 :         r = -1.069e+00;
    9912             :     }
    9913           0 :     if( w==123 )
    9914             :     {
    9915           0 :         r = -1.101e+00;
    9916             :     }
    9917           0 :     if( w==122 )
    9918             :     {
    9919           0 :         r = -1.134e+00;
    9920             :     }
    9921           0 :     if( w==121 )
    9922             :     {
    9923           0 :         r = -1.168e+00;
    9924             :     }
    9925           0 :     if( w==120 )
    9926             :     {
    9927           0 :         r = -1.202e+00;
    9928             :     }
    9929           0 :     if( w==119 )
    9930             :     {
    9931           0 :         r = -1.237e+00;
    9932             :     }
    9933           0 :     if( w==118 )
    9934             :     {
    9935           0 :         r = -1.273e+00;
    9936             :     }
    9937           0 :     if( w==117 )
    9938             :     {
    9939           0 :         r = -1.309e+00;
    9940             :     }
    9941           0 :     if( w==116 )
    9942             :     {
    9943           0 :         r = -1.347e+00;
    9944             :     }
    9945           0 :     if( w==115 )
    9946             :     {
    9947           0 :         r = -1.384e+00;
    9948             :     }
    9949           0 :     if( w==114 )
    9950             :     {
    9951           0 :         r = -1.423e+00;
    9952             :     }
    9953           0 :     if( w==113 )
    9954             :     {
    9955           0 :         r = -1.462e+00;
    9956             :     }
    9957           0 :     if( w==112 )
    9958             :     {
    9959           0 :         r = -1.502e+00;
    9960             :     }
    9961           0 :     if( w==111 )
    9962             :     {
    9963           0 :         r = -1.543e+00;
    9964             :     }
    9965           0 :     if( w==110 )
    9966             :     {
    9967           0 :         r = -1.585e+00;
    9968             :     }
    9969           0 :     if( w==109 )
    9970             :     {
    9971           0 :         r = -1.627e+00;
    9972             :     }
    9973           0 :     if( w==108 )
    9974             :     {
    9975           0 :         r = -1.670e+00;
    9976             :     }
    9977           0 :     if( w==107 )
    9978             :     {
    9979           0 :         r = -1.714e+00;
    9980             :     }
    9981           0 :     if( w==106 )
    9982             :     {
    9983           0 :         r = -1.758e+00;
    9984             :     }
    9985           0 :     if( w==105 )
    9986             :     {
    9987           0 :         r = -1.804e+00;
    9988             :     }
    9989           0 :     if( w==104 )
    9990             :     {
    9991           0 :         r = -1.850e+00;
    9992             :     }
    9993           0 :     if( w==103 )
    9994             :     {
    9995           0 :         r = -1.897e+00;
    9996             :     }
    9997           0 :     if( w==102 )
    9998             :     {
    9999           0 :         r = -1.944e+00;
   10000             :     }
   10001           0 :     if( w==101 )
   10002             :     {
   10003           0 :         r = -1.993e+00;
   10004             :     }
   10005           0 :     if( w==100 )
   10006             :     {
   10007           0 :         r = -2.042e+00;
   10008             :     }
   10009           0 :     if( w==99 )
   10010             :     {
   10011           0 :         r = -2.093e+00;
   10012             :     }
   10013           0 :     if( w==98 )
   10014             :     {
   10015           0 :         r = -2.144e+00;
   10016             :     }
   10017           0 :     if( w==97 )
   10018             :     {
   10019           0 :         r = -2.195e+00;
   10020             :     }
   10021           0 :     if( w==96 )
   10022             :     {
   10023           0 :         r = -2.248e+00;
   10024             :     }
   10025           0 :     if( w==95 )
   10026             :     {
   10027           0 :         r = -2.302e+00;
   10028             :     }
   10029           0 :     if( w==94 )
   10030             :     {
   10031           0 :         r = -2.356e+00;
   10032             :     }
   10033           0 :     if( w==93 )
   10034             :     {
   10035           0 :         r = -2.412e+00;
   10036             :     }
   10037           0 :     if( w==92 )
   10038             :     {
   10039           0 :         r = -2.468e+00;
   10040             :     }
   10041           0 :     if( w==91 )
   10042             :     {
   10043           0 :         r = -2.525e+00;
   10044             :     }
   10045           0 :     if( w==90 )
   10046             :     {
   10047           0 :         r = -2.583e+00;
   10048             :     }
   10049           0 :     if( w==89 )
   10050             :     {
   10051           0 :         r = -2.642e+00;
   10052             :     }
   10053           0 :     if( w==88 )
   10054             :     {
   10055           0 :         r = -2.702e+00;
   10056             :     }
   10057           0 :     if( w==87 )
   10058             :     {
   10059           0 :         r = -2.763e+00;
   10060             :     }
   10061           0 :     if( w==86 )
   10062             :     {
   10063           0 :         r = -2.825e+00;
   10064             :     }
   10065           0 :     if( w==85 )
   10066             :     {
   10067           0 :         r = -2.888e+00;
   10068             :     }
   10069           0 :     if( w==84 )
   10070             :     {
   10071           0 :         r = -2.951e+00;
   10072             :     }
   10073           0 :     if( w==83 )
   10074             :     {
   10075           0 :         r = -3.016e+00;
   10076             :     }
   10077           0 :     if( w==82 )
   10078             :     {
   10079           0 :         r = -3.082e+00;
   10080             :     }
   10081           0 :     if( w==81 )
   10082             :     {
   10083           0 :         r = -3.149e+00;
   10084             :     }
   10085           0 :     if( w==80 )
   10086             :     {
   10087           0 :         r = -3.216e+00;
   10088             :     }
   10089           0 :     if( w==79 )
   10090             :     {
   10091           0 :         r = -3.285e+00;
   10092             :     }
   10093           0 :     if( w==78 )
   10094             :     {
   10095           0 :         r = -3.355e+00;
   10096             :     }
   10097           0 :     if( w==77 )
   10098             :     {
   10099           0 :         r = -3.426e+00;
   10100             :     }
   10101           0 :     if( w==76 )
   10102             :     {
   10103           0 :         r = -3.498e+00;
   10104             :     }
   10105           0 :     if( w==75 )
   10106             :     {
   10107           0 :         r = -3.571e+00;
   10108             :     }
   10109           0 :     if( w==74 )
   10110             :     {
   10111           0 :         r = -3.645e+00;
   10112             :     }
   10113           0 :     if( w==73 )
   10114             :     {
   10115           0 :         r = -3.721e+00;
   10116             :     }
   10117           0 :     if( w==72 )
   10118             :     {
   10119           0 :         r = -3.797e+00;
   10120             :     }
   10121           0 :     if( w==71 )
   10122             :     {
   10123           0 :         r = -3.875e+00;
   10124             :     }
   10125           0 :     if( w==70 )
   10126             :     {
   10127           0 :         r = -3.953e+00;
   10128             :     }
   10129           0 :     if( w==69 )
   10130             :     {
   10131           0 :         r = -4.033e+00;
   10132             :     }
   10133           0 :     if( w==68 )
   10134             :     {
   10135           0 :         r = -4.114e+00;
   10136             :     }
   10137           0 :     if( w==67 )
   10138             :     {
   10139           0 :         r = -4.197e+00;
   10140             :     }
   10141           0 :     if( w==66 )
   10142             :     {
   10143           0 :         r = -4.280e+00;
   10144             :     }
   10145           0 :     if( w==65 )
   10146             :     {
   10147           0 :         r = -4.365e+00;
   10148             :     }
   10149           0 :     if( w==64 )
   10150             :     {
   10151           0 :         r = -4.451e+00;
   10152             :     }
   10153           0 :     if( w==63 )
   10154             :     {
   10155           0 :         r = -4.539e+00;
   10156             :     }
   10157           0 :     if( w==62 )
   10158             :     {
   10159           0 :         r = -4.628e+00;
   10160             :     }
   10161           0 :     if( w==61 )
   10162             :     {
   10163           0 :         r = -4.718e+00;
   10164             :     }
   10165           0 :     if( w==60 )
   10166             :     {
   10167           0 :         r = -4.809e+00;
   10168             :     }
   10169           0 :     if( w==59 )
   10170             :     {
   10171           0 :         r = -4.902e+00;
   10172             :     }
   10173           0 :     if( w==58 )
   10174             :     {
   10175           0 :         r = -4.996e+00;
   10176             :     }
   10177           0 :     if( w==57 )
   10178             :     {
   10179           0 :         r = -5.092e+00;
   10180             :     }
   10181           0 :     if( w==56 )
   10182             :     {
   10183           0 :         r = -5.189e+00;
   10184             :     }
   10185           0 :     if( w==55 )
   10186             :     {
   10187           0 :         r = -5.287e+00;
   10188             :     }
   10189           0 :     if( w==54 )
   10190             :     {
   10191           0 :         r = -5.388e+00;
   10192             :     }
   10193           0 :     if( w==53 )
   10194             :     {
   10195           0 :         r = -5.489e+00;
   10196             :     }
   10197           0 :     if( w==52 )
   10198             :     {
   10199           0 :         r = -5.592e+00;
   10200             :     }
   10201           0 :     if( w==51 )
   10202             :     {
   10203           0 :         r = -5.697e+00;
   10204             :     }
   10205           0 :     if( w==50 )
   10206             :     {
   10207           0 :         r = -5.804e+00;
   10208             :     }
   10209           0 :     if( w==49 )
   10210             :     {
   10211           0 :         r = -5.912e+00;
   10212             :     }
   10213           0 :     if( w==48 )
   10214             :     {
   10215           0 :         r = -6.022e+00;
   10216             :     }
   10217           0 :     if( w==47 )
   10218             :     {
   10219           0 :         r = -6.133e+00;
   10220             :     }
   10221           0 :     if( w==46 )
   10222             :     {
   10223           0 :         r = -6.247e+00;
   10224             :     }
   10225           0 :     if( w==45 )
   10226             :     {
   10227           0 :         r = -6.362e+00;
   10228             :     }
   10229           0 :     if( w==44 )
   10230             :     {
   10231           0 :         r = -6.479e+00;
   10232             :     }
   10233           0 :     if( w==43 )
   10234             :     {
   10235           0 :         r = -6.598e+00;
   10236             :     }
   10237           0 :     if( w==42 )
   10238             :     {
   10239           0 :         r = -6.719e+00;
   10240             :     }
   10241           0 :     if( w==41 )
   10242             :     {
   10243           0 :         r = -6.842e+00;
   10244             :     }
   10245           0 :     if( w==40 )
   10246             :     {
   10247           0 :         r = -6.967e+00;
   10248             :     }
   10249           0 :     if( w==39 )
   10250             :     {
   10251           0 :         r = -7.094e+00;
   10252             :     }
   10253           0 :     if( w==38 )
   10254             :     {
   10255           0 :         r = -7.224e+00;
   10256             :     }
   10257           0 :     if( w==37 )
   10258             :     {
   10259           0 :         r = -7.355e+00;
   10260             :     }
   10261           0 :     if( w==36 )
   10262             :     {
   10263           0 :         r = -7.489e+00;
   10264             :     }
   10265           0 :     if( w==35 )
   10266             :     {
   10267           0 :         r = -7.625e+00;
   10268             :     }
   10269           0 :     if( w==34 )
   10270             :     {
   10271           0 :         r = -7.764e+00;
   10272             :     }
   10273           0 :     if( w==33 )
   10274             :     {
   10275           0 :         r = -7.905e+00;
   10276             :     }
   10277           0 :     if( w==32 )
   10278             :     {
   10279           0 :         r = -8.049e+00;
   10280             :     }
   10281           0 :     if( w==31 )
   10282             :     {
   10283           0 :         r = -8.196e+00;
   10284             :     }
   10285           0 :     if( w==30 )
   10286             :     {
   10287           0 :         r = -8.345e+00;
   10288             :     }
   10289           0 :     if( w==29 )
   10290             :     {
   10291           0 :         r = -8.498e+00;
   10292             :     }
   10293           0 :     if( w==28 )
   10294             :     {
   10295           0 :         r = -8.653e+00;
   10296             :     }
   10297           0 :     if( w==27 )
   10298             :     {
   10299           0 :         r = -8.811e+00;
   10300             :     }
   10301           0 :     if( w==26 )
   10302             :     {
   10303           0 :         r = -8.974e+00;
   10304             :     }
   10305           0 :     if( w==25 )
   10306             :     {
   10307           0 :         r = -9.139e+00;
   10308             :     }
   10309           0 :     if( w==24 )
   10310             :     {
   10311           0 :         r = -9.308e+00;
   10312             :     }
   10313           0 :     if( w==23 )
   10314             :     {
   10315           0 :         r = -9.481e+00;
   10316             :     }
   10317           0 :     if( w==22 )
   10318             :     {
   10319           0 :         r = -9.658e+00;
   10320             :     }
   10321           0 :     if( w==21 )
   10322             :     {
   10323           0 :         r = -9.840e+00;
   10324             :     }
   10325           0 :     if( w==20 )
   10326             :     {
   10327           0 :         r = -1.003e+01;
   10328             :     }
   10329           0 :     if( w==19 )
   10330             :     {
   10331           0 :         r = -1.022e+01;
   10332             :     }
   10333           0 :     if( w==18 )
   10334             :     {
   10335           0 :         r = -1.041e+01;
   10336             :     }
   10337           0 :     if( w==17 )
   10338             :     {
   10339           0 :         r = -1.061e+01;
   10340             :     }
   10341           0 :     if( w==16 )
   10342             :     {
   10343           0 :         r = -1.081e+01;
   10344             :     }
   10345           0 :     if( w==15 )
   10346             :     {
   10347           0 :         r = -1.102e+01;
   10348             :     }
   10349           0 :     if( w==14 )
   10350             :     {
   10351           0 :         r = -1.124e+01;
   10352             :     }
   10353           0 :     if( w==13 )
   10354             :     {
   10355           0 :         r = -1.147e+01;
   10356             :     }
   10357           0 :     if( w==12 )
   10358             :     {
   10359           0 :         r = -1.169e+01;
   10360             :     }
   10361           0 :     if( w==11 )
   10362             :     {
   10363           0 :         r = -1.194e+01;
   10364             :     }
   10365           0 :     if( w==10 )
   10366             :     {
   10367           0 :         r = -1.218e+01;
   10368             :     }
   10369           0 :     if( w==9 )
   10370             :     {
   10371           0 :         r = -1.245e+01;
   10372             :     }
   10373           0 :     if( w==8 )
   10374             :     {
   10375           0 :         r = -1.272e+01;
   10376             :     }
   10377           0 :     if( w==7 )
   10378             :     {
   10379           0 :         r = -1.300e+01;
   10380             :     }
   10381           0 :     if( w==6 )
   10382             :     {
   10383           0 :         r = -1.330e+01;
   10384             :     }
   10385           0 :     if( w==5 )
   10386             :     {
   10387           0 :         r = -1.364e+01;
   10388             :     }
   10389           0 :     if( w==4 )
   10390             :     {
   10391           0 :         r = -1.400e+01;
   10392             :     }
   10393           0 :     if( w==3 )
   10394             :     {
   10395           0 :         r = -1.433e+01;
   10396             :     }
   10397           0 :     if( w==2 )
   10398             :     {
   10399           0 :         r = -1.484e+01;
   10400             :     }
   10401           0 :     if( w==1 )
   10402             :     {
   10403           0 :         r = -1.525e+01;
   10404             :     }
   10405           0 :     if( w<=0 )
   10406             :     {
   10407           0 :         r = -1.594e+01;
   10408             :     }
   10409           0 :     result = r;
   10410           0 :     return result;
   10411             : }
   10412             : 
   10413             : 
   10414             : /*************************************************************************
   10415             : Tail(S, 24)
   10416             : *************************************************************************/
   10417           0 : static double wsr_w24(double s, ae_state *_state)
   10418             : {
   10419             :     ae_int_t w;
   10420             :     double r;
   10421             :     double result;
   10422             : 
   10423             : 
   10424           0 :     r = (double)(0);
   10425           0 :     w = ae_round(-3.500000e+01*s+1.500000e+02, _state);
   10426           0 :     if( w>=150 )
   10427             :     {
   10428           0 :         r = -6.820e-01;
   10429             :     }
   10430           0 :     if( w==149 )
   10431             :     {
   10432           0 :         r = -7.044e-01;
   10433             :     }
   10434           0 :     if( w==148 )
   10435             :     {
   10436           0 :         r = -7.273e-01;
   10437             :     }
   10438           0 :     if( w==147 )
   10439             :     {
   10440           0 :         r = -7.507e-01;
   10441             :     }
   10442           0 :     if( w==146 )
   10443             :     {
   10444           0 :         r = -7.746e-01;
   10445             :     }
   10446           0 :     if( w==145 )
   10447             :     {
   10448           0 :         r = -7.990e-01;
   10449             :     }
   10450           0 :     if( w==144 )
   10451             :     {
   10452           0 :         r = -8.239e-01;
   10453             :     }
   10454           0 :     if( w==143 )
   10455             :     {
   10456           0 :         r = -8.494e-01;
   10457             :     }
   10458           0 :     if( w==142 )
   10459             :     {
   10460           0 :         r = -8.754e-01;
   10461             :     }
   10462           0 :     if( w==141 )
   10463             :     {
   10464           0 :         r = -9.020e-01;
   10465             :     }
   10466           0 :     if( w==140 )
   10467             :     {
   10468           0 :         r = -9.291e-01;
   10469             :     }
   10470           0 :     if( w==139 )
   10471             :     {
   10472           0 :         r = -9.567e-01;
   10473             :     }
   10474           0 :     if( w==138 )
   10475             :     {
   10476           0 :         r = -9.849e-01;
   10477             :     }
   10478           0 :     if( w==137 )
   10479             :     {
   10480           0 :         r = -1.014e+00;
   10481             :     }
   10482           0 :     if( w==136 )
   10483             :     {
   10484           0 :         r = -1.043e+00;
   10485             :     }
   10486           0 :     if( w==135 )
   10487             :     {
   10488           0 :         r = -1.073e+00;
   10489             :     }
   10490           0 :     if( w==134 )
   10491             :     {
   10492           0 :         r = -1.103e+00;
   10493             :     }
   10494           0 :     if( w==133 )
   10495             :     {
   10496           0 :         r = -1.135e+00;
   10497             :     }
   10498           0 :     if( w==132 )
   10499             :     {
   10500           0 :         r = -1.166e+00;
   10501             :     }
   10502           0 :     if( w==131 )
   10503             :     {
   10504           0 :         r = -1.198e+00;
   10505             :     }
   10506           0 :     if( w==130 )
   10507             :     {
   10508           0 :         r = -1.231e+00;
   10509             :     }
   10510           0 :     if( w==129 )
   10511             :     {
   10512           0 :         r = -1.265e+00;
   10513             :     }
   10514           0 :     if( w==128 )
   10515             :     {
   10516           0 :         r = -1.299e+00;
   10517             :     }
   10518           0 :     if( w==127 )
   10519             :     {
   10520           0 :         r = -1.334e+00;
   10521             :     }
   10522           0 :     if( w==126 )
   10523             :     {
   10524           0 :         r = -1.369e+00;
   10525             :     }
   10526           0 :     if( w==125 )
   10527             :     {
   10528           0 :         r = -1.405e+00;
   10529             :     }
   10530           0 :     if( w==124 )
   10531             :     {
   10532           0 :         r = -1.441e+00;
   10533             :     }
   10534           0 :     if( w==123 )
   10535             :     {
   10536           0 :         r = -1.479e+00;
   10537             :     }
   10538           0 :     if( w==122 )
   10539             :     {
   10540           0 :         r = -1.517e+00;
   10541             :     }
   10542           0 :     if( w==121 )
   10543             :     {
   10544           0 :         r = -1.555e+00;
   10545             :     }
   10546           0 :     if( w==120 )
   10547             :     {
   10548           0 :         r = -1.594e+00;
   10549             :     }
   10550           0 :     if( w==119 )
   10551             :     {
   10552           0 :         r = -1.634e+00;
   10553             :     }
   10554           0 :     if( w==118 )
   10555             :     {
   10556           0 :         r = -1.675e+00;
   10557             :     }
   10558           0 :     if( w==117 )
   10559             :     {
   10560           0 :         r = -1.716e+00;
   10561             :     }
   10562           0 :     if( w==116 )
   10563             :     {
   10564           0 :         r = -1.758e+00;
   10565             :     }
   10566           0 :     if( w==115 )
   10567             :     {
   10568           0 :         r = -1.800e+00;
   10569             :     }
   10570           0 :     if( w==114 )
   10571             :     {
   10572           0 :         r = -1.844e+00;
   10573             :     }
   10574           0 :     if( w==113 )
   10575             :     {
   10576           0 :         r = -1.888e+00;
   10577             :     }
   10578           0 :     if( w==112 )
   10579             :     {
   10580           0 :         r = -1.932e+00;
   10581             :     }
   10582           0 :     if( w==111 )
   10583             :     {
   10584           0 :         r = -1.978e+00;
   10585             :     }
   10586           0 :     if( w==110 )
   10587             :     {
   10588           0 :         r = -2.024e+00;
   10589             :     }
   10590           0 :     if( w==109 )
   10591             :     {
   10592           0 :         r = -2.070e+00;
   10593             :     }
   10594           0 :     if( w==108 )
   10595             :     {
   10596           0 :         r = -2.118e+00;
   10597             :     }
   10598           0 :     if( w==107 )
   10599             :     {
   10600           0 :         r = -2.166e+00;
   10601             :     }
   10602           0 :     if( w==106 )
   10603             :     {
   10604           0 :         r = -2.215e+00;
   10605             :     }
   10606           0 :     if( w==105 )
   10607             :     {
   10608           0 :         r = -2.265e+00;
   10609             :     }
   10610           0 :     if( w==104 )
   10611             :     {
   10612           0 :         r = -2.316e+00;
   10613             :     }
   10614           0 :     if( w==103 )
   10615             :     {
   10616           0 :         r = -2.367e+00;
   10617             :     }
   10618           0 :     if( w==102 )
   10619             :     {
   10620           0 :         r = -2.419e+00;
   10621             :     }
   10622           0 :     if( w==101 )
   10623             :     {
   10624           0 :         r = -2.472e+00;
   10625             :     }
   10626           0 :     if( w==100 )
   10627             :     {
   10628           0 :         r = -2.526e+00;
   10629             :     }
   10630           0 :     if( w==99 )
   10631             :     {
   10632           0 :         r = -2.580e+00;
   10633             :     }
   10634           0 :     if( w==98 )
   10635             :     {
   10636           0 :         r = -2.636e+00;
   10637             :     }
   10638           0 :     if( w==97 )
   10639             :     {
   10640           0 :         r = -2.692e+00;
   10641             :     }
   10642           0 :     if( w==96 )
   10643             :     {
   10644           0 :         r = -2.749e+00;
   10645             :     }
   10646           0 :     if( w==95 )
   10647             :     {
   10648           0 :         r = -2.806e+00;
   10649             :     }
   10650           0 :     if( w==94 )
   10651             :     {
   10652           0 :         r = -2.865e+00;
   10653             :     }
   10654           0 :     if( w==93 )
   10655             :     {
   10656           0 :         r = -2.925e+00;
   10657             :     }
   10658           0 :     if( w==92 )
   10659             :     {
   10660           0 :         r = -2.985e+00;
   10661             :     }
   10662           0 :     if( w==91 )
   10663             :     {
   10664           0 :         r = -3.046e+00;
   10665             :     }
   10666           0 :     if( w==90 )
   10667             :     {
   10668           0 :         r = -3.108e+00;
   10669             :     }
   10670           0 :     if( w==89 )
   10671             :     {
   10672           0 :         r = -3.171e+00;
   10673             :     }
   10674           0 :     if( w==88 )
   10675             :     {
   10676           0 :         r = -3.235e+00;
   10677             :     }
   10678           0 :     if( w==87 )
   10679             :     {
   10680           0 :         r = -3.300e+00;
   10681             :     }
   10682           0 :     if( w==86 )
   10683             :     {
   10684           0 :         r = -3.365e+00;
   10685             :     }
   10686           0 :     if( w==85 )
   10687             :     {
   10688           0 :         r = -3.432e+00;
   10689             :     }
   10690           0 :     if( w==84 )
   10691             :     {
   10692           0 :         r = -3.499e+00;
   10693             :     }
   10694           0 :     if( w==83 )
   10695             :     {
   10696           0 :         r = -3.568e+00;
   10697             :     }
   10698           0 :     if( w==82 )
   10699             :     {
   10700           0 :         r = -3.637e+00;
   10701             :     }
   10702           0 :     if( w==81 )
   10703             :     {
   10704           0 :         r = -3.708e+00;
   10705             :     }
   10706           0 :     if( w==80 )
   10707             :     {
   10708           0 :         r = -3.779e+00;
   10709             :     }
   10710           0 :     if( w==79 )
   10711             :     {
   10712           0 :         r = -3.852e+00;
   10713             :     }
   10714           0 :     if( w==78 )
   10715             :     {
   10716           0 :         r = -3.925e+00;
   10717             :     }
   10718           0 :     if( w==77 )
   10719             :     {
   10720           0 :         r = -4.000e+00;
   10721             :     }
   10722           0 :     if( w==76 )
   10723             :     {
   10724           0 :         r = -4.075e+00;
   10725             :     }
   10726           0 :     if( w==75 )
   10727             :     {
   10728           0 :         r = -4.151e+00;
   10729             :     }
   10730           0 :     if( w==74 )
   10731             :     {
   10732           0 :         r = -4.229e+00;
   10733             :     }
   10734           0 :     if( w==73 )
   10735             :     {
   10736           0 :         r = -4.308e+00;
   10737             :     }
   10738           0 :     if( w==72 )
   10739             :     {
   10740           0 :         r = -4.387e+00;
   10741             :     }
   10742           0 :     if( w==71 )
   10743             :     {
   10744           0 :         r = -4.468e+00;
   10745             :     }
   10746           0 :     if( w==70 )
   10747             :     {
   10748           0 :         r = -4.550e+00;
   10749             :     }
   10750           0 :     if( w==69 )
   10751             :     {
   10752           0 :         r = -4.633e+00;
   10753             :     }
   10754           0 :     if( w==68 )
   10755             :     {
   10756           0 :         r = -4.718e+00;
   10757             :     }
   10758           0 :     if( w==67 )
   10759             :     {
   10760           0 :         r = -4.803e+00;
   10761             :     }
   10762           0 :     if( w==66 )
   10763             :     {
   10764           0 :         r = -4.890e+00;
   10765             :     }
   10766           0 :     if( w==65 )
   10767             :     {
   10768           0 :         r = -4.978e+00;
   10769             :     }
   10770           0 :     if( w==64 )
   10771             :     {
   10772           0 :         r = -5.067e+00;
   10773             :     }
   10774           0 :     if( w==63 )
   10775             :     {
   10776           0 :         r = -5.157e+00;
   10777             :     }
   10778           0 :     if( w==62 )
   10779             :     {
   10780           0 :         r = -5.249e+00;
   10781             :     }
   10782           0 :     if( w==61 )
   10783             :     {
   10784           0 :         r = -5.342e+00;
   10785             :     }
   10786           0 :     if( w==60 )
   10787             :     {
   10788           0 :         r = -5.436e+00;
   10789             :     }
   10790           0 :     if( w==59 )
   10791             :     {
   10792           0 :         r = -5.531e+00;
   10793             :     }
   10794           0 :     if( w==58 )
   10795             :     {
   10796           0 :         r = -5.628e+00;
   10797             :     }
   10798           0 :     if( w==57 )
   10799             :     {
   10800           0 :         r = -5.727e+00;
   10801             :     }
   10802           0 :     if( w==56 )
   10803             :     {
   10804           0 :         r = -5.826e+00;
   10805             :     }
   10806           0 :     if( w==55 )
   10807             :     {
   10808           0 :         r = -5.927e+00;
   10809             :     }
   10810           0 :     if( w==54 )
   10811             :     {
   10812           0 :         r = -6.030e+00;
   10813             :     }
   10814           0 :     if( w==53 )
   10815             :     {
   10816           0 :         r = -6.134e+00;
   10817             :     }
   10818           0 :     if( w==52 )
   10819             :     {
   10820           0 :         r = -6.240e+00;
   10821             :     }
   10822           0 :     if( w==51 )
   10823             :     {
   10824           0 :         r = -6.347e+00;
   10825             :     }
   10826           0 :     if( w==50 )
   10827             :     {
   10828           0 :         r = -6.456e+00;
   10829             :     }
   10830           0 :     if( w==49 )
   10831             :     {
   10832           0 :         r = -6.566e+00;
   10833             :     }
   10834           0 :     if( w==48 )
   10835             :     {
   10836           0 :         r = -6.678e+00;
   10837             :     }
   10838           0 :     if( w==47 )
   10839             :     {
   10840           0 :         r = -6.792e+00;
   10841             :     }
   10842           0 :     if( w==46 )
   10843             :     {
   10844           0 :         r = -6.907e+00;
   10845             :     }
   10846           0 :     if( w==45 )
   10847             :     {
   10848           0 :         r = -7.025e+00;
   10849             :     }
   10850           0 :     if( w==44 )
   10851             :     {
   10852           0 :         r = -7.144e+00;
   10853             :     }
   10854           0 :     if( w==43 )
   10855             :     {
   10856           0 :         r = -7.265e+00;
   10857             :     }
   10858           0 :     if( w==42 )
   10859             :     {
   10860           0 :         r = -7.387e+00;
   10861             :     }
   10862           0 :     if( w==41 )
   10863             :     {
   10864           0 :         r = -7.512e+00;
   10865             :     }
   10866           0 :     if( w==40 )
   10867             :     {
   10868           0 :         r = -7.639e+00;
   10869             :     }
   10870           0 :     if( w==39 )
   10871             :     {
   10872           0 :         r = -7.768e+00;
   10873             :     }
   10874           0 :     if( w==38 )
   10875             :     {
   10876           0 :         r = -7.899e+00;
   10877             :     }
   10878           0 :     if( w==37 )
   10879             :     {
   10880           0 :         r = -8.032e+00;
   10881             :     }
   10882           0 :     if( w==36 )
   10883             :     {
   10884           0 :         r = -8.167e+00;
   10885             :     }
   10886           0 :     if( w==35 )
   10887             :     {
   10888           0 :         r = -8.305e+00;
   10889             :     }
   10890           0 :     if( w==34 )
   10891             :     {
   10892           0 :         r = -8.445e+00;
   10893             :     }
   10894           0 :     if( w==33 )
   10895             :     {
   10896           0 :         r = -8.588e+00;
   10897             :     }
   10898           0 :     if( w==32 )
   10899             :     {
   10900           0 :         r = -8.733e+00;
   10901             :     }
   10902           0 :     if( w==31 )
   10903             :     {
   10904           0 :         r = -8.881e+00;
   10905             :     }
   10906           0 :     if( w==30 )
   10907             :     {
   10908           0 :         r = -9.031e+00;
   10909             :     }
   10910           0 :     if( w==29 )
   10911             :     {
   10912           0 :         r = -9.185e+00;
   10913             :     }
   10914           0 :     if( w==28 )
   10915             :     {
   10916           0 :         r = -9.341e+00;
   10917             :     }
   10918           0 :     if( w==27 )
   10919             :     {
   10920           0 :         r = -9.501e+00;
   10921             :     }
   10922           0 :     if( w==26 )
   10923             :     {
   10924           0 :         r = -9.664e+00;
   10925             :     }
   10926           0 :     if( w==25 )
   10927             :     {
   10928           0 :         r = -9.830e+00;
   10929             :     }
   10930           0 :     if( w==24 )
   10931             :     {
   10932           0 :         r = -1.000e+01;
   10933             :     }
   10934           0 :     if( w==23 )
   10935             :     {
   10936           0 :         r = -1.017e+01;
   10937             :     }
   10938           0 :     if( w==22 )
   10939             :     {
   10940           0 :         r = -1.035e+01;
   10941             :     }
   10942           0 :     if( w==21 )
   10943             :     {
   10944           0 :         r = -1.053e+01;
   10945             :     }
   10946           0 :     if( w==20 )
   10947             :     {
   10948           0 :         r = -1.072e+01;
   10949             :     }
   10950           0 :     if( w==19 )
   10951             :     {
   10952           0 :         r = -1.091e+01;
   10953             :     }
   10954           0 :     if( w==18 )
   10955             :     {
   10956           0 :         r = -1.110e+01;
   10957             :     }
   10958           0 :     if( w==17 )
   10959             :     {
   10960           0 :         r = -1.130e+01;
   10961             :     }
   10962           0 :     if( w==16 )
   10963             :     {
   10964           0 :         r = -1.151e+01;
   10965             :     }
   10966           0 :     if( w==15 )
   10967             :     {
   10968           0 :         r = -1.172e+01;
   10969             :     }
   10970           0 :     if( w==14 )
   10971             :     {
   10972           0 :         r = -1.194e+01;
   10973             :     }
   10974           0 :     if( w==13 )
   10975             :     {
   10976           0 :         r = -1.216e+01;
   10977             :     }
   10978           0 :     if( w==12 )
   10979             :     {
   10980           0 :         r = -1.239e+01;
   10981             :     }
   10982           0 :     if( w==11 )
   10983             :     {
   10984           0 :         r = -1.263e+01;
   10985             :     }
   10986           0 :     if( w==10 )
   10987             :     {
   10988           0 :         r = -1.287e+01;
   10989             :     }
   10990           0 :     if( w==9 )
   10991             :     {
   10992           0 :         r = -1.314e+01;
   10993             :     }
   10994           0 :     if( w==8 )
   10995             :     {
   10996           0 :         r = -1.342e+01;
   10997             :     }
   10998           0 :     if( w==7 )
   10999             :     {
   11000           0 :         r = -1.369e+01;
   11001             :     }
   11002           0 :     if( w==6 )
   11003             :     {
   11004           0 :         r = -1.400e+01;
   11005             :     }
   11006           0 :     if( w==5 )
   11007             :     {
   11008           0 :         r = -1.433e+01;
   11009             :     }
   11010           0 :     if( w==4 )
   11011             :     {
   11012           0 :         r = -1.469e+01;
   11013             :     }
   11014           0 :     if( w==3 )
   11015             :     {
   11016           0 :         r = -1.503e+01;
   11017             :     }
   11018           0 :     if( w==2 )
   11019             :     {
   11020           0 :         r = -1.554e+01;
   11021             :     }
   11022           0 :     if( w==1 )
   11023             :     {
   11024           0 :         r = -1.594e+01;
   11025             :     }
   11026           0 :     if( w<=0 )
   11027             :     {
   11028           0 :         r = -1.664e+01;
   11029             :     }
   11030           0 :     result = r;
   11031           0 :     return result;
   11032             : }
   11033             : 
   11034             : 
   11035             : /*************************************************************************
   11036             : Tail(S, 25)
   11037             : *************************************************************************/
   11038           0 : static double wsr_w25(double s, ae_state *_state)
   11039             : {
   11040             :     double x;
   11041             :     double tj;
   11042             :     double tj1;
   11043             :     double result;
   11044             : 
   11045             : 
   11046           0 :     result = (double)(0);
   11047           0 :     x = ae_minreal(2*(s-0.000000e+00)/4.000000e+00-1, 1.0, _state);
   11048           0 :     tj = (double)(1);
   11049           0 :     tj1 = x;
   11050           0 :     wsr_wcheb(x, -5.150509e+00, &tj, &tj1, &result, _state);
   11051           0 :     wsr_wcheb(x, -5.695528e+00, &tj, &tj1, &result, _state);
   11052           0 :     wsr_wcheb(x, -1.437637e+00, &tj, &tj1, &result, _state);
   11053           0 :     wsr_wcheb(x, -2.611906e-01, &tj, &tj1, &result, _state);
   11054           0 :     wsr_wcheb(x, -7.625722e-02, &tj, &tj1, &result, _state);
   11055           0 :     wsr_wcheb(x, -2.579892e-02, &tj, &tj1, &result, _state);
   11056           0 :     wsr_wcheb(x, -1.086876e-02, &tj, &tj1, &result, _state);
   11057           0 :     wsr_wcheb(x, -2.906543e-03, &tj, &tj1, &result, _state);
   11058           0 :     wsr_wcheb(x, -2.354881e-03, &tj, &tj1, &result, _state);
   11059           0 :     wsr_wcheb(x, 1.007195e-04, &tj, &tj1, &result, _state);
   11060           0 :     wsr_wcheb(x, -8.437327e-04, &tj, &tj1, &result, _state);
   11061           0 :     return result;
   11062             : }
   11063             : 
   11064             : 
   11065             : /*************************************************************************
   11066             : Tail(S, 26)
   11067             : *************************************************************************/
   11068           0 : static double wsr_w26(double s, ae_state *_state)
   11069             : {
   11070             :     double x;
   11071             :     double tj;
   11072             :     double tj1;
   11073             :     double result;
   11074             : 
   11075             : 
   11076           0 :     result = (double)(0);
   11077           0 :     x = ae_minreal(2*(s-0.000000e+00)/4.000000e+00-1, 1.0, _state);
   11078           0 :     tj = (double)(1);
   11079           0 :     tj1 = x;
   11080           0 :     wsr_wcheb(x, -5.117622e+00, &tj, &tj1, &result, _state);
   11081           0 :     wsr_wcheb(x, -5.635159e+00, &tj, &tj1, &result, _state);
   11082           0 :     wsr_wcheb(x, -1.395167e+00, &tj, &tj1, &result, _state);
   11083           0 :     wsr_wcheb(x, -2.382823e-01, &tj, &tj1, &result, _state);
   11084           0 :     wsr_wcheb(x, -6.531987e-02, &tj, &tj1, &result, _state);
   11085           0 :     wsr_wcheb(x, -2.060112e-02, &tj, &tj1, &result, _state);
   11086           0 :     wsr_wcheb(x, -8.203697e-03, &tj, &tj1, &result, _state);
   11087           0 :     wsr_wcheb(x, -1.516523e-03, &tj, &tj1, &result, _state);
   11088           0 :     wsr_wcheb(x, -1.431364e-03, &tj, &tj1, &result, _state);
   11089           0 :     wsr_wcheb(x, 6.384553e-04, &tj, &tj1, &result, _state);
   11090           0 :     wsr_wcheb(x, -3.238369e-04, &tj, &tj1, &result, _state);
   11091           0 :     return result;
   11092             : }
   11093             : 
   11094             : 
   11095             : /*************************************************************************
   11096             : Tail(S, 27)
   11097             : *************************************************************************/
   11098           0 : static double wsr_w27(double s, ae_state *_state)
   11099             : {
   11100             :     double x;
   11101             :     double tj;
   11102             :     double tj1;
   11103             :     double result;
   11104             : 
   11105             : 
   11106           0 :     result = (double)(0);
   11107           0 :     x = ae_minreal(2*(s-0.000000e+00)/4.000000e+00-1, 1.0, _state);
   11108           0 :     tj = (double)(1);
   11109           0 :     tj1 = x;
   11110           0 :     wsr_wcheb(x, -5.089731e+00, &tj, &tj1, &result, _state);
   11111           0 :     wsr_wcheb(x, -5.584248e+00, &tj, &tj1, &result, _state);
   11112           0 :     wsr_wcheb(x, -1.359966e+00, &tj, &tj1, &result, _state);
   11113           0 :     wsr_wcheb(x, -2.203696e-01, &tj, &tj1, &result, _state);
   11114           0 :     wsr_wcheb(x, -5.753344e-02, &tj, &tj1, &result, _state);
   11115           0 :     wsr_wcheb(x, -1.761891e-02, &tj, &tj1, &result, _state);
   11116           0 :     wsr_wcheb(x, -7.096897e-03, &tj, &tj1, &result, _state);
   11117           0 :     wsr_wcheb(x, -1.419108e-03, &tj, &tj1, &result, _state);
   11118           0 :     wsr_wcheb(x, -1.581214e-03, &tj, &tj1, &result, _state);
   11119           0 :     wsr_wcheb(x, 3.033766e-04, &tj, &tj1, &result, _state);
   11120           0 :     wsr_wcheb(x, -5.901441e-04, &tj, &tj1, &result, _state);
   11121           0 :     return result;
   11122             : }
   11123             : 
   11124             : 
   11125             : /*************************************************************************
   11126             : Tail(S, 28)
   11127             : *************************************************************************/
   11128           0 : static double wsr_w28(double s, ae_state *_state)
   11129             : {
   11130             :     double x;
   11131             :     double tj;
   11132             :     double tj1;
   11133             :     double result;
   11134             : 
   11135             : 
   11136           0 :     result = (double)(0);
   11137           0 :     x = ae_minreal(2*(s-0.000000e+00)/4.000000e+00-1, 1.0, _state);
   11138           0 :     tj = (double)(1);
   11139           0 :     tj1 = x;
   11140           0 :     wsr_wcheb(x, -5.065046e+00, &tj, &tj1, &result, _state);
   11141           0 :     wsr_wcheb(x, -5.539163e+00, &tj, &tj1, &result, _state);
   11142           0 :     wsr_wcheb(x, -1.328939e+00, &tj, &tj1, &result, _state);
   11143           0 :     wsr_wcheb(x, -2.046376e-01, &tj, &tj1, &result, _state);
   11144           0 :     wsr_wcheb(x, -5.061515e-02, &tj, &tj1, &result, _state);
   11145           0 :     wsr_wcheb(x, -1.469271e-02, &tj, &tj1, &result, _state);
   11146           0 :     wsr_wcheb(x, -5.711578e-03, &tj, &tj1, &result, _state);
   11147           0 :     wsr_wcheb(x, -8.389153e-04, &tj, &tj1, &result, _state);
   11148           0 :     wsr_wcheb(x, -1.250575e-03, &tj, &tj1, &result, _state);
   11149           0 :     wsr_wcheb(x, 4.047245e-04, &tj, &tj1, &result, _state);
   11150           0 :     wsr_wcheb(x, -5.128555e-04, &tj, &tj1, &result, _state);
   11151           0 :     return result;
   11152             : }
   11153             : 
   11154             : 
   11155             : /*************************************************************************
   11156             : Tail(S, 29)
   11157             : *************************************************************************/
   11158           0 : static double wsr_w29(double s, ae_state *_state)
   11159             : {
   11160             :     double x;
   11161             :     double tj;
   11162             :     double tj1;
   11163             :     double result;
   11164             : 
   11165             : 
   11166           0 :     result = (double)(0);
   11167           0 :     x = ae_minreal(2*(s-0.000000e+00)/4.000000e+00-1, 1.0, _state);
   11168           0 :     tj = (double)(1);
   11169           0 :     tj1 = x;
   11170           0 :     wsr_wcheb(x, -5.043413e+00, &tj, &tj1, &result, _state);
   11171           0 :     wsr_wcheb(x, -5.499756e+00, &tj, &tj1, &result, _state);
   11172           0 :     wsr_wcheb(x, -1.302137e+00, &tj, &tj1, &result, _state);
   11173           0 :     wsr_wcheb(x, -1.915129e-01, &tj, &tj1, &result, _state);
   11174           0 :     wsr_wcheb(x, -4.516329e-02, &tj, &tj1, &result, _state);
   11175           0 :     wsr_wcheb(x, -1.260064e-02, &tj, &tj1, &result, _state);
   11176           0 :     wsr_wcheb(x, -4.817269e-03, &tj, &tj1, &result, _state);
   11177           0 :     wsr_wcheb(x, -5.478130e-04, &tj, &tj1, &result, _state);
   11178           0 :     wsr_wcheb(x, -1.111668e-03, &tj, &tj1, &result, _state);
   11179           0 :     wsr_wcheb(x, 4.093451e-04, &tj, &tj1, &result, _state);
   11180           0 :     wsr_wcheb(x, -5.135860e-04, &tj, &tj1, &result, _state);
   11181           0 :     return result;
   11182             : }
   11183             : 
   11184             : 
   11185             : /*************************************************************************
   11186             : Tail(S, 30)
   11187             : *************************************************************************/
   11188           0 : static double wsr_w30(double s, ae_state *_state)
   11189             : {
   11190             :     double x;
   11191             :     double tj;
   11192             :     double tj1;
   11193             :     double result;
   11194             : 
   11195             : 
   11196           0 :     result = (double)(0);
   11197           0 :     x = ae_minreal(2*(s-0.000000e+00)/4.000000e+00-1, 1.0, _state);
   11198           0 :     tj = (double)(1);
   11199           0 :     tj1 = x;
   11200           0 :     wsr_wcheb(x, -5.024071e+00, &tj, &tj1, &result, _state);
   11201           0 :     wsr_wcheb(x, -5.464515e+00, &tj, &tj1, &result, _state);
   11202           0 :     wsr_wcheb(x, -1.278342e+00, &tj, &tj1, &result, _state);
   11203           0 :     wsr_wcheb(x, -1.800030e-01, &tj, &tj1, &result, _state);
   11204           0 :     wsr_wcheb(x, -4.046294e-02, &tj, &tj1, &result, _state);
   11205           0 :     wsr_wcheb(x, -1.076162e-02, &tj, &tj1, &result, _state);
   11206           0 :     wsr_wcheb(x, -3.968677e-03, &tj, &tj1, &result, _state);
   11207           0 :     wsr_wcheb(x, -1.911679e-04, &tj, &tj1, &result, _state);
   11208           0 :     wsr_wcheb(x, -8.619185e-04, &tj, &tj1, &result, _state);
   11209           0 :     wsr_wcheb(x, 5.125362e-04, &tj, &tj1, &result, _state);
   11210           0 :     wsr_wcheb(x, -3.984370e-04, &tj, &tj1, &result, _state);
   11211           0 :     return result;
   11212             : }
   11213             : 
   11214             : 
   11215             : /*************************************************************************
   11216             : Tail(S, 40)
   11217             : *************************************************************************/
   11218           0 : static double wsr_w40(double s, ae_state *_state)
   11219             : {
   11220             :     double x;
   11221             :     double tj;
   11222             :     double tj1;
   11223             :     double result;
   11224             : 
   11225             : 
   11226           0 :     result = (double)(0);
   11227           0 :     x = ae_minreal(2*(s-0.000000e+00)/4.000000e+00-1, 1.0, _state);
   11228           0 :     tj = (double)(1);
   11229           0 :     tj1 = x;
   11230           0 :     wsr_wcheb(x, -4.904809e+00, &tj, &tj1, &result, _state);
   11231           0 :     wsr_wcheb(x, -5.248327e+00, &tj, &tj1, &result, _state);
   11232           0 :     wsr_wcheb(x, -1.136698e+00, &tj, &tj1, &result, _state);
   11233           0 :     wsr_wcheb(x, -1.170982e-01, &tj, &tj1, &result, _state);
   11234           0 :     wsr_wcheb(x, -1.824427e-02, &tj, &tj1, &result, _state);
   11235           0 :     wsr_wcheb(x, -3.888648e-03, &tj, &tj1, &result, _state);
   11236           0 :     wsr_wcheb(x, -1.344929e-03, &tj, &tj1, &result, _state);
   11237           0 :     wsr_wcheb(x, 2.790407e-04, &tj, &tj1, &result, _state);
   11238           0 :     wsr_wcheb(x, -4.619858e-04, &tj, &tj1, &result, _state);
   11239           0 :     wsr_wcheb(x, 3.359121e-04, &tj, &tj1, &result, _state);
   11240           0 :     wsr_wcheb(x, -2.883026e-04, &tj, &tj1, &result, _state);
   11241           0 :     return result;
   11242             : }
   11243             : 
   11244             : 
   11245             : /*************************************************************************
   11246             : Tail(S, 60)
   11247             : *************************************************************************/
   11248           0 : static double wsr_w60(double s, ae_state *_state)
   11249             : {
   11250             :     double x;
   11251             :     double tj;
   11252             :     double tj1;
   11253             :     double result;
   11254             : 
   11255             : 
   11256           0 :     result = (double)(0);
   11257           0 :     x = ae_minreal(2*(s-0.000000e+00)/4.000000e+00-1, 1.0, _state);
   11258           0 :     tj = (double)(1);
   11259           0 :     tj1 = x;
   11260           0 :     wsr_wcheb(x, -4.809656e+00, &tj, &tj1, &result, _state);
   11261           0 :     wsr_wcheb(x, -5.077191e+00, &tj, &tj1, &result, _state);
   11262           0 :     wsr_wcheb(x, -1.029402e+00, &tj, &tj1, &result, _state);
   11263           0 :     wsr_wcheb(x, -7.507931e-02, &tj, &tj1, &result, _state);
   11264           0 :     wsr_wcheb(x, -6.506226e-03, &tj, &tj1, &result, _state);
   11265           0 :     wsr_wcheb(x, -1.391278e-03, &tj, &tj1, &result, _state);
   11266           0 :     wsr_wcheb(x, -4.263635e-04, &tj, &tj1, &result, _state);
   11267           0 :     wsr_wcheb(x, 2.302271e-04, &tj, &tj1, &result, _state);
   11268           0 :     wsr_wcheb(x, -2.384348e-04, &tj, &tj1, &result, _state);
   11269           0 :     wsr_wcheb(x, 1.865587e-04, &tj, &tj1, &result, _state);
   11270           0 :     wsr_wcheb(x, -1.622355e-04, &tj, &tj1, &result, _state);
   11271           0 :     return result;
   11272             : }
   11273             : 
   11274             : 
   11275             : /*************************************************************************
   11276             : Tail(S, 120)
   11277             : *************************************************************************/
   11278           0 : static double wsr_w120(double s, ae_state *_state)
   11279             : {
   11280             :     double x;
   11281             :     double tj;
   11282             :     double tj1;
   11283             :     double result;
   11284             : 
   11285             : 
   11286           0 :     result = (double)(0);
   11287           0 :     x = ae_minreal(2*(s-0.000000e+00)/4.000000e+00-1, 1.0, _state);
   11288           0 :     tj = (double)(1);
   11289           0 :     tj1 = x;
   11290           0 :     wsr_wcheb(x, -4.729426e+00, &tj, &tj1, &result, _state);
   11291           0 :     wsr_wcheb(x, -4.934426e+00, &tj, &tj1, &result, _state);
   11292           0 :     wsr_wcheb(x, -9.433231e-01, &tj, &tj1, &result, _state);
   11293           0 :     wsr_wcheb(x, -4.492504e-02, &tj, &tj1, &result, _state);
   11294           0 :     wsr_wcheb(x, 1.673948e-05, &tj, &tj1, &result, _state);
   11295           0 :     wsr_wcheb(x, -6.077014e-04, &tj, &tj1, &result, _state);
   11296           0 :     wsr_wcheb(x, -7.215768e-05, &tj, &tj1, &result, _state);
   11297           0 :     wsr_wcheb(x, 9.086734e-05, &tj, &tj1, &result, _state);
   11298           0 :     wsr_wcheb(x, -8.447980e-05, &tj, &tj1, &result, _state);
   11299           0 :     wsr_wcheb(x, 6.705028e-05, &tj, &tj1, &result, _state);
   11300           0 :     wsr_wcheb(x, -5.828507e-05, &tj, &tj1, &result, _state);
   11301           0 :     return result;
   11302             : }
   11303             : 
   11304             : 
   11305             : /*************************************************************************
   11306             : Tail(S, 200)
   11307             : *************************************************************************/
   11308           0 : static double wsr_w200(double s, ae_state *_state)
   11309             : {
   11310             :     double x;
   11311             :     double tj;
   11312             :     double tj1;
   11313             :     double result;
   11314             : 
   11315             : 
   11316           0 :     result = (double)(0);
   11317           0 :     x = ae_minreal(2*(s-0.000000e+00)/4.000000e+00-1, 1.0, _state);
   11318           0 :     tj = (double)(1);
   11319           0 :     tj1 = x;
   11320           0 :     wsr_wcheb(x, -4.700240e+00, &tj, &tj1, &result, _state);
   11321           0 :     wsr_wcheb(x, -4.883080e+00, &tj, &tj1, &result, _state);
   11322           0 :     wsr_wcheb(x, -9.132168e-01, &tj, &tj1, &result, _state);
   11323           0 :     wsr_wcheb(x, -3.512684e-02, &tj, &tj1, &result, _state);
   11324           0 :     wsr_wcheb(x, 1.726342e-03, &tj, &tj1, &result, _state);
   11325           0 :     wsr_wcheb(x, -5.189796e-04, &tj, &tj1, &result, _state);
   11326           0 :     wsr_wcheb(x, -1.628659e-06, &tj, &tj1, &result, _state);
   11327           0 :     wsr_wcheb(x, 4.261786e-05, &tj, &tj1, &result, _state);
   11328           0 :     wsr_wcheb(x, -4.002498e-05, &tj, &tj1, &result, _state);
   11329           0 :     wsr_wcheb(x, 3.146287e-05, &tj, &tj1, &result, _state);
   11330           0 :     wsr_wcheb(x, -2.727576e-05, &tj, &tj1, &result, _state);
   11331           0 :     return result;
   11332             : }
   11333             : 
   11334             : 
   11335             : /*************************************************************************
   11336             : Tail(S,N), S>=0
   11337             : *************************************************************************/
   11338           0 : static double wsr_wsigma(double s, ae_int_t n, ae_state *_state)
   11339             : {
   11340             :     double f0;
   11341             :     double f1;
   11342             :     double f2;
   11343             :     double f3;
   11344             :     double f4;
   11345             :     double x0;
   11346             :     double x1;
   11347             :     double x2;
   11348             :     double x3;
   11349             :     double x4;
   11350             :     double x;
   11351             :     double result;
   11352             : 
   11353             : 
   11354           0 :     result = (double)(0);
   11355           0 :     if( n==5 )
   11356             :     {
   11357           0 :         result = wsr_w5(s, _state);
   11358             :     }
   11359           0 :     if( n==6 )
   11360             :     {
   11361           0 :         result = wsr_w6(s, _state);
   11362             :     }
   11363           0 :     if( n==7 )
   11364             :     {
   11365           0 :         result = wsr_w7(s, _state);
   11366             :     }
   11367           0 :     if( n==8 )
   11368             :     {
   11369           0 :         result = wsr_w8(s, _state);
   11370             :     }
   11371           0 :     if( n==9 )
   11372             :     {
   11373           0 :         result = wsr_w9(s, _state);
   11374             :     }
   11375           0 :     if( n==10 )
   11376             :     {
   11377           0 :         result = wsr_w10(s, _state);
   11378             :     }
   11379           0 :     if( n==11 )
   11380             :     {
   11381           0 :         result = wsr_w11(s, _state);
   11382             :     }
   11383           0 :     if( n==12 )
   11384             :     {
   11385           0 :         result = wsr_w12(s, _state);
   11386             :     }
   11387           0 :     if( n==13 )
   11388             :     {
   11389           0 :         result = wsr_w13(s, _state);
   11390             :     }
   11391           0 :     if( n==14 )
   11392             :     {
   11393           0 :         result = wsr_w14(s, _state);
   11394             :     }
   11395           0 :     if( n==15 )
   11396             :     {
   11397           0 :         result = wsr_w15(s, _state);
   11398             :     }
   11399           0 :     if( n==16 )
   11400             :     {
   11401           0 :         result = wsr_w16(s, _state);
   11402             :     }
   11403           0 :     if( n==17 )
   11404             :     {
   11405           0 :         result = wsr_w17(s, _state);
   11406             :     }
   11407           0 :     if( n==18 )
   11408             :     {
   11409           0 :         result = wsr_w18(s, _state);
   11410             :     }
   11411           0 :     if( n==19 )
   11412             :     {
   11413           0 :         result = wsr_w19(s, _state);
   11414             :     }
   11415           0 :     if( n==20 )
   11416             :     {
   11417           0 :         result = wsr_w20(s, _state);
   11418             :     }
   11419           0 :     if( n==21 )
   11420             :     {
   11421           0 :         result = wsr_w21(s, _state);
   11422             :     }
   11423           0 :     if( n==22 )
   11424             :     {
   11425           0 :         result = wsr_w22(s, _state);
   11426             :     }
   11427           0 :     if( n==23 )
   11428             :     {
   11429           0 :         result = wsr_w23(s, _state);
   11430             :     }
   11431           0 :     if( n==24 )
   11432             :     {
   11433           0 :         result = wsr_w24(s, _state);
   11434             :     }
   11435           0 :     if( n==25 )
   11436             :     {
   11437           0 :         result = wsr_w25(s, _state);
   11438             :     }
   11439           0 :     if( n==26 )
   11440             :     {
   11441           0 :         result = wsr_w26(s, _state);
   11442             :     }
   11443           0 :     if( n==27 )
   11444             :     {
   11445           0 :         result = wsr_w27(s, _state);
   11446             :     }
   11447           0 :     if( n==28 )
   11448             :     {
   11449           0 :         result = wsr_w28(s, _state);
   11450             :     }
   11451           0 :     if( n==29 )
   11452             :     {
   11453           0 :         result = wsr_w29(s, _state);
   11454             :     }
   11455           0 :     if( n==30 )
   11456             :     {
   11457           0 :         result = wsr_w30(s, _state);
   11458             :     }
   11459           0 :     if( n>30 )
   11460             :     {
   11461           0 :         x = 1.0/n;
   11462           0 :         x0 = 1.0/30;
   11463           0 :         f0 = wsr_w30(s, _state);
   11464           0 :         x1 = 1.0/40;
   11465           0 :         f1 = wsr_w40(s, _state);
   11466           0 :         x2 = 1.0/60;
   11467           0 :         f2 = wsr_w60(s, _state);
   11468           0 :         x3 = 1.0/120;
   11469           0 :         f3 = wsr_w120(s, _state);
   11470           0 :         x4 = 1.0/200;
   11471           0 :         f4 = wsr_w200(s, _state);
   11472           0 :         f1 = ((x-x0)*f1-(x-x1)*f0)/(x1-x0);
   11473           0 :         f2 = ((x-x0)*f2-(x-x2)*f0)/(x2-x0);
   11474           0 :         f3 = ((x-x0)*f3-(x-x3)*f0)/(x3-x0);
   11475           0 :         f4 = ((x-x0)*f4-(x-x4)*f0)/(x4-x0);
   11476           0 :         f2 = ((x-x1)*f2-(x-x2)*f1)/(x2-x1);
   11477           0 :         f3 = ((x-x1)*f3-(x-x3)*f1)/(x3-x1);
   11478           0 :         f4 = ((x-x1)*f4-(x-x4)*f1)/(x4-x1);
   11479           0 :         f3 = ((x-x2)*f3-(x-x3)*f2)/(x3-x2);
   11480           0 :         f4 = ((x-x2)*f4-(x-x4)*f2)/(x4-x2);
   11481           0 :         f4 = ((x-x3)*f4-(x-x4)*f3)/(x4-x3);
   11482           0 :         result = f4;
   11483             :     }
   11484           0 :     return result;
   11485             : }
   11486             : 
   11487             : 
   11488             : #endif
   11489             : #if defined(AE_COMPILE_STEST) || !defined(AE_PARTIAL_BUILD)
   11490             : 
   11491             : 
   11492             : /*************************************************************************
   11493             : Sign test
   11494             : 
   11495             : This test checks three hypotheses about the median of  the  given  sample.
   11496             : The following tests are performed:
   11497             :     * two-tailed test (null hypothesis - the median is equal to the  given
   11498             :       value)
   11499             :     * left-tailed test (null hypothesis - the median is  greater  than  or
   11500             :       equal to the given value)
   11501             :     * right-tailed test (null hypothesis - the  median  is  less  than  or
   11502             :       equal to the given value)
   11503             : 
   11504             : Requirements:
   11505             :     * the scale of measurement should be ordinal, interval or ratio  (i.e.
   11506             :       the test could not be applied to nominal variables).
   11507             : 
   11508             : The test is non-parametric and doesn't require distribution X to be normal
   11509             : 
   11510             : Input parameters:
   11511             :     X       -   sample. Array whose index goes from 0 to N-1.
   11512             :     N       -   size of the sample.
   11513             :     Median  -   assumed median value.
   11514             : 
   11515             : Output parameters:
   11516             :     BothTails   -   p-value for two-tailed test.
   11517             :                     If BothTails is less than the given significance level
   11518             :                     the null hypothesis is rejected.
   11519             :     LeftTail    -   p-value for left-tailed test.
   11520             :                     If LeftTail is less than the given significance level,
   11521             :                     the null hypothesis is rejected.
   11522             :     RightTail   -   p-value for right-tailed test.
   11523             :                     If RightTail is less than the given significance level
   11524             :                     the null hypothesis is rejected.
   11525             : 
   11526             : While   calculating   p-values   high-precision   binomial    distribution
   11527             : approximation is used, so significance levels have about 15 exact digits.
   11528             : 
   11529             :   -- ALGLIB --
   11530             :      Copyright 08.09.2006 by Bochkanov Sergey
   11531             : *************************************************************************/
   11532           0 : void onesamplesigntest(/* Real    */ ae_vector* x,
   11533             :      ae_int_t n,
   11534             :      double median,
   11535             :      double* bothtails,
   11536             :      double* lefttail,
   11537             :      double* righttail,
   11538             :      ae_state *_state)
   11539             : {
   11540             :     ae_int_t i;
   11541             :     ae_int_t gtcnt;
   11542             :     ae_int_t necnt;
   11543             : 
   11544           0 :     *bothtails = 0;
   11545           0 :     *lefttail = 0;
   11546           0 :     *righttail = 0;
   11547             : 
   11548           0 :     if( n<=1 )
   11549             :     {
   11550           0 :         *bothtails = 1.0;
   11551           0 :         *lefttail = 1.0;
   11552           0 :         *righttail = 1.0;
   11553           0 :         return;
   11554             :     }
   11555             :     
   11556             :     /*
   11557             :      * Calculate:
   11558             :      * GTCnt - count of x[i]>Median
   11559             :      * NECnt - count of x[i]<>Median
   11560             :      */
   11561           0 :     gtcnt = 0;
   11562           0 :     necnt = 0;
   11563           0 :     for(i=0; i<=n-1; i++)
   11564             :     {
   11565           0 :         if( ae_fp_greater(x->ptr.p_double[i],median) )
   11566             :         {
   11567           0 :             gtcnt = gtcnt+1;
   11568             :         }
   11569           0 :         if( ae_fp_neq(x->ptr.p_double[i],median) )
   11570             :         {
   11571           0 :             necnt = necnt+1;
   11572             :         }
   11573             :     }
   11574           0 :     if( necnt==0 )
   11575             :     {
   11576             :         
   11577             :         /*
   11578             :          * all x[i] are equal to Median.
   11579             :          * So we can conclude that Median is a true median :)
   11580             :          */
   11581           0 :         *bothtails = 1.0;
   11582           0 :         *lefttail = 1.0;
   11583           0 :         *righttail = 1.0;
   11584           0 :         return;
   11585             :     }
   11586           0 :     *bothtails = ae_minreal(2*binomialdistribution(ae_minint(gtcnt, necnt-gtcnt, _state), necnt, 0.5, _state), 1.0, _state);
   11587           0 :     *lefttail = binomialdistribution(gtcnt, necnt, 0.5, _state);
   11588           0 :     *righttail = binomialcdistribution(gtcnt-1, necnt, 0.5, _state);
   11589             : }
   11590             : 
   11591             : 
   11592             : #endif
   11593             : #if defined(AE_COMPILE_CORRELATIONTESTS) || !defined(AE_PARTIAL_BUILD)
   11594             : 
   11595             : 
   11596             : /*************************************************************************
   11597             : Pearson's correlation coefficient significance test
   11598             : 
   11599             : This test checks hypotheses about whether X  and  Y  are  samples  of  two
   11600             : continuous  distributions  having  zero  correlation  or   whether   their
   11601             : correlation is non-zero.
   11602             : 
   11603             : The following tests are performed:
   11604             :     * two-tailed test (null hypothesis - X and Y have zero correlation)
   11605             :     * left-tailed test (null hypothesis - the correlation  coefficient  is
   11606             :       greater than or equal to 0)
   11607             :     * right-tailed test (null hypothesis - the correlation coefficient  is
   11608             :       less than or equal to 0).
   11609             : 
   11610             : Requirements:
   11611             :     * the number of elements in each sample is not less than 5
   11612             :     * normality of distributions of X and Y.
   11613             : 
   11614             : Input parameters:
   11615             :     R   -   Pearson's correlation coefficient for X and Y
   11616             :     N   -   number of elements in samples, N>=5.
   11617             : 
   11618             : Output parameters:
   11619             :     BothTails   -   p-value for two-tailed test.
   11620             :                     If BothTails is less than the given significance level
   11621             :                     the null hypothesis is rejected.
   11622             :     LeftTail    -   p-value for left-tailed test.
   11623             :                     If LeftTail is less than the given significance level,
   11624             :                     the null hypothesis is rejected.
   11625             :     RightTail   -   p-value for right-tailed test.
   11626             :                     If RightTail is less than the given significance level
   11627             :                     the null hypothesis is rejected.
   11628             : 
   11629             :   -- ALGLIB --
   11630             :      Copyright 09.04.2007 by Bochkanov Sergey
   11631             : *************************************************************************/
   11632           0 : void pearsoncorrelationsignificance(double r,
   11633             :      ae_int_t n,
   11634             :      double* bothtails,
   11635             :      double* lefttail,
   11636             :      double* righttail,
   11637             :      ae_state *_state)
   11638             : {
   11639             :     double t;
   11640             :     double p;
   11641             : 
   11642           0 :     *bothtails = 0;
   11643           0 :     *lefttail = 0;
   11644           0 :     *righttail = 0;
   11645             : 
   11646             :     
   11647             :     /*
   11648             :      * Some special cases
   11649             :      */
   11650           0 :     if( ae_fp_greater_eq(r,(double)(1)) )
   11651             :     {
   11652           0 :         *bothtails = 0.0;
   11653           0 :         *lefttail = 1.0;
   11654           0 :         *righttail = 0.0;
   11655           0 :         return;
   11656             :     }
   11657           0 :     if( ae_fp_less_eq(r,(double)(-1)) )
   11658             :     {
   11659           0 :         *bothtails = 0.0;
   11660           0 :         *lefttail = 0.0;
   11661           0 :         *righttail = 1.0;
   11662           0 :         return;
   11663             :     }
   11664           0 :     if( n<5 )
   11665             :     {
   11666           0 :         *bothtails = 1.0;
   11667           0 :         *lefttail = 1.0;
   11668           0 :         *righttail = 1.0;
   11669           0 :         return;
   11670             :     }
   11671             :     
   11672             :     /*
   11673             :      * General case
   11674             :      */
   11675           0 :     t = r*ae_sqrt((n-2)/(1-ae_sqr(r, _state)), _state);
   11676           0 :     p = studenttdistribution(n-2, t, _state);
   11677           0 :     *bothtails = 2*ae_minreal(p, 1-p, _state);
   11678           0 :     *lefttail = p;
   11679           0 :     *righttail = 1-p;
   11680             : }
   11681             : 
   11682             : 
   11683             : /*************************************************************************
   11684             : Spearman's rank correlation coefficient significance test
   11685             : 
   11686             : This test checks hypotheses about whether X  and  Y  are  samples  of  two
   11687             : continuous  distributions  having  zero  correlation  or   whether   their
   11688             : correlation is non-zero.
   11689             : 
   11690             : The following tests are performed:
   11691             :     * two-tailed test (null hypothesis - X and Y have zero correlation)
   11692             :     * left-tailed test (null hypothesis - the correlation  coefficient  is
   11693             :       greater than or equal to 0)
   11694             :     * right-tailed test (null hypothesis - the correlation coefficient  is
   11695             :       less than or equal to 0).
   11696             : 
   11697             : Requirements:
   11698             :     * the number of elements in each sample is not less than 5.
   11699             : 
   11700             : The test is non-parametric and doesn't require distributions X and Y to be
   11701             : normal.
   11702             : 
   11703             : Input parameters:
   11704             :     R   -   Spearman's rank correlation coefficient for X and Y
   11705             :     N   -   number of elements in samples, N>=5.
   11706             : 
   11707             : Output parameters:
   11708             :     BothTails   -   p-value for two-tailed test.
   11709             :                     If BothTails is less than the given significance level
   11710             :                     the null hypothesis is rejected.
   11711             :     LeftTail    -   p-value for left-tailed test.
   11712             :                     If LeftTail is less than the given significance level,
   11713             :                     the null hypothesis is rejected.
   11714             :     RightTail   -   p-value for right-tailed test.
   11715             :                     If RightTail is less than the given significance level
   11716             :                     the null hypothesis is rejected.
   11717             : 
   11718             :   -- ALGLIB --
   11719             :      Copyright 09.04.2007 by Bochkanov Sergey
   11720             : *************************************************************************/
   11721           0 : void spearmanrankcorrelationsignificance(double r,
   11722             :      ae_int_t n,
   11723             :      double* bothtails,
   11724             :      double* lefttail,
   11725             :      double* righttail,
   11726             :      ae_state *_state)
   11727             : {
   11728             :     double t;
   11729             :     double p;
   11730             : 
   11731           0 :     *bothtails = 0;
   11732           0 :     *lefttail = 0;
   11733           0 :     *righttail = 0;
   11734             : 
   11735             :     
   11736             :     /*
   11737             :      * Special case
   11738             :      */
   11739           0 :     if( n<5 )
   11740             :     {
   11741           0 :         *bothtails = 1.0;
   11742           0 :         *lefttail = 1.0;
   11743           0 :         *righttail = 1.0;
   11744           0 :         return;
   11745             :     }
   11746             :     
   11747             :     /*
   11748             :      * General case
   11749             :      */
   11750           0 :     if( ae_fp_greater_eq(r,(double)(1)) )
   11751             :     {
   11752           0 :         t = 1.0E10;
   11753             :     }
   11754             :     else
   11755             :     {
   11756           0 :         if( ae_fp_less_eq(r,(double)(-1)) )
   11757             :         {
   11758           0 :             t = -1.0E10;
   11759             :         }
   11760             :         else
   11761             :         {
   11762           0 :             t = r*ae_sqrt((n-2)/(1-ae_sqr(r, _state)), _state);
   11763             :         }
   11764             :     }
   11765           0 :     if( ae_fp_less(t,(double)(0)) )
   11766             :     {
   11767           0 :         p = correlationtests_spearmantail(t, n, _state);
   11768           0 :         *bothtails = 2*p;
   11769           0 :         *lefttail = p;
   11770           0 :         *righttail = 1-p;
   11771             :     }
   11772             :     else
   11773             :     {
   11774           0 :         p = correlationtests_spearmantail(-t, n, _state);
   11775           0 :         *bothtails = 2*p;
   11776           0 :         *lefttail = 1-p;
   11777           0 :         *righttail = p;
   11778             :     }
   11779             : }
   11780             : 
   11781             : 
   11782             : /*************************************************************************
   11783             : Tail(S, 5)
   11784             : *************************************************************************/
   11785           0 : static double correlationtests_spearmantail5(double s, ae_state *_state)
   11786             : {
   11787             :     double result;
   11788             : 
   11789             : 
   11790           0 :     if( ae_fp_less(s,0.000e+00) )
   11791             :     {
   11792           0 :         result = studenttdistribution(3, -s, _state);
   11793           0 :         return result;
   11794             :     }
   11795           0 :     if( ae_fp_greater_eq(s,3.580e+00) )
   11796             :     {
   11797           0 :         result = 8.304e-03;
   11798           0 :         return result;
   11799             :     }
   11800           0 :     if( ae_fp_greater_eq(s,2.322e+00) )
   11801             :     {
   11802           0 :         result = 4.163e-02;
   11803           0 :         return result;
   11804             :     }
   11805           0 :     if( ae_fp_greater_eq(s,1.704e+00) )
   11806             :     {
   11807           0 :         result = 6.641e-02;
   11808           0 :         return result;
   11809             :     }
   11810           0 :     if( ae_fp_greater_eq(s,1.303e+00) )
   11811             :     {
   11812           0 :         result = 1.164e-01;
   11813           0 :         return result;
   11814             :     }
   11815           0 :     if( ae_fp_greater_eq(s,1.003e+00) )
   11816             :     {
   11817           0 :         result = 1.748e-01;
   11818           0 :         return result;
   11819             :     }
   11820           0 :     if( ae_fp_greater_eq(s,7.584e-01) )
   11821             :     {
   11822           0 :         result = 2.249e-01;
   11823           0 :         return result;
   11824             :     }
   11825           0 :     if( ae_fp_greater_eq(s,5.468e-01) )
   11826             :     {
   11827           0 :         result = 2.581e-01;
   11828           0 :         return result;
   11829             :     }
   11830           0 :     if( ae_fp_greater_eq(s,3.555e-01) )
   11831             :     {
   11832           0 :         result = 3.413e-01;
   11833           0 :         return result;
   11834             :     }
   11835           0 :     if( ae_fp_greater_eq(s,1.759e-01) )
   11836             :     {
   11837           0 :         result = 3.911e-01;
   11838           0 :         return result;
   11839             :     }
   11840           0 :     if( ae_fp_greater_eq(s,1.741e-03) )
   11841             :     {
   11842           0 :         result = 4.747e-01;
   11843           0 :         return result;
   11844             :     }
   11845           0 :     if( ae_fp_greater_eq(s,0.000e+00) )
   11846             :     {
   11847           0 :         result = 5.248e-01;
   11848           0 :         return result;
   11849             :     }
   11850           0 :     result = (double)(0);
   11851           0 :     return result;
   11852             : }
   11853             : 
   11854             : 
   11855             : /*************************************************************************
   11856             : Tail(S, 6)
   11857             : *************************************************************************/
   11858           0 : static double correlationtests_spearmantail6(double s, ae_state *_state)
   11859             : {
   11860             :     double result;
   11861             : 
   11862             : 
   11863           0 :     if( ae_fp_less(s,1.001e+00) )
   11864             :     {
   11865           0 :         result = studenttdistribution(4, -s, _state);
   11866           0 :         return result;
   11867             :     }
   11868           0 :     if( ae_fp_greater_eq(s,5.663e+00) )
   11869             :     {
   11870           0 :         result = 1.366e-03;
   11871           0 :         return result;
   11872             :     }
   11873           0 :     if( ae_fp_greater_eq(s,3.834e+00) )
   11874             :     {
   11875           0 :         result = 8.350e-03;
   11876           0 :         return result;
   11877             :     }
   11878           0 :     if( ae_fp_greater_eq(s,2.968e+00) )
   11879             :     {
   11880           0 :         result = 1.668e-02;
   11881           0 :         return result;
   11882             :     }
   11883           0 :     if( ae_fp_greater_eq(s,2.430e+00) )
   11884             :     {
   11885           0 :         result = 2.921e-02;
   11886           0 :         return result;
   11887             :     }
   11888           0 :     if( ae_fp_greater_eq(s,2.045e+00) )
   11889             :     {
   11890           0 :         result = 5.144e-02;
   11891           0 :         return result;
   11892             :     }
   11893           0 :     if( ae_fp_greater_eq(s,1.747e+00) )
   11894             :     {
   11895           0 :         result = 6.797e-02;
   11896           0 :         return result;
   11897             :     }
   11898           0 :     if( ae_fp_greater_eq(s,1.502e+00) )
   11899             :     {
   11900           0 :         result = 8.752e-02;
   11901           0 :         return result;
   11902             :     }
   11903           0 :     if( ae_fp_greater_eq(s,1.295e+00) )
   11904             :     {
   11905           0 :         result = 1.210e-01;
   11906           0 :         return result;
   11907             :     }
   11908           0 :     if( ae_fp_greater_eq(s,1.113e+00) )
   11909             :     {
   11910           0 :         result = 1.487e-01;
   11911           0 :         return result;
   11912             :     }
   11913           0 :     if( ae_fp_greater_eq(s,1.001e+00) )
   11914             :     {
   11915           0 :         result = 1.780e-01;
   11916           0 :         return result;
   11917             :     }
   11918           0 :     result = (double)(0);
   11919           0 :     return result;
   11920             : }
   11921             : 
   11922             : 
   11923             : /*************************************************************************
   11924             : Tail(S, 7)
   11925             : *************************************************************************/
   11926           0 : static double correlationtests_spearmantail7(double s, ae_state *_state)
   11927             : {
   11928             :     double result;
   11929             : 
   11930             : 
   11931           0 :     if( ae_fp_less(s,1.001e+00) )
   11932             :     {
   11933           0 :         result = studenttdistribution(5, -s, _state);
   11934           0 :         return result;
   11935             :     }
   11936           0 :     if( ae_fp_greater_eq(s,8.159e+00) )
   11937             :     {
   11938           0 :         result = 2.081e-04;
   11939           0 :         return result;
   11940             :     }
   11941           0 :     if( ae_fp_greater_eq(s,5.620e+00) )
   11942             :     {
   11943           0 :         result = 1.393e-03;
   11944           0 :         return result;
   11945             :     }
   11946           0 :     if( ae_fp_greater_eq(s,4.445e+00) )
   11947             :     {
   11948           0 :         result = 3.398e-03;
   11949           0 :         return result;
   11950             :     }
   11951           0 :     if( ae_fp_greater_eq(s,3.728e+00) )
   11952             :     {
   11953           0 :         result = 6.187e-03;
   11954           0 :         return result;
   11955             :     }
   11956           0 :     if( ae_fp_greater_eq(s,3.226e+00) )
   11957             :     {
   11958           0 :         result = 1.200e-02;
   11959           0 :         return result;
   11960             :     }
   11961           0 :     if( ae_fp_greater_eq(s,2.844e+00) )
   11962             :     {
   11963           0 :         result = 1.712e-02;
   11964           0 :         return result;
   11965             :     }
   11966           0 :     if( ae_fp_greater_eq(s,2.539e+00) )
   11967             :     {
   11968           0 :         result = 2.408e-02;
   11969           0 :         return result;
   11970             :     }
   11971           0 :     if( ae_fp_greater_eq(s,2.285e+00) )
   11972             :     {
   11973           0 :         result = 3.320e-02;
   11974           0 :         return result;
   11975             :     }
   11976           0 :     if( ae_fp_greater_eq(s,2.068e+00) )
   11977             :     {
   11978           0 :         result = 4.406e-02;
   11979           0 :         return result;
   11980             :     }
   11981           0 :     if( ae_fp_greater_eq(s,1.879e+00) )
   11982             :     {
   11983           0 :         result = 5.478e-02;
   11984           0 :         return result;
   11985             :     }
   11986           0 :     if( ae_fp_greater_eq(s,1.710e+00) )
   11987             :     {
   11988           0 :         result = 6.946e-02;
   11989           0 :         return result;
   11990             :     }
   11991           0 :     if( ae_fp_greater_eq(s,1.559e+00) )
   11992             :     {
   11993           0 :         result = 8.331e-02;
   11994           0 :         return result;
   11995             :     }
   11996           0 :     if( ae_fp_greater_eq(s,1.420e+00) )
   11997             :     {
   11998           0 :         result = 1.001e-01;
   11999           0 :         return result;
   12000             :     }
   12001           0 :     if( ae_fp_greater_eq(s,1.292e+00) )
   12002             :     {
   12003           0 :         result = 1.180e-01;
   12004           0 :         return result;
   12005             :     }
   12006           0 :     if( ae_fp_greater_eq(s,1.173e+00) )
   12007             :     {
   12008           0 :         result = 1.335e-01;
   12009           0 :         return result;
   12010             :     }
   12011           0 :     if( ae_fp_greater_eq(s,1.062e+00) )
   12012             :     {
   12013           0 :         result = 1.513e-01;
   12014           0 :         return result;
   12015             :     }
   12016           0 :     if( ae_fp_greater_eq(s,1.001e+00) )
   12017             :     {
   12018           0 :         result = 1.770e-01;
   12019           0 :         return result;
   12020             :     }
   12021           0 :     result = (double)(0);
   12022           0 :     return result;
   12023             : }
   12024             : 
   12025             : 
   12026             : /*************************************************************************
   12027             : Tail(S, 8)
   12028             : *************************************************************************/
   12029           0 : static double correlationtests_spearmantail8(double s, ae_state *_state)
   12030             : {
   12031             :     double result;
   12032             : 
   12033             : 
   12034           0 :     if( ae_fp_less(s,2.001e+00) )
   12035             :     {
   12036           0 :         result = studenttdistribution(6, -s, _state);
   12037           0 :         return result;
   12038             :     }
   12039           0 :     if( ae_fp_greater_eq(s,1.103e+01) )
   12040             :     {
   12041           0 :         result = 2.194e-05;
   12042           0 :         return result;
   12043             :     }
   12044           0 :     if( ae_fp_greater_eq(s,7.685e+00) )
   12045             :     {
   12046           0 :         result = 2.008e-04;
   12047           0 :         return result;
   12048             :     }
   12049           0 :     if( ae_fp_greater_eq(s,6.143e+00) )
   12050             :     {
   12051           0 :         result = 5.686e-04;
   12052           0 :         return result;
   12053             :     }
   12054           0 :     if( ae_fp_greater_eq(s,5.213e+00) )
   12055             :     {
   12056           0 :         result = 1.138e-03;
   12057           0 :         return result;
   12058             :     }
   12059           0 :     if( ae_fp_greater_eq(s,4.567e+00) )
   12060             :     {
   12061           0 :         result = 2.310e-03;
   12062           0 :         return result;
   12063             :     }
   12064           0 :     if( ae_fp_greater_eq(s,4.081e+00) )
   12065             :     {
   12066           0 :         result = 3.634e-03;
   12067           0 :         return result;
   12068             :     }
   12069           0 :     if( ae_fp_greater_eq(s,3.697e+00) )
   12070             :     {
   12071           0 :         result = 5.369e-03;
   12072           0 :         return result;
   12073             :     }
   12074           0 :     if( ae_fp_greater_eq(s,3.381e+00) )
   12075             :     {
   12076           0 :         result = 7.708e-03;
   12077           0 :         return result;
   12078             :     }
   12079           0 :     if( ae_fp_greater_eq(s,3.114e+00) )
   12080             :     {
   12081           0 :         result = 1.087e-02;
   12082           0 :         return result;
   12083             :     }
   12084           0 :     if( ae_fp_greater_eq(s,2.884e+00) )
   12085             :     {
   12086           0 :         result = 1.397e-02;
   12087           0 :         return result;
   12088             :     }
   12089           0 :     if( ae_fp_greater_eq(s,2.682e+00) )
   12090             :     {
   12091           0 :         result = 1.838e-02;
   12092           0 :         return result;
   12093             :     }
   12094           0 :     if( ae_fp_greater_eq(s,2.502e+00) )
   12095             :     {
   12096           0 :         result = 2.288e-02;
   12097           0 :         return result;
   12098             :     }
   12099           0 :     if( ae_fp_greater_eq(s,2.340e+00) )
   12100             :     {
   12101           0 :         result = 2.883e-02;
   12102           0 :         return result;
   12103             :     }
   12104           0 :     if( ae_fp_greater_eq(s,2.192e+00) )
   12105             :     {
   12106           0 :         result = 3.469e-02;
   12107           0 :         return result;
   12108             :     }
   12109           0 :     if( ae_fp_greater_eq(s,2.057e+00) )
   12110             :     {
   12111           0 :         result = 4.144e-02;
   12112           0 :         return result;
   12113             :     }
   12114           0 :     if( ae_fp_greater_eq(s,2.001e+00) )
   12115             :     {
   12116           0 :         result = 4.804e-02;
   12117           0 :         return result;
   12118             :     }
   12119           0 :     result = (double)(0);
   12120           0 :     return result;
   12121             : }
   12122             : 
   12123             : 
   12124             : /*************************************************************************
   12125             : Tail(S, 9)
   12126             : *************************************************************************/
   12127           0 : static double correlationtests_spearmantail9(double s, ae_state *_state)
   12128             : {
   12129             :     double result;
   12130             : 
   12131             : 
   12132           0 :     if( ae_fp_less(s,2.001e+00) )
   12133             :     {
   12134           0 :         result = studenttdistribution(7, -s, _state);
   12135           0 :         return result;
   12136             :     }
   12137           0 :     if( ae_fp_greater_eq(s,9.989e+00) )
   12138             :     {
   12139           0 :         result = 2.306e-05;
   12140           0 :         return result;
   12141             :     }
   12142           0 :     if( ae_fp_greater_eq(s,8.069e+00) )
   12143             :     {
   12144           0 :         result = 8.167e-05;
   12145           0 :         return result;
   12146             :     }
   12147           0 :     if( ae_fp_greater_eq(s,6.890e+00) )
   12148             :     {
   12149           0 :         result = 1.744e-04;
   12150           0 :         return result;
   12151             :     }
   12152           0 :     if( ae_fp_greater_eq(s,6.077e+00) )
   12153             :     {
   12154           0 :         result = 3.625e-04;
   12155           0 :         return result;
   12156             :     }
   12157           0 :     if( ae_fp_greater_eq(s,5.469e+00) )
   12158             :     {
   12159           0 :         result = 6.450e-04;
   12160           0 :         return result;
   12161             :     }
   12162           0 :     if( ae_fp_greater_eq(s,4.991e+00) )
   12163             :     {
   12164           0 :         result = 1.001e-03;
   12165           0 :         return result;
   12166             :     }
   12167           0 :     if( ae_fp_greater_eq(s,4.600e+00) )
   12168             :     {
   12169           0 :         result = 1.514e-03;
   12170           0 :         return result;
   12171             :     }
   12172           0 :     if( ae_fp_greater_eq(s,4.272e+00) )
   12173             :     {
   12174           0 :         result = 2.213e-03;
   12175           0 :         return result;
   12176             :     }
   12177           0 :     if( ae_fp_greater_eq(s,3.991e+00) )
   12178             :     {
   12179           0 :         result = 2.990e-03;
   12180           0 :         return result;
   12181             :     }
   12182           0 :     if( ae_fp_greater_eq(s,3.746e+00) )
   12183             :     {
   12184           0 :         result = 4.101e-03;
   12185           0 :         return result;
   12186             :     }
   12187           0 :     if( ae_fp_greater_eq(s,3.530e+00) )
   12188             :     {
   12189           0 :         result = 5.355e-03;
   12190           0 :         return result;
   12191             :     }
   12192           0 :     if( ae_fp_greater_eq(s,3.336e+00) )
   12193             :     {
   12194           0 :         result = 6.887e-03;
   12195           0 :         return result;
   12196             :     }
   12197           0 :     if( ae_fp_greater_eq(s,3.161e+00) )
   12198             :     {
   12199           0 :         result = 8.598e-03;
   12200           0 :         return result;
   12201             :     }
   12202           0 :     if( ae_fp_greater_eq(s,3.002e+00) )
   12203             :     {
   12204           0 :         result = 1.065e-02;
   12205           0 :         return result;
   12206             :     }
   12207           0 :     if( ae_fp_greater_eq(s,2.855e+00) )
   12208             :     {
   12209           0 :         result = 1.268e-02;
   12210           0 :         return result;
   12211             :     }
   12212           0 :     if( ae_fp_greater_eq(s,2.720e+00) )
   12213             :     {
   12214           0 :         result = 1.552e-02;
   12215           0 :         return result;
   12216             :     }
   12217           0 :     if( ae_fp_greater_eq(s,2.595e+00) )
   12218             :     {
   12219           0 :         result = 1.836e-02;
   12220           0 :         return result;
   12221             :     }
   12222           0 :     if( ae_fp_greater_eq(s,2.477e+00) )
   12223             :     {
   12224           0 :         result = 2.158e-02;
   12225           0 :         return result;
   12226             :     }
   12227           0 :     if( ae_fp_greater_eq(s,2.368e+00) )
   12228             :     {
   12229           0 :         result = 2.512e-02;
   12230           0 :         return result;
   12231             :     }
   12232           0 :     if( ae_fp_greater_eq(s,2.264e+00) )
   12233             :     {
   12234           0 :         result = 2.942e-02;
   12235           0 :         return result;
   12236             :     }
   12237           0 :     if( ae_fp_greater_eq(s,2.166e+00) )
   12238             :     {
   12239           0 :         result = 3.325e-02;
   12240           0 :         return result;
   12241             :     }
   12242           0 :     if( ae_fp_greater_eq(s,2.073e+00) )
   12243             :     {
   12244           0 :         result = 3.800e-02;
   12245           0 :         return result;
   12246             :     }
   12247           0 :     if( ae_fp_greater_eq(s,2.001e+00) )
   12248             :     {
   12249           0 :         result = 4.285e-02;
   12250           0 :         return result;
   12251             :     }
   12252           0 :     result = (double)(0);
   12253           0 :     return result;
   12254             : }
   12255             : 
   12256             : 
   12257             : /*************************************************************************
   12258             : Tail(T,N), accepts T<0
   12259             : *************************************************************************/
   12260           0 : static double correlationtests_spearmantail(double t,
   12261             :      ae_int_t n,
   12262             :      ae_state *_state)
   12263             : {
   12264             :     double result;
   12265             : 
   12266             : 
   12267           0 :     if( n==5 )
   12268             :     {
   12269           0 :         result = correlationtests_spearmantail5(-t, _state);
   12270           0 :         return result;
   12271             :     }
   12272           0 :     if( n==6 )
   12273             :     {
   12274           0 :         result = correlationtests_spearmantail6(-t, _state);
   12275           0 :         return result;
   12276             :     }
   12277           0 :     if( n==7 )
   12278             :     {
   12279           0 :         result = correlationtests_spearmantail7(-t, _state);
   12280           0 :         return result;
   12281             :     }
   12282           0 :     if( n==8 )
   12283             :     {
   12284           0 :         result = correlationtests_spearmantail8(-t, _state);
   12285           0 :         return result;
   12286             :     }
   12287           0 :     if( n==9 )
   12288             :     {
   12289           0 :         result = correlationtests_spearmantail9(-t, _state);
   12290           0 :         return result;
   12291             :     }
   12292           0 :     result = studenttdistribution(n-2, t, _state);
   12293           0 :     return result;
   12294             : }
   12295             : 
   12296             : 
   12297             : #endif
   12298             : #if defined(AE_COMPILE_STUDENTTTESTS) || !defined(AE_PARTIAL_BUILD)
   12299             : 
   12300             : 
   12301             : /*************************************************************************
   12302             : One-sample t-test
   12303             : 
   12304             : This test checks three hypotheses about the mean of the given sample.  The
   12305             : following tests are performed:
   12306             :     * two-tailed test (null hypothesis - the mean is equal  to  the  given
   12307             :       value)
   12308             :     * left-tailed test (null hypothesis - the  mean  is  greater  than  or
   12309             :       equal to the given value)
   12310             :     * right-tailed test (null hypothesis - the mean is less than or  equal
   12311             :       to the given value).
   12312             : 
   12313             : The test is based on the assumption that  a  given  sample  has  a  normal
   12314             : distribution and  an  unknown  dispersion.  If  the  distribution  sharply
   12315             : differs from normal, the test will work incorrectly.
   12316             : 
   12317             : INPUT PARAMETERS:
   12318             :     X       -   sample. Array whose index goes from 0 to N-1.
   12319             :     N       -   size of sample, N>=0
   12320             :     Mean    -   assumed value of the mean.
   12321             : 
   12322             : OUTPUT PARAMETERS:
   12323             :     BothTails   -   p-value for two-tailed test.
   12324             :                     If BothTails is less than the given significance level
   12325             :                     the null hypothesis is rejected.
   12326             :     LeftTail    -   p-value for left-tailed test.
   12327             :                     If LeftTail is less than the given significance level,
   12328             :                     the null hypothesis is rejected.
   12329             :     RightTail   -   p-value for right-tailed test.
   12330             :                     If RightTail is less than the given significance level
   12331             :                     the null hypothesis is rejected.
   12332             : 
   12333             : NOTE: this function correctly handles degenerate cases:
   12334             :       * when N=0, all p-values are set to 1.0
   12335             :       * when variance of X[] is exactly zero, p-values are set
   12336             :         to 1.0 or 0.0, depending on difference between sample mean and
   12337             :         value of mean being tested.
   12338             : 
   12339             : 
   12340             :   -- ALGLIB --
   12341             :      Copyright 08.09.2006 by Bochkanov Sergey
   12342             : *************************************************************************/
   12343           0 : void studentttest1(/* Real    */ ae_vector* x,
   12344             :      ae_int_t n,
   12345             :      double mean,
   12346             :      double* bothtails,
   12347             :      double* lefttail,
   12348             :      double* righttail,
   12349             :      ae_state *_state)
   12350             : {
   12351             :     ae_int_t i;
   12352             :     double xmean;
   12353             :     double x0;
   12354             :     double v;
   12355             :     ae_bool samex;
   12356             :     double xvariance;
   12357             :     double xstddev;
   12358             :     double v1;
   12359             :     double v2;
   12360             :     double stat;
   12361             :     double s;
   12362             : 
   12363           0 :     *bothtails = 0;
   12364           0 :     *lefttail = 0;
   12365           0 :     *righttail = 0;
   12366             : 
   12367           0 :     if( n<=0 )
   12368             :     {
   12369           0 :         *bothtails = 1.0;
   12370           0 :         *lefttail = 1.0;
   12371           0 :         *righttail = 1.0;
   12372           0 :         return;
   12373             :     }
   12374             :     
   12375             :     /*
   12376             :      * Mean
   12377             :      */
   12378           0 :     xmean = (double)(0);
   12379           0 :     x0 = x->ptr.p_double[0];
   12380           0 :     samex = ae_true;
   12381           0 :     for(i=0; i<=n-1; i++)
   12382             :     {
   12383           0 :         v = x->ptr.p_double[i];
   12384           0 :         xmean = xmean+v;
   12385           0 :         samex = samex&&ae_fp_eq(v,x0);
   12386             :     }
   12387           0 :     if( samex )
   12388             :     {
   12389           0 :         xmean = x0;
   12390             :     }
   12391             :     else
   12392             :     {
   12393           0 :         xmean = xmean/n;
   12394             :     }
   12395             :     
   12396             :     /*
   12397             :      * Variance (using corrected two-pass algorithm)
   12398             :      */
   12399           0 :     xvariance = (double)(0);
   12400           0 :     xstddev = (double)(0);
   12401           0 :     if( n!=1&&!samex )
   12402             :     {
   12403           0 :         v1 = (double)(0);
   12404           0 :         for(i=0; i<=n-1; i++)
   12405             :         {
   12406           0 :             v1 = v1+ae_sqr(x->ptr.p_double[i]-xmean, _state);
   12407             :         }
   12408           0 :         v2 = (double)(0);
   12409           0 :         for(i=0; i<=n-1; i++)
   12410             :         {
   12411           0 :             v2 = v2+(x->ptr.p_double[i]-xmean);
   12412             :         }
   12413           0 :         v2 = ae_sqr(v2, _state)/n;
   12414           0 :         xvariance = (v1-v2)/(n-1);
   12415           0 :         if( ae_fp_less(xvariance,(double)(0)) )
   12416             :         {
   12417           0 :             xvariance = (double)(0);
   12418             :         }
   12419           0 :         xstddev = ae_sqrt(xvariance, _state);
   12420             :     }
   12421           0 :     if( ae_fp_eq(xstddev,(double)(0)) )
   12422             :     {
   12423           0 :         if( ae_fp_eq(xmean,mean) )
   12424             :         {
   12425           0 :             *bothtails = 1.0;
   12426             :         }
   12427             :         else
   12428             :         {
   12429           0 :             *bothtails = 0.0;
   12430             :         }
   12431           0 :         if( ae_fp_greater_eq(xmean,mean) )
   12432             :         {
   12433           0 :             *lefttail = 1.0;
   12434             :         }
   12435             :         else
   12436             :         {
   12437           0 :             *lefttail = 0.0;
   12438             :         }
   12439           0 :         if( ae_fp_less_eq(xmean,mean) )
   12440             :         {
   12441           0 :             *righttail = 1.0;
   12442             :         }
   12443             :         else
   12444             :         {
   12445           0 :             *righttail = 0.0;
   12446             :         }
   12447           0 :         return;
   12448             :     }
   12449             :     
   12450             :     /*
   12451             :      * Statistic
   12452             :      */
   12453           0 :     stat = (xmean-mean)/(xstddev/ae_sqrt((double)(n), _state));
   12454           0 :     s = studenttdistribution(n-1, stat, _state);
   12455           0 :     *bothtails = 2*ae_minreal(s, 1-s, _state);
   12456           0 :     *lefttail = s;
   12457           0 :     *righttail = 1-s;
   12458             : }
   12459             : 
   12460             : 
   12461             : /*************************************************************************
   12462             : Two-sample pooled test
   12463             : 
   12464             : This test checks three hypotheses about the mean of the given samples. The
   12465             : following tests are performed:
   12466             :     * two-tailed test (null hypothesis - the means are equal)
   12467             :     * left-tailed test (null hypothesis - the mean of the first sample  is
   12468             :       greater than or equal to the mean of the second sample)
   12469             :     * right-tailed test (null hypothesis - the mean of the first sample is
   12470             :       less than or equal to the mean of the second sample).
   12471             : 
   12472             : Test is based on the following assumptions:
   12473             :     * given samples have normal distributions
   12474             :     * dispersions are equal
   12475             :     * samples are independent.
   12476             : 
   12477             : Input parameters:
   12478             :     X       -   sample 1. Array whose index goes from 0 to N-1.
   12479             :     N       -   size of sample.
   12480             :     Y       -   sample 2. Array whose index goes from 0 to M-1.
   12481             :     M       -   size of sample.
   12482             : 
   12483             : Output parameters:
   12484             :     BothTails   -   p-value for two-tailed test.
   12485             :                     If BothTails is less than the given significance level
   12486             :                     the null hypothesis is rejected.
   12487             :     LeftTail    -   p-value for left-tailed test.
   12488             :                     If LeftTail is less than the given significance level,
   12489             :                     the null hypothesis is rejected.
   12490             :     RightTail   -   p-value for right-tailed test.
   12491             :                     If RightTail is less than the given significance level
   12492             :                     the null hypothesis is rejected.
   12493             : 
   12494             : NOTE: this function correctly handles degenerate cases:
   12495             :       * when N=0 or M=0, all p-values are set to 1.0
   12496             :       * when both samples has exactly zero variance, p-values are set
   12497             :         to 1.0 or 0.0, depending on difference between means.
   12498             : 
   12499             :   -- ALGLIB --
   12500             :      Copyright 18.09.2006 by Bochkanov Sergey
   12501             : *************************************************************************/
   12502           0 : void studentttest2(/* Real    */ ae_vector* x,
   12503             :      ae_int_t n,
   12504             :      /* Real    */ ae_vector* y,
   12505             :      ae_int_t m,
   12506             :      double* bothtails,
   12507             :      double* lefttail,
   12508             :      double* righttail,
   12509             :      ae_state *_state)
   12510             : {
   12511             :     ae_int_t i;
   12512             :     ae_bool samex;
   12513             :     ae_bool samey;
   12514             :     double x0;
   12515             :     double y0;
   12516             :     double xmean;
   12517             :     double ymean;
   12518             :     double v;
   12519             :     double stat;
   12520             :     double s;
   12521             :     double p;
   12522             : 
   12523           0 :     *bothtails = 0;
   12524           0 :     *lefttail = 0;
   12525           0 :     *righttail = 0;
   12526             : 
   12527           0 :     if( n<=0||m<=0 )
   12528             :     {
   12529           0 :         *bothtails = 1.0;
   12530           0 :         *lefttail = 1.0;
   12531           0 :         *righttail = 1.0;
   12532           0 :         return;
   12533             :     }
   12534             :     
   12535             :     /*
   12536             :      * Mean
   12537             :      */
   12538           0 :     xmean = (double)(0);
   12539           0 :     x0 = x->ptr.p_double[0];
   12540           0 :     samex = ae_true;
   12541           0 :     for(i=0; i<=n-1; i++)
   12542             :     {
   12543           0 :         v = x->ptr.p_double[i];
   12544           0 :         xmean = xmean+v;
   12545           0 :         samex = samex&&ae_fp_eq(v,x0);
   12546             :     }
   12547           0 :     if( samex )
   12548             :     {
   12549           0 :         xmean = x0;
   12550             :     }
   12551             :     else
   12552             :     {
   12553           0 :         xmean = xmean/n;
   12554             :     }
   12555           0 :     ymean = (double)(0);
   12556           0 :     y0 = y->ptr.p_double[0];
   12557           0 :     samey = ae_true;
   12558           0 :     for(i=0; i<=m-1; i++)
   12559             :     {
   12560           0 :         v = y->ptr.p_double[i];
   12561           0 :         ymean = ymean+v;
   12562           0 :         samey = samey&&ae_fp_eq(v,y0);
   12563             :     }
   12564           0 :     if( samey )
   12565             :     {
   12566           0 :         ymean = y0;
   12567             :     }
   12568             :     else
   12569             :     {
   12570           0 :         ymean = ymean/m;
   12571             :     }
   12572             :     
   12573             :     /*
   12574             :      * S
   12575             :      */
   12576           0 :     s = (double)(0);
   12577           0 :     if( n+m>2 )
   12578             :     {
   12579           0 :         for(i=0; i<=n-1; i++)
   12580             :         {
   12581           0 :             s = s+ae_sqr(x->ptr.p_double[i]-xmean, _state);
   12582             :         }
   12583           0 :         for(i=0; i<=m-1; i++)
   12584             :         {
   12585           0 :             s = s+ae_sqr(y->ptr.p_double[i]-ymean, _state);
   12586             :         }
   12587           0 :         s = ae_sqrt(s*((double)1/(double)n+(double)1/(double)m)/(n+m-2), _state);
   12588             :     }
   12589           0 :     if( ae_fp_eq(s,(double)(0)) )
   12590             :     {
   12591           0 :         if( ae_fp_eq(xmean,ymean) )
   12592             :         {
   12593           0 :             *bothtails = 1.0;
   12594             :         }
   12595             :         else
   12596             :         {
   12597           0 :             *bothtails = 0.0;
   12598             :         }
   12599           0 :         if( ae_fp_greater_eq(xmean,ymean) )
   12600             :         {
   12601           0 :             *lefttail = 1.0;
   12602             :         }
   12603             :         else
   12604             :         {
   12605           0 :             *lefttail = 0.0;
   12606             :         }
   12607           0 :         if( ae_fp_less_eq(xmean,ymean) )
   12608             :         {
   12609           0 :             *righttail = 1.0;
   12610             :         }
   12611             :         else
   12612             :         {
   12613           0 :             *righttail = 0.0;
   12614             :         }
   12615           0 :         return;
   12616             :     }
   12617             :     
   12618             :     /*
   12619             :      * Statistic
   12620             :      */
   12621           0 :     stat = (xmean-ymean)/s;
   12622           0 :     p = studenttdistribution(n+m-2, stat, _state);
   12623           0 :     *bothtails = 2*ae_minreal(p, 1-p, _state);
   12624           0 :     *lefttail = p;
   12625           0 :     *righttail = 1-p;
   12626             : }
   12627             : 
   12628             : 
   12629             : /*************************************************************************
   12630             : Two-sample unpooled test
   12631             : 
   12632             : This test checks three hypotheses about the mean of the given samples. The
   12633             : following tests are performed:
   12634             :     * two-tailed test (null hypothesis - the means are equal)
   12635             :     * left-tailed test (null hypothesis - the mean of the first sample  is
   12636             :       greater than or equal to the mean of the second sample)
   12637             :     * right-tailed test (null hypothesis - the mean of the first sample is
   12638             :       less than or equal to the mean of the second sample).
   12639             : 
   12640             : Test is based on the following assumptions:
   12641             :     * given samples have normal distributions
   12642             :     * samples are independent.
   12643             : Equality of variances is NOT required.
   12644             : 
   12645             : Input parameters:
   12646             :     X - sample 1. Array whose index goes from 0 to N-1.
   12647             :     N - size of the sample.
   12648             :     Y - sample 2. Array whose index goes from 0 to M-1.
   12649             :     M - size of the sample.
   12650             : 
   12651             : Output parameters:
   12652             :     BothTails   -   p-value for two-tailed test.
   12653             :                     If BothTails is less than the given significance level
   12654             :                     the null hypothesis is rejected.
   12655             :     LeftTail    -   p-value for left-tailed test.
   12656             :                     If LeftTail is less than the given significance level,
   12657             :                     the null hypothesis is rejected.
   12658             :     RightTail   -   p-value for right-tailed test.
   12659             :                     If RightTail is less than the given significance level
   12660             :                     the null hypothesis is rejected.
   12661             : 
   12662             : NOTE: this function correctly handles degenerate cases:
   12663             :       * when N=0 or M=0, all p-values are set to 1.0
   12664             :       * when both samples has zero variance, p-values are set
   12665             :         to 1.0 or 0.0, depending on difference between means.
   12666             :       * when only one sample has zero variance, test reduces to 1-sample
   12667             :         version.
   12668             : 
   12669             :   -- ALGLIB --
   12670             :      Copyright 18.09.2006 by Bochkanov Sergey
   12671             : *************************************************************************/
   12672           0 : void unequalvariancettest(/* Real    */ ae_vector* x,
   12673             :      ae_int_t n,
   12674             :      /* Real    */ ae_vector* y,
   12675             :      ae_int_t m,
   12676             :      double* bothtails,
   12677             :      double* lefttail,
   12678             :      double* righttail,
   12679             :      ae_state *_state)
   12680             : {
   12681             :     ae_int_t i;
   12682             :     ae_bool samex;
   12683             :     ae_bool samey;
   12684             :     double x0;
   12685             :     double y0;
   12686             :     double xmean;
   12687             :     double ymean;
   12688             :     double xvar;
   12689             :     double yvar;
   12690             :     double v;
   12691             :     double df;
   12692             :     double p;
   12693             :     double stat;
   12694             :     double c;
   12695             : 
   12696           0 :     *bothtails = 0;
   12697           0 :     *lefttail = 0;
   12698           0 :     *righttail = 0;
   12699             : 
   12700           0 :     if( n<=0||m<=0 )
   12701             :     {
   12702           0 :         *bothtails = 1.0;
   12703           0 :         *lefttail = 1.0;
   12704           0 :         *righttail = 1.0;
   12705           0 :         return;
   12706             :     }
   12707             :     
   12708             :     /*
   12709             :      * Mean
   12710             :      */
   12711           0 :     xmean = (double)(0);
   12712           0 :     x0 = x->ptr.p_double[0];
   12713           0 :     samex = ae_true;
   12714           0 :     for(i=0; i<=n-1; i++)
   12715             :     {
   12716           0 :         v = x->ptr.p_double[i];
   12717           0 :         xmean = xmean+v;
   12718           0 :         samex = samex&&ae_fp_eq(v,x0);
   12719             :     }
   12720           0 :     if( samex )
   12721             :     {
   12722           0 :         xmean = x0;
   12723             :     }
   12724             :     else
   12725             :     {
   12726           0 :         xmean = xmean/n;
   12727             :     }
   12728           0 :     ymean = (double)(0);
   12729           0 :     y0 = y->ptr.p_double[0];
   12730           0 :     samey = ae_true;
   12731           0 :     for(i=0; i<=m-1; i++)
   12732             :     {
   12733           0 :         v = y->ptr.p_double[i];
   12734           0 :         ymean = ymean+v;
   12735           0 :         samey = samey&&ae_fp_eq(v,y0);
   12736             :     }
   12737           0 :     if( samey )
   12738             :     {
   12739           0 :         ymean = y0;
   12740             :     }
   12741             :     else
   12742             :     {
   12743           0 :         ymean = ymean/m;
   12744             :     }
   12745             :     
   12746             :     /*
   12747             :      * Variance (using corrected two-pass algorithm)
   12748             :      */
   12749           0 :     xvar = (double)(0);
   12750           0 :     if( n>=2&&!samex )
   12751             :     {
   12752           0 :         for(i=0; i<=n-1; i++)
   12753             :         {
   12754           0 :             xvar = xvar+ae_sqr(x->ptr.p_double[i]-xmean, _state);
   12755             :         }
   12756           0 :         xvar = xvar/(n-1);
   12757             :     }
   12758           0 :     yvar = (double)(0);
   12759           0 :     if( m>=2&&!samey )
   12760             :     {
   12761           0 :         for(i=0; i<=m-1; i++)
   12762             :         {
   12763           0 :             yvar = yvar+ae_sqr(y->ptr.p_double[i]-ymean, _state);
   12764             :         }
   12765           0 :         yvar = yvar/(m-1);
   12766             :     }
   12767             :     
   12768             :     /*
   12769             :      * Handle different special cases
   12770             :      * (one or both variances are zero).
   12771             :      */
   12772           0 :     if( ae_fp_eq(xvar,(double)(0))&&ae_fp_eq(yvar,(double)(0)) )
   12773             :     {
   12774           0 :         if( ae_fp_eq(xmean,ymean) )
   12775             :         {
   12776           0 :             *bothtails = 1.0;
   12777             :         }
   12778             :         else
   12779             :         {
   12780           0 :             *bothtails = 0.0;
   12781             :         }
   12782           0 :         if( ae_fp_greater_eq(xmean,ymean) )
   12783             :         {
   12784           0 :             *lefttail = 1.0;
   12785             :         }
   12786             :         else
   12787             :         {
   12788           0 :             *lefttail = 0.0;
   12789             :         }
   12790           0 :         if( ae_fp_less_eq(xmean,ymean) )
   12791             :         {
   12792           0 :             *righttail = 1.0;
   12793             :         }
   12794             :         else
   12795             :         {
   12796           0 :             *righttail = 0.0;
   12797             :         }
   12798           0 :         return;
   12799             :     }
   12800           0 :     if( ae_fp_eq(xvar,(double)(0)) )
   12801             :     {
   12802             :         
   12803             :         /*
   12804             :          * X is constant, unpooled 2-sample test reduces to 1-sample test.
   12805             :          *
   12806             :          * NOTE: right-tail and left-tail must be passed to 1-sample
   12807             :          *       t-test in reverse order because we reverse order of
   12808             :          *       of samples.
   12809             :          */
   12810           0 :         studentttest1(y, m, xmean, bothtails, righttail, lefttail, _state);
   12811           0 :         return;
   12812             :     }
   12813           0 :     if( ae_fp_eq(yvar,(double)(0)) )
   12814             :     {
   12815             :         
   12816             :         /*
   12817             :          * Y is constant, unpooled 2-sample test reduces to 1-sample test.
   12818             :          */
   12819           0 :         studentttest1(x, n, ymean, bothtails, lefttail, righttail, _state);
   12820           0 :         return;
   12821             :     }
   12822             :     
   12823             :     /*
   12824             :      * Statistic
   12825             :      */
   12826           0 :     stat = (xmean-ymean)/ae_sqrt(xvar/n+yvar/m, _state);
   12827           0 :     c = xvar/n/(xvar/n+yvar/m);
   12828           0 :     df = rmul2((double)(n-1), (double)(m-1), _state)/((m-1)*ae_sqr(c, _state)+(n-1)*ae_sqr(1-c, _state));
   12829           0 :     if( ae_fp_greater(stat,(double)(0)) )
   12830             :     {
   12831           0 :         p = 1-0.5*incompletebeta(df/2, 0.5, df/(df+ae_sqr(stat, _state)), _state);
   12832             :     }
   12833             :     else
   12834             :     {
   12835           0 :         p = 0.5*incompletebeta(df/2, 0.5, df/(df+ae_sqr(stat, _state)), _state);
   12836             :     }
   12837           0 :     *bothtails = 2*ae_minreal(p, 1-p, _state);
   12838           0 :     *lefttail = p;
   12839           0 :     *righttail = 1-p;
   12840             : }
   12841             : 
   12842             : 
   12843             : #endif
   12844             : #if defined(AE_COMPILE_MANNWHITNEYU) || !defined(AE_PARTIAL_BUILD)
   12845             : 
   12846             : 
   12847             : /*************************************************************************
   12848             : Mann-Whitney U-test
   12849             : 
   12850             : This test checks hypotheses about whether X  and  Y  are  samples  of  two
   12851             : continuous distributions of the same shape  and  same  median  or  whether
   12852             : their medians are different.
   12853             : 
   12854             : The following tests are performed:
   12855             :     * two-tailed test (null hypothesis - the medians are equal)
   12856             :     * left-tailed test (null hypothesis - the median of the  first  sample
   12857             :       is greater than or equal to the median of the second sample)
   12858             :     * right-tailed test (null hypothesis - the median of the first  sample
   12859             :       is less than or equal to the median of the second sample).
   12860             : 
   12861             : Requirements:
   12862             :     * the samples are independent
   12863             :     * X and Y are continuous distributions (or discrete distributions well-
   12864             :       approximating continuous distributions)
   12865             :     * distributions of X and Y have the  same  shape.  The  only  possible
   12866             :       difference is their position (i.e. the value of the median)
   12867             :     * the number of elements in each sample is not less than 5
   12868             :     * the scale of measurement should be ordinal, interval or ratio  (i.e.
   12869             :       the test could not be applied to nominal variables).
   12870             : 
   12871             : The test is non-parametric and doesn't require distributions to be normal.
   12872             : 
   12873             : Input parameters:
   12874             :     X   -   sample 1. Array whose index goes from 0 to N-1.
   12875             :     N   -   size of the sample. N>=5
   12876             :     Y   -   sample 2. Array whose index goes from 0 to M-1.
   12877             :     M   -   size of the sample. M>=5
   12878             : 
   12879             : Output parameters:
   12880             :     BothTails   -   p-value for two-tailed test.
   12881             :                     If BothTails is less than the given significance level
   12882             :                     the null hypothesis is rejected.
   12883             :     LeftTail    -   p-value for left-tailed test.
   12884             :                     If LeftTail is less than the given significance level,
   12885             :                     the null hypothesis is rejected.
   12886             :     RightTail   -   p-value for right-tailed test.
   12887             :                     If RightTail is less than the given significance level
   12888             :                     the null hypothesis is rejected.
   12889             : 
   12890             : To calculate p-values, special approximation is used. This method lets  us
   12891             : calculate p-values with satisfactory  accuracy  in  interval  [0.0001, 1].
   12892             : There is no approximation outside the [0.0001, 1] interval. Therefore,  if
   12893             : the significance level outlies this interval, the test returns 0.0001.
   12894             : 
   12895             : Relative precision of approximation of p-value:
   12896             : 
   12897             : N          M          Max.err.   Rms.err.
   12898             : 5..10      N..10      1.4e-02    6.0e-04
   12899             : 5..10      N..100     2.2e-02    5.3e-06
   12900             : 10..15     N..15      1.0e-02    3.2e-04
   12901             : 10..15     N..100     1.0e-02    2.2e-05
   12902             : 15..100    N..100     6.1e-03    2.7e-06
   12903             : 
   12904             : For N,M>100 accuracy checks weren't put into  practice,  but  taking  into
   12905             : account characteristics of asymptotic approximation used, precision should
   12906             : not be sharply different from the values for interval [5, 100].
   12907             : 
   12908             : NOTE: P-value approximation was  optimized  for  0.0001<=p<=0.2500.  Thus,
   12909             :       P's outside of this interval are enforced to these bounds. Say,  you
   12910             :       may quite often get P equal to exactly 0.25 or 0.0001.
   12911             : 
   12912             :   -- ALGLIB --
   12913             :      Copyright 09.04.2007 by Bochkanov Sergey
   12914             : *************************************************************************/
   12915           0 : void mannwhitneyutest(/* Real    */ ae_vector* x,
   12916             :      ae_int_t n,
   12917             :      /* Real    */ ae_vector* y,
   12918             :      ae_int_t m,
   12919             :      double* bothtails,
   12920             :      double* lefttail,
   12921             :      double* righttail,
   12922             :      ae_state *_state)
   12923             : {
   12924             :     ae_frame _frame_block;
   12925             :     ae_int_t i;
   12926             :     ae_int_t j;
   12927             :     ae_int_t k;
   12928             :     ae_int_t t;
   12929             :     double tmp;
   12930             :     ae_int_t tmpi;
   12931             :     ae_int_t ns;
   12932             :     ae_vector r;
   12933             :     ae_vector c;
   12934             :     double u;
   12935             :     double p;
   12936             :     double mp;
   12937             :     double s;
   12938             :     double sigma;
   12939             :     double mu;
   12940             :     ae_int_t tiecount;
   12941             :     ae_vector tiesize;
   12942             : 
   12943           0 :     ae_frame_make(_state, &_frame_block);
   12944           0 :     memset(&r, 0, sizeof(r));
   12945           0 :     memset(&c, 0, sizeof(c));
   12946           0 :     memset(&tiesize, 0, sizeof(tiesize));
   12947           0 :     *bothtails = 0;
   12948           0 :     *lefttail = 0;
   12949           0 :     *righttail = 0;
   12950           0 :     ae_vector_init(&r, 0, DT_REAL, _state, ae_true);
   12951           0 :     ae_vector_init(&c, 0, DT_INT, _state, ae_true);
   12952           0 :     ae_vector_init(&tiesize, 0, DT_INT, _state, ae_true);
   12953             : 
   12954             :     
   12955             :     /*
   12956             :      * Prepare
   12957             :      */
   12958           0 :     if( n<=4||m<=4 )
   12959             :     {
   12960           0 :         *bothtails = 1.0;
   12961           0 :         *lefttail = 1.0;
   12962           0 :         *righttail = 1.0;
   12963           0 :         ae_frame_leave(_state);
   12964           0 :         return;
   12965             :     }
   12966           0 :     ns = n+m;
   12967           0 :     ae_vector_set_length(&r, ns-1+1, _state);
   12968           0 :     ae_vector_set_length(&c, ns-1+1, _state);
   12969           0 :     for(i=0; i<=n-1; i++)
   12970             :     {
   12971           0 :         r.ptr.p_double[i] = x->ptr.p_double[i];
   12972           0 :         c.ptr.p_int[i] = 0;
   12973             :     }
   12974           0 :     for(i=0; i<=m-1; i++)
   12975             :     {
   12976           0 :         r.ptr.p_double[n+i] = y->ptr.p_double[i];
   12977           0 :         c.ptr.p_int[n+i] = 1;
   12978             :     }
   12979             :     
   12980             :     /*
   12981             :      * sort {R, C}
   12982             :      */
   12983           0 :     if( ns!=1 )
   12984             :     {
   12985           0 :         i = 2;
   12986             :         do
   12987             :         {
   12988           0 :             t = i;
   12989           0 :             while(t!=1)
   12990             :             {
   12991           0 :                 k = t/2;
   12992           0 :                 if( ae_fp_greater_eq(r.ptr.p_double[k-1],r.ptr.p_double[t-1]) )
   12993             :                 {
   12994           0 :                     t = 1;
   12995             :                 }
   12996             :                 else
   12997             :                 {
   12998           0 :                     tmp = r.ptr.p_double[k-1];
   12999           0 :                     r.ptr.p_double[k-1] = r.ptr.p_double[t-1];
   13000           0 :                     r.ptr.p_double[t-1] = tmp;
   13001           0 :                     tmpi = c.ptr.p_int[k-1];
   13002           0 :                     c.ptr.p_int[k-1] = c.ptr.p_int[t-1];
   13003           0 :                     c.ptr.p_int[t-1] = tmpi;
   13004           0 :                     t = k;
   13005             :                 }
   13006             :             }
   13007           0 :             i = i+1;
   13008             :         }
   13009           0 :         while(i<=ns);
   13010           0 :         i = ns-1;
   13011             :         do
   13012             :         {
   13013           0 :             tmp = r.ptr.p_double[i];
   13014           0 :             r.ptr.p_double[i] = r.ptr.p_double[0];
   13015           0 :             r.ptr.p_double[0] = tmp;
   13016           0 :             tmpi = c.ptr.p_int[i];
   13017           0 :             c.ptr.p_int[i] = c.ptr.p_int[0];
   13018           0 :             c.ptr.p_int[0] = tmpi;
   13019           0 :             t = 1;
   13020           0 :             while(t!=0)
   13021             :             {
   13022           0 :                 k = 2*t;
   13023           0 :                 if( k>i )
   13024             :                 {
   13025           0 :                     t = 0;
   13026             :                 }
   13027             :                 else
   13028             :                 {
   13029           0 :                     if( k<i )
   13030             :                     {
   13031           0 :                         if( ae_fp_greater(r.ptr.p_double[k],r.ptr.p_double[k-1]) )
   13032             :                         {
   13033           0 :                             k = k+1;
   13034             :                         }
   13035             :                     }
   13036           0 :                     if( ae_fp_greater_eq(r.ptr.p_double[t-1],r.ptr.p_double[k-1]) )
   13037             :                     {
   13038           0 :                         t = 0;
   13039             :                     }
   13040             :                     else
   13041             :                     {
   13042           0 :                         tmp = r.ptr.p_double[k-1];
   13043           0 :                         r.ptr.p_double[k-1] = r.ptr.p_double[t-1];
   13044           0 :                         r.ptr.p_double[t-1] = tmp;
   13045           0 :                         tmpi = c.ptr.p_int[k-1];
   13046           0 :                         c.ptr.p_int[k-1] = c.ptr.p_int[t-1];
   13047           0 :                         c.ptr.p_int[t-1] = tmpi;
   13048           0 :                         t = k;
   13049             :                     }
   13050             :                 }
   13051             :             }
   13052           0 :             i = i-1;
   13053             :         }
   13054           0 :         while(i>=1);
   13055             :     }
   13056             :     
   13057             :     /*
   13058             :      * compute tied ranks
   13059             :      */
   13060           0 :     i = 0;
   13061           0 :     tiecount = 0;
   13062           0 :     ae_vector_set_length(&tiesize, ns-1+1, _state);
   13063           0 :     while(i<=ns-1)
   13064             :     {
   13065           0 :         j = i+1;
   13066           0 :         while(j<=ns-1)
   13067             :         {
   13068           0 :             if( ae_fp_neq(r.ptr.p_double[j],r.ptr.p_double[i]) )
   13069             :             {
   13070           0 :                 break;
   13071             :             }
   13072           0 :             j = j+1;
   13073             :         }
   13074           0 :         for(k=i; k<=j-1; k++)
   13075             :         {
   13076           0 :             r.ptr.p_double[k] = 1+(double)(i+j-1)/(double)2;
   13077             :         }
   13078           0 :         tiesize.ptr.p_int[tiecount] = j-i;
   13079           0 :         tiecount = tiecount+1;
   13080           0 :         i = j;
   13081             :     }
   13082             :     
   13083             :     /*
   13084             :      * Compute U
   13085             :      */
   13086           0 :     u = (double)(0);
   13087           0 :     for(i=0; i<=ns-1; i++)
   13088             :     {
   13089           0 :         if( c.ptr.p_int[i]==0 )
   13090             :         {
   13091           0 :             u = u+r.ptr.p_double[i];
   13092             :         }
   13093             :     }
   13094           0 :     u = rmul2((double)(n), (double)(m), _state)+rmul2((double)(n), (double)(n+1), _state)*0.5-u;
   13095             :     
   13096             :     /*
   13097             :      * Result
   13098             :      */
   13099           0 :     mu = rmul2((double)(n), (double)(m), _state)/2;
   13100           0 :     tmp = ns*(ae_sqr((double)(ns), _state)-1)/12;
   13101           0 :     for(i=0; i<=tiecount-1; i++)
   13102             :     {
   13103           0 :         tmp = tmp-tiesize.ptr.p_int[i]*(ae_sqr((double)(tiesize.ptr.p_int[i]), _state)-1)/12;
   13104             :     }
   13105           0 :     sigma = ae_sqrt(rmul2((double)(n), (double)(m), _state)/ns/(ns-1)*tmp, _state);
   13106           0 :     s = (u-mu)/sigma;
   13107           0 :     if( ae_fp_less_eq(s,(double)(0)) )
   13108             :     {
   13109           0 :         p = ae_exp(mannwhitneyu_usigma(-(u-mu)/sigma, n, m, _state), _state);
   13110           0 :         mp = 1-ae_exp(mannwhitneyu_usigma(-(u-1-mu)/sigma, n, m, _state), _state);
   13111             :     }
   13112             :     else
   13113             :     {
   13114           0 :         mp = ae_exp(mannwhitneyu_usigma((u-mu)/sigma, n, m, _state), _state);
   13115           0 :         p = 1-ae_exp(mannwhitneyu_usigma((u+1-mu)/sigma, n, m, _state), _state);
   13116             :     }
   13117           0 :     *lefttail = boundval(ae_maxreal(mp, 1.0E-4, _state), 0.0001, 0.2500, _state);
   13118           0 :     *righttail = boundval(ae_maxreal(p, 1.0E-4, _state), 0.0001, 0.2500, _state);
   13119           0 :     *bothtails = 2*ae_minreal(*lefttail, *righttail, _state);
   13120           0 :     ae_frame_leave(_state);
   13121             : }
   13122             : 
   13123             : 
   13124             : /*************************************************************************
   13125             : Sequential Chebyshev interpolation.
   13126             : *************************************************************************/
   13127           0 : static void mannwhitneyu_ucheb(double x,
   13128             :      double c,
   13129             :      double* tj,
   13130             :      double* tj1,
   13131             :      double* r,
   13132             :      ae_state *_state)
   13133             : {
   13134             :     double t;
   13135             : 
   13136             : 
   13137           0 :     *r = *r+c*(*tj);
   13138           0 :     t = 2*x*(*tj1)-(*tj);
   13139           0 :     *tj = *tj1;
   13140           0 :     *tj1 = t;
   13141           0 : }
   13142             : 
   13143             : 
   13144             : /*************************************************************************
   13145             : Three-point polynomial interpolation.
   13146             : *************************************************************************/
   13147           0 : static double mannwhitneyu_uninterpolate(double p1,
   13148             :      double p2,
   13149             :      double p3,
   13150             :      ae_int_t n,
   13151             :      ae_state *_state)
   13152             : {
   13153             :     double t1;
   13154             :     double t2;
   13155             :     double t3;
   13156             :     double t;
   13157             :     double p12;
   13158             :     double p23;
   13159             :     double result;
   13160             : 
   13161             : 
   13162           0 :     t1 = 1.0/15.0;
   13163           0 :     t2 = 1.0/30.0;
   13164           0 :     t3 = 1.0/100.0;
   13165           0 :     t = 1.0/n;
   13166           0 :     p12 = ((t-t2)*p1+(t1-t)*p2)/(t1-t2);
   13167           0 :     p23 = ((t-t3)*p2+(t2-t)*p3)/(t2-t3);
   13168           0 :     result = ((t-t3)*p12+(t1-t)*p23)/(t1-t3);
   13169           0 :     return result;
   13170             : }
   13171             : 
   13172             : 
   13173             : /*************************************************************************
   13174             : Tail(0, N1, N2)
   13175             : *************************************************************************/
   13176           0 : static double mannwhitneyu_usigma000(ae_int_t n1,
   13177             :      ae_int_t n2,
   13178             :      ae_state *_state)
   13179             : {
   13180             :     double p1;
   13181             :     double p2;
   13182             :     double p3;
   13183             :     double result;
   13184             : 
   13185             : 
   13186           0 :     p1 = mannwhitneyu_uninterpolate(-6.76984e-01, -6.83700e-01, -6.89873e-01, n2, _state);
   13187           0 :     p2 = mannwhitneyu_uninterpolate(-6.83700e-01, -6.87311e-01, -6.90957e-01, n2, _state);
   13188           0 :     p3 = mannwhitneyu_uninterpolate(-6.89873e-01, -6.90957e-01, -6.92175e-01, n2, _state);
   13189           0 :     result = mannwhitneyu_uninterpolate(p1, p2, p3, n1, _state);
   13190           0 :     return result;
   13191             : }
   13192             : 
   13193             : 
   13194             : /*************************************************************************
   13195             : Tail(0.75, N1, N2)
   13196             : *************************************************************************/
   13197           0 : static double mannwhitneyu_usigma075(ae_int_t n1,
   13198             :      ae_int_t n2,
   13199             :      ae_state *_state)
   13200             : {
   13201             :     double p1;
   13202             :     double p2;
   13203             :     double p3;
   13204             :     double result;
   13205             : 
   13206             : 
   13207           0 :     p1 = mannwhitneyu_uninterpolate(-1.44500e+00, -1.45906e+00, -1.47063e+00, n2, _state);
   13208           0 :     p2 = mannwhitneyu_uninterpolate(-1.45906e+00, -1.46856e+00, -1.47644e+00, n2, _state);
   13209           0 :     p3 = mannwhitneyu_uninterpolate(-1.47063e+00, -1.47644e+00, -1.48100e+00, n2, _state);
   13210           0 :     result = mannwhitneyu_uninterpolate(p1, p2, p3, n1, _state);
   13211           0 :     return result;
   13212             : }
   13213             : 
   13214             : 
   13215             : /*************************************************************************
   13216             : Tail(1.5, N1, N2)
   13217             : *************************************************************************/
   13218           0 : static double mannwhitneyu_usigma150(ae_int_t n1,
   13219             :      ae_int_t n2,
   13220             :      ae_state *_state)
   13221             : {
   13222             :     double p1;
   13223             :     double p2;
   13224             :     double p3;
   13225             :     double result;
   13226             : 
   13227             : 
   13228           0 :     p1 = mannwhitneyu_uninterpolate(-2.65380e+00, -2.67352e+00, -2.69011e+00, n2, _state);
   13229           0 :     p2 = mannwhitneyu_uninterpolate(-2.67352e+00, -2.68591e+00, -2.69659e+00, n2, _state);
   13230           0 :     p3 = mannwhitneyu_uninterpolate(-2.69011e+00, -2.69659e+00, -2.70192e+00, n2, _state);
   13231           0 :     result = mannwhitneyu_uninterpolate(p1, p2, p3, n1, _state);
   13232           0 :     return result;
   13233             : }
   13234             : 
   13235             : 
   13236             : /*************************************************************************
   13237             : Tail(2.25, N1, N2)
   13238             : *************************************************************************/
   13239           0 : static double mannwhitneyu_usigma225(ae_int_t n1,
   13240             :      ae_int_t n2,
   13241             :      ae_state *_state)
   13242             : {
   13243             :     double p1;
   13244             :     double p2;
   13245             :     double p3;
   13246             :     double result;
   13247             : 
   13248             : 
   13249           0 :     p1 = mannwhitneyu_uninterpolate(-4.41465e+00, -4.42260e+00, -4.43702e+00, n2, _state);
   13250           0 :     p2 = mannwhitneyu_uninterpolate(-4.42260e+00, -4.41639e+00, -4.41928e+00, n2, _state);
   13251           0 :     p3 = mannwhitneyu_uninterpolate(-4.43702e+00, -4.41928e+00, -4.41030e+00, n2, _state);
   13252           0 :     result = mannwhitneyu_uninterpolate(p1, p2, p3, n1, _state);
   13253           0 :     return result;
   13254             : }
   13255             : 
   13256             : 
   13257             : /*************************************************************************
   13258             : Tail(3.0, N1, N2)
   13259             : *************************************************************************/
   13260           0 : static double mannwhitneyu_usigma300(ae_int_t n1,
   13261             :      ae_int_t n2,
   13262             :      ae_state *_state)
   13263             : {
   13264             :     double p1;
   13265             :     double p2;
   13266             :     double p3;
   13267             :     double result;
   13268             : 
   13269             : 
   13270           0 :     p1 = mannwhitneyu_uninterpolate(-6.89839e+00, -6.83477e+00, -6.82340e+00, n2, _state);
   13271           0 :     p2 = mannwhitneyu_uninterpolate(-6.83477e+00, -6.74559e+00, -6.71117e+00, n2, _state);
   13272           0 :     p3 = mannwhitneyu_uninterpolate(-6.82340e+00, -6.71117e+00, -6.64929e+00, n2, _state);
   13273           0 :     result = mannwhitneyu_uninterpolate(p1, p2, p3, n1, _state);
   13274           0 :     return result;
   13275             : }
   13276             : 
   13277             : 
   13278             : /*************************************************************************
   13279             : Tail(3.33, N1, N2)
   13280             : *************************************************************************/
   13281           0 : static double mannwhitneyu_usigma333(ae_int_t n1,
   13282             :      ae_int_t n2,
   13283             :      ae_state *_state)
   13284             : {
   13285             :     double p1;
   13286             :     double p2;
   13287             :     double p3;
   13288             :     double result;
   13289             : 
   13290             : 
   13291           0 :     p1 = mannwhitneyu_uninterpolate(-8.31272e+00, -8.17096e+00, -8.13125e+00, n2, _state);
   13292           0 :     p2 = mannwhitneyu_uninterpolate(-8.17096e+00, -8.00156e+00, -7.93245e+00, n2, _state);
   13293           0 :     p3 = mannwhitneyu_uninterpolate(-8.13125e+00, -7.93245e+00, -7.82502e+00, n2, _state);
   13294           0 :     result = mannwhitneyu_uninterpolate(p1, p2, p3, n1, _state);
   13295           0 :     return result;
   13296             : }
   13297             : 
   13298             : 
   13299             : /*************************************************************************
   13300             : Tail(3.66, N1, N2)
   13301             : *************************************************************************/
   13302           0 : static double mannwhitneyu_usigma367(ae_int_t n1,
   13303             :      ae_int_t n2,
   13304             :      ae_state *_state)
   13305             : {
   13306             :     double p1;
   13307             :     double p2;
   13308             :     double p3;
   13309             :     double result;
   13310             : 
   13311             : 
   13312           0 :     p1 = mannwhitneyu_uninterpolate(-9.98837e+00, -9.70844e+00, -9.62087e+00, n2, _state);
   13313           0 :     p2 = mannwhitneyu_uninterpolate(-9.70844e+00, -9.41156e+00, -9.28998e+00, n2, _state);
   13314           0 :     p3 = mannwhitneyu_uninterpolate(-9.62087e+00, -9.28998e+00, -9.11686e+00, n2, _state);
   13315           0 :     result = mannwhitneyu_uninterpolate(p1, p2, p3, n1, _state);
   13316           0 :     return result;
   13317             : }
   13318             : 
   13319             : 
   13320             : /*************************************************************************
   13321             : Tail(4.0, N1, N2)
   13322             : *************************************************************************/
   13323           0 : static double mannwhitneyu_usigma400(ae_int_t n1,
   13324             :      ae_int_t n2,
   13325             :      ae_state *_state)
   13326             : {
   13327             :     double p1;
   13328             :     double p2;
   13329             :     double p3;
   13330             :     double result;
   13331             : 
   13332             : 
   13333           0 :     p1 = mannwhitneyu_uninterpolate(-1.20250e+01, -1.14911e+01, -1.13231e+01, n2, _state);
   13334           0 :     p2 = mannwhitneyu_uninterpolate(-1.14911e+01, -1.09927e+01, -1.07937e+01, n2, _state);
   13335           0 :     p3 = mannwhitneyu_uninterpolate(-1.13231e+01, -1.07937e+01, -1.05285e+01, n2, _state);
   13336           0 :     result = mannwhitneyu_uninterpolate(p1, p2, p3, n1, _state);
   13337           0 :     return result;
   13338             : }
   13339             : 
   13340             : 
   13341             : /*************************************************************************
   13342             : Tail(S, 5, 5)
   13343             : *************************************************************************/
   13344           0 : static double mannwhitneyu_utbln5n5(double s, ae_state *_state)
   13345             : {
   13346             :     double x;
   13347             :     double tj;
   13348             :     double tj1;
   13349             :     double result;
   13350             : 
   13351             : 
   13352           0 :     result = (double)(0);
   13353           0 :     x = ae_minreal(2*(s-0.000000e+00)/2.611165e+00-1, 1.0, _state);
   13354           0 :     tj = (double)(1);
   13355           0 :     tj1 = x;
   13356           0 :     mannwhitneyu_ucheb(x, -2.596264e+00, &tj, &tj1, &result, _state);
   13357           0 :     mannwhitneyu_ucheb(x, -2.412086e+00, &tj, &tj1, &result, _state);
   13358           0 :     mannwhitneyu_ucheb(x, -4.858542e-01, &tj, &tj1, &result, _state);
   13359           0 :     mannwhitneyu_ucheb(x, -5.614282e-02, &tj, &tj1, &result, _state);
   13360           0 :     mannwhitneyu_ucheb(x, 3.372686e-03, &tj, &tj1, &result, _state);
   13361           0 :     mannwhitneyu_ucheb(x, 8.524731e-03, &tj, &tj1, &result, _state);
   13362           0 :     mannwhitneyu_ucheb(x, 4.435331e-03, &tj, &tj1, &result, _state);
   13363           0 :     mannwhitneyu_ucheb(x, 1.284665e-03, &tj, &tj1, &result, _state);
   13364           0 :     mannwhitneyu_ucheb(x, 4.184141e-03, &tj, &tj1, &result, _state);
   13365           0 :     mannwhitneyu_ucheb(x, 5.298360e-03, &tj, &tj1, &result, _state);
   13366           0 :     mannwhitneyu_ucheb(x, 7.447272e-04, &tj, &tj1, &result, _state);
   13367           0 :     mannwhitneyu_ucheb(x, -3.938769e-03, &tj, &tj1, &result, _state);
   13368           0 :     mannwhitneyu_ucheb(x, -4.276205e-03, &tj, &tj1, &result, _state);
   13369           0 :     mannwhitneyu_ucheb(x, -1.138481e-03, &tj, &tj1, &result, _state);
   13370           0 :     mannwhitneyu_ucheb(x, 8.684625e-04, &tj, &tj1, &result, _state);
   13371           0 :     mannwhitneyu_ucheb(x, 1.558104e-03, &tj, &tj1, &result, _state);
   13372           0 :     return result;
   13373             : }
   13374             : 
   13375             : 
   13376             : /*************************************************************************
   13377             : Tail(S, 5, 6)
   13378             : *************************************************************************/
   13379           0 : static double mannwhitneyu_utbln5n6(double s, ae_state *_state)
   13380             : {
   13381             :     double x;
   13382             :     double tj;
   13383             :     double tj1;
   13384             :     double result;
   13385             : 
   13386             : 
   13387           0 :     result = (double)(0);
   13388           0 :     x = ae_minreal(2*(s-0.000000e+00)/2.738613e+00-1, 1.0, _state);
   13389           0 :     tj = (double)(1);
   13390           0 :     tj1 = x;
   13391           0 :     mannwhitneyu_ucheb(x, -2.810459e+00, &tj, &tj1, &result, _state);
   13392           0 :     mannwhitneyu_ucheb(x, -2.684429e+00, &tj, &tj1, &result, _state);
   13393           0 :     mannwhitneyu_ucheb(x, -5.712858e-01, &tj, &tj1, &result, _state);
   13394           0 :     mannwhitneyu_ucheb(x, -8.009324e-02, &tj, &tj1, &result, _state);
   13395           0 :     mannwhitneyu_ucheb(x, -6.644391e-03, &tj, &tj1, &result, _state);
   13396           0 :     mannwhitneyu_ucheb(x, 6.034173e-03, &tj, &tj1, &result, _state);
   13397           0 :     mannwhitneyu_ucheb(x, 4.953498e-03, &tj, &tj1, &result, _state);
   13398           0 :     mannwhitneyu_ucheb(x, 3.279293e-03, &tj, &tj1, &result, _state);
   13399           0 :     mannwhitneyu_ucheb(x, 3.563485e-03, &tj, &tj1, &result, _state);
   13400           0 :     mannwhitneyu_ucheb(x, 4.971952e-03, &tj, &tj1, &result, _state);
   13401           0 :     mannwhitneyu_ucheb(x, 3.506309e-03, &tj, &tj1, &result, _state);
   13402           0 :     mannwhitneyu_ucheb(x, -1.541406e-04, &tj, &tj1, &result, _state);
   13403           0 :     mannwhitneyu_ucheb(x, -3.283205e-03, &tj, &tj1, &result, _state);
   13404           0 :     mannwhitneyu_ucheb(x, -3.016347e-03, &tj, &tj1, &result, _state);
   13405           0 :     mannwhitneyu_ucheb(x, -1.221626e-03, &tj, &tj1, &result, _state);
   13406           0 :     mannwhitneyu_ucheb(x, -1.286752e-03, &tj, &tj1, &result, _state);
   13407           0 :     return result;
   13408             : }
   13409             : 
   13410             : 
   13411             : /*************************************************************************
   13412             : Tail(S, 5, 7)
   13413             : *************************************************************************/
   13414           0 : static double mannwhitneyu_utbln5n7(double s, ae_state *_state)
   13415             : {
   13416             :     double x;
   13417             :     double tj;
   13418             :     double tj1;
   13419             :     double result;
   13420             : 
   13421             : 
   13422           0 :     result = (double)(0);
   13423           0 :     x = ae_minreal(2*(s-0.000000e+00)/2.841993e+00-1, 1.0, _state);
   13424           0 :     tj = (double)(1);
   13425           0 :     tj1 = x;
   13426           0 :     mannwhitneyu_ucheb(x, -2.994677e+00, &tj, &tj1, &result, _state);
   13427           0 :     mannwhitneyu_ucheb(x, -2.923264e+00, &tj, &tj1, &result, _state);
   13428           0 :     mannwhitneyu_ucheb(x, -6.506190e-01, &tj, &tj1, &result, _state);
   13429           0 :     mannwhitneyu_ucheb(x, -1.054280e-01, &tj, &tj1, &result, _state);
   13430           0 :     mannwhitneyu_ucheb(x, -1.794587e-02, &tj, &tj1, &result, _state);
   13431           0 :     mannwhitneyu_ucheb(x, 1.726290e-03, &tj, &tj1, &result, _state);
   13432           0 :     mannwhitneyu_ucheb(x, 4.534180e-03, &tj, &tj1, &result, _state);
   13433           0 :     mannwhitneyu_ucheb(x, 4.517845e-03, &tj, &tj1, &result, _state);
   13434           0 :     mannwhitneyu_ucheb(x, 3.904428e-03, &tj, &tj1, &result, _state);
   13435           0 :     mannwhitneyu_ucheb(x, 3.882443e-03, &tj, &tj1, &result, _state);
   13436           0 :     mannwhitneyu_ucheb(x, 3.482988e-03, &tj, &tj1, &result, _state);
   13437           0 :     mannwhitneyu_ucheb(x, 2.114875e-03, &tj, &tj1, &result, _state);
   13438           0 :     mannwhitneyu_ucheb(x, -1.515082e-04, &tj, &tj1, &result, _state);
   13439           0 :     mannwhitneyu_ucheb(x, -1.996056e-03, &tj, &tj1, &result, _state);
   13440           0 :     mannwhitneyu_ucheb(x, -2.293581e-03, &tj, &tj1, &result, _state);
   13441           0 :     mannwhitneyu_ucheb(x, -2.349444e-03, &tj, &tj1, &result, _state);
   13442           0 :     return result;
   13443             : }
   13444             : 
   13445             : 
   13446             : /*************************************************************************
   13447             : Tail(S, 5, 8)
   13448             : *************************************************************************/
   13449           0 : static double mannwhitneyu_utbln5n8(double s, ae_state *_state)
   13450             : {
   13451             :     double x;
   13452             :     double tj;
   13453             :     double tj1;
   13454             :     double result;
   13455             : 
   13456             : 
   13457           0 :     result = (double)(0);
   13458           0 :     x = ae_minreal(2*(s-0.000000e+00)/2.927700e+00-1, 1.0, _state);
   13459           0 :     tj = (double)(1);
   13460           0 :     tj1 = x;
   13461           0 :     mannwhitneyu_ucheb(x, -3.155727e+00, &tj, &tj1, &result, _state);
   13462           0 :     mannwhitneyu_ucheb(x, -3.135078e+00, &tj, &tj1, &result, _state);
   13463           0 :     mannwhitneyu_ucheb(x, -7.247203e-01, &tj, &tj1, &result, _state);
   13464           0 :     mannwhitneyu_ucheb(x, -1.309697e-01, &tj, &tj1, &result, _state);
   13465           0 :     mannwhitneyu_ucheb(x, -2.993725e-02, &tj, &tj1, &result, _state);
   13466           0 :     mannwhitneyu_ucheb(x, -3.567219e-03, &tj, &tj1, &result, _state);
   13467           0 :     mannwhitneyu_ucheb(x, 3.383704e-03, &tj, &tj1, &result, _state);
   13468           0 :     mannwhitneyu_ucheb(x, 5.002188e-03, &tj, &tj1, &result, _state);
   13469           0 :     mannwhitneyu_ucheb(x, 4.487322e-03, &tj, &tj1, &result, _state);
   13470           0 :     mannwhitneyu_ucheb(x, 3.443899e-03, &tj, &tj1, &result, _state);
   13471           0 :     mannwhitneyu_ucheb(x, 2.688270e-03, &tj, &tj1, &result, _state);
   13472           0 :     mannwhitneyu_ucheb(x, 2.600339e-03, &tj, &tj1, &result, _state);
   13473           0 :     mannwhitneyu_ucheb(x, 1.874948e-03, &tj, &tj1, &result, _state);
   13474           0 :     mannwhitneyu_ucheb(x, 1.811593e-04, &tj, &tj1, &result, _state);
   13475           0 :     mannwhitneyu_ucheb(x, -1.072353e-03, &tj, &tj1, &result, _state);
   13476           0 :     mannwhitneyu_ucheb(x, -2.659457e-03, &tj, &tj1, &result, _state);
   13477           0 :     return result;
   13478             : }
   13479             : 
   13480             : 
   13481             : /*************************************************************************
   13482             : Tail(S, 5, 9)
   13483             : *************************************************************************/
   13484           0 : static double mannwhitneyu_utbln5n9(double s, ae_state *_state)
   13485             : {
   13486             :     double x;
   13487             :     double tj;
   13488             :     double tj1;
   13489             :     double result;
   13490             : 
   13491             : 
   13492           0 :     result = (double)(0);
   13493           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.000000e+00-1, 1.0, _state);
   13494           0 :     tj = (double)(1);
   13495           0 :     tj1 = x;
   13496           0 :     mannwhitneyu_ucheb(x, -3.298162e+00, &tj, &tj1, &result, _state);
   13497           0 :     mannwhitneyu_ucheb(x, -3.325016e+00, &tj, &tj1, &result, _state);
   13498           0 :     mannwhitneyu_ucheb(x, -7.939852e-01, &tj, &tj1, &result, _state);
   13499           0 :     mannwhitneyu_ucheb(x, -1.563029e-01, &tj, &tj1, &result, _state);
   13500           0 :     mannwhitneyu_ucheb(x, -4.222652e-02, &tj, &tj1, &result, _state);
   13501           0 :     mannwhitneyu_ucheb(x, -9.195200e-03, &tj, &tj1, &result, _state);
   13502           0 :     mannwhitneyu_ucheb(x, 1.445665e-03, &tj, &tj1, &result, _state);
   13503           0 :     mannwhitneyu_ucheb(x, 5.204792e-03, &tj, &tj1, &result, _state);
   13504           0 :     mannwhitneyu_ucheb(x, 4.775217e-03, &tj, &tj1, &result, _state);
   13505           0 :     mannwhitneyu_ucheb(x, 3.527781e-03, &tj, &tj1, &result, _state);
   13506           0 :     mannwhitneyu_ucheb(x, 2.221948e-03, &tj, &tj1, &result, _state);
   13507           0 :     mannwhitneyu_ucheb(x, 2.242968e-03, &tj, &tj1, &result, _state);
   13508           0 :     mannwhitneyu_ucheb(x, 2.607959e-03, &tj, &tj1, &result, _state);
   13509           0 :     mannwhitneyu_ucheb(x, 1.771285e-03, &tj, &tj1, &result, _state);
   13510           0 :     mannwhitneyu_ucheb(x, 6.694026e-04, &tj, &tj1, &result, _state);
   13511           0 :     mannwhitneyu_ucheb(x, -1.481190e-03, &tj, &tj1, &result, _state);
   13512           0 :     return result;
   13513             : }
   13514             : 
   13515             : 
   13516             : /*************************************************************************
   13517             : Tail(S, 5, 10)
   13518             : *************************************************************************/
   13519           0 : static double mannwhitneyu_utbln5n10(double s, ae_state *_state)
   13520             : {
   13521             :     double x;
   13522             :     double tj;
   13523             :     double tj1;
   13524             :     double result;
   13525             : 
   13526             : 
   13527           0 :     result = (double)(0);
   13528           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.061862e+00-1, 1.0, _state);
   13529           0 :     tj = (double)(1);
   13530           0 :     tj1 = x;
   13531           0 :     mannwhitneyu_ucheb(x, -3.425360e+00, &tj, &tj1, &result, _state);
   13532           0 :     mannwhitneyu_ucheb(x, -3.496710e+00, &tj, &tj1, &result, _state);
   13533           0 :     mannwhitneyu_ucheb(x, -8.587658e-01, &tj, &tj1, &result, _state);
   13534           0 :     mannwhitneyu_ucheb(x, -1.812005e-01, &tj, &tj1, &result, _state);
   13535           0 :     mannwhitneyu_ucheb(x, -5.427637e-02, &tj, &tj1, &result, _state);
   13536           0 :     mannwhitneyu_ucheb(x, -1.515702e-02, &tj, &tj1, &result, _state);
   13537           0 :     mannwhitneyu_ucheb(x, -5.406867e-04, &tj, &tj1, &result, _state);
   13538           0 :     mannwhitneyu_ucheb(x, 4.796295e-03, &tj, &tj1, &result, _state);
   13539           0 :     mannwhitneyu_ucheb(x, 5.237591e-03, &tj, &tj1, &result, _state);
   13540           0 :     mannwhitneyu_ucheb(x, 3.654249e-03, &tj, &tj1, &result, _state);
   13541           0 :     mannwhitneyu_ucheb(x, 2.181165e-03, &tj, &tj1, &result, _state);
   13542           0 :     mannwhitneyu_ucheb(x, 2.011665e-03, &tj, &tj1, &result, _state);
   13543           0 :     mannwhitneyu_ucheb(x, 2.417927e-03, &tj, &tj1, &result, _state);
   13544           0 :     mannwhitneyu_ucheb(x, 2.534880e-03, &tj, &tj1, &result, _state);
   13545           0 :     mannwhitneyu_ucheb(x, 1.791255e-03, &tj, &tj1, &result, _state);
   13546           0 :     mannwhitneyu_ucheb(x, 1.871512e-05, &tj, &tj1, &result, _state);
   13547           0 :     return result;
   13548             : }
   13549             : 
   13550             : 
   13551             : /*************************************************************************
   13552             : Tail(S, 5, 11)
   13553             : *************************************************************************/
   13554           0 : static double mannwhitneyu_utbln5n11(double s, ae_state *_state)
   13555             : {
   13556             :     double x;
   13557             :     double tj;
   13558             :     double tj1;
   13559             :     double result;
   13560             : 
   13561             : 
   13562           0 :     result = (double)(0);
   13563           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.115427e+00-1, 1.0, _state);
   13564           0 :     tj = (double)(1);
   13565           0 :     tj1 = x;
   13566           0 :     mannwhitneyu_ucheb(x, -3.539959e+00, &tj, &tj1, &result, _state);
   13567           0 :     mannwhitneyu_ucheb(x, -3.652998e+00, &tj, &tj1, &result, _state);
   13568           0 :     mannwhitneyu_ucheb(x, -9.196503e-01, &tj, &tj1, &result, _state);
   13569           0 :     mannwhitneyu_ucheb(x, -2.054363e-01, &tj, &tj1, &result, _state);
   13570           0 :     mannwhitneyu_ucheb(x, -6.618848e-02, &tj, &tj1, &result, _state);
   13571           0 :     mannwhitneyu_ucheb(x, -2.109411e-02, &tj, &tj1, &result, _state);
   13572           0 :     mannwhitneyu_ucheb(x, -2.786668e-03, &tj, &tj1, &result, _state);
   13573           0 :     mannwhitneyu_ucheb(x, 4.215648e-03, &tj, &tj1, &result, _state);
   13574           0 :     mannwhitneyu_ucheb(x, 5.484220e-03, &tj, &tj1, &result, _state);
   13575           0 :     mannwhitneyu_ucheb(x, 3.935991e-03, &tj, &tj1, &result, _state);
   13576           0 :     mannwhitneyu_ucheb(x, 2.396191e-03, &tj, &tj1, &result, _state);
   13577           0 :     mannwhitneyu_ucheb(x, 1.894177e-03, &tj, &tj1, &result, _state);
   13578           0 :     mannwhitneyu_ucheb(x, 2.206979e-03, &tj, &tj1, &result, _state);
   13579           0 :     mannwhitneyu_ucheb(x, 2.519055e-03, &tj, &tj1, &result, _state);
   13580           0 :     mannwhitneyu_ucheb(x, 2.210326e-03, &tj, &tj1, &result, _state);
   13581           0 :     mannwhitneyu_ucheb(x, 1.189679e-03, &tj, &tj1, &result, _state);
   13582           0 :     return result;
   13583             : }
   13584             : 
   13585             : 
   13586             : /*************************************************************************
   13587             : Tail(S, 5, 12)
   13588             : *************************************************************************/
   13589           0 : static double mannwhitneyu_utbln5n12(double s, ae_state *_state)
   13590             : {
   13591             :     double x;
   13592             :     double tj;
   13593             :     double tj1;
   13594             :     double result;
   13595             : 
   13596             : 
   13597           0 :     result = (double)(0);
   13598           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.162278e+00-1, 1.0, _state);
   13599           0 :     tj = (double)(1);
   13600           0 :     tj1 = x;
   13601           0 :     mannwhitneyu_ucheb(x, -3.644007e+00, &tj, &tj1, &result, _state);
   13602           0 :     mannwhitneyu_ucheb(x, -3.796173e+00, &tj, &tj1, &result, _state);
   13603           0 :     mannwhitneyu_ucheb(x, -9.771177e-01, &tj, &tj1, &result, _state);
   13604           0 :     mannwhitneyu_ucheb(x, -2.290043e-01, &tj, &tj1, &result, _state);
   13605           0 :     mannwhitneyu_ucheb(x, -7.794686e-02, &tj, &tj1, &result, _state);
   13606           0 :     mannwhitneyu_ucheb(x, -2.702110e-02, &tj, &tj1, &result, _state);
   13607           0 :     mannwhitneyu_ucheb(x, -5.185959e-03, &tj, &tj1, &result, _state);
   13608           0 :     mannwhitneyu_ucheb(x, 3.416259e-03, &tj, &tj1, &result, _state);
   13609           0 :     mannwhitneyu_ucheb(x, 5.592056e-03, &tj, &tj1, &result, _state);
   13610           0 :     mannwhitneyu_ucheb(x, 4.201530e-03, &tj, &tj1, &result, _state);
   13611           0 :     mannwhitneyu_ucheb(x, 2.754365e-03, &tj, &tj1, &result, _state);
   13612           0 :     mannwhitneyu_ucheb(x, 1.978945e-03, &tj, &tj1, &result, _state);
   13613           0 :     mannwhitneyu_ucheb(x, 2.012032e-03, &tj, &tj1, &result, _state);
   13614           0 :     mannwhitneyu_ucheb(x, 2.304579e-03, &tj, &tj1, &result, _state);
   13615           0 :     mannwhitneyu_ucheb(x, 2.100378e-03, &tj, &tj1, &result, _state);
   13616           0 :     mannwhitneyu_ucheb(x, 1.728269e-03, &tj, &tj1, &result, _state);
   13617           0 :     return result;
   13618             : }
   13619             : 
   13620             : 
   13621             : /*************************************************************************
   13622             : Tail(S, 5, 13)
   13623             : *************************************************************************/
   13624           0 : static double mannwhitneyu_utbln5n13(double s, ae_state *_state)
   13625             : {
   13626             :     double x;
   13627             :     double tj;
   13628             :     double tj1;
   13629             :     double result;
   13630             : 
   13631             : 
   13632           0 :     result = (double)(0);
   13633           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.203616e+00-1, 1.0, _state);
   13634           0 :     tj = (double)(1);
   13635           0 :     tj1 = x;
   13636           0 :     mannwhitneyu_ucheb(x, -3.739120e+00, &tj, &tj1, &result, _state);
   13637           0 :     mannwhitneyu_ucheb(x, -3.928117e+00, &tj, &tj1, &result, _state);
   13638           0 :     mannwhitneyu_ucheb(x, -1.031605e+00, &tj, &tj1, &result, _state);
   13639           0 :     mannwhitneyu_ucheb(x, -2.519403e-01, &tj, &tj1, &result, _state);
   13640           0 :     mannwhitneyu_ucheb(x, -8.962648e-02, &tj, &tj1, &result, _state);
   13641           0 :     mannwhitneyu_ucheb(x, -3.292183e-02, &tj, &tj1, &result, _state);
   13642           0 :     mannwhitneyu_ucheb(x, -7.809293e-03, &tj, &tj1, &result, _state);
   13643           0 :     mannwhitneyu_ucheb(x, 2.465156e-03, &tj, &tj1, &result, _state);
   13644           0 :     mannwhitneyu_ucheb(x, 5.456278e-03, &tj, &tj1, &result, _state);
   13645           0 :     mannwhitneyu_ucheb(x, 4.446055e-03, &tj, &tj1, &result, _state);
   13646           0 :     mannwhitneyu_ucheb(x, 3.109490e-03, &tj, &tj1, &result, _state);
   13647           0 :     mannwhitneyu_ucheb(x, 2.218256e-03, &tj, &tj1, &result, _state);
   13648           0 :     mannwhitneyu_ucheb(x, 1.941479e-03, &tj, &tj1, &result, _state);
   13649           0 :     mannwhitneyu_ucheb(x, 2.058603e-03, &tj, &tj1, &result, _state);
   13650           0 :     mannwhitneyu_ucheb(x, 1.824402e-03, &tj, &tj1, &result, _state);
   13651           0 :     mannwhitneyu_ucheb(x, 1.830947e-03, &tj, &tj1, &result, _state);
   13652           0 :     return result;
   13653             : }
   13654             : 
   13655             : 
   13656             : /*************************************************************************
   13657             : Tail(S, 5, 14)
   13658             : *************************************************************************/
   13659           0 : static double mannwhitneyu_utbln5n14(double s, ae_state *_state)
   13660             : {
   13661             :     double x;
   13662             :     double tj;
   13663             :     double tj1;
   13664             :     double result;
   13665             : 
   13666             : 
   13667           0 :     result = (double)(0);
   13668           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.240370e+00-1, 1.0, _state);
   13669           0 :     tj = (double)(1);
   13670           0 :     tj1 = x;
   13671           0 :     mannwhitneyu_ucheb(x, -3.826559e+00, &tj, &tj1, &result, _state);
   13672           0 :     mannwhitneyu_ucheb(x, -4.050370e+00, &tj, &tj1, &result, _state);
   13673           0 :     mannwhitneyu_ucheb(x, -1.083408e+00, &tj, &tj1, &result, _state);
   13674           0 :     mannwhitneyu_ucheb(x, -2.743164e-01, &tj, &tj1, &result, _state);
   13675           0 :     mannwhitneyu_ucheb(x, -1.012030e-01, &tj, &tj1, &result, _state);
   13676           0 :     mannwhitneyu_ucheb(x, -3.884686e-02, &tj, &tj1, &result, _state);
   13677           0 :     mannwhitneyu_ucheb(x, -1.059656e-02, &tj, &tj1, &result, _state);
   13678           0 :     mannwhitneyu_ucheb(x, 1.327521e-03, &tj, &tj1, &result, _state);
   13679           0 :     mannwhitneyu_ucheb(x, 5.134026e-03, &tj, &tj1, &result, _state);
   13680           0 :     mannwhitneyu_ucheb(x, 4.584201e-03, &tj, &tj1, &result, _state);
   13681           0 :     mannwhitneyu_ucheb(x, 3.440618e-03, &tj, &tj1, &result, _state);
   13682           0 :     mannwhitneyu_ucheb(x, 2.524133e-03, &tj, &tj1, &result, _state);
   13683           0 :     mannwhitneyu_ucheb(x, 1.990007e-03, &tj, &tj1, &result, _state);
   13684           0 :     mannwhitneyu_ucheb(x, 1.887334e-03, &tj, &tj1, &result, _state);
   13685           0 :     mannwhitneyu_ucheb(x, 1.534977e-03, &tj, &tj1, &result, _state);
   13686           0 :     mannwhitneyu_ucheb(x, 1.705395e-03, &tj, &tj1, &result, _state);
   13687           0 :     return result;
   13688             : }
   13689             : 
   13690             : 
   13691             : /*************************************************************************
   13692             : Tail(S, 5, 15)
   13693             : *************************************************************************/
   13694           0 : static double mannwhitneyu_utbln5n15(double s, ae_state *_state)
   13695             : {
   13696             :     double x;
   13697             :     double tj;
   13698             :     double tj1;
   13699             :     double result;
   13700             : 
   13701             : 
   13702           0 :     result = (double)(0);
   13703           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
   13704           0 :     tj = (double)(1);
   13705           0 :     tj1 = x;
   13706           0 :     mannwhitneyu_ucheb(x, -3.851572e+00, &tj, &tj1, &result, _state);
   13707           0 :     mannwhitneyu_ucheb(x, -4.082033e+00, &tj, &tj1, &result, _state);
   13708           0 :     mannwhitneyu_ucheb(x, -1.095983e+00, &tj, &tj1, &result, _state);
   13709           0 :     mannwhitneyu_ucheb(x, -2.814595e-01, &tj, &tj1, &result, _state);
   13710           0 :     mannwhitneyu_ucheb(x, -1.073148e-01, &tj, &tj1, &result, _state);
   13711           0 :     mannwhitneyu_ucheb(x, -4.420213e-02, &tj, &tj1, &result, _state);
   13712           0 :     mannwhitneyu_ucheb(x, -1.517175e-02, &tj, &tj1, &result, _state);
   13713           0 :     mannwhitneyu_ucheb(x, -2.344180e-03, &tj, &tj1, &result, _state);
   13714           0 :     mannwhitneyu_ucheb(x, 2.371393e-03, &tj, &tj1, &result, _state);
   13715           0 :     mannwhitneyu_ucheb(x, 2.711443e-03, &tj, &tj1, &result, _state);
   13716           0 :     mannwhitneyu_ucheb(x, 2.228569e-03, &tj, &tj1, &result, _state);
   13717           0 :     mannwhitneyu_ucheb(x, 1.683483e-03, &tj, &tj1, &result, _state);
   13718           0 :     mannwhitneyu_ucheb(x, 1.267112e-03, &tj, &tj1, &result, _state);
   13719           0 :     mannwhitneyu_ucheb(x, 1.156044e-03, &tj, &tj1, &result, _state);
   13720           0 :     mannwhitneyu_ucheb(x, 9.131316e-04, &tj, &tj1, &result, _state);
   13721           0 :     mannwhitneyu_ucheb(x, 1.301023e-03, &tj, &tj1, &result, _state);
   13722           0 :     return result;
   13723             : }
   13724             : 
   13725             : 
   13726             : /*************************************************************************
   13727             : Tail(S, 5, 16)
   13728             : *************************************************************************/
   13729           0 : static double mannwhitneyu_utbln5n16(double s, ae_state *_state)
   13730             : {
   13731             :     double x;
   13732             :     double tj;
   13733             :     double tj1;
   13734             :     double result;
   13735             : 
   13736             : 
   13737           0 :     result = (double)(0);
   13738           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
   13739           0 :     tj = (double)(1);
   13740           0 :     tj1 = x;
   13741           0 :     mannwhitneyu_ucheb(x, -3.852210e+00, &tj, &tj1, &result, _state);
   13742           0 :     mannwhitneyu_ucheb(x, -4.077482e+00, &tj, &tj1, &result, _state);
   13743           0 :     mannwhitneyu_ucheb(x, -1.091186e+00, &tj, &tj1, &result, _state);
   13744           0 :     mannwhitneyu_ucheb(x, -2.797282e-01, &tj, &tj1, &result, _state);
   13745           0 :     mannwhitneyu_ucheb(x, -1.084994e-01, &tj, &tj1, &result, _state);
   13746           0 :     mannwhitneyu_ucheb(x, -4.667054e-02, &tj, &tj1, &result, _state);
   13747           0 :     mannwhitneyu_ucheb(x, -1.843909e-02, &tj, &tj1, &result, _state);
   13748           0 :     mannwhitneyu_ucheb(x, -5.456732e-03, &tj, &tj1, &result, _state);
   13749           0 :     mannwhitneyu_ucheb(x, -5.039830e-04, &tj, &tj1, &result, _state);
   13750           0 :     mannwhitneyu_ucheb(x, 4.723508e-04, &tj, &tj1, &result, _state);
   13751           0 :     mannwhitneyu_ucheb(x, 3.940608e-04, &tj, &tj1, &result, _state);
   13752           0 :     mannwhitneyu_ucheb(x, 1.478285e-04, &tj, &tj1, &result, _state);
   13753           0 :     mannwhitneyu_ucheb(x, -1.649144e-04, &tj, &tj1, &result, _state);
   13754           0 :     mannwhitneyu_ucheb(x, -4.237703e-04, &tj, &tj1, &result, _state);
   13755           0 :     mannwhitneyu_ucheb(x, -4.707410e-04, &tj, &tj1, &result, _state);
   13756           0 :     mannwhitneyu_ucheb(x, -1.874293e-04, &tj, &tj1, &result, _state);
   13757           0 :     return result;
   13758             : }
   13759             : 
   13760             : 
   13761             : /*************************************************************************
   13762             : Tail(S, 5, 17)
   13763             : *************************************************************************/
   13764           0 : static double mannwhitneyu_utbln5n17(double s, ae_state *_state)
   13765             : {
   13766             :     double x;
   13767             :     double tj;
   13768             :     double tj1;
   13769             :     double result;
   13770             : 
   13771             : 
   13772           0 :     result = (double)(0);
   13773           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
   13774           0 :     tj = (double)(1);
   13775           0 :     tj1 = x;
   13776           0 :     mannwhitneyu_ucheb(x, -3.851752e+00, &tj, &tj1, &result, _state);
   13777           0 :     mannwhitneyu_ucheb(x, -4.071259e+00, &tj, &tj1, &result, _state);
   13778           0 :     mannwhitneyu_ucheb(x, -1.084700e+00, &tj, &tj1, &result, _state);
   13779           0 :     mannwhitneyu_ucheb(x, -2.758898e-01, &tj, &tj1, &result, _state);
   13780           0 :     mannwhitneyu_ucheb(x, -1.073846e-01, &tj, &tj1, &result, _state);
   13781           0 :     mannwhitneyu_ucheb(x, -4.684838e-02, &tj, &tj1, &result, _state);
   13782           0 :     mannwhitneyu_ucheb(x, -1.964936e-02, &tj, &tj1, &result, _state);
   13783           0 :     mannwhitneyu_ucheb(x, -6.782442e-03, &tj, &tj1, &result, _state);
   13784           0 :     mannwhitneyu_ucheb(x, -1.956362e-03, &tj, &tj1, &result, _state);
   13785           0 :     mannwhitneyu_ucheb(x, -5.984727e-04, &tj, &tj1, &result, _state);
   13786           0 :     mannwhitneyu_ucheb(x, -5.196936e-04, &tj, &tj1, &result, _state);
   13787           0 :     mannwhitneyu_ucheb(x, -5.558262e-04, &tj, &tj1, &result, _state);
   13788           0 :     mannwhitneyu_ucheb(x, -8.690746e-04, &tj, &tj1, &result, _state);
   13789           0 :     mannwhitneyu_ucheb(x, -1.364855e-03, &tj, &tj1, &result, _state);
   13790           0 :     mannwhitneyu_ucheb(x, -1.401006e-03, &tj, &tj1, &result, _state);
   13791           0 :     mannwhitneyu_ucheb(x, -1.546748e-03, &tj, &tj1, &result, _state);
   13792           0 :     return result;
   13793             : }
   13794             : 
   13795             : 
   13796             : /*************************************************************************
   13797             : Tail(S, 5, 18)
   13798             : *************************************************************************/
   13799           0 : static double mannwhitneyu_utbln5n18(double s, ae_state *_state)
   13800             : {
   13801             :     double x;
   13802             :     double tj;
   13803             :     double tj1;
   13804             :     double result;
   13805             : 
   13806             : 
   13807           0 :     result = (double)(0);
   13808           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
   13809           0 :     tj = (double)(1);
   13810           0 :     tj1 = x;
   13811           0 :     mannwhitneyu_ucheb(x, -3.850840e+00, &tj, &tj1, &result, _state);
   13812           0 :     mannwhitneyu_ucheb(x, -4.064799e+00, &tj, &tj1, &result, _state);
   13813           0 :     mannwhitneyu_ucheb(x, -1.077651e+00, &tj, &tj1, &result, _state);
   13814           0 :     mannwhitneyu_ucheb(x, -2.712659e-01, &tj, &tj1, &result, _state);
   13815           0 :     mannwhitneyu_ucheb(x, -1.049217e-01, &tj, &tj1, &result, _state);
   13816           0 :     mannwhitneyu_ucheb(x, -4.571333e-02, &tj, &tj1, &result, _state);
   13817           0 :     mannwhitneyu_ucheb(x, -1.929809e-02, &tj, &tj1, &result, _state);
   13818           0 :     mannwhitneyu_ucheb(x, -6.752044e-03, &tj, &tj1, &result, _state);
   13819           0 :     mannwhitneyu_ucheb(x, -1.949464e-03, &tj, &tj1, &result, _state);
   13820           0 :     mannwhitneyu_ucheb(x, -3.896101e-04, &tj, &tj1, &result, _state);
   13821           0 :     mannwhitneyu_ucheb(x, -4.614460e-05, &tj, &tj1, &result, _state);
   13822           0 :     mannwhitneyu_ucheb(x, 1.384357e-04, &tj, &tj1, &result, _state);
   13823           0 :     mannwhitneyu_ucheb(x, -6.489113e-05, &tj, &tj1, &result, _state);
   13824           0 :     mannwhitneyu_ucheb(x, -6.445725e-04, &tj, &tj1, &result, _state);
   13825           0 :     mannwhitneyu_ucheb(x, -8.945636e-04, &tj, &tj1, &result, _state);
   13826           0 :     mannwhitneyu_ucheb(x, -1.424653e-03, &tj, &tj1, &result, _state);
   13827           0 :     return result;
   13828             : }
   13829             : 
   13830             : 
   13831             : /*************************************************************************
   13832             : Tail(S, 5, 19)
   13833             : *************************************************************************/
   13834           0 : static double mannwhitneyu_utbln5n19(double s, ae_state *_state)
   13835             : {
   13836             :     double x;
   13837             :     double tj;
   13838             :     double tj1;
   13839             :     double result;
   13840             : 
   13841             : 
   13842           0 :     result = (double)(0);
   13843           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
   13844           0 :     tj = (double)(1);
   13845           0 :     tj1 = x;
   13846           0 :     mannwhitneyu_ucheb(x, -3.850027e+00, &tj, &tj1, &result, _state);
   13847           0 :     mannwhitneyu_ucheb(x, -4.059159e+00, &tj, &tj1, &result, _state);
   13848           0 :     mannwhitneyu_ucheb(x, -1.071106e+00, &tj, &tj1, &result, _state);
   13849           0 :     mannwhitneyu_ucheb(x, -2.669960e-01, &tj, &tj1, &result, _state);
   13850           0 :     mannwhitneyu_ucheb(x, -1.022780e-01, &tj, &tj1, &result, _state);
   13851           0 :     mannwhitneyu_ucheb(x, -4.442555e-02, &tj, &tj1, &result, _state);
   13852           0 :     mannwhitneyu_ucheb(x, -1.851335e-02, &tj, &tj1, &result, _state);
   13853           0 :     mannwhitneyu_ucheb(x, -6.433865e-03, &tj, &tj1, &result, _state);
   13854           0 :     mannwhitneyu_ucheb(x, -1.514465e-03, &tj, &tj1, &result, _state);
   13855           0 :     mannwhitneyu_ucheb(x, 1.332989e-04, &tj, &tj1, &result, _state);
   13856           0 :     mannwhitneyu_ucheb(x, 8.606099e-04, &tj, &tj1, &result, _state);
   13857           0 :     mannwhitneyu_ucheb(x, 1.341945e-03, &tj, &tj1, &result, _state);
   13858           0 :     mannwhitneyu_ucheb(x, 1.402164e-03, &tj, &tj1, &result, _state);
   13859           0 :     mannwhitneyu_ucheb(x, 1.039761e-03, &tj, &tj1, &result, _state);
   13860           0 :     mannwhitneyu_ucheb(x, 5.512831e-04, &tj, &tj1, &result, _state);
   13861           0 :     mannwhitneyu_ucheb(x, -3.284427e-05, &tj, &tj1, &result, _state);
   13862           0 :     return result;
   13863             : }
   13864             : 
   13865             : 
   13866             : /*************************************************************************
   13867             : Tail(S, 5, 20)
   13868             : *************************************************************************/
   13869           0 : static double mannwhitneyu_utbln5n20(double s, ae_state *_state)
   13870             : {
   13871             :     double x;
   13872             :     double tj;
   13873             :     double tj1;
   13874             :     double result;
   13875             : 
   13876             : 
   13877           0 :     result = (double)(0);
   13878           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
   13879           0 :     tj = (double)(1);
   13880           0 :     tj1 = x;
   13881           0 :     mannwhitneyu_ucheb(x, -3.849651e+00, &tj, &tj1, &result, _state);
   13882           0 :     mannwhitneyu_ucheb(x, -4.054729e+00, &tj, &tj1, &result, _state);
   13883           0 :     mannwhitneyu_ucheb(x, -1.065747e+00, &tj, &tj1, &result, _state);
   13884           0 :     mannwhitneyu_ucheb(x, -2.636243e-01, &tj, &tj1, &result, _state);
   13885           0 :     mannwhitneyu_ucheb(x, -1.003234e-01, &tj, &tj1, &result, _state);
   13886           0 :     mannwhitneyu_ucheb(x, -4.372789e-02, &tj, &tj1, &result, _state);
   13887           0 :     mannwhitneyu_ucheb(x, -1.831551e-02, &tj, &tj1, &result, _state);
   13888           0 :     mannwhitneyu_ucheb(x, -6.763090e-03, &tj, &tj1, &result, _state);
   13889           0 :     mannwhitneyu_ucheb(x, -1.830626e-03, &tj, &tj1, &result, _state);
   13890           0 :     mannwhitneyu_ucheb(x, -2.122384e-04, &tj, &tj1, &result, _state);
   13891           0 :     mannwhitneyu_ucheb(x, 8.108328e-04, &tj, &tj1, &result, _state);
   13892           0 :     mannwhitneyu_ucheb(x, 1.557983e-03, &tj, &tj1, &result, _state);
   13893           0 :     mannwhitneyu_ucheb(x, 1.945666e-03, &tj, &tj1, &result, _state);
   13894           0 :     mannwhitneyu_ucheb(x, 1.965696e-03, &tj, &tj1, &result, _state);
   13895           0 :     mannwhitneyu_ucheb(x, 1.493236e-03, &tj, &tj1, &result, _state);
   13896           0 :     mannwhitneyu_ucheb(x, 1.162591e-03, &tj, &tj1, &result, _state);
   13897           0 :     return result;
   13898             : }
   13899             : 
   13900             : 
   13901             : /*************************************************************************
   13902             : Tail(S, 5, 21)
   13903             : *************************************************************************/
   13904           0 : static double mannwhitneyu_utbln5n21(double s, ae_state *_state)
   13905             : {
   13906             :     double x;
   13907             :     double tj;
   13908             :     double tj1;
   13909             :     double result;
   13910             : 
   13911             : 
   13912           0 :     result = (double)(0);
   13913           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
   13914           0 :     tj = (double)(1);
   13915           0 :     tj1 = x;
   13916           0 :     mannwhitneyu_ucheb(x, -3.849649e+00, &tj, &tj1, &result, _state);
   13917           0 :     mannwhitneyu_ucheb(x, -4.051155e+00, &tj, &tj1, &result, _state);
   13918           0 :     mannwhitneyu_ucheb(x, -1.061430e+00, &tj, &tj1, &result, _state);
   13919           0 :     mannwhitneyu_ucheb(x, -2.608869e-01, &tj, &tj1, &result, _state);
   13920           0 :     mannwhitneyu_ucheb(x, -9.902788e-02, &tj, &tj1, &result, _state);
   13921           0 :     mannwhitneyu_ucheb(x, -4.346562e-02, &tj, &tj1, &result, _state);
   13922           0 :     mannwhitneyu_ucheb(x, -1.874709e-02, &tj, &tj1, &result, _state);
   13923           0 :     mannwhitneyu_ucheb(x, -7.682887e-03, &tj, &tj1, &result, _state);
   13924           0 :     mannwhitneyu_ucheb(x, -3.026206e-03, &tj, &tj1, &result, _state);
   13925           0 :     mannwhitneyu_ucheb(x, -1.534551e-03, &tj, &tj1, &result, _state);
   13926           0 :     mannwhitneyu_ucheb(x, -4.990575e-04, &tj, &tj1, &result, _state);
   13927           0 :     mannwhitneyu_ucheb(x, 3.713334e-04, &tj, &tj1, &result, _state);
   13928           0 :     mannwhitneyu_ucheb(x, 9.737011e-04, &tj, &tj1, &result, _state);
   13929           0 :     mannwhitneyu_ucheb(x, 1.304571e-03, &tj, &tj1, &result, _state);
   13930           0 :     mannwhitneyu_ucheb(x, 1.133110e-03, &tj, &tj1, &result, _state);
   13931           0 :     mannwhitneyu_ucheb(x, 1.123457e-03, &tj, &tj1, &result, _state);
   13932           0 :     return result;
   13933             : }
   13934             : 
   13935             : 
   13936             : /*************************************************************************
   13937             : Tail(S, 5, 22)
   13938             : *************************************************************************/
   13939           0 : static double mannwhitneyu_utbln5n22(double s, ae_state *_state)
   13940             : {
   13941             :     double x;
   13942             :     double tj;
   13943             :     double tj1;
   13944             :     double result;
   13945             : 
   13946             : 
   13947           0 :     result = (double)(0);
   13948           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
   13949           0 :     tj = (double)(1);
   13950           0 :     tj1 = x;
   13951           0 :     mannwhitneyu_ucheb(x, -3.849598e+00, &tj, &tj1, &result, _state);
   13952           0 :     mannwhitneyu_ucheb(x, -4.047605e+00, &tj, &tj1, &result, _state);
   13953           0 :     mannwhitneyu_ucheb(x, -1.057264e+00, &tj, &tj1, &result, _state);
   13954           0 :     mannwhitneyu_ucheb(x, -2.579513e-01, &tj, &tj1, &result, _state);
   13955           0 :     mannwhitneyu_ucheb(x, -9.749602e-02, &tj, &tj1, &result, _state);
   13956           0 :     mannwhitneyu_ucheb(x, -4.275137e-02, &tj, &tj1, &result, _state);
   13957           0 :     mannwhitneyu_ucheb(x, -1.881768e-02, &tj, &tj1, &result, _state);
   13958           0 :     mannwhitneyu_ucheb(x, -8.177374e-03, &tj, &tj1, &result, _state);
   13959           0 :     mannwhitneyu_ucheb(x, -3.981056e-03, &tj, &tj1, &result, _state);
   13960           0 :     mannwhitneyu_ucheb(x, -2.696290e-03, &tj, &tj1, &result, _state);
   13961           0 :     mannwhitneyu_ucheb(x, -1.886803e-03, &tj, &tj1, &result, _state);
   13962           0 :     mannwhitneyu_ucheb(x, -1.085378e-03, &tj, &tj1, &result, _state);
   13963           0 :     mannwhitneyu_ucheb(x, -4.675242e-04, &tj, &tj1, &result, _state);
   13964           0 :     mannwhitneyu_ucheb(x, -5.426367e-05, &tj, &tj1, &result, _state);
   13965           0 :     mannwhitneyu_ucheb(x, 1.039613e-04, &tj, &tj1, &result, _state);
   13966           0 :     mannwhitneyu_ucheb(x, 2.662378e-04, &tj, &tj1, &result, _state);
   13967           0 :     return result;
   13968             : }
   13969             : 
   13970             : 
   13971             : /*************************************************************************
   13972             : Tail(S, 5, 23)
   13973             : *************************************************************************/
   13974           0 : static double mannwhitneyu_utbln5n23(double s, ae_state *_state)
   13975             : {
   13976             :     double x;
   13977             :     double tj;
   13978             :     double tj1;
   13979             :     double result;
   13980             : 
   13981             : 
   13982           0 :     result = (double)(0);
   13983           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
   13984           0 :     tj = (double)(1);
   13985           0 :     tj1 = x;
   13986           0 :     mannwhitneyu_ucheb(x, -3.849269e+00, &tj, &tj1, &result, _state);
   13987           0 :     mannwhitneyu_ucheb(x, -4.043761e+00, &tj, &tj1, &result, _state);
   13988           0 :     mannwhitneyu_ucheb(x, -1.052735e+00, &tj, &tj1, &result, _state);
   13989           0 :     mannwhitneyu_ucheb(x, -2.544683e-01, &tj, &tj1, &result, _state);
   13990           0 :     mannwhitneyu_ucheb(x, -9.517503e-02, &tj, &tj1, &result, _state);
   13991           0 :     mannwhitneyu_ucheb(x, -4.112082e-02, &tj, &tj1, &result, _state);
   13992           0 :     mannwhitneyu_ucheb(x, -1.782070e-02, &tj, &tj1, &result, _state);
   13993           0 :     mannwhitneyu_ucheb(x, -7.549483e-03, &tj, &tj1, &result, _state);
   13994           0 :     mannwhitneyu_ucheb(x, -3.747329e-03, &tj, &tj1, &result, _state);
   13995           0 :     mannwhitneyu_ucheb(x, -2.694263e-03, &tj, &tj1, &result, _state);
   13996           0 :     mannwhitneyu_ucheb(x, -2.147141e-03, &tj, &tj1, &result, _state);
   13997           0 :     mannwhitneyu_ucheb(x, -1.526209e-03, &tj, &tj1, &result, _state);
   13998           0 :     mannwhitneyu_ucheb(x, -1.039173e-03, &tj, &tj1, &result, _state);
   13999           0 :     mannwhitneyu_ucheb(x, -7.235615e-04, &tj, &tj1, &result, _state);
   14000           0 :     mannwhitneyu_ucheb(x, -4.656546e-04, &tj, &tj1, &result, _state);
   14001           0 :     mannwhitneyu_ucheb(x, -3.014423e-04, &tj, &tj1, &result, _state);
   14002           0 :     return result;
   14003             : }
   14004             : 
   14005             : 
   14006             : /*************************************************************************
   14007             : Tail(S, 5, 24)
   14008             : *************************************************************************/
   14009           0 : static double mannwhitneyu_utbln5n24(double s, ae_state *_state)
   14010             : {
   14011             :     double x;
   14012             :     double tj;
   14013             :     double tj1;
   14014             :     double result;
   14015             : 
   14016             : 
   14017           0 :     result = (double)(0);
   14018           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
   14019           0 :     tj = (double)(1);
   14020           0 :     tj1 = x;
   14021           0 :     mannwhitneyu_ucheb(x, -3.848925e+00, &tj, &tj1, &result, _state);
   14022           0 :     mannwhitneyu_ucheb(x, -4.040178e+00, &tj, &tj1, &result, _state);
   14023           0 :     mannwhitneyu_ucheb(x, -1.048355e+00, &tj, &tj1, &result, _state);
   14024           0 :     mannwhitneyu_ucheb(x, -2.510198e-01, &tj, &tj1, &result, _state);
   14025           0 :     mannwhitneyu_ucheb(x, -9.261134e-02, &tj, &tj1, &result, _state);
   14026           0 :     mannwhitneyu_ucheb(x, -3.915864e-02, &tj, &tj1, &result, _state);
   14027           0 :     mannwhitneyu_ucheb(x, -1.627423e-02, &tj, &tj1, &result, _state);
   14028           0 :     mannwhitneyu_ucheb(x, -6.307345e-03, &tj, &tj1, &result, _state);
   14029           0 :     mannwhitneyu_ucheb(x, -2.732992e-03, &tj, &tj1, &result, _state);
   14030           0 :     mannwhitneyu_ucheb(x, -1.869652e-03, &tj, &tj1, &result, _state);
   14031           0 :     mannwhitneyu_ucheb(x, -1.494176e-03, &tj, &tj1, &result, _state);
   14032           0 :     mannwhitneyu_ucheb(x, -1.047533e-03, &tj, &tj1, &result, _state);
   14033           0 :     mannwhitneyu_ucheb(x, -7.178439e-04, &tj, &tj1, &result, _state);
   14034           0 :     mannwhitneyu_ucheb(x, -5.424171e-04, &tj, &tj1, &result, _state);
   14035           0 :     mannwhitneyu_ucheb(x, -3.829195e-04, &tj, &tj1, &result, _state);
   14036           0 :     mannwhitneyu_ucheb(x, -2.840810e-04, &tj, &tj1, &result, _state);
   14037           0 :     return result;
   14038             : }
   14039             : 
   14040             : 
   14041             : /*************************************************************************
   14042             : Tail(S, 5, 25)
   14043             : *************************************************************************/
   14044           0 : static double mannwhitneyu_utbln5n25(double s, ae_state *_state)
   14045             : {
   14046             :     double x;
   14047             :     double tj;
   14048             :     double tj1;
   14049             :     double result;
   14050             : 
   14051             : 
   14052           0 :     result = (double)(0);
   14053           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
   14054           0 :     tj = (double)(1);
   14055           0 :     tj1 = x;
   14056           0 :     mannwhitneyu_ucheb(x, -3.848937e+00, &tj, &tj1, &result, _state);
   14057           0 :     mannwhitneyu_ucheb(x, -4.037512e+00, &tj, &tj1, &result, _state);
   14058           0 :     mannwhitneyu_ucheb(x, -1.044866e+00, &tj, &tj1, &result, _state);
   14059           0 :     mannwhitneyu_ucheb(x, -2.483269e-01, &tj, &tj1, &result, _state);
   14060           0 :     mannwhitneyu_ucheb(x, -9.063682e-02, &tj, &tj1, &result, _state);
   14061           0 :     mannwhitneyu_ucheb(x, -3.767778e-02, &tj, &tj1, &result, _state);
   14062           0 :     mannwhitneyu_ucheb(x, -1.508540e-02, &tj, &tj1, &result, _state);
   14063           0 :     mannwhitneyu_ucheb(x, -5.332756e-03, &tj, &tj1, &result, _state);
   14064           0 :     mannwhitneyu_ucheb(x, -1.881511e-03, &tj, &tj1, &result, _state);
   14065           0 :     mannwhitneyu_ucheb(x, -1.124041e-03, &tj, &tj1, &result, _state);
   14066           0 :     mannwhitneyu_ucheb(x, -8.368456e-04, &tj, &tj1, &result, _state);
   14067           0 :     mannwhitneyu_ucheb(x, -4.930499e-04, &tj, &tj1, &result, _state);
   14068           0 :     mannwhitneyu_ucheb(x, -2.779630e-04, &tj, &tj1, &result, _state);
   14069           0 :     mannwhitneyu_ucheb(x, -2.029528e-04, &tj, &tj1, &result, _state);
   14070           0 :     mannwhitneyu_ucheb(x, -1.658678e-04, &tj, &tj1, &result, _state);
   14071           0 :     mannwhitneyu_ucheb(x, -1.289695e-04, &tj, &tj1, &result, _state);
   14072           0 :     return result;
   14073             : }
   14074             : 
   14075             : 
   14076             : /*************************************************************************
   14077             : Tail(S, 5, 26)
   14078             : *************************************************************************/
   14079           0 : static double mannwhitneyu_utbln5n26(double s, ae_state *_state)
   14080             : {
   14081             :     double x;
   14082             :     double tj;
   14083             :     double tj1;
   14084             :     double result;
   14085             : 
   14086             : 
   14087           0 :     result = (double)(0);
   14088           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
   14089           0 :     tj = (double)(1);
   14090           0 :     tj1 = x;
   14091           0 :     mannwhitneyu_ucheb(x, -3.849416e+00, &tj, &tj1, &result, _state);
   14092           0 :     mannwhitneyu_ucheb(x, -4.035915e+00, &tj, &tj1, &result, _state);
   14093           0 :     mannwhitneyu_ucheb(x, -1.042493e+00, &tj, &tj1, &result, _state);
   14094           0 :     mannwhitneyu_ucheb(x, -2.466021e-01, &tj, &tj1, &result, _state);
   14095           0 :     mannwhitneyu_ucheb(x, -8.956432e-02, &tj, &tj1, &result, _state);
   14096           0 :     mannwhitneyu_ucheb(x, -3.698914e-02, &tj, &tj1, &result, _state);
   14097           0 :     mannwhitneyu_ucheb(x, -1.465689e-02, &tj, &tj1, &result, _state);
   14098           0 :     mannwhitneyu_ucheb(x, -5.035254e-03, &tj, &tj1, &result, _state);
   14099           0 :     mannwhitneyu_ucheb(x, -1.674614e-03, &tj, &tj1, &result, _state);
   14100           0 :     mannwhitneyu_ucheb(x, -9.492734e-04, &tj, &tj1, &result, _state);
   14101           0 :     mannwhitneyu_ucheb(x, -7.014021e-04, &tj, &tj1, &result, _state);
   14102           0 :     mannwhitneyu_ucheb(x, -3.944953e-04, &tj, &tj1, &result, _state);
   14103           0 :     mannwhitneyu_ucheb(x, -2.255750e-04, &tj, &tj1, &result, _state);
   14104           0 :     mannwhitneyu_ucheb(x, -2.075841e-04, &tj, &tj1, &result, _state);
   14105           0 :     mannwhitneyu_ucheb(x, -1.989330e-04, &tj, &tj1, &result, _state);
   14106           0 :     mannwhitneyu_ucheb(x, -2.134862e-04, &tj, &tj1, &result, _state);
   14107           0 :     return result;
   14108             : }
   14109             : 
   14110             : 
   14111             : /*************************************************************************
   14112             : Tail(S, 5, 27)
   14113             : *************************************************************************/
   14114           0 : static double mannwhitneyu_utbln5n27(double s, ae_state *_state)
   14115             : {
   14116             :     double x;
   14117             :     double tj;
   14118             :     double tj1;
   14119             :     double result;
   14120             : 
   14121             : 
   14122           0 :     result = (double)(0);
   14123           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
   14124           0 :     tj = (double)(1);
   14125           0 :     tj1 = x;
   14126           0 :     mannwhitneyu_ucheb(x, -3.850070e+00, &tj, &tj1, &result, _state);
   14127           0 :     mannwhitneyu_ucheb(x, -4.034815e+00, &tj, &tj1, &result, _state);
   14128           0 :     mannwhitneyu_ucheb(x, -1.040650e+00, &tj, &tj1, &result, _state);
   14129           0 :     mannwhitneyu_ucheb(x, -2.453117e-01, &tj, &tj1, &result, _state);
   14130           0 :     mannwhitneyu_ucheb(x, -8.886426e-02, &tj, &tj1, &result, _state);
   14131           0 :     mannwhitneyu_ucheb(x, -3.661702e-02, &tj, &tj1, &result, _state);
   14132           0 :     mannwhitneyu_ucheb(x, -1.452346e-02, &tj, &tj1, &result, _state);
   14133           0 :     mannwhitneyu_ucheb(x, -5.002476e-03, &tj, &tj1, &result, _state);
   14134           0 :     mannwhitneyu_ucheb(x, -1.720126e-03, &tj, &tj1, &result, _state);
   14135           0 :     mannwhitneyu_ucheb(x, -1.001400e-03, &tj, &tj1, &result, _state);
   14136           0 :     mannwhitneyu_ucheb(x, -7.729826e-04, &tj, &tj1, &result, _state);
   14137           0 :     mannwhitneyu_ucheb(x, -4.740640e-04, &tj, &tj1, &result, _state);
   14138           0 :     mannwhitneyu_ucheb(x, -3.206333e-04, &tj, &tj1, &result, _state);
   14139           0 :     mannwhitneyu_ucheb(x, -3.366093e-04, &tj, &tj1, &result, _state);
   14140           0 :     mannwhitneyu_ucheb(x, -3.193471e-04, &tj, &tj1, &result, _state);
   14141           0 :     mannwhitneyu_ucheb(x, -3.804091e-04, &tj, &tj1, &result, _state);
   14142           0 :     return result;
   14143             : }
   14144             : 
   14145             : 
   14146             : /*************************************************************************
   14147             : Tail(S, 5, 28)
   14148             : *************************************************************************/
   14149           0 : static double mannwhitneyu_utbln5n28(double s, ae_state *_state)
   14150             : {
   14151             :     double x;
   14152             :     double tj;
   14153             :     double tj1;
   14154             :     double result;
   14155             : 
   14156             : 
   14157           0 :     result = (double)(0);
   14158           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
   14159           0 :     tj = (double)(1);
   14160           0 :     tj1 = x;
   14161           0 :     mannwhitneyu_ucheb(x, -3.850668e+00, &tj, &tj1, &result, _state);
   14162           0 :     mannwhitneyu_ucheb(x, -4.033786e+00, &tj, &tj1, &result, _state);
   14163           0 :     mannwhitneyu_ucheb(x, -1.038853e+00, &tj, &tj1, &result, _state);
   14164           0 :     mannwhitneyu_ucheb(x, -2.440281e-01, &tj, &tj1, &result, _state);
   14165           0 :     mannwhitneyu_ucheb(x, -8.806020e-02, &tj, &tj1, &result, _state);
   14166           0 :     mannwhitneyu_ucheb(x, -3.612883e-02, &tj, &tj1, &result, _state);
   14167           0 :     mannwhitneyu_ucheb(x, -1.420436e-02, &tj, &tj1, &result, _state);
   14168           0 :     mannwhitneyu_ucheb(x, -4.787982e-03, &tj, &tj1, &result, _state);
   14169           0 :     mannwhitneyu_ucheb(x, -1.535230e-03, &tj, &tj1, &result, _state);
   14170           0 :     mannwhitneyu_ucheb(x, -8.263121e-04, &tj, &tj1, &result, _state);
   14171           0 :     mannwhitneyu_ucheb(x, -5.849609e-04, &tj, &tj1, &result, _state);
   14172           0 :     mannwhitneyu_ucheb(x, -2.863967e-04, &tj, &tj1, &result, _state);
   14173           0 :     mannwhitneyu_ucheb(x, -1.391610e-04, &tj, &tj1, &result, _state);
   14174           0 :     mannwhitneyu_ucheb(x, -1.720294e-04, &tj, &tj1, &result, _state);
   14175           0 :     mannwhitneyu_ucheb(x, -1.952273e-04, &tj, &tj1, &result, _state);
   14176           0 :     mannwhitneyu_ucheb(x, -2.901413e-04, &tj, &tj1, &result, _state);
   14177           0 :     return result;
   14178             : }
   14179             : 
   14180             : 
   14181             : /*************************************************************************
   14182             : Tail(S, 5, 29)
   14183             : *************************************************************************/
   14184           0 : static double mannwhitneyu_utbln5n29(double s, ae_state *_state)
   14185             : {
   14186             :     double x;
   14187             :     double tj;
   14188             :     double tj1;
   14189             :     double result;
   14190             : 
   14191             : 
   14192           0 :     result = (double)(0);
   14193           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
   14194           0 :     tj = (double)(1);
   14195           0 :     tj1 = x;
   14196           0 :     mannwhitneyu_ucheb(x, -3.851217e+00, &tj, &tj1, &result, _state);
   14197           0 :     mannwhitneyu_ucheb(x, -4.032834e+00, &tj, &tj1, &result, _state);
   14198           0 :     mannwhitneyu_ucheb(x, -1.037113e+00, &tj, &tj1, &result, _state);
   14199           0 :     mannwhitneyu_ucheb(x, -2.427762e-01, &tj, &tj1, &result, _state);
   14200           0 :     mannwhitneyu_ucheb(x, -8.719146e-02, &tj, &tj1, &result, _state);
   14201           0 :     mannwhitneyu_ucheb(x, -3.557172e-02, &tj, &tj1, &result, _state);
   14202           0 :     mannwhitneyu_ucheb(x, -1.375498e-02, &tj, &tj1, &result, _state);
   14203           0 :     mannwhitneyu_ucheb(x, -4.452033e-03, &tj, &tj1, &result, _state);
   14204           0 :     mannwhitneyu_ucheb(x, -1.187516e-03, &tj, &tj1, &result, _state);
   14205           0 :     mannwhitneyu_ucheb(x, -4.916936e-04, &tj, &tj1, &result, _state);
   14206           0 :     mannwhitneyu_ucheb(x, -2.065533e-04, &tj, &tj1, &result, _state);
   14207           0 :     mannwhitneyu_ucheb(x, 1.067301e-04, &tj, &tj1, &result, _state);
   14208           0 :     mannwhitneyu_ucheb(x, 2.615824e-04, &tj, &tj1, &result, _state);
   14209           0 :     mannwhitneyu_ucheb(x, 2.432244e-04, &tj, &tj1, &result, _state);
   14210           0 :     mannwhitneyu_ucheb(x, 1.417795e-04, &tj, &tj1, &result, _state);
   14211           0 :     mannwhitneyu_ucheb(x, 4.710038e-05, &tj, &tj1, &result, _state);
   14212           0 :     return result;
   14213             : }
   14214             : 
   14215             : 
   14216             : /*************************************************************************
   14217             : Tail(S, 5, 30)
   14218             : *************************************************************************/
   14219           0 : static double mannwhitneyu_utbln5n30(double s, ae_state *_state)
   14220             : {
   14221             :     double x;
   14222             :     double tj;
   14223             :     double tj1;
   14224             :     double result;
   14225             : 
   14226             : 
   14227           0 :     result = (double)(0);
   14228           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
   14229           0 :     tj = (double)(1);
   14230           0 :     tj1 = x;
   14231           0 :     mannwhitneyu_ucheb(x, -3.851845e+00, &tj, &tj1, &result, _state);
   14232           0 :     mannwhitneyu_ucheb(x, -4.032148e+00, &tj, &tj1, &result, _state);
   14233           0 :     mannwhitneyu_ucheb(x, -1.035679e+00, &tj, &tj1, &result, _state);
   14234           0 :     mannwhitneyu_ucheb(x, -2.417758e-01, &tj, &tj1, &result, _state);
   14235           0 :     mannwhitneyu_ucheb(x, -8.655330e-02, &tj, &tj1, &result, _state);
   14236           0 :     mannwhitneyu_ucheb(x, -3.522132e-02, &tj, &tj1, &result, _state);
   14237           0 :     mannwhitneyu_ucheb(x, -1.352106e-02, &tj, &tj1, &result, _state);
   14238           0 :     mannwhitneyu_ucheb(x, -4.326911e-03, &tj, &tj1, &result, _state);
   14239           0 :     mannwhitneyu_ucheb(x, -1.064969e-03, &tj, &tj1, &result, _state);
   14240           0 :     mannwhitneyu_ucheb(x, -3.813321e-04, &tj, &tj1, &result, _state);
   14241           0 :     mannwhitneyu_ucheb(x, -5.683881e-05, &tj, &tj1, &result, _state);
   14242           0 :     mannwhitneyu_ucheb(x, 2.813346e-04, &tj, &tj1, &result, _state);
   14243           0 :     mannwhitneyu_ucheb(x, 4.627085e-04, &tj, &tj1, &result, _state);
   14244           0 :     mannwhitneyu_ucheb(x, 4.832107e-04, &tj, &tj1, &result, _state);
   14245           0 :     mannwhitneyu_ucheb(x, 3.519336e-04, &tj, &tj1, &result, _state);
   14246           0 :     mannwhitneyu_ucheb(x, 2.888530e-04, &tj, &tj1, &result, _state);
   14247           0 :     return result;
   14248             : }
   14249             : 
   14250             : 
   14251             : /*************************************************************************
   14252             : Tail(S, 5, 100)
   14253             : *************************************************************************/
   14254           0 : static double mannwhitneyu_utbln5n100(double s, ae_state *_state)
   14255             : {
   14256             :     double x;
   14257             :     double tj;
   14258             :     double tj1;
   14259             :     double result;
   14260             : 
   14261             : 
   14262           0 :     result = (double)(0);
   14263           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.250000e+00-1, 1.0, _state);
   14264           0 :     tj = (double)(1);
   14265           0 :     tj1 = x;
   14266           0 :     mannwhitneyu_ucheb(x, -3.877940e+00, &tj, &tj1, &result, _state);
   14267           0 :     mannwhitneyu_ucheb(x, -4.039324e+00, &tj, &tj1, &result, _state);
   14268           0 :     mannwhitneyu_ucheb(x, -1.022243e+00, &tj, &tj1, &result, _state);
   14269           0 :     mannwhitneyu_ucheb(x, -2.305825e-01, &tj, &tj1, &result, _state);
   14270           0 :     mannwhitneyu_ucheb(x, -7.960119e-02, &tj, &tj1, &result, _state);
   14271           0 :     mannwhitneyu_ucheb(x, -3.112000e-02, &tj, &tj1, &result, _state);
   14272           0 :     mannwhitneyu_ucheb(x, -1.138868e-02, &tj, &tj1, &result, _state);
   14273           0 :     mannwhitneyu_ucheb(x, -3.418164e-03, &tj, &tj1, &result, _state);
   14274           0 :     mannwhitneyu_ucheb(x, -9.174520e-04, &tj, &tj1, &result, _state);
   14275           0 :     mannwhitneyu_ucheb(x, -5.489617e-04, &tj, &tj1, &result, _state);
   14276           0 :     mannwhitneyu_ucheb(x, -3.878301e-04, &tj, &tj1, &result, _state);
   14277           0 :     mannwhitneyu_ucheb(x, -1.302233e-04, &tj, &tj1, &result, _state);
   14278           0 :     mannwhitneyu_ucheb(x, 1.054113e-05, &tj, &tj1, &result, _state);
   14279           0 :     mannwhitneyu_ucheb(x, 2.458862e-05, &tj, &tj1, &result, _state);
   14280           0 :     mannwhitneyu_ucheb(x, -4.186591e-06, &tj, &tj1, &result, _state);
   14281           0 :     mannwhitneyu_ucheb(x, -2.623412e-05, &tj, &tj1, &result, _state);
   14282           0 :     return result;
   14283             : }
   14284             : 
   14285             : 
   14286             : /*************************************************************************
   14287             : Tail(S, 6, 6)
   14288             : *************************************************************************/
   14289           0 : static double mannwhitneyu_utbln6n6(double s, ae_state *_state)
   14290             : {
   14291             :     double x;
   14292             :     double tj;
   14293             :     double tj1;
   14294             :     double result;
   14295             : 
   14296             : 
   14297           0 :     result = (double)(0);
   14298           0 :     x = ae_minreal(2*(s-0.000000e+00)/2.882307e+00-1, 1.0, _state);
   14299           0 :     tj = (double)(1);
   14300           0 :     tj1 = x;
   14301           0 :     mannwhitneyu_ucheb(x, -3.054075e+00, &tj, &tj1, &result, _state);
   14302           0 :     mannwhitneyu_ucheb(x, -2.998804e+00, &tj, &tj1, &result, _state);
   14303           0 :     mannwhitneyu_ucheb(x, -6.681518e-01, &tj, &tj1, &result, _state);
   14304           0 :     mannwhitneyu_ucheb(x, -1.067578e-01, &tj, &tj1, &result, _state);
   14305           0 :     mannwhitneyu_ucheb(x, -1.709435e-02, &tj, &tj1, &result, _state);
   14306           0 :     mannwhitneyu_ucheb(x, 9.952661e-04, &tj, &tj1, &result, _state);
   14307           0 :     mannwhitneyu_ucheb(x, 3.641700e-03, &tj, &tj1, &result, _state);
   14308           0 :     mannwhitneyu_ucheb(x, 2.304572e-03, &tj, &tj1, &result, _state);
   14309           0 :     mannwhitneyu_ucheb(x, 3.336275e-03, &tj, &tj1, &result, _state);
   14310           0 :     mannwhitneyu_ucheb(x, 4.770385e-03, &tj, &tj1, &result, _state);
   14311           0 :     mannwhitneyu_ucheb(x, 5.401891e-03, &tj, &tj1, &result, _state);
   14312           0 :     mannwhitneyu_ucheb(x, 2.246148e-03, &tj, &tj1, &result, _state);
   14313           0 :     mannwhitneyu_ucheb(x, -1.442663e-03, &tj, &tj1, &result, _state);
   14314           0 :     mannwhitneyu_ucheb(x, -2.502866e-03, &tj, &tj1, &result, _state);
   14315           0 :     mannwhitneyu_ucheb(x, -2.105855e-03, &tj, &tj1, &result, _state);
   14316           0 :     mannwhitneyu_ucheb(x, -4.739371e-04, &tj, &tj1, &result, _state);
   14317           0 :     return result;
   14318             : }
   14319             : 
   14320             : 
   14321             : /*************************************************************************
   14322             : Tail(S, 6, 7)
   14323             : *************************************************************************/
   14324           0 : static double mannwhitneyu_utbln6n7(double s, ae_state *_state)
   14325             : {
   14326             :     double x;
   14327             :     double tj;
   14328             :     double tj1;
   14329             :     double result;
   14330             : 
   14331             : 
   14332           0 :     result = (double)(0);
   14333           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.000000e+00-1, 1.0, _state);
   14334           0 :     tj = (double)(1);
   14335           0 :     tj1 = x;
   14336           0 :     mannwhitneyu_ucheb(x, -3.265287e+00, &tj, &tj1, &result, _state);
   14337           0 :     mannwhitneyu_ucheb(x, -3.274613e+00, &tj, &tj1, &result, _state);
   14338           0 :     mannwhitneyu_ucheb(x, -7.582352e-01, &tj, &tj1, &result, _state);
   14339           0 :     mannwhitneyu_ucheb(x, -1.334293e-01, &tj, &tj1, &result, _state);
   14340           0 :     mannwhitneyu_ucheb(x, -2.915502e-02, &tj, &tj1, &result, _state);
   14341           0 :     mannwhitneyu_ucheb(x, -4.108091e-03, &tj, &tj1, &result, _state);
   14342           0 :     mannwhitneyu_ucheb(x, 1.546701e-03, &tj, &tj1, &result, _state);
   14343           0 :     mannwhitneyu_ucheb(x, 2.298827e-03, &tj, &tj1, &result, _state);
   14344           0 :     mannwhitneyu_ucheb(x, 2.891501e-03, &tj, &tj1, &result, _state);
   14345           0 :     mannwhitneyu_ucheb(x, 4.313717e-03, &tj, &tj1, &result, _state);
   14346           0 :     mannwhitneyu_ucheb(x, 4.989501e-03, &tj, &tj1, &result, _state);
   14347           0 :     mannwhitneyu_ucheb(x, 3.914594e-03, &tj, &tj1, &result, _state);
   14348           0 :     mannwhitneyu_ucheb(x, 1.062372e-03, &tj, &tj1, &result, _state);
   14349           0 :     mannwhitneyu_ucheb(x, -1.158841e-03, &tj, &tj1, &result, _state);
   14350           0 :     mannwhitneyu_ucheb(x, -1.596443e-03, &tj, &tj1, &result, _state);
   14351           0 :     mannwhitneyu_ucheb(x, -1.185662e-03, &tj, &tj1, &result, _state);
   14352           0 :     return result;
   14353             : }
   14354             : 
   14355             : 
   14356             : /*************************************************************************
   14357             : Tail(S, 6, 8)
   14358             : *************************************************************************/
   14359           0 : static double mannwhitneyu_utbln6n8(double s, ae_state *_state)
   14360             : {
   14361             :     double x;
   14362             :     double tj;
   14363             :     double tj1;
   14364             :     double result;
   14365             : 
   14366             : 
   14367           0 :     result = (double)(0);
   14368           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.098387e+00-1, 1.0, _state);
   14369           0 :     tj = (double)(1);
   14370           0 :     tj1 = x;
   14371           0 :     mannwhitneyu_ucheb(x, -3.450954e+00, &tj, &tj1, &result, _state);
   14372           0 :     mannwhitneyu_ucheb(x, -3.520462e+00, &tj, &tj1, &result, _state);
   14373           0 :     mannwhitneyu_ucheb(x, -8.420299e-01, &tj, &tj1, &result, _state);
   14374           0 :     mannwhitneyu_ucheb(x, -1.604853e-01, &tj, &tj1, &result, _state);
   14375           0 :     mannwhitneyu_ucheb(x, -4.165840e-02, &tj, &tj1, &result, _state);
   14376           0 :     mannwhitneyu_ucheb(x, -1.008756e-02, &tj, &tj1, &result, _state);
   14377           0 :     mannwhitneyu_ucheb(x, -6.723402e-04, &tj, &tj1, &result, _state);
   14378           0 :     mannwhitneyu_ucheb(x, 1.843521e-03, &tj, &tj1, &result, _state);
   14379           0 :     mannwhitneyu_ucheb(x, 2.883405e-03, &tj, &tj1, &result, _state);
   14380           0 :     mannwhitneyu_ucheb(x, 3.720980e-03, &tj, &tj1, &result, _state);
   14381           0 :     mannwhitneyu_ucheb(x, 4.301709e-03, &tj, &tj1, &result, _state);
   14382           0 :     mannwhitneyu_ucheb(x, 3.948034e-03, &tj, &tj1, &result, _state);
   14383           0 :     mannwhitneyu_ucheb(x, 2.776243e-03, &tj, &tj1, &result, _state);
   14384           0 :     mannwhitneyu_ucheb(x, 8.623736e-04, &tj, &tj1, &result, _state);
   14385           0 :     mannwhitneyu_ucheb(x, -3.742068e-04, &tj, &tj1, &result, _state);
   14386           0 :     mannwhitneyu_ucheb(x, -9.796927e-04, &tj, &tj1, &result, _state);
   14387           0 :     return result;
   14388             : }
   14389             : 
   14390             : 
   14391             : /*************************************************************************
   14392             : Tail(S, 6, 9)
   14393             : *************************************************************************/
   14394           0 : static double mannwhitneyu_utbln6n9(double s, ae_state *_state)
   14395             : {
   14396             :     double x;
   14397             :     double tj;
   14398             :     double tj1;
   14399             :     double result;
   14400             : 
   14401             : 
   14402           0 :     result = (double)(0);
   14403           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.181981e+00-1, 1.0, _state);
   14404           0 :     tj = (double)(1);
   14405           0 :     tj1 = x;
   14406           0 :     mannwhitneyu_ucheb(x, -3.616113e+00, &tj, &tj1, &result, _state);
   14407           0 :     mannwhitneyu_ucheb(x, -3.741650e+00, &tj, &tj1, &result, _state);
   14408           0 :     mannwhitneyu_ucheb(x, -9.204487e-01, &tj, &tj1, &result, _state);
   14409           0 :     mannwhitneyu_ucheb(x, -1.873068e-01, &tj, &tj1, &result, _state);
   14410           0 :     mannwhitneyu_ucheb(x, -5.446794e-02, &tj, &tj1, &result, _state);
   14411           0 :     mannwhitneyu_ucheb(x, -1.632286e-02, &tj, &tj1, &result, _state);
   14412           0 :     mannwhitneyu_ucheb(x, -3.266481e-03, &tj, &tj1, &result, _state);
   14413           0 :     mannwhitneyu_ucheb(x, 1.280067e-03, &tj, &tj1, &result, _state);
   14414           0 :     mannwhitneyu_ucheb(x, 2.780687e-03, &tj, &tj1, &result, _state);
   14415           0 :     mannwhitneyu_ucheb(x, 3.480242e-03, &tj, &tj1, &result, _state);
   14416           0 :     mannwhitneyu_ucheb(x, 3.592200e-03, &tj, &tj1, &result, _state);
   14417           0 :     mannwhitneyu_ucheb(x, 3.581019e-03, &tj, &tj1, &result, _state);
   14418           0 :     mannwhitneyu_ucheb(x, 3.264231e-03, &tj, &tj1, &result, _state);
   14419           0 :     mannwhitneyu_ucheb(x, 2.347174e-03, &tj, &tj1, &result, _state);
   14420           0 :     mannwhitneyu_ucheb(x, 1.167535e-03, &tj, &tj1, &result, _state);
   14421           0 :     mannwhitneyu_ucheb(x, -1.092185e-04, &tj, &tj1, &result, _state);
   14422           0 :     return result;
   14423             : }
   14424             : 
   14425             : 
   14426             : /*************************************************************************
   14427             : Tail(S, 6, 10)
   14428             : *************************************************************************/
   14429           0 : static double mannwhitneyu_utbln6n10(double s, ae_state *_state)
   14430             : {
   14431             :     double x;
   14432             :     double tj;
   14433             :     double tj1;
   14434             :     double result;
   14435             : 
   14436             : 
   14437           0 :     result = (double)(0);
   14438           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.253957e+00-1, 1.0, _state);
   14439           0 :     tj = (double)(1);
   14440           0 :     tj1 = x;
   14441           0 :     mannwhitneyu_ucheb(x, -3.764382e+00, &tj, &tj1, &result, _state);
   14442           0 :     mannwhitneyu_ucheb(x, -3.942366e+00, &tj, &tj1, &result, _state);
   14443           0 :     mannwhitneyu_ucheb(x, -9.939896e-01, &tj, &tj1, &result, _state);
   14444           0 :     mannwhitneyu_ucheb(x, -2.137812e-01, &tj, &tj1, &result, _state);
   14445           0 :     mannwhitneyu_ucheb(x, -6.720270e-02, &tj, &tj1, &result, _state);
   14446           0 :     mannwhitneyu_ucheb(x, -2.281070e-02, &tj, &tj1, &result, _state);
   14447           0 :     mannwhitneyu_ucheb(x, -5.901060e-03, &tj, &tj1, &result, _state);
   14448           0 :     mannwhitneyu_ucheb(x, 3.824937e-04, &tj, &tj1, &result, _state);
   14449           0 :     mannwhitneyu_ucheb(x, 2.802812e-03, &tj, &tj1, &result, _state);
   14450           0 :     mannwhitneyu_ucheb(x, 3.258132e-03, &tj, &tj1, &result, _state);
   14451           0 :     mannwhitneyu_ucheb(x, 3.233536e-03, &tj, &tj1, &result, _state);
   14452           0 :     mannwhitneyu_ucheb(x, 3.085530e-03, &tj, &tj1, &result, _state);
   14453           0 :     mannwhitneyu_ucheb(x, 3.212151e-03, &tj, &tj1, &result, _state);
   14454           0 :     mannwhitneyu_ucheb(x, 3.001329e-03, &tj, &tj1, &result, _state);
   14455           0 :     mannwhitneyu_ucheb(x, 2.226048e-03, &tj, &tj1, &result, _state);
   14456           0 :     mannwhitneyu_ucheb(x, 1.035298e-03, &tj, &tj1, &result, _state);
   14457           0 :     return result;
   14458             : }
   14459             : 
   14460             : 
   14461             : /*************************************************************************
   14462             : Tail(S, 6, 11)
   14463             : *************************************************************************/
   14464           0 : static double mannwhitneyu_utbln6n11(double s, ae_state *_state)
   14465             : {
   14466             :     double x;
   14467             :     double tj;
   14468             :     double tj1;
   14469             :     double result;
   14470             : 
   14471             : 
   14472           0 :     result = (double)(0);
   14473           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.316625e+00-1, 1.0, _state);
   14474           0 :     tj = (double)(1);
   14475           0 :     tj1 = x;
   14476           0 :     mannwhitneyu_ucheb(x, -3.898597e+00, &tj, &tj1, &result, _state);
   14477           0 :     mannwhitneyu_ucheb(x, -4.125710e+00, &tj, &tj1, &result, _state);
   14478           0 :     mannwhitneyu_ucheb(x, -1.063297e+00, &tj, &tj1, &result, _state);
   14479           0 :     mannwhitneyu_ucheb(x, -2.396852e-01, &tj, &tj1, &result, _state);
   14480           0 :     mannwhitneyu_ucheb(x, -7.990126e-02, &tj, &tj1, &result, _state);
   14481           0 :     mannwhitneyu_ucheb(x, -2.927977e-02, &tj, &tj1, &result, _state);
   14482           0 :     mannwhitneyu_ucheb(x, -8.726500e-03, &tj, &tj1, &result, _state);
   14483           0 :     mannwhitneyu_ucheb(x, -5.858745e-04, &tj, &tj1, &result, _state);
   14484           0 :     mannwhitneyu_ucheb(x, 2.654590e-03, &tj, &tj1, &result, _state);
   14485           0 :     mannwhitneyu_ucheb(x, 3.217736e-03, &tj, &tj1, &result, _state);
   14486           0 :     mannwhitneyu_ucheb(x, 2.989770e-03, &tj, &tj1, &result, _state);
   14487           0 :     mannwhitneyu_ucheb(x, 2.768493e-03, &tj, &tj1, &result, _state);
   14488           0 :     mannwhitneyu_ucheb(x, 2.924364e-03, &tj, &tj1, &result, _state);
   14489           0 :     mannwhitneyu_ucheb(x, 3.140215e-03, &tj, &tj1, &result, _state);
   14490           0 :     mannwhitneyu_ucheb(x, 2.647914e-03, &tj, &tj1, &result, _state);
   14491           0 :     mannwhitneyu_ucheb(x, 1.924802e-03, &tj, &tj1, &result, _state);
   14492           0 :     return result;
   14493             : }
   14494             : 
   14495             : 
   14496             : /*************************************************************************
   14497             : Tail(S, 6, 12)
   14498             : *************************************************************************/
   14499           0 : static double mannwhitneyu_utbln6n12(double s, ae_state *_state)
   14500             : {
   14501             :     double x;
   14502             :     double tj;
   14503             :     double tj1;
   14504             :     double result;
   14505             : 
   14506             : 
   14507           0 :     result = (double)(0);
   14508           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.371709e+00-1, 1.0, _state);
   14509           0 :     tj = (double)(1);
   14510           0 :     tj1 = x;
   14511           0 :     mannwhitneyu_ucheb(x, -4.020941e+00, &tj, &tj1, &result, _state);
   14512           0 :     mannwhitneyu_ucheb(x, -4.294250e+00, &tj, &tj1, &result, _state);
   14513           0 :     mannwhitneyu_ucheb(x, -1.128842e+00, &tj, &tj1, &result, _state);
   14514           0 :     mannwhitneyu_ucheb(x, -2.650389e-01, &tj, &tj1, &result, _state);
   14515           0 :     mannwhitneyu_ucheb(x, -9.248611e-02, &tj, &tj1, &result, _state);
   14516           0 :     mannwhitneyu_ucheb(x, -3.578510e-02, &tj, &tj1, &result, _state);
   14517           0 :     mannwhitneyu_ucheb(x, -1.162852e-02, &tj, &tj1, &result, _state);
   14518           0 :     mannwhitneyu_ucheb(x, -1.746982e-03, &tj, &tj1, &result, _state);
   14519           0 :     mannwhitneyu_ucheb(x, 2.454209e-03, &tj, &tj1, &result, _state);
   14520           0 :     mannwhitneyu_ucheb(x, 3.128042e-03, &tj, &tj1, &result, _state);
   14521           0 :     mannwhitneyu_ucheb(x, 2.936650e-03, &tj, &tj1, &result, _state);
   14522           0 :     mannwhitneyu_ucheb(x, 2.530794e-03, &tj, &tj1, &result, _state);
   14523           0 :     mannwhitneyu_ucheb(x, 2.665192e-03, &tj, &tj1, &result, _state);
   14524           0 :     mannwhitneyu_ucheb(x, 2.994144e-03, &tj, &tj1, &result, _state);
   14525           0 :     mannwhitneyu_ucheb(x, 2.662249e-03, &tj, &tj1, &result, _state);
   14526           0 :     mannwhitneyu_ucheb(x, 2.368541e-03, &tj, &tj1, &result, _state);
   14527           0 :     return result;
   14528             : }
   14529             : 
   14530             : 
   14531             : /*************************************************************************
   14532             : Tail(S, 6, 13)
   14533             : *************************************************************************/
   14534           0 : static double mannwhitneyu_utbln6n13(double s, ae_state *_state)
   14535             : {
   14536             :     double x;
   14537             :     double tj;
   14538             :     double tj1;
   14539             :     double result;
   14540             : 
   14541             : 
   14542           0 :     result = (double)(0);
   14543           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.420526e+00-1, 1.0, _state);
   14544           0 :     tj = (double)(1);
   14545           0 :     tj1 = x;
   14546           0 :     mannwhitneyu_ucheb(x, -4.133167e+00, &tj, &tj1, &result, _state);
   14547           0 :     mannwhitneyu_ucheb(x, -4.450016e+00, &tj, &tj1, &result, _state);
   14548           0 :     mannwhitneyu_ucheb(x, -1.191088e+00, &tj, &tj1, &result, _state);
   14549           0 :     mannwhitneyu_ucheb(x, -2.898220e-01, &tj, &tj1, &result, _state);
   14550           0 :     mannwhitneyu_ucheb(x, -1.050249e-01, &tj, &tj1, &result, _state);
   14551           0 :     mannwhitneyu_ucheb(x, -4.226901e-02, &tj, &tj1, &result, _state);
   14552           0 :     mannwhitneyu_ucheb(x, -1.471113e-02, &tj, &tj1, &result, _state);
   14553           0 :     mannwhitneyu_ucheb(x, -3.007470e-03, &tj, &tj1, &result, _state);
   14554           0 :     mannwhitneyu_ucheb(x, 2.049420e-03, &tj, &tj1, &result, _state);
   14555           0 :     mannwhitneyu_ucheb(x, 3.059074e-03, &tj, &tj1, &result, _state);
   14556           0 :     mannwhitneyu_ucheb(x, 2.881249e-03, &tj, &tj1, &result, _state);
   14557           0 :     mannwhitneyu_ucheb(x, 2.452780e-03, &tj, &tj1, &result, _state);
   14558           0 :     mannwhitneyu_ucheb(x, 2.441805e-03, &tj, &tj1, &result, _state);
   14559           0 :     mannwhitneyu_ucheb(x, 2.787493e-03, &tj, &tj1, &result, _state);
   14560           0 :     mannwhitneyu_ucheb(x, 2.483957e-03, &tj, &tj1, &result, _state);
   14561           0 :     mannwhitneyu_ucheb(x, 2.481590e-03, &tj, &tj1, &result, _state);
   14562           0 :     return result;
   14563             : }
   14564             : 
   14565             : 
   14566             : /*************************************************************************
   14567             : Tail(S, 6, 14)
   14568             : *************************************************************************/
   14569           0 : static double mannwhitneyu_utbln6n14(double s, ae_state *_state)
   14570             : {
   14571             :     double x;
   14572             :     double tj;
   14573             :     double tj1;
   14574             :     double result;
   14575             : 
   14576             : 
   14577           0 :     result = (double)(0);
   14578           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.450000e+00-1, 1.0, _state);
   14579           0 :     tj = (double)(1);
   14580           0 :     tj1 = x;
   14581           0 :     mannwhitneyu_ucheb(x, -4.201268e+00, &tj, &tj1, &result, _state);
   14582           0 :     mannwhitneyu_ucheb(x, -4.542568e+00, &tj, &tj1, &result, _state);
   14583           0 :     mannwhitneyu_ucheb(x, -1.226965e+00, &tj, &tj1, &result, _state);
   14584           0 :     mannwhitneyu_ucheb(x, -3.046029e-01, &tj, &tj1, &result, _state);
   14585           0 :     mannwhitneyu_ucheb(x, -1.136657e-01, &tj, &tj1, &result, _state);
   14586           0 :     mannwhitneyu_ucheb(x, -4.786757e-02, &tj, &tj1, &result, _state);
   14587           0 :     mannwhitneyu_ucheb(x, -1.843748e-02, &tj, &tj1, &result, _state);
   14588           0 :     mannwhitneyu_ucheb(x, -5.588022e-03, &tj, &tj1, &result, _state);
   14589           0 :     mannwhitneyu_ucheb(x, 2.253029e-04, &tj, &tj1, &result, _state);
   14590           0 :     mannwhitneyu_ucheb(x, 1.667188e-03, &tj, &tj1, &result, _state);
   14591           0 :     mannwhitneyu_ucheb(x, 1.788330e-03, &tj, &tj1, &result, _state);
   14592           0 :     mannwhitneyu_ucheb(x, 1.474545e-03, &tj, &tj1, &result, _state);
   14593           0 :     mannwhitneyu_ucheb(x, 1.540494e-03, &tj, &tj1, &result, _state);
   14594           0 :     mannwhitneyu_ucheb(x, 1.951188e-03, &tj, &tj1, &result, _state);
   14595           0 :     mannwhitneyu_ucheb(x, 1.863323e-03, &tj, &tj1, &result, _state);
   14596           0 :     mannwhitneyu_ucheb(x, 2.220904e-03, &tj, &tj1, &result, _state);
   14597           0 :     return result;
   14598             : }
   14599             : 
   14600             : 
   14601             : /*************************************************************************
   14602             : Tail(S, 6, 15)
   14603             : *************************************************************************/
   14604           0 : static double mannwhitneyu_utbln6n15(double s, ae_state *_state)
   14605             : {
   14606             :     double x;
   14607             :     double tj;
   14608             :     double tj1;
   14609             :     double result;
   14610             : 
   14611             : 
   14612           0 :     result = (double)(0);
   14613           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.450000e+00-1, 1.0, _state);
   14614           0 :     tj = (double)(1);
   14615           0 :     tj1 = x;
   14616           0 :     mannwhitneyu_ucheb(x, -4.195689e+00, &tj, &tj1, &result, _state);
   14617           0 :     mannwhitneyu_ucheb(x, -4.526567e+00, &tj, &tj1, &result, _state);
   14618           0 :     mannwhitneyu_ucheb(x, -1.213617e+00, &tj, &tj1, &result, _state);
   14619           0 :     mannwhitneyu_ucheb(x, -2.975035e-01, &tj, &tj1, &result, _state);
   14620           0 :     mannwhitneyu_ucheb(x, -1.118480e-01, &tj, &tj1, &result, _state);
   14621           0 :     mannwhitneyu_ucheb(x, -4.859142e-02, &tj, &tj1, &result, _state);
   14622           0 :     mannwhitneyu_ucheb(x, -2.083312e-02, &tj, &tj1, &result, _state);
   14623           0 :     mannwhitneyu_ucheb(x, -8.298720e-03, &tj, &tj1, &result, _state);
   14624           0 :     mannwhitneyu_ucheb(x, -2.766708e-03, &tj, &tj1, &result, _state);
   14625           0 :     mannwhitneyu_ucheb(x, -1.026356e-03, &tj, &tj1, &result, _state);
   14626           0 :     mannwhitneyu_ucheb(x, -9.093113e-04, &tj, &tj1, &result, _state);
   14627           0 :     mannwhitneyu_ucheb(x, -1.135168e-03, &tj, &tj1, &result, _state);
   14628           0 :     mannwhitneyu_ucheb(x, -1.136376e-03, &tj, &tj1, &result, _state);
   14629           0 :     mannwhitneyu_ucheb(x, -8.190870e-04, &tj, &tj1, &result, _state);
   14630           0 :     mannwhitneyu_ucheb(x, -4.435972e-04, &tj, &tj1, &result, _state);
   14631           0 :     mannwhitneyu_ucheb(x, 1.413129e-04, &tj, &tj1, &result, _state);
   14632           0 :     return result;
   14633             : }
   14634             : 
   14635             : 
   14636             : /*************************************************************************
   14637             : Tail(S, 6, 30)
   14638             : *************************************************************************/
   14639           0 : static double mannwhitneyu_utbln6n30(double s, ae_state *_state)
   14640             : {
   14641             :     double x;
   14642             :     double tj;
   14643             :     double tj1;
   14644             :     double result;
   14645             : 
   14646             : 
   14647           0 :     result = (double)(0);
   14648           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.450000e+00-1, 1.0, _state);
   14649           0 :     tj = (double)(1);
   14650           0 :     tj1 = x;
   14651           0 :     mannwhitneyu_ucheb(x, -4.166269e+00, &tj, &tj1, &result, _state);
   14652           0 :     mannwhitneyu_ucheb(x, -4.427399e+00, &tj, &tj1, &result, _state);
   14653           0 :     mannwhitneyu_ucheb(x, -1.118239e+00, &tj, &tj1, &result, _state);
   14654           0 :     mannwhitneyu_ucheb(x, -2.360847e-01, &tj, &tj1, &result, _state);
   14655           0 :     mannwhitneyu_ucheb(x, -7.745885e-02, &tj, &tj1, &result, _state);
   14656           0 :     mannwhitneyu_ucheb(x, -3.025041e-02, &tj, &tj1, &result, _state);
   14657           0 :     mannwhitneyu_ucheb(x, -1.187179e-02, &tj, &tj1, &result, _state);
   14658           0 :     mannwhitneyu_ucheb(x, -4.432089e-03, &tj, &tj1, &result, _state);
   14659           0 :     mannwhitneyu_ucheb(x, -1.408451e-03, &tj, &tj1, &result, _state);
   14660           0 :     mannwhitneyu_ucheb(x, -4.388774e-04, &tj, &tj1, &result, _state);
   14661           0 :     mannwhitneyu_ucheb(x, -2.795560e-04, &tj, &tj1, &result, _state);
   14662           0 :     mannwhitneyu_ucheb(x, -2.304136e-04, &tj, &tj1, &result, _state);
   14663           0 :     mannwhitneyu_ucheb(x, -1.258516e-04, &tj, &tj1, &result, _state);
   14664           0 :     mannwhitneyu_ucheb(x, -4.180236e-05, &tj, &tj1, &result, _state);
   14665           0 :     mannwhitneyu_ucheb(x, -4.388679e-06, &tj, &tj1, &result, _state);
   14666           0 :     mannwhitneyu_ucheb(x, 4.836027e-06, &tj, &tj1, &result, _state);
   14667           0 :     return result;
   14668             : }
   14669             : 
   14670             : 
   14671             : /*************************************************************************
   14672             : Tail(S, 6, 100)
   14673             : *************************************************************************/
   14674           0 : static double mannwhitneyu_utbln6n100(double s, ae_state *_state)
   14675             : {
   14676             :     double x;
   14677             :     double tj;
   14678             :     double tj1;
   14679             :     double result;
   14680             : 
   14681             : 
   14682           0 :     result = (double)(0);
   14683           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.450000e+00-1, 1.0, _state);
   14684           0 :     tj = (double)(1);
   14685           0 :     tj1 = x;
   14686           0 :     mannwhitneyu_ucheb(x, -4.181350e+00, &tj, &tj1, &result, _state);
   14687           0 :     mannwhitneyu_ucheb(x, -4.417919e+00, &tj, &tj1, &result, _state);
   14688           0 :     mannwhitneyu_ucheb(x, -1.094201e+00, &tj, &tj1, &result, _state);
   14689           0 :     mannwhitneyu_ucheb(x, -2.195883e-01, &tj, &tj1, &result, _state);
   14690           0 :     mannwhitneyu_ucheb(x, -6.818937e-02, &tj, &tj1, &result, _state);
   14691           0 :     mannwhitneyu_ucheb(x, -2.514202e-02, &tj, &tj1, &result, _state);
   14692           0 :     mannwhitneyu_ucheb(x, -9.125047e-03, &tj, &tj1, &result, _state);
   14693           0 :     mannwhitneyu_ucheb(x, -3.022148e-03, &tj, &tj1, &result, _state);
   14694           0 :     mannwhitneyu_ucheb(x, -7.284181e-04, &tj, &tj1, &result, _state);
   14695           0 :     mannwhitneyu_ucheb(x, -1.157766e-04, &tj, &tj1, &result, _state);
   14696           0 :     mannwhitneyu_ucheb(x, -1.023752e-04, &tj, &tj1, &result, _state);
   14697           0 :     mannwhitneyu_ucheb(x, -1.127985e-04, &tj, &tj1, &result, _state);
   14698           0 :     mannwhitneyu_ucheb(x, -5.221690e-05, &tj, &tj1, &result, _state);
   14699           0 :     mannwhitneyu_ucheb(x, -3.516179e-06, &tj, &tj1, &result, _state);
   14700           0 :     mannwhitneyu_ucheb(x, 9.501398e-06, &tj, &tj1, &result, _state);
   14701           0 :     mannwhitneyu_ucheb(x, 9.380220e-06, &tj, &tj1, &result, _state);
   14702           0 :     return result;
   14703             : }
   14704             : 
   14705             : 
   14706             : /*************************************************************************
   14707             : Tail(S, 7, 7)
   14708             : *************************************************************************/
   14709           0 : static double mannwhitneyu_utbln7n7(double s, ae_state *_state)
   14710             : {
   14711             :     double x;
   14712             :     double tj;
   14713             :     double tj1;
   14714             :     double result;
   14715             : 
   14716             : 
   14717           0 :     result = (double)(0);
   14718           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.130495e+00-1, 1.0, _state);
   14719           0 :     tj = (double)(1);
   14720           0 :     tj1 = x;
   14721           0 :     mannwhitneyu_ucheb(x, -3.501264e+00, &tj, &tj1, &result, _state);
   14722           0 :     mannwhitneyu_ucheb(x, -3.584790e+00, &tj, &tj1, &result, _state);
   14723           0 :     mannwhitneyu_ucheb(x, -8.577311e-01, &tj, &tj1, &result, _state);
   14724           0 :     mannwhitneyu_ucheb(x, -1.617002e-01, &tj, &tj1, &result, _state);
   14725           0 :     mannwhitneyu_ucheb(x, -4.145186e-02, &tj, &tj1, &result, _state);
   14726           0 :     mannwhitneyu_ucheb(x, -1.023462e-02, &tj, &tj1, &result, _state);
   14727           0 :     mannwhitneyu_ucheb(x, -1.408251e-03, &tj, &tj1, &result, _state);
   14728           0 :     mannwhitneyu_ucheb(x, 8.626515e-04, &tj, &tj1, &result, _state);
   14729           0 :     mannwhitneyu_ucheb(x, 2.072492e-03, &tj, &tj1, &result, _state);
   14730           0 :     mannwhitneyu_ucheb(x, 3.722926e-03, &tj, &tj1, &result, _state);
   14731           0 :     mannwhitneyu_ucheb(x, 5.095445e-03, &tj, &tj1, &result, _state);
   14732           0 :     mannwhitneyu_ucheb(x, 4.842602e-03, &tj, &tj1, &result, _state);
   14733           0 :     mannwhitneyu_ucheb(x, 2.751427e-03, &tj, &tj1, &result, _state);
   14734           0 :     mannwhitneyu_ucheb(x, 2.008927e-04, &tj, &tj1, &result, _state);
   14735           0 :     mannwhitneyu_ucheb(x, -9.892431e-04, &tj, &tj1, &result, _state);
   14736           0 :     mannwhitneyu_ucheb(x, -8.772386e-04, &tj, &tj1, &result, _state);
   14737           0 :     return result;
   14738             : }
   14739             : 
   14740             : 
   14741             : /*************************************************************************
   14742             : Tail(S, 7, 8)
   14743             : *************************************************************************/
   14744           0 : static double mannwhitneyu_utbln7n8(double s, ae_state *_state)
   14745             : {
   14746             :     double x;
   14747             :     double tj;
   14748             :     double tj1;
   14749             :     double result;
   14750             : 
   14751             : 
   14752           0 :     result = (double)(0);
   14753           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.240370e+00-1, 1.0, _state);
   14754           0 :     tj = (double)(1);
   14755           0 :     tj1 = x;
   14756           0 :     mannwhitneyu_ucheb(x, -3.709965e+00, &tj, &tj1, &result, _state);
   14757           0 :     mannwhitneyu_ucheb(x, -3.862154e+00, &tj, &tj1, &result, _state);
   14758           0 :     mannwhitneyu_ucheb(x, -9.504541e-01, &tj, &tj1, &result, _state);
   14759           0 :     mannwhitneyu_ucheb(x, -1.900195e-01, &tj, &tj1, &result, _state);
   14760           0 :     mannwhitneyu_ucheb(x, -5.439995e-02, &tj, &tj1, &result, _state);
   14761           0 :     mannwhitneyu_ucheb(x, -1.678028e-02, &tj, &tj1, &result, _state);
   14762           0 :     mannwhitneyu_ucheb(x, -4.485540e-03, &tj, &tj1, &result, _state);
   14763           0 :     mannwhitneyu_ucheb(x, -4.437047e-04, &tj, &tj1, &result, _state);
   14764           0 :     mannwhitneyu_ucheb(x, 1.440092e-03, &tj, &tj1, &result, _state);
   14765           0 :     mannwhitneyu_ucheb(x, 3.114227e-03, &tj, &tj1, &result, _state);
   14766           0 :     mannwhitneyu_ucheb(x, 4.516569e-03, &tj, &tj1, &result, _state);
   14767           0 :     mannwhitneyu_ucheb(x, 4.829457e-03, &tj, &tj1, &result, _state);
   14768           0 :     mannwhitneyu_ucheb(x, 3.787550e-03, &tj, &tj1, &result, _state);
   14769           0 :     mannwhitneyu_ucheb(x, 1.761866e-03, &tj, &tj1, &result, _state);
   14770           0 :     mannwhitneyu_ucheb(x, 1.991911e-04, &tj, &tj1, &result, _state);
   14771           0 :     mannwhitneyu_ucheb(x, -4.533481e-04, &tj, &tj1, &result, _state);
   14772           0 :     return result;
   14773             : }
   14774             : 
   14775             : 
   14776             : /*************************************************************************
   14777             : Tail(S, 7, 9)
   14778             : *************************************************************************/
   14779           0 : static double mannwhitneyu_utbln7n9(double s, ae_state *_state)
   14780             : {
   14781             :     double x;
   14782             :     double tj;
   14783             :     double tj1;
   14784             :     double result;
   14785             : 
   14786             : 
   14787           0 :     result = (double)(0);
   14788           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.334314e+00-1, 1.0, _state);
   14789           0 :     tj = (double)(1);
   14790           0 :     tj1 = x;
   14791           0 :     mannwhitneyu_ucheb(x, -3.896550e+00, &tj, &tj1, &result, _state);
   14792           0 :     mannwhitneyu_ucheb(x, -4.112671e+00, &tj, &tj1, &result, _state);
   14793           0 :     mannwhitneyu_ucheb(x, -1.037277e+00, &tj, &tj1, &result, _state);
   14794           0 :     mannwhitneyu_ucheb(x, -2.181695e-01, &tj, &tj1, &result, _state);
   14795           0 :     mannwhitneyu_ucheb(x, -6.765190e-02, &tj, &tj1, &result, _state);
   14796           0 :     mannwhitneyu_ucheb(x, -2.360116e-02, &tj, &tj1, &result, _state);
   14797           0 :     mannwhitneyu_ucheb(x, -7.695960e-03, &tj, &tj1, &result, _state);
   14798           0 :     mannwhitneyu_ucheb(x, -1.780578e-03, &tj, &tj1, &result, _state);
   14799           0 :     mannwhitneyu_ucheb(x, 8.963843e-04, &tj, &tj1, &result, _state);
   14800           0 :     mannwhitneyu_ucheb(x, 2.616148e-03, &tj, &tj1, &result, _state);
   14801           0 :     mannwhitneyu_ucheb(x, 3.852104e-03, &tj, &tj1, &result, _state);
   14802           0 :     mannwhitneyu_ucheb(x, 4.390744e-03, &tj, &tj1, &result, _state);
   14803           0 :     mannwhitneyu_ucheb(x, 4.014041e-03, &tj, &tj1, &result, _state);
   14804           0 :     mannwhitneyu_ucheb(x, 2.888101e-03, &tj, &tj1, &result, _state);
   14805           0 :     mannwhitneyu_ucheb(x, 1.467474e-03, &tj, &tj1, &result, _state);
   14806           0 :     mannwhitneyu_ucheb(x, 4.004611e-04, &tj, &tj1, &result, _state);
   14807           0 :     return result;
   14808             : }
   14809             : 
   14810             : 
   14811             : /*************************************************************************
   14812             : Tail(S, 7, 10)
   14813             : *************************************************************************/
   14814           0 : static double mannwhitneyu_utbln7n10(double s, ae_state *_state)
   14815             : {
   14816             :     double x;
   14817             :     double tj;
   14818             :     double tj1;
   14819             :     double result;
   14820             : 
   14821             : 
   14822           0 :     result = (double)(0);
   14823           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.415650e+00-1, 1.0, _state);
   14824           0 :     tj = (double)(1);
   14825           0 :     tj1 = x;
   14826           0 :     mannwhitneyu_ucheb(x, -4.064844e+00, &tj, &tj1, &result, _state);
   14827           0 :     mannwhitneyu_ucheb(x, -4.340749e+00, &tj, &tj1, &result, _state);
   14828           0 :     mannwhitneyu_ucheb(x, -1.118888e+00, &tj, &tj1, &result, _state);
   14829           0 :     mannwhitneyu_ucheb(x, -2.459730e-01, &tj, &tj1, &result, _state);
   14830           0 :     mannwhitneyu_ucheb(x, -8.097781e-02, &tj, &tj1, &result, _state);
   14831           0 :     mannwhitneyu_ucheb(x, -3.057688e-02, &tj, &tj1, &result, _state);
   14832           0 :     mannwhitneyu_ucheb(x, -1.097406e-02, &tj, &tj1, &result, _state);
   14833           0 :     mannwhitneyu_ucheb(x, -3.209262e-03, &tj, &tj1, &result, _state);
   14834           0 :     mannwhitneyu_ucheb(x, 4.065641e-04, &tj, &tj1, &result, _state);
   14835           0 :     mannwhitneyu_ucheb(x, 2.196677e-03, &tj, &tj1, &result, _state);
   14836           0 :     mannwhitneyu_ucheb(x, 3.313994e-03, &tj, &tj1, &result, _state);
   14837           0 :     mannwhitneyu_ucheb(x, 3.827157e-03, &tj, &tj1, &result, _state);
   14838           0 :     mannwhitneyu_ucheb(x, 3.822284e-03, &tj, &tj1, &result, _state);
   14839           0 :     mannwhitneyu_ucheb(x, 3.389090e-03, &tj, &tj1, &result, _state);
   14840           0 :     mannwhitneyu_ucheb(x, 2.340850e-03, &tj, &tj1, &result, _state);
   14841           0 :     mannwhitneyu_ucheb(x, 1.395172e-03, &tj, &tj1, &result, _state);
   14842           0 :     return result;
   14843             : }
   14844             : 
   14845             : 
   14846             : /*************************************************************************
   14847             : Tail(S, 7, 11)
   14848             : *************************************************************************/
   14849           0 : static double mannwhitneyu_utbln7n11(double s, ae_state *_state)
   14850             : {
   14851             :     double x;
   14852             :     double tj;
   14853             :     double tj1;
   14854             :     double result;
   14855             : 
   14856             : 
   14857           0 :     result = (double)(0);
   14858           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.486817e+00-1, 1.0, _state);
   14859           0 :     tj = (double)(1);
   14860           0 :     tj1 = x;
   14861           0 :     mannwhitneyu_ucheb(x, -4.217795e+00, &tj, &tj1, &result, _state);
   14862           0 :     mannwhitneyu_ucheb(x, -4.549783e+00, &tj, &tj1, &result, _state);
   14863           0 :     mannwhitneyu_ucheb(x, -1.195905e+00, &tj, &tj1, &result, _state);
   14864           0 :     mannwhitneyu_ucheb(x, -2.733093e-01, &tj, &tj1, &result, _state);
   14865           0 :     mannwhitneyu_ucheb(x, -9.428447e-02, &tj, &tj1, &result, _state);
   14866           0 :     mannwhitneyu_ucheb(x, -3.760093e-02, &tj, &tj1, &result, _state);
   14867           0 :     mannwhitneyu_ucheb(x, -1.431676e-02, &tj, &tj1, &result, _state);
   14868           0 :     mannwhitneyu_ucheb(x, -4.717152e-03, &tj, &tj1, &result, _state);
   14869           0 :     mannwhitneyu_ucheb(x, -1.032199e-04, &tj, &tj1, &result, _state);
   14870           0 :     mannwhitneyu_ucheb(x, 1.832423e-03, &tj, &tj1, &result, _state);
   14871           0 :     mannwhitneyu_ucheb(x, 2.905979e-03, &tj, &tj1, &result, _state);
   14872           0 :     mannwhitneyu_ucheb(x, 3.302799e-03, &tj, &tj1, &result, _state);
   14873           0 :     mannwhitneyu_ucheb(x, 3.464371e-03, &tj, &tj1, &result, _state);
   14874           0 :     mannwhitneyu_ucheb(x, 3.456211e-03, &tj, &tj1, &result, _state);
   14875           0 :     mannwhitneyu_ucheb(x, 2.736244e-03, &tj, &tj1, &result, _state);
   14876           0 :     mannwhitneyu_ucheb(x, 2.140712e-03, &tj, &tj1, &result, _state);
   14877           0 :     return result;
   14878             : }
   14879             : 
   14880             : 
   14881             : /*************************************************************************
   14882             : Tail(S, 7, 12)
   14883             : *************************************************************************/
   14884           0 : static double mannwhitneyu_utbln7n12(double s, ae_state *_state)
   14885             : {
   14886             :     double x;
   14887             :     double tj;
   14888             :     double tj1;
   14889             :     double result;
   14890             : 
   14891             : 
   14892           0 :     result = (double)(0);
   14893           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.500000e+00-1, 1.0, _state);
   14894           0 :     tj = (double)(1);
   14895           0 :     tj1 = x;
   14896           0 :     mannwhitneyu_ucheb(x, -4.235822e+00, &tj, &tj1, &result, _state);
   14897           0 :     mannwhitneyu_ucheb(x, -4.564100e+00, &tj, &tj1, &result, _state);
   14898           0 :     mannwhitneyu_ucheb(x, -1.190813e+00, &tj, &tj1, &result, _state);
   14899           0 :     mannwhitneyu_ucheb(x, -2.686546e-01, &tj, &tj1, &result, _state);
   14900           0 :     mannwhitneyu_ucheb(x, -9.395083e-02, &tj, &tj1, &result, _state);
   14901           0 :     mannwhitneyu_ucheb(x, -3.967359e-02, &tj, &tj1, &result, _state);
   14902           0 :     mannwhitneyu_ucheb(x, -1.747096e-02, &tj, &tj1, &result, _state);
   14903           0 :     mannwhitneyu_ucheb(x, -8.304144e-03, &tj, &tj1, &result, _state);
   14904           0 :     mannwhitneyu_ucheb(x, -3.903198e-03, &tj, &tj1, &result, _state);
   14905           0 :     mannwhitneyu_ucheb(x, -2.134906e-03, &tj, &tj1, &result, _state);
   14906           0 :     mannwhitneyu_ucheb(x, -1.175035e-03, &tj, &tj1, &result, _state);
   14907           0 :     mannwhitneyu_ucheb(x, -7.266224e-04, &tj, &tj1, &result, _state);
   14908           0 :     mannwhitneyu_ucheb(x, -1.892931e-04, &tj, &tj1, &result, _state);
   14909           0 :     mannwhitneyu_ucheb(x, 5.604706e-04, &tj, &tj1, &result, _state);
   14910           0 :     mannwhitneyu_ucheb(x, 9.070459e-04, &tj, &tj1, &result, _state);
   14911           0 :     mannwhitneyu_ucheb(x, 1.427010e-03, &tj, &tj1, &result, _state);
   14912           0 :     return result;
   14913             : }
   14914             : 
   14915             : 
   14916             : /*************************************************************************
   14917             : Tail(S, 7, 13)
   14918             : *************************************************************************/
   14919           0 : static double mannwhitneyu_utbln7n13(double s, ae_state *_state)
   14920             : {
   14921             :     double x;
   14922             :     double tj;
   14923             :     double tj1;
   14924             :     double result;
   14925             : 
   14926             : 
   14927           0 :     result = (double)(0);
   14928           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.500000e+00-1, 1.0, _state);
   14929           0 :     tj = (double)(1);
   14930           0 :     tj1 = x;
   14931           0 :     mannwhitneyu_ucheb(x, -4.222204e+00, &tj, &tj1, &result, _state);
   14932           0 :     mannwhitneyu_ucheb(x, -4.532300e+00, &tj, &tj1, &result, _state);
   14933           0 :     mannwhitneyu_ucheb(x, -1.164642e+00, &tj, &tj1, &result, _state);
   14934           0 :     mannwhitneyu_ucheb(x, -2.523768e-01, &tj, &tj1, &result, _state);
   14935           0 :     mannwhitneyu_ucheb(x, -8.531984e-02, &tj, &tj1, &result, _state);
   14936           0 :     mannwhitneyu_ucheb(x, -3.467857e-02, &tj, &tj1, &result, _state);
   14937           0 :     mannwhitneyu_ucheb(x, -1.483804e-02, &tj, &tj1, &result, _state);
   14938           0 :     mannwhitneyu_ucheb(x, -6.524136e-03, &tj, &tj1, &result, _state);
   14939           0 :     mannwhitneyu_ucheb(x, -3.077740e-03, &tj, &tj1, &result, _state);
   14940           0 :     mannwhitneyu_ucheb(x, -1.745218e-03, &tj, &tj1, &result, _state);
   14941           0 :     mannwhitneyu_ucheb(x, -1.602085e-03, &tj, &tj1, &result, _state);
   14942           0 :     mannwhitneyu_ucheb(x, -1.828831e-03, &tj, &tj1, &result, _state);
   14943           0 :     mannwhitneyu_ucheb(x, -1.994070e-03, &tj, &tj1, &result, _state);
   14944           0 :     mannwhitneyu_ucheb(x, -1.873879e-03, &tj, &tj1, &result, _state);
   14945           0 :     mannwhitneyu_ucheb(x, -1.341937e-03, &tj, &tj1, &result, _state);
   14946           0 :     mannwhitneyu_ucheb(x, -8.706444e-04, &tj, &tj1, &result, _state);
   14947           0 :     return result;
   14948             : }
   14949             : 
   14950             : 
   14951             : /*************************************************************************
   14952             : Tail(S, 7, 14)
   14953             : *************************************************************************/
   14954           0 : static double mannwhitneyu_utbln7n14(double s, ae_state *_state)
   14955             : {
   14956             :     double x;
   14957             :     double tj;
   14958             :     double tj1;
   14959             :     double result;
   14960             : 
   14961             : 
   14962           0 :     result = (double)(0);
   14963           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.500000e+00-1, 1.0, _state);
   14964           0 :     tj = (double)(1);
   14965           0 :     tj1 = x;
   14966           0 :     mannwhitneyu_ucheb(x, -4.211763e+00, &tj, &tj1, &result, _state);
   14967           0 :     mannwhitneyu_ucheb(x, -4.507542e+00, &tj, &tj1, &result, _state);
   14968           0 :     mannwhitneyu_ucheb(x, -1.143640e+00, &tj, &tj1, &result, _state);
   14969           0 :     mannwhitneyu_ucheb(x, -2.395755e-01, &tj, &tj1, &result, _state);
   14970           0 :     mannwhitneyu_ucheb(x, -7.808020e-02, &tj, &tj1, &result, _state);
   14971           0 :     mannwhitneyu_ucheb(x, -3.044259e-02, &tj, &tj1, &result, _state);
   14972           0 :     mannwhitneyu_ucheb(x, -1.182308e-02, &tj, &tj1, &result, _state);
   14973           0 :     mannwhitneyu_ucheb(x, -4.057325e-03, &tj, &tj1, &result, _state);
   14974           0 :     mannwhitneyu_ucheb(x, -5.724255e-04, &tj, &tj1, &result, _state);
   14975           0 :     mannwhitneyu_ucheb(x, 8.303900e-04, &tj, &tj1, &result, _state);
   14976           0 :     mannwhitneyu_ucheb(x, 1.113148e-03, &tj, &tj1, &result, _state);
   14977           0 :     mannwhitneyu_ucheb(x, 8.102514e-04, &tj, &tj1, &result, _state);
   14978           0 :     mannwhitneyu_ucheb(x, 3.559442e-04, &tj, &tj1, &result, _state);
   14979           0 :     mannwhitneyu_ucheb(x, 4.634986e-05, &tj, &tj1, &result, _state);
   14980           0 :     mannwhitneyu_ucheb(x, -8.776476e-05, &tj, &tj1, &result, _state);
   14981           0 :     mannwhitneyu_ucheb(x, 1.054489e-05, &tj, &tj1, &result, _state);
   14982           0 :     return result;
   14983             : }
   14984             : 
   14985             : 
   14986             : /*************************************************************************
   14987             : Tail(S, 7, 15)
   14988             : *************************************************************************/
   14989           0 : static double mannwhitneyu_utbln7n15(double s, ae_state *_state)
   14990             : {
   14991             :     double x;
   14992             :     double tj;
   14993             :     double tj1;
   14994             :     double result;
   14995             : 
   14996             : 
   14997           0 :     result = (double)(0);
   14998           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.500000e+00-1, 1.0, _state);
   14999           0 :     tj = (double)(1);
   15000           0 :     tj1 = x;
   15001           0 :     mannwhitneyu_ucheb(x, -4.204898e+00, &tj, &tj1, &result, _state);
   15002           0 :     mannwhitneyu_ucheb(x, -4.489960e+00, &tj, &tj1, &result, _state);
   15003           0 :     mannwhitneyu_ucheb(x, -1.129172e+00, &tj, &tj1, &result, _state);
   15004           0 :     mannwhitneyu_ucheb(x, -2.316741e-01, &tj, &tj1, &result, _state);
   15005           0 :     mannwhitneyu_ucheb(x, -7.506107e-02, &tj, &tj1, &result, _state);
   15006           0 :     mannwhitneyu_ucheb(x, -2.983676e-02, &tj, &tj1, &result, _state);
   15007           0 :     mannwhitneyu_ucheb(x, -1.258013e-02, &tj, &tj1, &result, _state);
   15008           0 :     mannwhitneyu_ucheb(x, -5.262515e-03, &tj, &tj1, &result, _state);
   15009           0 :     mannwhitneyu_ucheb(x, -1.984156e-03, &tj, &tj1, &result, _state);
   15010           0 :     mannwhitneyu_ucheb(x, -3.912108e-04, &tj, &tj1, &result, _state);
   15011           0 :     mannwhitneyu_ucheb(x, 8.974023e-05, &tj, &tj1, &result, _state);
   15012           0 :     mannwhitneyu_ucheb(x, 6.056195e-05, &tj, &tj1, &result, _state);
   15013           0 :     mannwhitneyu_ucheb(x, -2.090842e-04, &tj, &tj1, &result, _state);
   15014           0 :     mannwhitneyu_ucheb(x, -5.232620e-04, &tj, &tj1, &result, _state);
   15015           0 :     mannwhitneyu_ucheb(x, -5.816339e-04, &tj, &tj1, &result, _state);
   15016           0 :     mannwhitneyu_ucheb(x, -7.020421e-04, &tj, &tj1, &result, _state);
   15017           0 :     return result;
   15018             : }
   15019             : 
   15020             : 
   15021             : /*************************************************************************
   15022             : Tail(S, 7, 30)
   15023             : *************************************************************************/
   15024           0 : static double mannwhitneyu_utbln7n30(double s, ae_state *_state)
   15025             : {
   15026             :     double x;
   15027             :     double tj;
   15028             :     double tj1;
   15029             :     double result;
   15030             : 
   15031             : 
   15032           0 :     result = (double)(0);
   15033           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.500000e+00-1, 1.0, _state);
   15034           0 :     tj = (double)(1);
   15035           0 :     tj1 = x;
   15036           0 :     mannwhitneyu_ucheb(x, -4.176536e+00, &tj, &tj1, &result, _state);
   15037           0 :     mannwhitneyu_ucheb(x, -4.398705e+00, &tj, &tj1, &result, _state);
   15038           0 :     mannwhitneyu_ucheb(x, -1.045481e+00, &tj, &tj1, &result, _state);
   15039           0 :     mannwhitneyu_ucheb(x, -1.821982e-01, &tj, &tj1, &result, _state);
   15040           0 :     mannwhitneyu_ucheb(x, -4.962304e-02, &tj, &tj1, &result, _state);
   15041           0 :     mannwhitneyu_ucheb(x, -1.698132e-02, &tj, &tj1, &result, _state);
   15042           0 :     mannwhitneyu_ucheb(x, -6.062667e-03, &tj, &tj1, &result, _state);
   15043           0 :     mannwhitneyu_ucheb(x, -2.282353e-03, &tj, &tj1, &result, _state);
   15044           0 :     mannwhitneyu_ucheb(x, -8.014836e-04, &tj, &tj1, &result, _state);
   15045           0 :     mannwhitneyu_ucheb(x, -2.035683e-04, &tj, &tj1, &result, _state);
   15046           0 :     mannwhitneyu_ucheb(x, -1.004137e-05, &tj, &tj1, &result, _state);
   15047           0 :     mannwhitneyu_ucheb(x, 3.801453e-06, &tj, &tj1, &result, _state);
   15048           0 :     mannwhitneyu_ucheb(x, -1.920705e-05, &tj, &tj1, &result, _state);
   15049           0 :     mannwhitneyu_ucheb(x, -2.518735e-05, &tj, &tj1, &result, _state);
   15050           0 :     mannwhitneyu_ucheb(x, -1.821501e-05, &tj, &tj1, &result, _state);
   15051           0 :     mannwhitneyu_ucheb(x, -1.801008e-05, &tj, &tj1, &result, _state);
   15052           0 :     return result;
   15053             : }
   15054             : 
   15055             : 
   15056             : /*************************************************************************
   15057             : Tail(S, 7, 100)
   15058             : *************************************************************************/
   15059           0 : static double mannwhitneyu_utbln7n100(double s, ae_state *_state)
   15060             : {
   15061             :     double x;
   15062             :     double tj;
   15063             :     double tj1;
   15064             :     double result;
   15065             : 
   15066             : 
   15067           0 :     result = (double)(0);
   15068           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.500000e+00-1, 1.0, _state);
   15069           0 :     tj = (double)(1);
   15070           0 :     tj1 = x;
   15071           0 :     mannwhitneyu_ucheb(x, -4.188337e+00, &tj, &tj1, &result, _state);
   15072           0 :     mannwhitneyu_ucheb(x, -4.386949e+00, &tj, &tj1, &result, _state);
   15073           0 :     mannwhitneyu_ucheb(x, -1.022834e+00, &tj, &tj1, &result, _state);
   15074           0 :     mannwhitneyu_ucheb(x, -1.686517e-01, &tj, &tj1, &result, _state);
   15075           0 :     mannwhitneyu_ucheb(x, -4.323516e-02, &tj, &tj1, &result, _state);
   15076           0 :     mannwhitneyu_ucheb(x, -1.399392e-02, &tj, &tj1, &result, _state);
   15077           0 :     mannwhitneyu_ucheb(x, -4.644333e-03, &tj, &tj1, &result, _state);
   15078           0 :     mannwhitneyu_ucheb(x, -1.617044e-03, &tj, &tj1, &result, _state);
   15079           0 :     mannwhitneyu_ucheb(x, -5.031396e-04, &tj, &tj1, &result, _state);
   15080           0 :     mannwhitneyu_ucheb(x, -8.792066e-05, &tj, &tj1, &result, _state);
   15081           0 :     mannwhitneyu_ucheb(x, 2.675457e-05, &tj, &tj1, &result, _state);
   15082           0 :     mannwhitneyu_ucheb(x, 1.673416e-05, &tj, &tj1, &result, _state);
   15083           0 :     mannwhitneyu_ucheb(x, -6.258552e-06, &tj, &tj1, &result, _state);
   15084           0 :     mannwhitneyu_ucheb(x, -8.174214e-06, &tj, &tj1, &result, _state);
   15085           0 :     mannwhitneyu_ucheb(x, -3.073644e-06, &tj, &tj1, &result, _state);
   15086           0 :     mannwhitneyu_ucheb(x, -1.349958e-06, &tj, &tj1, &result, _state);
   15087           0 :     return result;
   15088             : }
   15089             : 
   15090             : 
   15091             : /*************************************************************************
   15092             : Tail(S, 8, 8)
   15093             : *************************************************************************/
   15094           0 : static double mannwhitneyu_utbln8n8(double s, ae_state *_state)
   15095             : {
   15096             :     double x;
   15097             :     double tj;
   15098             :     double tj1;
   15099             :     double result;
   15100             : 
   15101             : 
   15102           0 :     result = (double)(0);
   15103           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.360672e+00-1, 1.0, _state);
   15104           0 :     tj = (double)(1);
   15105           0 :     tj1 = x;
   15106           0 :     mannwhitneyu_ucheb(x, -3.940217e+00, &tj, &tj1, &result, _state);
   15107           0 :     mannwhitneyu_ucheb(x, -4.168913e+00, &tj, &tj1, &result, _state);
   15108           0 :     mannwhitneyu_ucheb(x, -1.051485e+00, &tj, &tj1, &result, _state);
   15109           0 :     mannwhitneyu_ucheb(x, -2.195325e-01, &tj, &tj1, &result, _state);
   15110           0 :     mannwhitneyu_ucheb(x, -6.775196e-02, &tj, &tj1, &result, _state);
   15111           0 :     mannwhitneyu_ucheb(x, -2.385506e-02, &tj, &tj1, &result, _state);
   15112           0 :     mannwhitneyu_ucheb(x, -8.244902e-03, &tj, &tj1, &result, _state);
   15113           0 :     mannwhitneyu_ucheb(x, -2.525632e-03, &tj, &tj1, &result, _state);
   15114           0 :     mannwhitneyu_ucheb(x, 2.771275e-04, &tj, &tj1, &result, _state);
   15115           0 :     mannwhitneyu_ucheb(x, 2.332874e-03, &tj, &tj1, &result, _state);
   15116           0 :     mannwhitneyu_ucheb(x, 4.079599e-03, &tj, &tj1, &result, _state);
   15117           0 :     mannwhitneyu_ucheb(x, 4.882551e-03, &tj, &tj1, &result, _state);
   15118           0 :     mannwhitneyu_ucheb(x, 4.407944e-03, &tj, &tj1, &result, _state);
   15119           0 :     mannwhitneyu_ucheb(x, 2.769844e-03, &tj, &tj1, &result, _state);
   15120           0 :     mannwhitneyu_ucheb(x, 1.062433e-03, &tj, &tj1, &result, _state);
   15121           0 :     mannwhitneyu_ucheb(x, 5.872535e-05, &tj, &tj1, &result, _state);
   15122           0 :     return result;
   15123             : }
   15124             : 
   15125             : 
   15126             : /*************************************************************************
   15127             : Tail(S, 8, 9)
   15128             : *************************************************************************/
   15129           0 : static double mannwhitneyu_utbln8n9(double s, ae_state *_state)
   15130             : {
   15131             :     double x;
   15132             :     double tj;
   15133             :     double tj1;
   15134             :     double result;
   15135             : 
   15136             : 
   15137           0 :     result = (double)(0);
   15138           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.464102e+00-1, 1.0, _state);
   15139           0 :     tj = (double)(1);
   15140           0 :     tj1 = x;
   15141           0 :     mannwhitneyu_ucheb(x, -4.147004e+00, &tj, &tj1, &result, _state);
   15142           0 :     mannwhitneyu_ucheb(x, -4.446939e+00, &tj, &tj1, &result, _state);
   15143           0 :     mannwhitneyu_ucheb(x, -1.146155e+00, &tj, &tj1, &result, _state);
   15144           0 :     mannwhitneyu_ucheb(x, -2.488561e-01, &tj, &tj1, &result, _state);
   15145           0 :     mannwhitneyu_ucheb(x, -8.144561e-02, &tj, &tj1, &result, _state);
   15146           0 :     mannwhitneyu_ucheb(x, -3.116917e-02, &tj, &tj1, &result, _state);
   15147           0 :     mannwhitneyu_ucheb(x, -1.205667e-02, &tj, &tj1, &result, _state);
   15148           0 :     mannwhitneyu_ucheb(x, -4.515661e-03, &tj, &tj1, &result, _state);
   15149           0 :     mannwhitneyu_ucheb(x, -7.618616e-04, &tj, &tj1, &result, _state);
   15150           0 :     mannwhitneyu_ucheb(x, 1.599011e-03, &tj, &tj1, &result, _state);
   15151           0 :     mannwhitneyu_ucheb(x, 3.457324e-03, &tj, &tj1, &result, _state);
   15152           0 :     mannwhitneyu_ucheb(x, 4.482917e-03, &tj, &tj1, &result, _state);
   15153           0 :     mannwhitneyu_ucheb(x, 4.488267e-03, &tj, &tj1, &result, _state);
   15154           0 :     mannwhitneyu_ucheb(x, 3.469823e-03, &tj, &tj1, &result, _state);
   15155           0 :     mannwhitneyu_ucheb(x, 1.957591e-03, &tj, &tj1, &result, _state);
   15156           0 :     mannwhitneyu_ucheb(x, 8.058326e-04, &tj, &tj1, &result, _state);
   15157           0 :     return result;
   15158             : }
   15159             : 
   15160             : 
   15161             : /*************************************************************************
   15162             : Tail(S, 8, 10)
   15163             : *************************************************************************/
   15164           0 : static double mannwhitneyu_utbln8n10(double s, ae_state *_state)
   15165             : {
   15166             :     double x;
   15167             :     double tj;
   15168             :     double tj1;
   15169             :     double result;
   15170             : 
   15171             : 
   15172           0 :     result = (double)(0);
   15173           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.554093e+00-1, 1.0, _state);
   15174           0 :     tj = (double)(1);
   15175           0 :     tj1 = x;
   15176           0 :     mannwhitneyu_ucheb(x, -4.334282e+00, &tj, &tj1, &result, _state);
   15177           0 :     mannwhitneyu_ucheb(x, -4.700860e+00, &tj, &tj1, &result, _state);
   15178           0 :     mannwhitneyu_ucheb(x, -1.235253e+00, &tj, &tj1, &result, _state);
   15179           0 :     mannwhitneyu_ucheb(x, -2.778489e-01, &tj, &tj1, &result, _state);
   15180           0 :     mannwhitneyu_ucheb(x, -9.527324e-02, &tj, &tj1, &result, _state);
   15181           0 :     mannwhitneyu_ucheb(x, -3.862885e-02, &tj, &tj1, &result, _state);
   15182           0 :     mannwhitneyu_ucheb(x, -1.589781e-02, &tj, &tj1, &result, _state);
   15183           0 :     mannwhitneyu_ucheb(x, -6.507355e-03, &tj, &tj1, &result, _state);
   15184           0 :     mannwhitneyu_ucheb(x, -1.717526e-03, &tj, &tj1, &result, _state);
   15185           0 :     mannwhitneyu_ucheb(x, 9.215726e-04, &tj, &tj1, &result, _state);
   15186           0 :     mannwhitneyu_ucheb(x, 2.848696e-03, &tj, &tj1, &result, _state);
   15187           0 :     mannwhitneyu_ucheb(x, 3.918854e-03, &tj, &tj1, &result, _state);
   15188           0 :     mannwhitneyu_ucheb(x, 4.219614e-03, &tj, &tj1, &result, _state);
   15189           0 :     mannwhitneyu_ucheb(x, 3.753761e-03, &tj, &tj1, &result, _state);
   15190           0 :     mannwhitneyu_ucheb(x, 2.573688e-03, &tj, &tj1, &result, _state);
   15191           0 :     mannwhitneyu_ucheb(x, 1.602177e-03, &tj, &tj1, &result, _state);
   15192           0 :     return result;
   15193             : }
   15194             : 
   15195             : 
   15196             : /*************************************************************************
   15197             : Tail(S, 8, 11)
   15198             : *************************************************************************/
   15199           0 : static double mannwhitneyu_utbln8n11(double s, ae_state *_state)
   15200             : {
   15201             :     double x;
   15202             :     double tj;
   15203             :     double tj1;
   15204             :     double result;
   15205             : 
   15206             : 
   15207           0 :     result = (double)(0);
   15208           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.600000e+00-1, 1.0, _state);
   15209           0 :     tj = (double)(1);
   15210           0 :     tj1 = x;
   15211           0 :     mannwhitneyu_ucheb(x, -4.421882e+00, &tj, &tj1, &result, _state);
   15212           0 :     mannwhitneyu_ucheb(x, -4.812457e+00, &tj, &tj1, &result, _state);
   15213           0 :     mannwhitneyu_ucheb(x, -1.266153e+00, &tj, &tj1, &result, _state);
   15214           0 :     mannwhitneyu_ucheb(x, -2.849344e-01, &tj, &tj1, &result, _state);
   15215           0 :     mannwhitneyu_ucheb(x, -9.971527e-02, &tj, &tj1, &result, _state);
   15216           0 :     mannwhitneyu_ucheb(x, -4.258944e-02, &tj, &tj1, &result, _state);
   15217           0 :     mannwhitneyu_ucheb(x, -1.944820e-02, &tj, &tj1, &result, _state);
   15218           0 :     mannwhitneyu_ucheb(x, -9.894685e-03, &tj, &tj1, &result, _state);
   15219           0 :     mannwhitneyu_ucheb(x, -5.031836e-03, &tj, &tj1, &result, _state);
   15220           0 :     mannwhitneyu_ucheb(x, -2.514330e-03, &tj, &tj1, &result, _state);
   15221           0 :     mannwhitneyu_ucheb(x, -6.351660e-04, &tj, &tj1, &result, _state);
   15222           0 :     mannwhitneyu_ucheb(x, 6.206748e-04, &tj, &tj1, &result, _state);
   15223           0 :     mannwhitneyu_ucheb(x, 1.492600e-03, &tj, &tj1, &result, _state);
   15224           0 :     mannwhitneyu_ucheb(x, 2.005338e-03, &tj, &tj1, &result, _state);
   15225           0 :     mannwhitneyu_ucheb(x, 1.780099e-03, &tj, &tj1, &result, _state);
   15226           0 :     mannwhitneyu_ucheb(x, 1.673599e-03, &tj, &tj1, &result, _state);
   15227           0 :     return result;
   15228             : }
   15229             : 
   15230             : 
   15231             : /*************************************************************************
   15232             : Tail(S, 8, 12)
   15233             : *************************************************************************/
   15234           0 : static double mannwhitneyu_utbln8n12(double s, ae_state *_state)
   15235             : {
   15236             :     double x;
   15237             :     double tj;
   15238             :     double tj1;
   15239             :     double result;
   15240             : 
   15241             : 
   15242           0 :     result = (double)(0);
   15243           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.600000e+00-1, 1.0, _state);
   15244           0 :     tj = (double)(1);
   15245           0 :     tj1 = x;
   15246           0 :     mannwhitneyu_ucheb(x, -4.398211e+00, &tj, &tj1, &result, _state);
   15247           0 :     mannwhitneyu_ucheb(x, -4.762214e+00, &tj, &tj1, &result, _state);
   15248           0 :     mannwhitneyu_ucheb(x, -1.226296e+00, &tj, &tj1, &result, _state);
   15249           0 :     mannwhitneyu_ucheb(x, -2.603837e-01, &tj, &tj1, &result, _state);
   15250           0 :     mannwhitneyu_ucheb(x, -8.643223e-02, &tj, &tj1, &result, _state);
   15251           0 :     mannwhitneyu_ucheb(x, -3.502438e-02, &tj, &tj1, &result, _state);
   15252           0 :     mannwhitneyu_ucheb(x, -1.544574e-02, &tj, &tj1, &result, _state);
   15253           0 :     mannwhitneyu_ucheb(x, -7.647734e-03, &tj, &tj1, &result, _state);
   15254           0 :     mannwhitneyu_ucheb(x, -4.442259e-03, &tj, &tj1, &result, _state);
   15255           0 :     mannwhitneyu_ucheb(x, -3.011484e-03, &tj, &tj1, &result, _state);
   15256           0 :     mannwhitneyu_ucheb(x, -2.384758e-03, &tj, &tj1, &result, _state);
   15257           0 :     mannwhitneyu_ucheb(x, -1.998259e-03, &tj, &tj1, &result, _state);
   15258           0 :     mannwhitneyu_ucheb(x, -1.659985e-03, &tj, &tj1, &result, _state);
   15259           0 :     mannwhitneyu_ucheb(x, -1.331046e-03, &tj, &tj1, &result, _state);
   15260           0 :     mannwhitneyu_ucheb(x, -8.638478e-04, &tj, &tj1, &result, _state);
   15261           0 :     mannwhitneyu_ucheb(x, -6.056785e-04, &tj, &tj1, &result, _state);
   15262           0 :     return result;
   15263             : }
   15264             : 
   15265             : 
   15266             : /*************************************************************************
   15267             : Tail(S, 8, 13)
   15268             : *************************************************************************/
   15269           0 : static double mannwhitneyu_utbln8n13(double s, ae_state *_state)
   15270             : {
   15271             :     double x;
   15272             :     double tj;
   15273             :     double tj1;
   15274             :     double result;
   15275             : 
   15276             : 
   15277           0 :     result = (double)(0);
   15278           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.600000e+00-1, 1.0, _state);
   15279           0 :     tj = (double)(1);
   15280           0 :     tj1 = x;
   15281           0 :     mannwhitneyu_ucheb(x, -4.380670e+00, &tj, &tj1, &result, _state);
   15282           0 :     mannwhitneyu_ucheb(x, -4.724511e+00, &tj, &tj1, &result, _state);
   15283           0 :     mannwhitneyu_ucheb(x, -1.195851e+00, &tj, &tj1, &result, _state);
   15284           0 :     mannwhitneyu_ucheb(x, -2.420511e-01, &tj, &tj1, &result, _state);
   15285           0 :     mannwhitneyu_ucheb(x, -7.609928e-02, &tj, &tj1, &result, _state);
   15286           0 :     mannwhitneyu_ucheb(x, -2.893999e-02, &tj, &tj1, &result, _state);
   15287           0 :     mannwhitneyu_ucheb(x, -1.115919e-02, &tj, &tj1, &result, _state);
   15288           0 :     mannwhitneyu_ucheb(x, -4.291410e-03, &tj, &tj1, &result, _state);
   15289           0 :     mannwhitneyu_ucheb(x, -1.339664e-03, &tj, &tj1, &result, _state);
   15290           0 :     mannwhitneyu_ucheb(x, -1.801548e-04, &tj, &tj1, &result, _state);
   15291           0 :     mannwhitneyu_ucheb(x, 2.534710e-04, &tj, &tj1, &result, _state);
   15292           0 :     mannwhitneyu_ucheb(x, 2.793250e-04, &tj, &tj1, &result, _state);
   15293           0 :     mannwhitneyu_ucheb(x, 1.806718e-04, &tj, &tj1, &result, _state);
   15294           0 :     mannwhitneyu_ucheb(x, 1.384624e-04, &tj, &tj1, &result, _state);
   15295           0 :     mannwhitneyu_ucheb(x, 1.120582e-04, &tj, &tj1, &result, _state);
   15296           0 :     mannwhitneyu_ucheb(x, 2.936453e-04, &tj, &tj1, &result, _state);
   15297           0 :     return result;
   15298             : }
   15299             : 
   15300             : 
   15301             : /*************************************************************************
   15302             : Tail(S, 8, 14)
   15303             : *************************************************************************/
   15304           0 : static double mannwhitneyu_utbln8n14(double s, ae_state *_state)
   15305             : {
   15306             :     double x;
   15307             :     double tj;
   15308             :     double tj1;
   15309             :     double result;
   15310             : 
   15311             : 
   15312           0 :     result = (double)(0);
   15313           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.600000e+00-1, 1.0, _state);
   15314           0 :     tj = (double)(1);
   15315           0 :     tj1 = x;
   15316           0 :     mannwhitneyu_ucheb(x, -4.368494e+00, &tj, &tj1, &result, _state);
   15317           0 :     mannwhitneyu_ucheb(x, -4.697171e+00, &tj, &tj1, &result, _state);
   15318           0 :     mannwhitneyu_ucheb(x, -1.174440e+00, &tj, &tj1, &result, _state);
   15319           0 :     mannwhitneyu_ucheb(x, -2.300621e-01, &tj, &tj1, &result, _state);
   15320           0 :     mannwhitneyu_ucheb(x, -7.087393e-02, &tj, &tj1, &result, _state);
   15321           0 :     mannwhitneyu_ucheb(x, -2.685826e-02, &tj, &tj1, &result, _state);
   15322           0 :     mannwhitneyu_ucheb(x, -1.085254e-02, &tj, &tj1, &result, _state);
   15323           0 :     mannwhitneyu_ucheb(x, -4.525658e-03, &tj, &tj1, &result, _state);
   15324           0 :     mannwhitneyu_ucheb(x, -1.966647e-03, &tj, &tj1, &result, _state);
   15325           0 :     mannwhitneyu_ucheb(x, -7.453388e-04, &tj, &tj1, &result, _state);
   15326           0 :     mannwhitneyu_ucheb(x, -3.826066e-04, &tj, &tj1, &result, _state);
   15327           0 :     mannwhitneyu_ucheb(x, -3.501958e-04, &tj, &tj1, &result, _state);
   15328           0 :     mannwhitneyu_ucheb(x, -5.336297e-04, &tj, &tj1, &result, _state);
   15329           0 :     mannwhitneyu_ucheb(x, -8.251972e-04, &tj, &tj1, &result, _state);
   15330           0 :     mannwhitneyu_ucheb(x, -8.118456e-04, &tj, &tj1, &result, _state);
   15331           0 :     mannwhitneyu_ucheb(x, -9.415959e-04, &tj, &tj1, &result, _state);
   15332           0 :     return result;
   15333             : }
   15334             : 
   15335             : 
   15336             : /*************************************************************************
   15337             : Tail(S, 8, 15)
   15338             : *************************************************************************/
   15339           0 : static double mannwhitneyu_utbln8n15(double s, ae_state *_state)
   15340             : {
   15341             :     double x;
   15342             :     double tj;
   15343             :     double tj1;
   15344             :     double result;
   15345             : 
   15346             : 
   15347           0 :     result = (double)(0);
   15348           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.600000e+00-1, 1.0, _state);
   15349           0 :     tj = (double)(1);
   15350           0 :     tj1 = x;
   15351           0 :     mannwhitneyu_ucheb(x, -4.358397e+00, &tj, &tj1, &result, _state);
   15352           0 :     mannwhitneyu_ucheb(x, -4.674485e+00, &tj, &tj1, &result, _state);
   15353           0 :     mannwhitneyu_ucheb(x, -1.155941e+00, &tj, &tj1, &result, _state);
   15354           0 :     mannwhitneyu_ucheb(x, -2.195780e-01, &tj, &tj1, &result, _state);
   15355           0 :     mannwhitneyu_ucheb(x, -6.544830e-02, &tj, &tj1, &result, _state);
   15356           0 :     mannwhitneyu_ucheb(x, -2.426183e-02, &tj, &tj1, &result, _state);
   15357           0 :     mannwhitneyu_ucheb(x, -9.309902e-03, &tj, &tj1, &result, _state);
   15358           0 :     mannwhitneyu_ucheb(x, -3.650956e-03, &tj, &tj1, &result, _state);
   15359           0 :     mannwhitneyu_ucheb(x, -1.068874e-03, &tj, &tj1, &result, _state);
   15360           0 :     mannwhitneyu_ucheb(x, 1.538544e-04, &tj, &tj1, &result, _state);
   15361           0 :     mannwhitneyu_ucheb(x, 8.192525e-04, &tj, &tj1, &result, _state);
   15362           0 :     mannwhitneyu_ucheb(x, 1.073905e-03, &tj, &tj1, &result, _state);
   15363           0 :     mannwhitneyu_ucheb(x, 1.079673e-03, &tj, &tj1, &result, _state);
   15364           0 :     mannwhitneyu_ucheb(x, 9.423572e-04, &tj, &tj1, &result, _state);
   15365           0 :     mannwhitneyu_ucheb(x, 6.579647e-04, &tj, &tj1, &result, _state);
   15366           0 :     mannwhitneyu_ucheb(x, 4.765904e-04, &tj, &tj1, &result, _state);
   15367           0 :     return result;
   15368             : }
   15369             : 
   15370             : 
   15371             : /*************************************************************************
   15372             : Tail(S, 8, 30)
   15373             : *************************************************************************/
   15374           0 : static double mannwhitneyu_utbln8n30(double s, ae_state *_state)
   15375             : {
   15376             :     double x;
   15377             :     double tj;
   15378             :     double tj1;
   15379             :     double result;
   15380             : 
   15381             : 
   15382           0 :     result = (double)(0);
   15383           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.600000e+00-1, 1.0, _state);
   15384           0 :     tj = (double)(1);
   15385           0 :     tj1 = x;
   15386           0 :     mannwhitneyu_ucheb(x, -4.318823e+00, &tj, &tj1, &result, _state);
   15387           0 :     mannwhitneyu_ucheb(x, -4.567159e+00, &tj, &tj1, &result, _state);
   15388           0 :     mannwhitneyu_ucheb(x, -1.064864e+00, &tj, &tj1, &result, _state);
   15389           0 :     mannwhitneyu_ucheb(x, -1.688413e-01, &tj, &tj1, &result, _state);
   15390           0 :     mannwhitneyu_ucheb(x, -4.153712e-02, &tj, &tj1, &result, _state);
   15391           0 :     mannwhitneyu_ucheb(x, -1.309389e-02, &tj, &tj1, &result, _state);
   15392           0 :     mannwhitneyu_ucheb(x, -4.226861e-03, &tj, &tj1, &result, _state);
   15393           0 :     mannwhitneyu_ucheb(x, -1.523815e-03, &tj, &tj1, &result, _state);
   15394           0 :     mannwhitneyu_ucheb(x, -5.780987e-04, &tj, &tj1, &result, _state);
   15395           0 :     mannwhitneyu_ucheb(x, -2.166866e-04, &tj, &tj1, &result, _state);
   15396           0 :     mannwhitneyu_ucheb(x, -6.922431e-05, &tj, &tj1, &result, _state);
   15397           0 :     mannwhitneyu_ucheb(x, -1.466397e-05, &tj, &tj1, &result, _state);
   15398           0 :     mannwhitneyu_ucheb(x, -5.690036e-06, &tj, &tj1, &result, _state);
   15399           0 :     mannwhitneyu_ucheb(x, -1.008185e-05, &tj, &tj1, &result, _state);
   15400           0 :     mannwhitneyu_ucheb(x, -9.271903e-06, &tj, &tj1, &result, _state);
   15401           0 :     mannwhitneyu_ucheb(x, -7.534751e-06, &tj, &tj1, &result, _state);
   15402           0 :     return result;
   15403             : }
   15404             : 
   15405             : 
   15406             : /*************************************************************************
   15407             : Tail(S, 8, 100)
   15408             : *************************************************************************/
   15409           0 : static double mannwhitneyu_utbln8n100(double s, ae_state *_state)
   15410             : {
   15411             :     double x;
   15412             :     double tj;
   15413             :     double tj1;
   15414             :     double result;
   15415             : 
   15416             : 
   15417           0 :     result = (double)(0);
   15418           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.600000e+00-1, 1.0, _state);
   15419           0 :     tj = (double)(1);
   15420           0 :     tj1 = x;
   15421           0 :     mannwhitneyu_ucheb(x, -4.324531e+00, &tj, &tj1, &result, _state);
   15422           0 :     mannwhitneyu_ucheb(x, -4.547071e+00, &tj, &tj1, &result, _state);
   15423           0 :     mannwhitneyu_ucheb(x, -1.038129e+00, &tj, &tj1, &result, _state);
   15424           0 :     mannwhitneyu_ucheb(x, -1.541549e-01, &tj, &tj1, &result, _state);
   15425           0 :     mannwhitneyu_ucheb(x, -3.525605e-02, &tj, &tj1, &result, _state);
   15426           0 :     mannwhitneyu_ucheb(x, -1.044992e-02, &tj, &tj1, &result, _state);
   15427           0 :     mannwhitneyu_ucheb(x, -3.085713e-03, &tj, &tj1, &result, _state);
   15428           0 :     mannwhitneyu_ucheb(x, -1.017871e-03, &tj, &tj1, &result, _state);
   15429           0 :     mannwhitneyu_ucheb(x, -3.459226e-04, &tj, &tj1, &result, _state);
   15430           0 :     mannwhitneyu_ucheb(x, -1.092064e-04, &tj, &tj1, &result, _state);
   15431           0 :     mannwhitneyu_ucheb(x, -2.024349e-05, &tj, &tj1, &result, _state);
   15432           0 :     mannwhitneyu_ucheb(x, 7.366347e-06, &tj, &tj1, &result, _state);
   15433           0 :     mannwhitneyu_ucheb(x, 6.385637e-06, &tj, &tj1, &result, _state);
   15434           0 :     mannwhitneyu_ucheb(x, 8.321722e-08, &tj, &tj1, &result, _state);
   15435           0 :     mannwhitneyu_ucheb(x, -1.439286e-06, &tj, &tj1, &result, _state);
   15436           0 :     mannwhitneyu_ucheb(x, -3.058079e-07, &tj, &tj1, &result, _state);
   15437           0 :     return result;
   15438             : }
   15439             : 
   15440             : 
   15441             : /*************************************************************************
   15442             : Tail(S, 9, 9)
   15443             : *************************************************************************/
   15444           0 : static double mannwhitneyu_utbln9n9(double s, ae_state *_state)
   15445             : {
   15446             :     double x;
   15447             :     double tj;
   15448             :     double tj1;
   15449             :     double result;
   15450             : 
   15451             : 
   15452           0 :     result = (double)(0);
   15453           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.576237e+00-1, 1.0, _state);
   15454           0 :     tj = (double)(1);
   15455           0 :     tj1 = x;
   15456           0 :     mannwhitneyu_ucheb(x, -4.372857e+00, &tj, &tj1, &result, _state);
   15457           0 :     mannwhitneyu_ucheb(x, -4.750859e+00, &tj, &tj1, &result, _state);
   15458           0 :     mannwhitneyu_ucheb(x, -1.248233e+00, &tj, &tj1, &result, _state);
   15459           0 :     mannwhitneyu_ucheb(x, -2.792868e-01, &tj, &tj1, &result, _state);
   15460           0 :     mannwhitneyu_ucheb(x, -9.559372e-02, &tj, &tj1, &result, _state);
   15461           0 :     mannwhitneyu_ucheb(x, -3.894941e-02, &tj, &tj1, &result, _state);
   15462           0 :     mannwhitneyu_ucheb(x, -1.643256e-02, &tj, &tj1, &result, _state);
   15463           0 :     mannwhitneyu_ucheb(x, -7.091370e-03, &tj, &tj1, &result, _state);
   15464           0 :     mannwhitneyu_ucheb(x, -2.285034e-03, &tj, &tj1, &result, _state);
   15465           0 :     mannwhitneyu_ucheb(x, 6.112997e-04, &tj, &tj1, &result, _state);
   15466           0 :     mannwhitneyu_ucheb(x, 2.806229e-03, &tj, &tj1, &result, _state);
   15467           0 :     mannwhitneyu_ucheb(x, 4.150741e-03, &tj, &tj1, &result, _state);
   15468           0 :     mannwhitneyu_ucheb(x, 4.509825e-03, &tj, &tj1, &result, _state);
   15469           0 :     mannwhitneyu_ucheb(x, 3.891051e-03, &tj, &tj1, &result, _state);
   15470           0 :     mannwhitneyu_ucheb(x, 2.485013e-03, &tj, &tj1, &result, _state);
   15471           0 :     mannwhitneyu_ucheb(x, 1.343653e-03, &tj, &tj1, &result, _state);
   15472           0 :     return result;
   15473             : }
   15474             : 
   15475             : 
   15476             : /*************************************************************************
   15477             : Tail(S, 9, 10)
   15478             : *************************************************************************/
   15479           0 : static double mannwhitneyu_utbln9n10(double s, ae_state *_state)
   15480             : {
   15481             :     double x;
   15482             :     double tj;
   15483             :     double tj1;
   15484             :     double result;
   15485             : 
   15486             : 
   15487           0 :     result = (double)(0);
   15488           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
   15489           0 :     tj = (double)(1);
   15490           0 :     tj1 = x;
   15491           0 :     mannwhitneyu_ucheb(x, -4.516726e+00, &tj, &tj1, &result, _state);
   15492           0 :     mannwhitneyu_ucheb(x, -4.939333e+00, &tj, &tj1, &result, _state);
   15493           0 :     mannwhitneyu_ucheb(x, -1.305046e+00, &tj, &tj1, &result, _state);
   15494           0 :     mannwhitneyu_ucheb(x, -2.935326e-01, &tj, &tj1, &result, _state);
   15495           0 :     mannwhitneyu_ucheb(x, -1.029141e-01, &tj, &tj1, &result, _state);
   15496           0 :     mannwhitneyu_ucheb(x, -4.420592e-02, &tj, &tj1, &result, _state);
   15497           0 :     mannwhitneyu_ucheb(x, -2.053140e-02, &tj, &tj1, &result, _state);
   15498           0 :     mannwhitneyu_ucheb(x, -1.065930e-02, &tj, &tj1, &result, _state);
   15499           0 :     mannwhitneyu_ucheb(x, -5.523581e-03, &tj, &tj1, &result, _state);
   15500           0 :     mannwhitneyu_ucheb(x, -2.544888e-03, &tj, &tj1, &result, _state);
   15501           0 :     mannwhitneyu_ucheb(x, -1.813741e-04, &tj, &tj1, &result, _state);
   15502           0 :     mannwhitneyu_ucheb(x, 1.510631e-03, &tj, &tj1, &result, _state);
   15503           0 :     mannwhitneyu_ucheb(x, 2.536057e-03, &tj, &tj1, &result, _state);
   15504           0 :     mannwhitneyu_ucheb(x, 2.833815e-03, &tj, &tj1, &result, _state);
   15505           0 :     mannwhitneyu_ucheb(x, 2.189692e-03, &tj, &tj1, &result, _state);
   15506           0 :     mannwhitneyu_ucheb(x, 1.615050e-03, &tj, &tj1, &result, _state);
   15507           0 :     return result;
   15508             : }
   15509             : 
   15510             : 
   15511             : /*************************************************************************
   15512             : Tail(S, 9, 11)
   15513             : *************************************************************************/
   15514           0 : static double mannwhitneyu_utbln9n11(double s, ae_state *_state)
   15515             : {
   15516             :     double x;
   15517             :     double tj;
   15518             :     double tj1;
   15519             :     double result;
   15520             : 
   15521             : 
   15522           0 :     result = (double)(0);
   15523           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
   15524           0 :     tj = (double)(1);
   15525           0 :     tj1 = x;
   15526           0 :     mannwhitneyu_ucheb(x, -4.481308e+00, &tj, &tj1, &result, _state);
   15527           0 :     mannwhitneyu_ucheb(x, -4.867483e+00, &tj, &tj1, &result, _state);
   15528           0 :     mannwhitneyu_ucheb(x, -1.249072e+00, &tj, &tj1, &result, _state);
   15529           0 :     mannwhitneyu_ucheb(x, -2.591790e-01, &tj, &tj1, &result, _state);
   15530           0 :     mannwhitneyu_ucheb(x, -8.400128e-02, &tj, &tj1, &result, _state);
   15531           0 :     mannwhitneyu_ucheb(x, -3.341992e-02, &tj, &tj1, &result, _state);
   15532           0 :     mannwhitneyu_ucheb(x, -1.463680e-02, &tj, &tj1, &result, _state);
   15533           0 :     mannwhitneyu_ucheb(x, -7.487211e-03, &tj, &tj1, &result, _state);
   15534           0 :     mannwhitneyu_ucheb(x, -4.671196e-03, &tj, &tj1, &result, _state);
   15535           0 :     mannwhitneyu_ucheb(x, -3.343472e-03, &tj, &tj1, &result, _state);
   15536           0 :     mannwhitneyu_ucheb(x, -2.544146e-03, &tj, &tj1, &result, _state);
   15537           0 :     mannwhitneyu_ucheb(x, -1.802335e-03, &tj, &tj1, &result, _state);
   15538           0 :     mannwhitneyu_ucheb(x, -1.117084e-03, &tj, &tj1, &result, _state);
   15539           0 :     mannwhitneyu_ucheb(x, -6.217443e-04, &tj, &tj1, &result, _state);
   15540           0 :     mannwhitneyu_ucheb(x, -2.858766e-04, &tj, &tj1, &result, _state);
   15541           0 :     mannwhitneyu_ucheb(x, -3.193687e-04, &tj, &tj1, &result, _state);
   15542           0 :     return result;
   15543             : }
   15544             : 
   15545             : 
   15546             : /*************************************************************************
   15547             : Tail(S, 9, 12)
   15548             : *************************************************************************/
   15549           0 : static double mannwhitneyu_utbln9n12(double s, ae_state *_state)
   15550             : {
   15551             :     double x;
   15552             :     double tj;
   15553             :     double tj1;
   15554             :     double result;
   15555             : 
   15556             : 
   15557           0 :     result = (double)(0);
   15558           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
   15559           0 :     tj = (double)(1);
   15560           0 :     tj1 = x;
   15561           0 :     mannwhitneyu_ucheb(x, -4.456776e+00, &tj, &tj1, &result, _state);
   15562           0 :     mannwhitneyu_ucheb(x, -4.817037e+00, &tj, &tj1, &result, _state);
   15563           0 :     mannwhitneyu_ucheb(x, -1.209788e+00, &tj, &tj1, &result, _state);
   15564           0 :     mannwhitneyu_ucheb(x, -2.362108e-01, &tj, &tj1, &result, _state);
   15565           0 :     mannwhitneyu_ucheb(x, -7.171356e-02, &tj, &tj1, &result, _state);
   15566           0 :     mannwhitneyu_ucheb(x, -2.661557e-02, &tj, &tj1, &result, _state);
   15567           0 :     mannwhitneyu_ucheb(x, -1.026141e-02, &tj, &tj1, &result, _state);
   15568           0 :     mannwhitneyu_ucheb(x, -4.361908e-03, &tj, &tj1, &result, _state);
   15569           0 :     mannwhitneyu_ucheb(x, -2.093885e-03, &tj, &tj1, &result, _state);
   15570           0 :     mannwhitneyu_ucheb(x, -1.298389e-03, &tj, &tj1, &result, _state);
   15571           0 :     mannwhitneyu_ucheb(x, -9.663603e-04, &tj, &tj1, &result, _state);
   15572           0 :     mannwhitneyu_ucheb(x, -7.768522e-04, &tj, &tj1, &result, _state);
   15573           0 :     mannwhitneyu_ucheb(x, -5.579015e-04, &tj, &tj1, &result, _state);
   15574           0 :     mannwhitneyu_ucheb(x, -2.868677e-04, &tj, &tj1, &result, _state);
   15575           0 :     mannwhitneyu_ucheb(x, -7.440652e-05, &tj, &tj1, &result, _state);
   15576           0 :     mannwhitneyu_ucheb(x, 1.523037e-04, &tj, &tj1, &result, _state);
   15577           0 :     return result;
   15578             : }
   15579             : 
   15580             : 
   15581             : /*************************************************************************
   15582             : Tail(S, 9, 13)
   15583             : *************************************************************************/
   15584           0 : static double mannwhitneyu_utbln9n13(double s, ae_state *_state)
   15585             : {
   15586             :     double x;
   15587             :     double tj;
   15588             :     double tj1;
   15589             :     double result;
   15590             : 
   15591             : 
   15592           0 :     result = (double)(0);
   15593           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
   15594           0 :     tj = (double)(1);
   15595           0 :     tj1 = x;
   15596           0 :     mannwhitneyu_ucheb(x, -4.438840e+00, &tj, &tj1, &result, _state);
   15597           0 :     mannwhitneyu_ucheb(x, -4.779308e+00, &tj, &tj1, &result, _state);
   15598           0 :     mannwhitneyu_ucheb(x, -1.180614e+00, &tj, &tj1, &result, _state);
   15599           0 :     mannwhitneyu_ucheb(x, -2.196489e-01, &tj, &tj1, &result, _state);
   15600           0 :     mannwhitneyu_ucheb(x, -6.346621e-02, &tj, &tj1, &result, _state);
   15601           0 :     mannwhitneyu_ucheb(x, -2.234857e-02, &tj, &tj1, &result, _state);
   15602           0 :     mannwhitneyu_ucheb(x, -7.796211e-03, &tj, &tj1, &result, _state);
   15603           0 :     mannwhitneyu_ucheb(x, -2.575715e-03, &tj, &tj1, &result, _state);
   15604           0 :     mannwhitneyu_ucheb(x, -5.525647e-04, &tj, &tj1, &result, _state);
   15605           0 :     mannwhitneyu_ucheb(x, 1.964651e-04, &tj, &tj1, &result, _state);
   15606           0 :     mannwhitneyu_ucheb(x, 4.275235e-04, &tj, &tj1, &result, _state);
   15607           0 :     mannwhitneyu_ucheb(x, 4.299124e-04, &tj, &tj1, &result, _state);
   15608           0 :     mannwhitneyu_ucheb(x, 3.397416e-04, &tj, &tj1, &result, _state);
   15609           0 :     mannwhitneyu_ucheb(x, 2.295781e-04, &tj, &tj1, &result, _state);
   15610           0 :     mannwhitneyu_ucheb(x, 1.237619e-04, &tj, &tj1, &result, _state);
   15611           0 :     mannwhitneyu_ucheb(x, 7.269692e-05, &tj, &tj1, &result, _state);
   15612           0 :     return result;
   15613             : }
   15614             : 
   15615             : 
   15616             : /*************************************************************************
   15617             : Tail(S, 9, 14)
   15618             : *************************************************************************/
   15619           0 : static double mannwhitneyu_utbln9n14(double s, ae_state *_state)
   15620             : {
   15621             :     double x;
   15622             :     double tj;
   15623             :     double tj1;
   15624             :     double result;
   15625             : 
   15626             : 
   15627           0 :     result = (double)(0);
   15628           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
   15629           0 :     tj = (double)(1);
   15630           0 :     tj1 = x;
   15631           0 :     mannwhitneyu_ucheb(x, -4.425981e+00, &tj, &tj1, &result, _state);
   15632           0 :     mannwhitneyu_ucheb(x, -4.751545e+00, &tj, &tj1, &result, _state);
   15633           0 :     mannwhitneyu_ucheb(x, -1.159543e+00, &tj, &tj1, &result, _state);
   15634           0 :     mannwhitneyu_ucheb(x, -2.086570e-01, &tj, &tj1, &result, _state);
   15635           0 :     mannwhitneyu_ucheb(x, -5.917446e-02, &tj, &tj1, &result, _state);
   15636           0 :     mannwhitneyu_ucheb(x, -2.120112e-02, &tj, &tj1, &result, _state);
   15637           0 :     mannwhitneyu_ucheb(x, -8.175519e-03, &tj, &tj1, &result, _state);
   15638           0 :     mannwhitneyu_ucheb(x, -3.515473e-03, &tj, &tj1, &result, _state);
   15639           0 :     mannwhitneyu_ucheb(x, -1.727772e-03, &tj, &tj1, &result, _state);
   15640           0 :     mannwhitneyu_ucheb(x, -9.070629e-04, &tj, &tj1, &result, _state);
   15641           0 :     mannwhitneyu_ucheb(x, -5.677569e-04, &tj, &tj1, &result, _state);
   15642           0 :     mannwhitneyu_ucheb(x, -3.876953e-04, &tj, &tj1, &result, _state);
   15643           0 :     mannwhitneyu_ucheb(x, -3.233502e-04, &tj, &tj1, &result, _state);
   15644           0 :     mannwhitneyu_ucheb(x, -3.508182e-04, &tj, &tj1, &result, _state);
   15645           0 :     mannwhitneyu_ucheb(x, -3.120389e-04, &tj, &tj1, &result, _state);
   15646           0 :     mannwhitneyu_ucheb(x, -3.847212e-04, &tj, &tj1, &result, _state);
   15647           0 :     return result;
   15648             : }
   15649             : 
   15650             : 
   15651             : /*************************************************************************
   15652             : Tail(S, 9, 15)
   15653             : *************************************************************************/
   15654           0 : static double mannwhitneyu_utbln9n15(double s, ae_state *_state)
   15655             : {
   15656             :     double x;
   15657             :     double tj;
   15658             :     double tj1;
   15659             :     double result;
   15660             : 
   15661             : 
   15662           0 :     result = (double)(0);
   15663           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
   15664           0 :     tj = (double)(1);
   15665           0 :     tj1 = x;
   15666           0 :     mannwhitneyu_ucheb(x, -4.414952e+00, &tj, &tj1, &result, _state);
   15667           0 :     mannwhitneyu_ucheb(x, -4.727612e+00, &tj, &tj1, &result, _state);
   15668           0 :     mannwhitneyu_ucheb(x, -1.140634e+00, &tj, &tj1, &result, _state);
   15669           0 :     mannwhitneyu_ucheb(x, -1.981231e-01, &tj, &tj1, &result, _state);
   15670           0 :     mannwhitneyu_ucheb(x, -5.382635e-02, &tj, &tj1, &result, _state);
   15671           0 :     mannwhitneyu_ucheb(x, -1.853575e-02, &tj, &tj1, &result, _state);
   15672           0 :     mannwhitneyu_ucheb(x, -6.571051e-03, &tj, &tj1, &result, _state);
   15673           0 :     mannwhitneyu_ucheb(x, -2.567625e-03, &tj, &tj1, &result, _state);
   15674           0 :     mannwhitneyu_ucheb(x, -9.214197e-04, &tj, &tj1, &result, _state);
   15675           0 :     mannwhitneyu_ucheb(x, -2.448700e-04, &tj, &tj1, &result, _state);
   15676           0 :     mannwhitneyu_ucheb(x, 1.712669e-04, &tj, &tj1, &result, _state);
   15677           0 :     mannwhitneyu_ucheb(x, 4.015050e-04, &tj, &tj1, &result, _state);
   15678           0 :     mannwhitneyu_ucheb(x, 5.438610e-04, &tj, &tj1, &result, _state);
   15679           0 :     mannwhitneyu_ucheb(x, 6.301363e-04, &tj, &tj1, &result, _state);
   15680           0 :     mannwhitneyu_ucheb(x, 5.309386e-04, &tj, &tj1, &result, _state);
   15681           0 :     mannwhitneyu_ucheb(x, 5.164772e-04, &tj, &tj1, &result, _state);
   15682           0 :     return result;
   15683             : }
   15684             : 
   15685             : 
   15686             : /*************************************************************************
   15687             : Tail(S, 9, 30)
   15688             : *************************************************************************/
   15689           0 : static double mannwhitneyu_utbln9n30(double s, ae_state *_state)
   15690             : {
   15691             :     double x;
   15692             :     double tj;
   15693             :     double tj1;
   15694             :     double result;
   15695             : 
   15696             : 
   15697           0 :     result = (double)(0);
   15698           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
   15699           0 :     tj = (double)(1);
   15700           0 :     tj1 = x;
   15701           0 :     mannwhitneyu_ucheb(x, -4.370720e+00, &tj, &tj1, &result, _state);
   15702           0 :     mannwhitneyu_ucheb(x, -4.615712e+00, &tj, &tj1, &result, _state);
   15703           0 :     mannwhitneyu_ucheb(x, -1.050023e+00, &tj, &tj1, &result, _state);
   15704           0 :     mannwhitneyu_ucheb(x, -1.504775e-01, &tj, &tj1, &result, _state);
   15705           0 :     mannwhitneyu_ucheb(x, -3.318265e-02, &tj, &tj1, &result, _state);
   15706           0 :     mannwhitneyu_ucheb(x, -9.646826e-03, &tj, &tj1, &result, _state);
   15707           0 :     mannwhitneyu_ucheb(x, -2.741492e-03, &tj, &tj1, &result, _state);
   15708           0 :     mannwhitneyu_ucheb(x, -8.735360e-04, &tj, &tj1, &result, _state);
   15709           0 :     mannwhitneyu_ucheb(x, -2.966911e-04, &tj, &tj1, &result, _state);
   15710           0 :     mannwhitneyu_ucheb(x, -1.100738e-04, &tj, &tj1, &result, _state);
   15711           0 :     mannwhitneyu_ucheb(x, -4.348991e-05, &tj, &tj1, &result, _state);
   15712           0 :     mannwhitneyu_ucheb(x, -1.527687e-05, &tj, &tj1, &result, _state);
   15713           0 :     mannwhitneyu_ucheb(x, -2.917286e-06, &tj, &tj1, &result, _state);
   15714           0 :     mannwhitneyu_ucheb(x, 3.397466e-07, &tj, &tj1, &result, _state);
   15715           0 :     mannwhitneyu_ucheb(x, -2.360175e-07, &tj, &tj1, &result, _state);
   15716           0 :     mannwhitneyu_ucheb(x, -9.892252e-07, &tj, &tj1, &result, _state);
   15717           0 :     return result;
   15718             : }
   15719             : 
   15720             : 
   15721             : /*************************************************************************
   15722             : Tail(S, 9, 100)
   15723             : *************************************************************************/
   15724           0 : static double mannwhitneyu_utbln9n100(double s, ae_state *_state)
   15725             : {
   15726             :     double x;
   15727             :     double tj;
   15728             :     double tj1;
   15729             :     double result;
   15730             : 
   15731             : 
   15732           0 :     result = (double)(0);
   15733           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
   15734           0 :     tj = (double)(1);
   15735           0 :     tj1 = x;
   15736           0 :     mannwhitneyu_ucheb(x, -4.372506e+00, &tj, &tj1, &result, _state);
   15737           0 :     mannwhitneyu_ucheb(x, -4.590966e+00, &tj, &tj1, &result, _state);
   15738           0 :     mannwhitneyu_ucheb(x, -1.021758e+00, &tj, &tj1, &result, _state);
   15739           0 :     mannwhitneyu_ucheb(x, -1.359849e-01, &tj, &tj1, &result, _state);
   15740           0 :     mannwhitneyu_ucheb(x, -2.755519e-02, &tj, &tj1, &result, _state);
   15741           0 :     mannwhitneyu_ucheb(x, -7.533166e-03, &tj, &tj1, &result, _state);
   15742           0 :     mannwhitneyu_ucheb(x, -1.936659e-03, &tj, &tj1, &result, _state);
   15743           0 :     mannwhitneyu_ucheb(x, -5.634913e-04, &tj, &tj1, &result, _state);
   15744           0 :     mannwhitneyu_ucheb(x, -1.730053e-04, &tj, &tj1, &result, _state);
   15745           0 :     mannwhitneyu_ucheb(x, -5.791845e-05, &tj, &tj1, &result, _state);
   15746           0 :     mannwhitneyu_ucheb(x, -2.030682e-05, &tj, &tj1, &result, _state);
   15747           0 :     mannwhitneyu_ucheb(x, -5.228663e-06, &tj, &tj1, &result, _state);
   15748           0 :     mannwhitneyu_ucheb(x, 8.631175e-07, &tj, &tj1, &result, _state);
   15749           0 :     mannwhitneyu_ucheb(x, 1.636749e-06, &tj, &tj1, &result, _state);
   15750           0 :     mannwhitneyu_ucheb(x, 4.404599e-07, &tj, &tj1, &result, _state);
   15751           0 :     mannwhitneyu_ucheb(x, -2.789872e-07, &tj, &tj1, &result, _state);
   15752           0 :     return result;
   15753             : }
   15754             : 
   15755             : 
   15756             : /*************************************************************************
   15757             : Tail(S, 10, 10)
   15758             : *************************************************************************/
   15759           0 : static double mannwhitneyu_utbln10n10(double s, ae_state *_state)
   15760             : {
   15761             :     double x;
   15762             :     double tj;
   15763             :     double tj1;
   15764             :     double result;
   15765             : 
   15766             : 
   15767           0 :     result = (double)(0);
   15768           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
   15769           0 :     tj = (double)(1);
   15770           0 :     tj1 = x;
   15771           0 :     mannwhitneyu_ucheb(x, -4.468831e+00, &tj, &tj1, &result, _state);
   15772           0 :     mannwhitneyu_ucheb(x, -4.844398e+00, &tj, &tj1, &result, _state);
   15773           0 :     mannwhitneyu_ucheb(x, -1.231728e+00, &tj, &tj1, &result, _state);
   15774           0 :     mannwhitneyu_ucheb(x, -2.486073e-01, &tj, &tj1, &result, _state);
   15775           0 :     mannwhitneyu_ucheb(x, -7.781321e-02, &tj, &tj1, &result, _state);
   15776           0 :     mannwhitneyu_ucheb(x, -2.971425e-02, &tj, &tj1, &result, _state);
   15777           0 :     mannwhitneyu_ucheb(x, -1.215371e-02, &tj, &tj1, &result, _state);
   15778           0 :     mannwhitneyu_ucheb(x, -5.828451e-03, &tj, &tj1, &result, _state);
   15779           0 :     mannwhitneyu_ucheb(x, -3.419872e-03, &tj, &tj1, &result, _state);
   15780           0 :     mannwhitneyu_ucheb(x, -2.430165e-03, &tj, &tj1, &result, _state);
   15781           0 :     mannwhitneyu_ucheb(x, -1.740363e-03, &tj, &tj1, &result, _state);
   15782           0 :     mannwhitneyu_ucheb(x, -1.049211e-03, &tj, &tj1, &result, _state);
   15783           0 :     mannwhitneyu_ucheb(x, -3.269371e-04, &tj, &tj1, &result, _state);
   15784           0 :     mannwhitneyu_ucheb(x, 2.211393e-04, &tj, &tj1, &result, _state);
   15785           0 :     mannwhitneyu_ucheb(x, 4.232314e-04, &tj, &tj1, &result, _state);
   15786           0 :     mannwhitneyu_ucheb(x, 3.016081e-04, &tj, &tj1, &result, _state);
   15787           0 :     return result;
   15788             : }
   15789             : 
   15790             : 
   15791             : /*************************************************************************
   15792             : Tail(S, 10, 11)
   15793             : *************************************************************************/
   15794           0 : static double mannwhitneyu_utbln10n11(double s, ae_state *_state)
   15795             : {
   15796             :     double x;
   15797             :     double tj;
   15798             :     double tj1;
   15799             :     double result;
   15800             : 
   15801             : 
   15802           0 :     result = (double)(0);
   15803           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
   15804           0 :     tj = (double)(1);
   15805           0 :     tj1 = x;
   15806           0 :     mannwhitneyu_ucheb(x, -4.437998e+00, &tj, &tj1, &result, _state);
   15807           0 :     mannwhitneyu_ucheb(x, -4.782296e+00, &tj, &tj1, &result, _state);
   15808           0 :     mannwhitneyu_ucheb(x, -1.184732e+00, &tj, &tj1, &result, _state);
   15809           0 :     mannwhitneyu_ucheb(x, -2.219585e-01, &tj, &tj1, &result, _state);
   15810           0 :     mannwhitneyu_ucheb(x, -6.457012e-02, &tj, &tj1, &result, _state);
   15811           0 :     mannwhitneyu_ucheb(x, -2.296008e-02, &tj, &tj1, &result, _state);
   15812           0 :     mannwhitneyu_ucheb(x, -8.481501e-03, &tj, &tj1, &result, _state);
   15813           0 :     mannwhitneyu_ucheb(x, -3.527940e-03, &tj, &tj1, &result, _state);
   15814           0 :     mannwhitneyu_ucheb(x, -1.953426e-03, &tj, &tj1, &result, _state);
   15815           0 :     mannwhitneyu_ucheb(x, -1.563840e-03, &tj, &tj1, &result, _state);
   15816           0 :     mannwhitneyu_ucheb(x, -1.574403e-03, &tj, &tj1, &result, _state);
   15817           0 :     mannwhitneyu_ucheb(x, -1.535775e-03, &tj, &tj1, &result, _state);
   15818           0 :     mannwhitneyu_ucheb(x, -1.338037e-03, &tj, &tj1, &result, _state);
   15819           0 :     mannwhitneyu_ucheb(x, -1.002654e-03, &tj, &tj1, &result, _state);
   15820           0 :     mannwhitneyu_ucheb(x, -5.852676e-04, &tj, &tj1, &result, _state);
   15821           0 :     mannwhitneyu_ucheb(x, -3.318132e-04, &tj, &tj1, &result, _state);
   15822           0 :     return result;
   15823             : }
   15824             : 
   15825             : 
   15826             : /*************************************************************************
   15827             : Tail(S, 10, 12)
   15828             : *************************************************************************/
   15829           0 : static double mannwhitneyu_utbln10n12(double s, ae_state *_state)
   15830             : {
   15831             :     double x;
   15832             :     double tj;
   15833             :     double tj1;
   15834             :     double result;
   15835             : 
   15836             : 
   15837           0 :     result = (double)(0);
   15838           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
   15839           0 :     tj = (double)(1);
   15840           0 :     tj1 = x;
   15841           0 :     mannwhitneyu_ucheb(x, -4.416082e+00, &tj, &tj1, &result, _state);
   15842           0 :     mannwhitneyu_ucheb(x, -4.737458e+00, &tj, &tj1, &result, _state);
   15843           0 :     mannwhitneyu_ucheb(x, -1.150952e+00, &tj, &tj1, &result, _state);
   15844           0 :     mannwhitneyu_ucheb(x, -2.036884e-01, &tj, &tj1, &result, _state);
   15845           0 :     mannwhitneyu_ucheb(x, -5.609030e-02, &tj, &tj1, &result, _state);
   15846           0 :     mannwhitneyu_ucheb(x, -1.908684e-02, &tj, &tj1, &result, _state);
   15847           0 :     mannwhitneyu_ucheb(x, -6.439666e-03, &tj, &tj1, &result, _state);
   15848           0 :     mannwhitneyu_ucheb(x, -2.162647e-03, &tj, &tj1, &result, _state);
   15849           0 :     mannwhitneyu_ucheb(x, -6.451601e-04, &tj, &tj1, &result, _state);
   15850           0 :     mannwhitneyu_ucheb(x, -2.148757e-04, &tj, &tj1, &result, _state);
   15851           0 :     mannwhitneyu_ucheb(x, -1.803981e-04, &tj, &tj1, &result, _state);
   15852           0 :     mannwhitneyu_ucheb(x, -2.731621e-04, &tj, &tj1, &result, _state);
   15853           0 :     mannwhitneyu_ucheb(x, -3.346903e-04, &tj, &tj1, &result, _state);
   15854           0 :     mannwhitneyu_ucheb(x, -3.013151e-04, &tj, &tj1, &result, _state);
   15855           0 :     mannwhitneyu_ucheb(x, -1.956148e-04, &tj, &tj1, &result, _state);
   15856           0 :     mannwhitneyu_ucheb(x, -2.438381e-05, &tj, &tj1, &result, _state);
   15857           0 :     return result;
   15858             : }
   15859             : 
   15860             : 
   15861             : /*************************************************************************
   15862             : Tail(S, 10, 13)
   15863             : *************************************************************************/
   15864           0 : static double mannwhitneyu_utbln10n13(double s, ae_state *_state)
   15865             : {
   15866             :     double x;
   15867             :     double tj;
   15868             :     double tj1;
   15869             :     double result;
   15870             : 
   15871             : 
   15872           0 :     result = (double)(0);
   15873           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
   15874           0 :     tj = (double)(1);
   15875           0 :     tj1 = x;
   15876           0 :     mannwhitneyu_ucheb(x, -4.399480e+00, &tj, &tj1, &result, _state);
   15877           0 :     mannwhitneyu_ucheb(x, -4.702863e+00, &tj, &tj1, &result, _state);
   15878           0 :     mannwhitneyu_ucheb(x, -1.124829e+00, &tj, &tj1, &result, _state);
   15879           0 :     mannwhitneyu_ucheb(x, -1.897428e-01, &tj, &tj1, &result, _state);
   15880           0 :     mannwhitneyu_ucheb(x, -4.979802e-02, &tj, &tj1, &result, _state);
   15881           0 :     mannwhitneyu_ucheb(x, -1.634368e-02, &tj, &tj1, &result, _state);
   15882           0 :     mannwhitneyu_ucheb(x, -5.180461e-03, &tj, &tj1, &result, _state);
   15883           0 :     mannwhitneyu_ucheb(x, -1.484926e-03, &tj, &tj1, &result, _state);
   15884           0 :     mannwhitneyu_ucheb(x, -7.864376e-05, &tj, &tj1, &result, _state);
   15885           0 :     mannwhitneyu_ucheb(x, 4.186576e-04, &tj, &tj1, &result, _state);
   15886           0 :     mannwhitneyu_ucheb(x, 5.886925e-04, &tj, &tj1, &result, _state);
   15887           0 :     mannwhitneyu_ucheb(x, 5.836828e-04, &tj, &tj1, &result, _state);
   15888           0 :     mannwhitneyu_ucheb(x, 5.074756e-04, &tj, &tj1, &result, _state);
   15889           0 :     mannwhitneyu_ucheb(x, 4.209547e-04, &tj, &tj1, &result, _state);
   15890           0 :     mannwhitneyu_ucheb(x, 2.883266e-04, &tj, &tj1, &result, _state);
   15891           0 :     mannwhitneyu_ucheb(x, 2.380143e-04, &tj, &tj1, &result, _state);
   15892           0 :     return result;
   15893             : }
   15894             : 
   15895             : 
   15896             : /*************************************************************************
   15897             : Tail(S, 10, 14)
   15898             : *************************************************************************/
   15899           0 : static double mannwhitneyu_utbln10n14(double s, ae_state *_state)
   15900             : {
   15901             :     double x;
   15902             :     double tj;
   15903             :     double tj1;
   15904             :     double result;
   15905             : 
   15906             : 
   15907           0 :     result = (double)(0);
   15908           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
   15909           0 :     tj = (double)(1);
   15910           0 :     tj1 = x;
   15911           0 :     mannwhitneyu_ucheb(x, -4.386924e+00, &tj, &tj1, &result, _state);
   15912           0 :     mannwhitneyu_ucheb(x, -4.676124e+00, &tj, &tj1, &result, _state);
   15913           0 :     mannwhitneyu_ucheb(x, -1.104740e+00, &tj, &tj1, &result, _state);
   15914           0 :     mannwhitneyu_ucheb(x, -1.793826e-01, &tj, &tj1, &result, _state);
   15915           0 :     mannwhitneyu_ucheb(x, -4.558886e-02, &tj, &tj1, &result, _state);
   15916           0 :     mannwhitneyu_ucheb(x, -1.492462e-02, &tj, &tj1, &result, _state);
   15917           0 :     mannwhitneyu_ucheb(x, -5.052903e-03, &tj, &tj1, &result, _state);
   15918           0 :     mannwhitneyu_ucheb(x, -1.917782e-03, &tj, &tj1, &result, _state);
   15919           0 :     mannwhitneyu_ucheb(x, -7.878696e-04, &tj, &tj1, &result, _state);
   15920           0 :     mannwhitneyu_ucheb(x, -3.576046e-04, &tj, &tj1, &result, _state);
   15921           0 :     mannwhitneyu_ucheb(x, -1.764551e-04, &tj, &tj1, &result, _state);
   15922           0 :     mannwhitneyu_ucheb(x, -9.288778e-05, &tj, &tj1, &result, _state);
   15923           0 :     mannwhitneyu_ucheb(x, -4.757658e-05, &tj, &tj1, &result, _state);
   15924           0 :     mannwhitneyu_ucheb(x, -2.299101e-05, &tj, &tj1, &result, _state);
   15925           0 :     mannwhitneyu_ucheb(x, -9.265197e-06, &tj, &tj1, &result, _state);
   15926           0 :     mannwhitneyu_ucheb(x, -2.384503e-07, &tj, &tj1, &result, _state);
   15927           0 :     return result;
   15928             : }
   15929             : 
   15930             : 
   15931             : /*************************************************************************
   15932             : Tail(S, 10, 15)
   15933             : *************************************************************************/
   15934           0 : static double mannwhitneyu_utbln10n15(double s, ae_state *_state)
   15935             : {
   15936             :     double x;
   15937             :     double tj;
   15938             :     double tj1;
   15939             :     double result;
   15940             : 
   15941             : 
   15942           0 :     result = (double)(0);
   15943           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
   15944           0 :     tj = (double)(1);
   15945           0 :     tj1 = x;
   15946           0 :     mannwhitneyu_ucheb(x, -4.376846e+00, &tj, &tj1, &result, _state);
   15947           0 :     mannwhitneyu_ucheb(x, -4.654247e+00, &tj, &tj1, &result, _state);
   15948           0 :     mannwhitneyu_ucheb(x, -1.088083e+00, &tj, &tj1, &result, _state);
   15949           0 :     mannwhitneyu_ucheb(x, -1.705945e-01, &tj, &tj1, &result, _state);
   15950           0 :     mannwhitneyu_ucheb(x, -4.169677e-02, &tj, &tj1, &result, _state);
   15951           0 :     mannwhitneyu_ucheb(x, -1.317213e-02, &tj, &tj1, &result, _state);
   15952           0 :     mannwhitneyu_ucheb(x, -4.264836e-03, &tj, &tj1, &result, _state);
   15953           0 :     mannwhitneyu_ucheb(x, -1.548024e-03, &tj, &tj1, &result, _state);
   15954           0 :     mannwhitneyu_ucheb(x, -6.633910e-04, &tj, &tj1, &result, _state);
   15955           0 :     mannwhitneyu_ucheb(x, -3.505621e-04, &tj, &tj1, &result, _state);
   15956           0 :     mannwhitneyu_ucheb(x, -2.658588e-04, &tj, &tj1, &result, _state);
   15957           0 :     mannwhitneyu_ucheb(x, -2.320254e-04, &tj, &tj1, &result, _state);
   15958           0 :     mannwhitneyu_ucheb(x, -2.175277e-04, &tj, &tj1, &result, _state);
   15959           0 :     mannwhitneyu_ucheb(x, -2.122317e-04, &tj, &tj1, &result, _state);
   15960           0 :     mannwhitneyu_ucheb(x, -1.675688e-04, &tj, &tj1, &result, _state);
   15961           0 :     mannwhitneyu_ucheb(x, -1.661363e-04, &tj, &tj1, &result, _state);
   15962           0 :     return result;
   15963             : }
   15964             : 
   15965             : 
   15966             : /*************************************************************************
   15967             : Tail(S, 10, 30)
   15968             : *************************************************************************/
   15969           0 : static double mannwhitneyu_utbln10n30(double s, ae_state *_state)
   15970             : {
   15971             :     double x;
   15972             :     double tj;
   15973             :     double tj1;
   15974             :     double result;
   15975             : 
   15976             : 
   15977           0 :     result = (double)(0);
   15978           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
   15979           0 :     tj = (double)(1);
   15980           0 :     tj1 = x;
   15981           0 :     mannwhitneyu_ucheb(x, -4.333977e+00, &tj, &tj1, &result, _state);
   15982           0 :     mannwhitneyu_ucheb(x, -4.548099e+00, &tj, &tj1, &result, _state);
   15983           0 :     mannwhitneyu_ucheb(x, -1.004444e+00, &tj, &tj1, &result, _state);
   15984           0 :     mannwhitneyu_ucheb(x, -1.291014e-01, &tj, &tj1, &result, _state);
   15985           0 :     mannwhitneyu_ucheb(x, -2.523674e-02, &tj, &tj1, &result, _state);
   15986           0 :     mannwhitneyu_ucheb(x, -6.828211e-03, &tj, &tj1, &result, _state);
   15987           0 :     mannwhitneyu_ucheb(x, -1.716917e-03, &tj, &tj1, &result, _state);
   15988           0 :     mannwhitneyu_ucheb(x, -4.894256e-04, &tj, &tj1, &result, _state);
   15989           0 :     mannwhitneyu_ucheb(x, -1.433371e-04, &tj, &tj1, &result, _state);
   15990           0 :     mannwhitneyu_ucheb(x, -4.522675e-05, &tj, &tj1, &result, _state);
   15991           0 :     mannwhitneyu_ucheb(x, -1.764192e-05, &tj, &tj1, &result, _state);
   15992           0 :     mannwhitneyu_ucheb(x, -9.140235e-06, &tj, &tj1, &result, _state);
   15993           0 :     mannwhitneyu_ucheb(x, -5.629230e-06, &tj, &tj1, &result, _state);
   15994           0 :     mannwhitneyu_ucheb(x, -3.541895e-06, &tj, &tj1, &result, _state);
   15995           0 :     mannwhitneyu_ucheb(x, -1.944946e-06, &tj, &tj1, &result, _state);
   15996           0 :     mannwhitneyu_ucheb(x, -1.726360e-06, &tj, &tj1, &result, _state);
   15997           0 :     return result;
   15998             : }
   15999             : 
   16000             : 
   16001             : /*************************************************************************
   16002             : Tail(S, 10, 100)
   16003             : *************************************************************************/
   16004           0 : static double mannwhitneyu_utbln10n100(double s, ae_state *_state)
   16005             : {
   16006             :     double x;
   16007             :     double tj;
   16008             :     double tj1;
   16009             :     double result;
   16010             : 
   16011             : 
   16012           0 :     result = (double)(0);
   16013           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.650000e+00-1, 1.0, _state);
   16014           0 :     tj = (double)(1);
   16015           0 :     tj1 = x;
   16016           0 :     mannwhitneyu_ucheb(x, -4.334008e+00, &tj, &tj1, &result, _state);
   16017           0 :     mannwhitneyu_ucheb(x, -4.522316e+00, &tj, &tj1, &result, _state);
   16018           0 :     mannwhitneyu_ucheb(x, -9.769627e-01, &tj, &tj1, &result, _state);
   16019           0 :     mannwhitneyu_ucheb(x, -1.158110e-01, &tj, &tj1, &result, _state);
   16020           0 :     mannwhitneyu_ucheb(x, -2.053650e-02, &tj, &tj1, &result, _state);
   16021           0 :     mannwhitneyu_ucheb(x, -5.242235e-03, &tj, &tj1, &result, _state);
   16022           0 :     mannwhitneyu_ucheb(x, -1.173571e-03, &tj, &tj1, &result, _state);
   16023           0 :     mannwhitneyu_ucheb(x, -3.033661e-04, &tj, &tj1, &result, _state);
   16024           0 :     mannwhitneyu_ucheb(x, -7.824732e-05, &tj, &tj1, &result, _state);
   16025           0 :     mannwhitneyu_ucheb(x, -2.084420e-05, &tj, &tj1, &result, _state);
   16026           0 :     mannwhitneyu_ucheb(x, -6.610036e-06, &tj, &tj1, &result, _state);
   16027           0 :     mannwhitneyu_ucheb(x, -2.728155e-06, &tj, &tj1, &result, _state);
   16028           0 :     mannwhitneyu_ucheb(x, -1.217130e-06, &tj, &tj1, &result, _state);
   16029           0 :     mannwhitneyu_ucheb(x, -2.340966e-07, &tj, &tj1, &result, _state);
   16030           0 :     mannwhitneyu_ucheb(x, 2.001235e-07, &tj, &tj1, &result, _state);
   16031           0 :     mannwhitneyu_ucheb(x, 1.694052e-07, &tj, &tj1, &result, _state);
   16032           0 :     return result;
   16033             : }
   16034             : 
   16035             : 
   16036             : /*************************************************************************
   16037             : Tail(S, 11, 11)
   16038             : *************************************************************************/
   16039           0 : static double mannwhitneyu_utbln11n11(double s, ae_state *_state)
   16040             : {
   16041             :     double x;
   16042             :     double tj;
   16043             :     double tj1;
   16044             :     double result;
   16045             : 
   16046             : 
   16047           0 :     result = (double)(0);
   16048           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
   16049           0 :     tj = (double)(1);
   16050           0 :     tj1 = x;
   16051           0 :     mannwhitneyu_ucheb(x, -4.519760e+00, &tj, &tj1, &result, _state);
   16052           0 :     mannwhitneyu_ucheb(x, -4.880694e+00, &tj, &tj1, &result, _state);
   16053           0 :     mannwhitneyu_ucheb(x, -1.200698e+00, &tj, &tj1, &result, _state);
   16054           0 :     mannwhitneyu_ucheb(x, -2.174092e-01, &tj, &tj1, &result, _state);
   16055           0 :     mannwhitneyu_ucheb(x, -6.072304e-02, &tj, &tj1, &result, _state);
   16056           0 :     mannwhitneyu_ucheb(x, -2.054773e-02, &tj, &tj1, &result, _state);
   16057           0 :     mannwhitneyu_ucheb(x, -6.506613e-03, &tj, &tj1, &result, _state);
   16058           0 :     mannwhitneyu_ucheb(x, -1.813942e-03, &tj, &tj1, &result, _state);
   16059           0 :     mannwhitneyu_ucheb(x, -1.223644e-04, &tj, &tj1, &result, _state);
   16060           0 :     mannwhitneyu_ucheb(x, 2.417416e-04, &tj, &tj1, &result, _state);
   16061           0 :     mannwhitneyu_ucheb(x, 2.499166e-04, &tj, &tj1, &result, _state);
   16062           0 :     mannwhitneyu_ucheb(x, 1.194332e-04, &tj, &tj1, &result, _state);
   16063           0 :     mannwhitneyu_ucheb(x, 7.369096e-05, &tj, &tj1, &result, _state);
   16064           0 :     mannwhitneyu_ucheb(x, 1.968590e-04, &tj, &tj1, &result, _state);
   16065           0 :     mannwhitneyu_ucheb(x, 2.630532e-04, &tj, &tj1, &result, _state);
   16066           0 :     mannwhitneyu_ucheb(x, 5.061000e-04, &tj, &tj1, &result, _state);
   16067           0 :     return result;
   16068             : }
   16069             : 
   16070             : 
   16071             : /*************************************************************************
   16072             : Tail(S, 11, 12)
   16073             : *************************************************************************/
   16074           0 : static double mannwhitneyu_utbln11n12(double s, ae_state *_state)
   16075             : {
   16076             :     double x;
   16077             :     double tj;
   16078             :     double tj1;
   16079             :     double result;
   16080             : 
   16081             : 
   16082           0 :     result = (double)(0);
   16083           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
   16084           0 :     tj = (double)(1);
   16085           0 :     tj1 = x;
   16086           0 :     mannwhitneyu_ucheb(x, -4.495790e+00, &tj, &tj1, &result, _state);
   16087           0 :     mannwhitneyu_ucheb(x, -4.832622e+00, &tj, &tj1, &result, _state);
   16088           0 :     mannwhitneyu_ucheb(x, -1.165420e+00, &tj, &tj1, &result, _state);
   16089           0 :     mannwhitneyu_ucheb(x, -1.987306e-01, &tj, &tj1, &result, _state);
   16090           0 :     mannwhitneyu_ucheb(x, -5.265621e-02, &tj, &tj1, &result, _state);
   16091           0 :     mannwhitneyu_ucheb(x, -1.723537e-02, &tj, &tj1, &result, _state);
   16092           0 :     mannwhitneyu_ucheb(x, -5.347406e-03, &tj, &tj1, &result, _state);
   16093           0 :     mannwhitneyu_ucheb(x, -1.353464e-03, &tj, &tj1, &result, _state);
   16094           0 :     mannwhitneyu_ucheb(x, 6.613369e-05, &tj, &tj1, &result, _state);
   16095           0 :     mannwhitneyu_ucheb(x, 5.102522e-04, &tj, &tj1, &result, _state);
   16096           0 :     mannwhitneyu_ucheb(x, 5.237709e-04, &tj, &tj1, &result, _state);
   16097           0 :     mannwhitneyu_ucheb(x, 3.665652e-04, &tj, &tj1, &result, _state);
   16098           0 :     mannwhitneyu_ucheb(x, 1.626903e-04, &tj, &tj1, &result, _state);
   16099           0 :     mannwhitneyu_ucheb(x, -1.167518e-05, &tj, &tj1, &result, _state);
   16100           0 :     mannwhitneyu_ucheb(x, -8.564455e-05, &tj, &tj1, &result, _state);
   16101           0 :     mannwhitneyu_ucheb(x, -1.047320e-04, &tj, &tj1, &result, _state);
   16102           0 :     return result;
   16103             : }
   16104             : 
   16105             : 
   16106             : /*************************************************************************
   16107             : Tail(S, 11, 13)
   16108             : *************************************************************************/
   16109           0 : static double mannwhitneyu_utbln11n13(double s, ae_state *_state)
   16110             : {
   16111             :     double x;
   16112             :     double tj;
   16113             :     double tj1;
   16114             :     double result;
   16115             : 
   16116             : 
   16117           0 :     result = (double)(0);
   16118           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
   16119           0 :     tj = (double)(1);
   16120           0 :     tj1 = x;
   16121           0 :     mannwhitneyu_ucheb(x, -4.477880e+00, &tj, &tj1, &result, _state);
   16122           0 :     mannwhitneyu_ucheb(x, -4.796242e+00, &tj, &tj1, &result, _state);
   16123           0 :     mannwhitneyu_ucheb(x, -1.138769e+00, &tj, &tj1, &result, _state);
   16124           0 :     mannwhitneyu_ucheb(x, -1.851739e-01, &tj, &tj1, &result, _state);
   16125           0 :     mannwhitneyu_ucheb(x, -4.722104e-02, &tj, &tj1, &result, _state);
   16126           0 :     mannwhitneyu_ucheb(x, -1.548304e-02, &tj, &tj1, &result, _state);
   16127           0 :     mannwhitneyu_ucheb(x, -5.176683e-03, &tj, &tj1, &result, _state);
   16128           0 :     mannwhitneyu_ucheb(x, -1.817895e-03, &tj, &tj1, &result, _state);
   16129           0 :     mannwhitneyu_ucheb(x, -5.842451e-04, &tj, &tj1, &result, _state);
   16130           0 :     mannwhitneyu_ucheb(x, -8.935870e-05, &tj, &tj1, &result, _state);
   16131           0 :     mannwhitneyu_ucheb(x, 8.421777e-05, &tj, &tj1, &result, _state);
   16132           0 :     mannwhitneyu_ucheb(x, 1.238831e-04, &tj, &tj1, &result, _state);
   16133           0 :     mannwhitneyu_ucheb(x, 8.867026e-05, &tj, &tj1, &result, _state);
   16134           0 :     mannwhitneyu_ucheb(x, 1.458255e-05, &tj, &tj1, &result, _state);
   16135           0 :     mannwhitneyu_ucheb(x, -3.306259e-05, &tj, &tj1, &result, _state);
   16136           0 :     mannwhitneyu_ucheb(x, -8.961487e-05, &tj, &tj1, &result, _state);
   16137           0 :     return result;
   16138             : }
   16139             : 
   16140             : 
   16141             : /*************************************************************************
   16142             : Tail(S, 11, 14)
   16143             : *************************************************************************/
   16144           0 : static double mannwhitneyu_utbln11n14(double s, ae_state *_state)
   16145             : {
   16146             :     double x;
   16147             :     double tj;
   16148             :     double tj1;
   16149             :     double result;
   16150             : 
   16151             : 
   16152           0 :     result = (double)(0);
   16153           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
   16154           0 :     tj = (double)(1);
   16155           0 :     tj1 = x;
   16156           0 :     mannwhitneyu_ucheb(x, -4.463683e+00, &tj, &tj1, &result, _state);
   16157           0 :     mannwhitneyu_ucheb(x, -4.766969e+00, &tj, &tj1, &result, _state);
   16158           0 :     mannwhitneyu_ucheb(x, -1.117082e+00, &tj, &tj1, &result, _state);
   16159           0 :     mannwhitneyu_ucheb(x, -1.739574e-01, &tj, &tj1, &result, _state);
   16160           0 :     mannwhitneyu_ucheb(x, -4.238865e-02, &tj, &tj1, &result, _state);
   16161           0 :     mannwhitneyu_ucheb(x, -1.350306e-02, &tj, &tj1, &result, _state);
   16162           0 :     mannwhitneyu_ucheb(x, -4.425871e-03, &tj, &tj1, &result, _state);
   16163           0 :     mannwhitneyu_ucheb(x, -1.640172e-03, &tj, &tj1, &result, _state);
   16164           0 :     mannwhitneyu_ucheb(x, -6.660633e-04, &tj, &tj1, &result, _state);
   16165           0 :     mannwhitneyu_ucheb(x, -2.879883e-04, &tj, &tj1, &result, _state);
   16166           0 :     mannwhitneyu_ucheb(x, -1.349658e-04, &tj, &tj1, &result, _state);
   16167           0 :     mannwhitneyu_ucheb(x, -6.271795e-05, &tj, &tj1, &result, _state);
   16168           0 :     mannwhitneyu_ucheb(x, -3.304544e-05, &tj, &tj1, &result, _state);
   16169           0 :     mannwhitneyu_ucheb(x, -3.024201e-05, &tj, &tj1, &result, _state);
   16170           0 :     mannwhitneyu_ucheb(x, -2.816867e-05, &tj, &tj1, &result, _state);
   16171           0 :     mannwhitneyu_ucheb(x, -4.596787e-05, &tj, &tj1, &result, _state);
   16172           0 :     return result;
   16173             : }
   16174             : 
   16175             : 
   16176             : /*************************************************************************
   16177             : Tail(S, 11, 15)
   16178             : *************************************************************************/
   16179           0 : static double mannwhitneyu_utbln11n15(double s, ae_state *_state)
   16180             : {
   16181             :     double x;
   16182             :     double tj;
   16183             :     double tj1;
   16184             :     double result;
   16185             : 
   16186             : 
   16187           0 :     result = (double)(0);
   16188           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
   16189           0 :     tj = (double)(1);
   16190           0 :     tj1 = x;
   16191           0 :     mannwhitneyu_ucheb(x, -4.452526e+00, &tj, &tj1, &result, _state);
   16192           0 :     mannwhitneyu_ucheb(x, -4.743570e+00, &tj, &tj1, &result, _state);
   16193           0 :     mannwhitneyu_ucheb(x, -1.099705e+00, &tj, &tj1, &result, _state);
   16194           0 :     mannwhitneyu_ucheb(x, -1.650612e-01, &tj, &tj1, &result, _state);
   16195           0 :     mannwhitneyu_ucheb(x, -3.858285e-02, &tj, &tj1, &result, _state);
   16196           0 :     mannwhitneyu_ucheb(x, -1.187036e-02, &tj, &tj1, &result, _state);
   16197           0 :     mannwhitneyu_ucheb(x, -3.689241e-03, &tj, &tj1, &result, _state);
   16198           0 :     mannwhitneyu_ucheb(x, -1.294360e-03, &tj, &tj1, &result, _state);
   16199           0 :     mannwhitneyu_ucheb(x, -5.072623e-04, &tj, &tj1, &result, _state);
   16200           0 :     mannwhitneyu_ucheb(x, -2.278008e-04, &tj, &tj1, &result, _state);
   16201           0 :     mannwhitneyu_ucheb(x, -1.322382e-04, &tj, &tj1, &result, _state);
   16202           0 :     mannwhitneyu_ucheb(x, -9.131558e-05, &tj, &tj1, &result, _state);
   16203           0 :     mannwhitneyu_ucheb(x, -7.305669e-05, &tj, &tj1, &result, _state);
   16204           0 :     mannwhitneyu_ucheb(x, -6.825627e-05, &tj, &tj1, &result, _state);
   16205           0 :     mannwhitneyu_ucheb(x, -5.332689e-05, &tj, &tj1, &result, _state);
   16206           0 :     mannwhitneyu_ucheb(x, -6.120973e-05, &tj, &tj1, &result, _state);
   16207           0 :     return result;
   16208             : }
   16209             : 
   16210             : 
   16211             : /*************************************************************************
   16212             : Tail(S, 11, 30)
   16213             : *************************************************************************/
   16214           0 : static double mannwhitneyu_utbln11n30(double s, ae_state *_state)
   16215             : {
   16216             :     double x;
   16217             :     double tj;
   16218             :     double tj1;
   16219             :     double result;
   16220             : 
   16221             : 
   16222           0 :     result = (double)(0);
   16223           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
   16224           0 :     tj = (double)(1);
   16225           0 :     tj1 = x;
   16226           0 :     mannwhitneyu_ucheb(x, -4.402621e+00, &tj, &tj1, &result, _state);
   16227           0 :     mannwhitneyu_ucheb(x, -4.627440e+00, &tj, &tj1, &result, _state);
   16228           0 :     mannwhitneyu_ucheb(x, -1.011333e+00, &tj, &tj1, &result, _state);
   16229           0 :     mannwhitneyu_ucheb(x, -1.224126e-01, &tj, &tj1, &result, _state);
   16230           0 :     mannwhitneyu_ucheb(x, -2.232856e-02, &tj, &tj1, &result, _state);
   16231           0 :     mannwhitneyu_ucheb(x, -5.859347e-03, &tj, &tj1, &result, _state);
   16232           0 :     mannwhitneyu_ucheb(x, -1.377381e-03, &tj, &tj1, &result, _state);
   16233           0 :     mannwhitneyu_ucheb(x, -3.756709e-04, &tj, &tj1, &result, _state);
   16234           0 :     mannwhitneyu_ucheb(x, -1.033230e-04, &tj, &tj1, &result, _state);
   16235           0 :     mannwhitneyu_ucheb(x, -2.875472e-05, &tj, &tj1, &result, _state);
   16236           0 :     mannwhitneyu_ucheb(x, -8.608399e-06, &tj, &tj1, &result, _state);
   16237           0 :     mannwhitneyu_ucheb(x, -3.102943e-06, &tj, &tj1, &result, _state);
   16238           0 :     mannwhitneyu_ucheb(x, -1.740693e-06, &tj, &tj1, &result, _state);
   16239           0 :     mannwhitneyu_ucheb(x, -1.343139e-06, &tj, &tj1, &result, _state);
   16240           0 :     mannwhitneyu_ucheb(x, -9.196878e-07, &tj, &tj1, &result, _state);
   16241           0 :     mannwhitneyu_ucheb(x, -6.658062e-07, &tj, &tj1, &result, _state);
   16242           0 :     return result;
   16243             : }
   16244             : 
   16245             : 
   16246             : /*************************************************************************
   16247             : Tail(S, 11, 100)
   16248             : *************************************************************************/
   16249           0 : static double mannwhitneyu_utbln11n100(double s, ae_state *_state)
   16250             : {
   16251             :     double x;
   16252             :     double tj;
   16253             :     double tj1;
   16254             :     double result;
   16255             : 
   16256             : 
   16257           0 :     result = (double)(0);
   16258           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
   16259           0 :     tj = (double)(1);
   16260           0 :     tj1 = x;
   16261           0 :     mannwhitneyu_ucheb(x, -4.398795e+00, &tj, &tj1, &result, _state);
   16262           0 :     mannwhitneyu_ucheb(x, -4.596486e+00, &tj, &tj1, &result, _state);
   16263           0 :     mannwhitneyu_ucheb(x, -9.814761e-01, &tj, &tj1, &result, _state);
   16264           0 :     mannwhitneyu_ucheb(x, -1.085187e-01, &tj, &tj1, &result, _state);
   16265           0 :     mannwhitneyu_ucheb(x, -1.766529e-02, &tj, &tj1, &result, _state);
   16266           0 :     mannwhitneyu_ucheb(x, -4.379425e-03, &tj, &tj1, &result, _state);
   16267           0 :     mannwhitneyu_ucheb(x, -8.986351e-04, &tj, &tj1, &result, _state);
   16268           0 :     mannwhitneyu_ucheb(x, -2.214705e-04, &tj, &tj1, &result, _state);
   16269           0 :     mannwhitneyu_ucheb(x, -5.360075e-05, &tj, &tj1, &result, _state);
   16270           0 :     mannwhitneyu_ucheb(x, -1.260869e-05, &tj, &tj1, &result, _state);
   16271           0 :     mannwhitneyu_ucheb(x, -3.033307e-06, &tj, &tj1, &result, _state);
   16272           0 :     mannwhitneyu_ucheb(x, -7.727087e-07, &tj, &tj1, &result, _state);
   16273           0 :     mannwhitneyu_ucheb(x, -3.393883e-07, &tj, &tj1, &result, _state);
   16274           0 :     mannwhitneyu_ucheb(x, -2.242989e-07, &tj, &tj1, &result, _state);
   16275           0 :     mannwhitneyu_ucheb(x, -1.111928e-07, &tj, &tj1, &result, _state);
   16276           0 :     mannwhitneyu_ucheb(x, 3.898823e-09, &tj, &tj1, &result, _state);
   16277           0 :     return result;
   16278             : }
   16279             : 
   16280             : 
   16281             : /*************************************************************************
   16282             : Tail(S, 12, 12)
   16283             : *************************************************************************/
   16284           0 : static double mannwhitneyu_utbln12n12(double s, ae_state *_state)
   16285             : {
   16286             :     double x;
   16287             :     double tj;
   16288             :     double tj1;
   16289             :     double result;
   16290             : 
   16291             : 
   16292           0 :     result = (double)(0);
   16293           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
   16294           0 :     tj = (double)(1);
   16295           0 :     tj1 = x;
   16296           0 :     mannwhitneyu_ucheb(x, -4.472616e+00, &tj, &tj1, &result, _state);
   16297           0 :     mannwhitneyu_ucheb(x, -4.786627e+00, &tj, &tj1, &result, _state);
   16298           0 :     mannwhitneyu_ucheb(x, -1.132099e+00, &tj, &tj1, &result, _state);
   16299           0 :     mannwhitneyu_ucheb(x, -1.817523e-01, &tj, &tj1, &result, _state);
   16300           0 :     mannwhitneyu_ucheb(x, -4.570179e-02, &tj, &tj1, &result, _state);
   16301           0 :     mannwhitneyu_ucheb(x, -1.479511e-02, &tj, &tj1, &result, _state);
   16302           0 :     mannwhitneyu_ucheb(x, -4.799492e-03, &tj, &tj1, &result, _state);
   16303           0 :     mannwhitneyu_ucheb(x, -1.565350e-03, &tj, &tj1, &result, _state);
   16304           0 :     mannwhitneyu_ucheb(x, -3.530139e-04, &tj, &tj1, &result, _state);
   16305           0 :     mannwhitneyu_ucheb(x, 1.380132e-04, &tj, &tj1, &result, _state);
   16306           0 :     mannwhitneyu_ucheb(x, 3.242761e-04, &tj, &tj1, &result, _state);
   16307           0 :     mannwhitneyu_ucheb(x, 3.576269e-04, &tj, &tj1, &result, _state);
   16308           0 :     mannwhitneyu_ucheb(x, 3.018771e-04, &tj, &tj1, &result, _state);
   16309           0 :     mannwhitneyu_ucheb(x, 1.933911e-04, &tj, &tj1, &result, _state);
   16310           0 :     mannwhitneyu_ucheb(x, 9.002799e-05, &tj, &tj1, &result, _state);
   16311           0 :     mannwhitneyu_ucheb(x, -2.022048e-06, &tj, &tj1, &result, _state);
   16312           0 :     return result;
   16313             : }
   16314             : 
   16315             : 
   16316             : /*************************************************************************
   16317             : Tail(S, 12, 13)
   16318             : *************************************************************************/
   16319           0 : static double mannwhitneyu_utbln12n13(double s, ae_state *_state)
   16320             : {
   16321             :     double x;
   16322             :     double tj;
   16323             :     double tj1;
   16324             :     double result;
   16325             : 
   16326             : 
   16327           0 :     result = (double)(0);
   16328           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
   16329           0 :     tj = (double)(1);
   16330           0 :     tj1 = x;
   16331           0 :     mannwhitneyu_ucheb(x, -4.454800e+00, &tj, &tj1, &result, _state);
   16332           0 :     mannwhitneyu_ucheb(x, -4.750794e+00, &tj, &tj1, &result, _state);
   16333           0 :     mannwhitneyu_ucheb(x, -1.105988e+00, &tj, &tj1, &result, _state);
   16334           0 :     mannwhitneyu_ucheb(x, -1.684754e-01, &tj, &tj1, &result, _state);
   16335           0 :     mannwhitneyu_ucheb(x, -4.011826e-02, &tj, &tj1, &result, _state);
   16336           0 :     mannwhitneyu_ucheb(x, -1.262579e-02, &tj, &tj1, &result, _state);
   16337           0 :     mannwhitneyu_ucheb(x, -4.044492e-03, &tj, &tj1, &result, _state);
   16338           0 :     mannwhitneyu_ucheb(x, -1.478741e-03, &tj, &tj1, &result, _state);
   16339           0 :     mannwhitneyu_ucheb(x, -5.322165e-04, &tj, &tj1, &result, _state);
   16340           0 :     mannwhitneyu_ucheb(x, -1.621104e-04, &tj, &tj1, &result, _state);
   16341           0 :     mannwhitneyu_ucheb(x, 4.068753e-05, &tj, &tj1, &result, _state);
   16342           0 :     mannwhitneyu_ucheb(x, 1.468396e-04, &tj, &tj1, &result, _state);
   16343           0 :     mannwhitneyu_ucheb(x, 2.056235e-04, &tj, &tj1, &result, _state);
   16344           0 :     mannwhitneyu_ucheb(x, 2.327375e-04, &tj, &tj1, &result, _state);
   16345           0 :     mannwhitneyu_ucheb(x, 1.914877e-04, &tj, &tj1, &result, _state);
   16346           0 :     mannwhitneyu_ucheb(x, 1.784191e-04, &tj, &tj1, &result, _state);
   16347           0 :     return result;
   16348             : }
   16349             : 
   16350             : 
   16351             : /*************************************************************************
   16352             : Tail(S, 12, 14)
   16353             : *************************************************************************/
   16354           0 : static double mannwhitneyu_utbln12n14(double s, ae_state *_state)
   16355             : {
   16356             :     double x;
   16357             :     double tj;
   16358             :     double tj1;
   16359             :     double result;
   16360             : 
   16361             : 
   16362           0 :     result = (double)(0);
   16363           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
   16364           0 :     tj = (double)(1);
   16365           0 :     tj1 = x;
   16366           0 :     mannwhitneyu_ucheb(x, -4.440910e+00, &tj, &tj1, &result, _state);
   16367           0 :     mannwhitneyu_ucheb(x, -4.722404e+00, &tj, &tj1, &result, _state);
   16368           0 :     mannwhitneyu_ucheb(x, -1.085254e+00, &tj, &tj1, &result, _state);
   16369           0 :     mannwhitneyu_ucheb(x, -1.579439e-01, &tj, &tj1, &result, _state);
   16370           0 :     mannwhitneyu_ucheb(x, -3.563738e-02, &tj, &tj1, &result, _state);
   16371           0 :     mannwhitneyu_ucheb(x, -1.066730e-02, &tj, &tj1, &result, _state);
   16372           0 :     mannwhitneyu_ucheb(x, -3.129346e-03, &tj, &tj1, &result, _state);
   16373           0 :     mannwhitneyu_ucheb(x, -1.014531e-03, &tj, &tj1, &result, _state);
   16374           0 :     mannwhitneyu_ucheb(x, -3.129679e-04, &tj, &tj1, &result, _state);
   16375           0 :     mannwhitneyu_ucheb(x, -8.000909e-05, &tj, &tj1, &result, _state);
   16376           0 :     mannwhitneyu_ucheb(x, 1.996174e-05, &tj, &tj1, &result, _state);
   16377           0 :     mannwhitneyu_ucheb(x, 6.377924e-05, &tj, &tj1, &result, _state);
   16378           0 :     mannwhitneyu_ucheb(x, 8.936304e-05, &tj, &tj1, &result, _state);
   16379           0 :     mannwhitneyu_ucheb(x, 1.051098e-04, &tj, &tj1, &result, _state);
   16380           0 :     mannwhitneyu_ucheb(x, 9.025820e-05, &tj, &tj1, &result, _state);
   16381           0 :     mannwhitneyu_ucheb(x, 8.730585e-05, &tj, &tj1, &result, _state);
   16382           0 :     return result;
   16383             : }
   16384             : 
   16385             : 
   16386             : /*************************************************************************
   16387             : Tail(S, 12, 15)
   16388             : *************************************************************************/
   16389           0 : static double mannwhitneyu_utbln12n15(double s, ae_state *_state)
   16390             : {
   16391             :     double x;
   16392             :     double tj;
   16393             :     double tj1;
   16394             :     double result;
   16395             : 
   16396             : 
   16397           0 :     result = (double)(0);
   16398           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
   16399           0 :     tj = (double)(1);
   16400           0 :     tj1 = x;
   16401           0 :     mannwhitneyu_ucheb(x, -4.430123e+00, &tj, &tj1, &result, _state);
   16402           0 :     mannwhitneyu_ucheb(x, -4.700008e+00, &tj, &tj1, &result, _state);
   16403           0 :     mannwhitneyu_ucheb(x, -1.068971e+00, &tj, &tj1, &result, _state);
   16404           0 :     mannwhitneyu_ucheb(x, -1.499725e-01, &tj, &tj1, &result, _state);
   16405           0 :     mannwhitneyu_ucheb(x, -3.250897e-02, &tj, &tj1, &result, _state);
   16406           0 :     mannwhitneyu_ucheb(x, -9.473145e-03, &tj, &tj1, &result, _state);
   16407           0 :     mannwhitneyu_ucheb(x, -2.680008e-03, &tj, &tj1, &result, _state);
   16408           0 :     mannwhitneyu_ucheb(x, -8.483350e-04, &tj, &tj1, &result, _state);
   16409           0 :     mannwhitneyu_ucheb(x, -2.766992e-04, &tj, &tj1, &result, _state);
   16410           0 :     mannwhitneyu_ucheb(x, -9.891081e-05, &tj, &tj1, &result, _state);
   16411           0 :     mannwhitneyu_ucheb(x, -4.015140e-05, &tj, &tj1, &result, _state);
   16412           0 :     mannwhitneyu_ucheb(x, -1.977756e-05, &tj, &tj1, &result, _state);
   16413           0 :     mannwhitneyu_ucheb(x, -8.707414e-06, &tj, &tj1, &result, _state);
   16414           0 :     mannwhitneyu_ucheb(x, 1.114786e-06, &tj, &tj1, &result, _state);
   16415           0 :     mannwhitneyu_ucheb(x, 6.238865e-06, &tj, &tj1, &result, _state);
   16416           0 :     mannwhitneyu_ucheb(x, 1.381445e-05, &tj, &tj1, &result, _state);
   16417           0 :     return result;
   16418             : }
   16419             : 
   16420             : 
   16421             : /*************************************************************************
   16422             : Tail(S, 12, 30)
   16423             : *************************************************************************/
   16424           0 : static double mannwhitneyu_utbln12n30(double s, ae_state *_state)
   16425             : {
   16426             :     double x;
   16427             :     double tj;
   16428             :     double tj1;
   16429             :     double result;
   16430             : 
   16431             : 
   16432           0 :     result = (double)(0);
   16433           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
   16434           0 :     tj = (double)(1);
   16435           0 :     tj1 = x;
   16436           0 :     mannwhitneyu_ucheb(x, -4.380023e+00, &tj, &tj1, &result, _state);
   16437           0 :     mannwhitneyu_ucheb(x, -4.585782e+00, &tj, &tj1, &result, _state);
   16438           0 :     mannwhitneyu_ucheb(x, -9.838583e-01, &tj, &tj1, &result, _state);
   16439           0 :     mannwhitneyu_ucheb(x, -1.103394e-01, &tj, &tj1, &result, _state);
   16440           0 :     mannwhitneyu_ucheb(x, -1.834015e-02, &tj, &tj1, &result, _state);
   16441           0 :     mannwhitneyu_ucheb(x, -4.635212e-03, &tj, &tj1, &result, _state);
   16442           0 :     mannwhitneyu_ucheb(x, -9.948212e-04, &tj, &tj1, &result, _state);
   16443           0 :     mannwhitneyu_ucheb(x, -2.574169e-04, &tj, &tj1, &result, _state);
   16444           0 :     mannwhitneyu_ucheb(x, -6.747980e-05, &tj, &tj1, &result, _state);
   16445           0 :     mannwhitneyu_ucheb(x, -1.833672e-05, &tj, &tj1, &result, _state);
   16446           0 :     mannwhitneyu_ucheb(x, -5.722433e-06, &tj, &tj1, &result, _state);
   16447           0 :     mannwhitneyu_ucheb(x, -2.181038e-06, &tj, &tj1, &result, _state);
   16448           0 :     mannwhitneyu_ucheb(x, -1.206473e-06, &tj, &tj1, &result, _state);
   16449           0 :     mannwhitneyu_ucheb(x, -9.716003e-07, &tj, &tj1, &result, _state);
   16450           0 :     mannwhitneyu_ucheb(x, -7.476434e-07, &tj, &tj1, &result, _state);
   16451           0 :     mannwhitneyu_ucheb(x, -7.217700e-07, &tj, &tj1, &result, _state);
   16452           0 :     return result;
   16453             : }
   16454             : 
   16455             : 
   16456             : /*************************************************************************
   16457             : Tail(S, 12, 100)
   16458             : *************************************************************************/
   16459           0 : static double mannwhitneyu_utbln12n100(double s, ae_state *_state)
   16460             : {
   16461             :     double x;
   16462             :     double tj;
   16463             :     double tj1;
   16464             :     double result;
   16465             : 
   16466             : 
   16467           0 :     result = (double)(0);
   16468           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.700000e+00-1, 1.0, _state);
   16469           0 :     tj = (double)(1);
   16470           0 :     tj1 = x;
   16471           0 :     mannwhitneyu_ucheb(x, -4.374567e+00, &tj, &tj1, &result, _state);
   16472           0 :     mannwhitneyu_ucheb(x, -4.553481e+00, &tj, &tj1, &result, _state);
   16473           0 :     mannwhitneyu_ucheb(x, -9.541334e-01, &tj, &tj1, &result, _state);
   16474           0 :     mannwhitneyu_ucheb(x, -9.701907e-02, &tj, &tj1, &result, _state);
   16475           0 :     mannwhitneyu_ucheb(x, -1.414757e-02, &tj, &tj1, &result, _state);
   16476           0 :     mannwhitneyu_ucheb(x, -3.404103e-03, &tj, &tj1, &result, _state);
   16477           0 :     mannwhitneyu_ucheb(x, -6.234388e-04, &tj, &tj1, &result, _state);
   16478           0 :     mannwhitneyu_ucheb(x, -1.453762e-04, &tj, &tj1, &result, _state);
   16479           0 :     mannwhitneyu_ucheb(x, -3.311060e-05, &tj, &tj1, &result, _state);
   16480           0 :     mannwhitneyu_ucheb(x, -7.317501e-06, &tj, &tj1, &result, _state);
   16481           0 :     mannwhitneyu_ucheb(x, -1.713888e-06, &tj, &tj1, &result, _state);
   16482           0 :     mannwhitneyu_ucheb(x, -3.309583e-07, &tj, &tj1, &result, _state);
   16483           0 :     mannwhitneyu_ucheb(x, -4.019804e-08, &tj, &tj1, &result, _state);
   16484           0 :     mannwhitneyu_ucheb(x, 1.224829e-09, &tj, &tj1, &result, _state);
   16485           0 :     mannwhitneyu_ucheb(x, -1.349019e-08, &tj, &tj1, &result, _state);
   16486           0 :     mannwhitneyu_ucheb(x, -1.893302e-08, &tj, &tj1, &result, _state);
   16487           0 :     return result;
   16488             : }
   16489             : 
   16490             : 
   16491             : /*************************************************************************
   16492             : Tail(S, 13, 13)
   16493             : *************************************************************************/
   16494           0 : static double mannwhitneyu_utbln13n13(double s, ae_state *_state)
   16495             : {
   16496             :     double x;
   16497             :     double tj;
   16498             :     double tj1;
   16499             :     double result;
   16500             : 
   16501             : 
   16502           0 :     result = (double)(0);
   16503           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.750000e+00-1, 1.0, _state);
   16504           0 :     tj = (double)(1);
   16505           0 :     tj1 = x;
   16506           0 :     mannwhitneyu_ucheb(x, -4.541046e+00, &tj, &tj1, &result, _state);
   16507           0 :     mannwhitneyu_ucheb(x, -4.859047e+00, &tj, &tj1, &result, _state);
   16508           0 :     mannwhitneyu_ucheb(x, -1.130164e+00, &tj, &tj1, &result, _state);
   16509           0 :     mannwhitneyu_ucheb(x, -1.689719e-01, &tj, &tj1, &result, _state);
   16510           0 :     mannwhitneyu_ucheb(x, -3.950693e-02, &tj, &tj1, &result, _state);
   16511           0 :     mannwhitneyu_ucheb(x, -1.231455e-02, &tj, &tj1, &result, _state);
   16512           0 :     mannwhitneyu_ucheb(x, -3.976550e-03, &tj, &tj1, &result, _state);
   16513           0 :     mannwhitneyu_ucheb(x, -1.538455e-03, &tj, &tj1, &result, _state);
   16514           0 :     mannwhitneyu_ucheb(x, -7.245603e-04, &tj, &tj1, &result, _state);
   16515           0 :     mannwhitneyu_ucheb(x, -4.142647e-04, &tj, &tj1, &result, _state);
   16516           0 :     mannwhitneyu_ucheb(x, -2.831434e-04, &tj, &tj1, &result, _state);
   16517           0 :     mannwhitneyu_ucheb(x, -2.032483e-04, &tj, &tj1, &result, _state);
   16518           0 :     mannwhitneyu_ucheb(x, -1.488405e-04, &tj, &tj1, &result, _state);
   16519           0 :     mannwhitneyu_ucheb(x, -1.156927e-04, &tj, &tj1, &result, _state);
   16520           0 :     mannwhitneyu_ucheb(x, -7.949279e-05, &tj, &tj1, &result, _state);
   16521           0 :     mannwhitneyu_ucheb(x, -7.532700e-05, &tj, &tj1, &result, _state);
   16522           0 :     return result;
   16523             : }
   16524             : 
   16525             : 
   16526             : /*************************************************************************
   16527             : Tail(S, 13, 14)
   16528             : *************************************************************************/
   16529           0 : static double mannwhitneyu_utbln13n14(double s, ae_state *_state)
   16530             : {
   16531             :     double x;
   16532             :     double tj;
   16533             :     double tj1;
   16534             :     double result;
   16535             : 
   16536             : 
   16537           0 :     result = (double)(0);
   16538           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.750000e+00-1, 1.0, _state);
   16539           0 :     tj = (double)(1);
   16540           0 :     tj1 = x;
   16541           0 :     mannwhitneyu_ucheb(x, -4.525655e+00, &tj, &tj1, &result, _state);
   16542           0 :     mannwhitneyu_ucheb(x, -4.828341e+00, &tj, &tj1, &result, _state);
   16543           0 :     mannwhitneyu_ucheb(x, -1.108110e+00, &tj, &tj1, &result, _state);
   16544           0 :     mannwhitneyu_ucheb(x, -1.579552e-01, &tj, &tj1, &result, _state);
   16545           0 :     mannwhitneyu_ucheb(x, -3.488307e-02, &tj, &tj1, &result, _state);
   16546           0 :     mannwhitneyu_ucheb(x, -1.032328e-02, &tj, &tj1, &result, _state);
   16547           0 :     mannwhitneyu_ucheb(x, -2.988741e-03, &tj, &tj1, &result, _state);
   16548           0 :     mannwhitneyu_ucheb(x, -9.766394e-04, &tj, &tj1, &result, _state);
   16549           0 :     mannwhitneyu_ucheb(x, -3.388950e-04, &tj, &tj1, &result, _state);
   16550           0 :     mannwhitneyu_ucheb(x, -1.338179e-04, &tj, &tj1, &result, _state);
   16551           0 :     mannwhitneyu_ucheb(x, -6.133440e-05, &tj, &tj1, &result, _state);
   16552           0 :     mannwhitneyu_ucheb(x, -3.023518e-05, &tj, &tj1, &result, _state);
   16553           0 :     mannwhitneyu_ucheb(x, -1.110570e-05, &tj, &tj1, &result, _state);
   16554           0 :     mannwhitneyu_ucheb(x, 4.202332e-06, &tj, &tj1, &result, _state);
   16555           0 :     mannwhitneyu_ucheb(x, 1.056132e-05, &tj, &tj1, &result, _state);
   16556           0 :     mannwhitneyu_ucheb(x, 1.536323e-05, &tj, &tj1, &result, _state);
   16557           0 :     return result;
   16558             : }
   16559             : 
   16560             : 
   16561             : /*************************************************************************
   16562             : Tail(S, 13, 15)
   16563             : *************************************************************************/
   16564           0 : static double mannwhitneyu_utbln13n15(double s, ae_state *_state)
   16565             : {
   16566             :     double x;
   16567             :     double tj;
   16568             :     double tj1;
   16569             :     double result;
   16570             : 
   16571             : 
   16572           0 :     result = (double)(0);
   16573           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.750000e+00-1, 1.0, _state);
   16574           0 :     tj = (double)(1);
   16575           0 :     tj1 = x;
   16576           0 :     mannwhitneyu_ucheb(x, -4.513585e+00, &tj, &tj1, &result, _state);
   16577           0 :     mannwhitneyu_ucheb(x, -4.803952e+00, &tj, &tj1, &result, _state);
   16578           0 :     mannwhitneyu_ucheb(x, -1.090686e+00, &tj, &tj1, &result, _state);
   16579           0 :     mannwhitneyu_ucheb(x, -1.495310e-01, &tj, &tj1, &result, _state);
   16580           0 :     mannwhitneyu_ucheb(x, -3.160314e-02, &tj, &tj1, &result, _state);
   16581           0 :     mannwhitneyu_ucheb(x, -9.073124e-03, &tj, &tj1, &result, _state);
   16582           0 :     mannwhitneyu_ucheb(x, -2.480313e-03, &tj, &tj1, &result, _state);
   16583           0 :     mannwhitneyu_ucheb(x, -7.478239e-04, &tj, &tj1, &result, _state);
   16584           0 :     mannwhitneyu_ucheb(x, -2.140914e-04, &tj, &tj1, &result, _state);
   16585           0 :     mannwhitneyu_ucheb(x, -5.311541e-05, &tj, &tj1, &result, _state);
   16586           0 :     mannwhitneyu_ucheb(x, -2.677105e-06, &tj, &tj1, &result, _state);
   16587           0 :     mannwhitneyu_ucheb(x, 1.115464e-05, &tj, &tj1, &result, _state);
   16588           0 :     mannwhitneyu_ucheb(x, 1.578563e-05, &tj, &tj1, &result, _state);
   16589           0 :     mannwhitneyu_ucheb(x, 2.044604e-05, &tj, &tj1, &result, _state);
   16590           0 :     mannwhitneyu_ucheb(x, 1.888939e-05, &tj, &tj1, &result, _state);
   16591           0 :     mannwhitneyu_ucheb(x, 2.395644e-05, &tj, &tj1, &result, _state);
   16592           0 :     return result;
   16593             : }
   16594             : 
   16595             : 
   16596             : /*************************************************************************
   16597             : Tail(S, 13, 30)
   16598             : *************************************************************************/
   16599           0 : static double mannwhitneyu_utbln13n30(double s, ae_state *_state)
   16600             : {
   16601             :     double x;
   16602             :     double tj;
   16603             :     double tj1;
   16604             :     double result;
   16605             : 
   16606             : 
   16607           0 :     result = (double)(0);
   16608           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.750000e+00-1, 1.0, _state);
   16609           0 :     tj = (double)(1);
   16610           0 :     tj1 = x;
   16611           0 :     mannwhitneyu_ucheb(x, -4.455999e+00, &tj, &tj1, &result, _state);
   16612           0 :     mannwhitneyu_ucheb(x, -4.678434e+00, &tj, &tj1, &result, _state);
   16613           0 :     mannwhitneyu_ucheb(x, -9.995491e-01, &tj, &tj1, &result, _state);
   16614           0 :     mannwhitneyu_ucheb(x, -1.078100e-01, &tj, &tj1, &result, _state);
   16615           0 :     mannwhitneyu_ucheb(x, -1.705220e-02, &tj, &tj1, &result, _state);
   16616           0 :     mannwhitneyu_ucheb(x, -4.258739e-03, &tj, &tj1, &result, _state);
   16617           0 :     mannwhitneyu_ucheb(x, -8.671526e-04, &tj, &tj1, &result, _state);
   16618           0 :     mannwhitneyu_ucheb(x, -2.185458e-04, &tj, &tj1, &result, _state);
   16619           0 :     mannwhitneyu_ucheb(x, -5.507764e-05, &tj, &tj1, &result, _state);
   16620           0 :     mannwhitneyu_ucheb(x, -1.411446e-05, &tj, &tj1, &result, _state);
   16621           0 :     mannwhitneyu_ucheb(x, -4.044355e-06, &tj, &tj1, &result, _state);
   16622           0 :     mannwhitneyu_ucheb(x, -1.285765e-06, &tj, &tj1, &result, _state);
   16623           0 :     mannwhitneyu_ucheb(x, -5.345282e-07, &tj, &tj1, &result, _state);
   16624           0 :     mannwhitneyu_ucheb(x, -3.066940e-07, &tj, &tj1, &result, _state);
   16625           0 :     mannwhitneyu_ucheb(x, -1.962037e-07, &tj, &tj1, &result, _state);
   16626           0 :     mannwhitneyu_ucheb(x, -1.723644e-07, &tj, &tj1, &result, _state);
   16627           0 :     return result;
   16628             : }
   16629             : 
   16630             : 
   16631             : /*************************************************************************
   16632             : Tail(S, 13, 100)
   16633             : *************************************************************************/
   16634           0 : static double mannwhitneyu_utbln13n100(double s, ae_state *_state)
   16635             : {
   16636             :     double x;
   16637             :     double tj;
   16638             :     double tj1;
   16639             :     double result;
   16640             : 
   16641             : 
   16642           0 :     result = (double)(0);
   16643           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.750000e+00-1, 1.0, _state);
   16644           0 :     tj = (double)(1);
   16645           0 :     tj1 = x;
   16646           0 :     mannwhitneyu_ucheb(x, -4.446787e+00, &tj, &tj1, &result, _state);
   16647           0 :     mannwhitneyu_ucheb(x, -4.640804e+00, &tj, &tj1, &result, _state);
   16648           0 :     mannwhitneyu_ucheb(x, -9.671552e-01, &tj, &tj1, &result, _state);
   16649           0 :     mannwhitneyu_ucheb(x, -9.364990e-02, &tj, &tj1, &result, _state);
   16650           0 :     mannwhitneyu_ucheb(x, -1.274444e-02, &tj, &tj1, &result, _state);
   16651           0 :     mannwhitneyu_ucheb(x, -3.047440e-03, &tj, &tj1, &result, _state);
   16652           0 :     mannwhitneyu_ucheb(x, -5.161439e-04, &tj, &tj1, &result, _state);
   16653           0 :     mannwhitneyu_ucheb(x, -1.171729e-04, &tj, &tj1, &result, _state);
   16654           0 :     mannwhitneyu_ucheb(x, -2.562171e-05, &tj, &tj1, &result, _state);
   16655           0 :     mannwhitneyu_ucheb(x, -5.359762e-06, &tj, &tj1, &result, _state);
   16656           0 :     mannwhitneyu_ucheb(x, -1.275494e-06, &tj, &tj1, &result, _state);
   16657           0 :     mannwhitneyu_ucheb(x, -2.747635e-07, &tj, &tj1, &result, _state);
   16658           0 :     mannwhitneyu_ucheb(x, -5.700292e-08, &tj, &tj1, &result, _state);
   16659           0 :     mannwhitneyu_ucheb(x, -2.565559e-09, &tj, &tj1, &result, _state);
   16660           0 :     mannwhitneyu_ucheb(x, 5.005396e-09, &tj, &tj1, &result, _state);
   16661           0 :     mannwhitneyu_ucheb(x, 3.335794e-09, &tj, &tj1, &result, _state);
   16662           0 :     return result;
   16663             : }
   16664             : 
   16665             : 
   16666             : /*************************************************************************
   16667             : Tail(S, 14, 14)
   16668             : *************************************************************************/
   16669           0 : static double mannwhitneyu_utbln14n14(double s, ae_state *_state)
   16670             : {
   16671             :     double x;
   16672             :     double tj;
   16673             :     double tj1;
   16674             :     double result;
   16675             : 
   16676             : 
   16677           0 :     result = (double)(0);
   16678           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.750000e+00-1, 1.0, _state);
   16679           0 :     tj = (double)(1);
   16680           0 :     tj1 = x;
   16681           0 :     mannwhitneyu_ucheb(x, -4.510624e+00, &tj, &tj1, &result, _state);
   16682           0 :     mannwhitneyu_ucheb(x, -4.798584e+00, &tj, &tj1, &result, _state);
   16683           0 :     mannwhitneyu_ucheb(x, -1.087107e+00, &tj, &tj1, &result, _state);
   16684           0 :     mannwhitneyu_ucheb(x, -1.478532e-01, &tj, &tj1, &result, _state);
   16685           0 :     mannwhitneyu_ucheb(x, -3.098050e-02, &tj, &tj1, &result, _state);
   16686           0 :     mannwhitneyu_ucheb(x, -8.855986e-03, &tj, &tj1, &result, _state);
   16687           0 :     mannwhitneyu_ucheb(x, -2.409083e-03, &tj, &tj1, &result, _state);
   16688           0 :     mannwhitneyu_ucheb(x, -7.299536e-04, &tj, &tj1, &result, _state);
   16689           0 :     mannwhitneyu_ucheb(x, -2.176177e-04, &tj, &tj1, &result, _state);
   16690           0 :     mannwhitneyu_ucheb(x, -6.479417e-05, &tj, &tj1, &result, _state);
   16691           0 :     mannwhitneyu_ucheb(x, -1.812761e-05, &tj, &tj1, &result, _state);
   16692           0 :     mannwhitneyu_ucheb(x, -5.225872e-06, &tj, &tj1, &result, _state);
   16693           0 :     mannwhitneyu_ucheb(x, 4.516521e-07, &tj, &tj1, &result, _state);
   16694           0 :     mannwhitneyu_ucheb(x, 6.730551e-06, &tj, &tj1, &result, _state);
   16695           0 :     mannwhitneyu_ucheb(x, 9.237563e-06, &tj, &tj1, &result, _state);
   16696           0 :     mannwhitneyu_ucheb(x, 1.611820e-05, &tj, &tj1, &result, _state);
   16697           0 :     return result;
   16698             : }
   16699             : 
   16700             : 
   16701             : /*************************************************************************
   16702             : Tail(S, 14, 15)
   16703             : *************************************************************************/
   16704           0 : static double mannwhitneyu_utbln14n15(double s, ae_state *_state)
   16705             : {
   16706             :     double x;
   16707             :     double tj;
   16708             :     double tj1;
   16709             :     double result;
   16710             : 
   16711             : 
   16712           0 :     result = (double)(0);
   16713           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.750000e+00-1, 1.0, _state);
   16714           0 :     tj = (double)(1);
   16715           0 :     tj1 = x;
   16716           0 :     mannwhitneyu_ucheb(x, -4.498681e+00, &tj, &tj1, &result, _state);
   16717           0 :     mannwhitneyu_ucheb(x, -4.774668e+00, &tj, &tj1, &result, _state);
   16718           0 :     mannwhitneyu_ucheb(x, -1.070267e+00, &tj, &tj1, &result, _state);
   16719           0 :     mannwhitneyu_ucheb(x, -1.399348e-01, &tj, &tj1, &result, _state);
   16720           0 :     mannwhitneyu_ucheb(x, -2.807239e-02, &tj, &tj1, &result, _state);
   16721           0 :     mannwhitneyu_ucheb(x, -7.845763e-03, &tj, &tj1, &result, _state);
   16722           0 :     mannwhitneyu_ucheb(x, -2.071773e-03, &tj, &tj1, &result, _state);
   16723           0 :     mannwhitneyu_ucheb(x, -6.261698e-04, &tj, &tj1, &result, _state);
   16724           0 :     mannwhitneyu_ucheb(x, -2.011695e-04, &tj, &tj1, &result, _state);
   16725           0 :     mannwhitneyu_ucheb(x, -7.305946e-05, &tj, &tj1, &result, _state);
   16726           0 :     mannwhitneyu_ucheb(x, -3.879295e-05, &tj, &tj1, &result, _state);
   16727           0 :     mannwhitneyu_ucheb(x, -2.999439e-05, &tj, &tj1, &result, _state);
   16728           0 :     mannwhitneyu_ucheb(x, -2.904438e-05, &tj, &tj1, &result, _state);
   16729           0 :     mannwhitneyu_ucheb(x, -2.944986e-05, &tj, &tj1, &result, _state);
   16730           0 :     mannwhitneyu_ucheb(x, -2.373908e-05, &tj, &tj1, &result, _state);
   16731           0 :     mannwhitneyu_ucheb(x, -2.140794e-05, &tj, &tj1, &result, _state);
   16732           0 :     return result;
   16733             : }
   16734             : 
   16735             : 
   16736             : /*************************************************************************
   16737             : Tail(S, 14, 30)
   16738             : *************************************************************************/
   16739           0 : static double mannwhitneyu_utbln14n30(double s, ae_state *_state)
   16740             : {
   16741             :     double x;
   16742             :     double tj;
   16743             :     double tj1;
   16744             :     double result;
   16745             : 
   16746             : 
   16747           0 :     result = (double)(0);
   16748           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.750000e+00-1, 1.0, _state);
   16749           0 :     tj = (double)(1);
   16750           0 :     tj1 = x;
   16751           0 :     mannwhitneyu_ucheb(x, -4.440378e+00, &tj, &tj1, &result, _state);
   16752           0 :     mannwhitneyu_ucheb(x, -4.649587e+00, &tj, &tj1, &result, _state);
   16753           0 :     mannwhitneyu_ucheb(x, -9.807829e-01, &tj, &tj1, &result, _state);
   16754           0 :     mannwhitneyu_ucheb(x, -9.989753e-02, &tj, &tj1, &result, _state);
   16755           0 :     mannwhitneyu_ucheb(x, -1.463646e-02, &tj, &tj1, &result, _state);
   16756           0 :     mannwhitneyu_ucheb(x, -3.586580e-03, &tj, &tj1, &result, _state);
   16757           0 :     mannwhitneyu_ucheb(x, -6.745917e-04, &tj, &tj1, &result, _state);
   16758           0 :     mannwhitneyu_ucheb(x, -1.635398e-04, &tj, &tj1, &result, _state);
   16759           0 :     mannwhitneyu_ucheb(x, -3.923172e-05, &tj, &tj1, &result, _state);
   16760           0 :     mannwhitneyu_ucheb(x, -9.446699e-06, &tj, &tj1, &result, _state);
   16761           0 :     mannwhitneyu_ucheb(x, -2.613892e-06, &tj, &tj1, &result, _state);
   16762           0 :     mannwhitneyu_ucheb(x, -8.214073e-07, &tj, &tj1, &result, _state);
   16763           0 :     mannwhitneyu_ucheb(x, -3.651683e-07, &tj, &tj1, &result, _state);
   16764           0 :     mannwhitneyu_ucheb(x, -2.272777e-07, &tj, &tj1, &result, _state);
   16765           0 :     mannwhitneyu_ucheb(x, -1.464988e-07, &tj, &tj1, &result, _state);
   16766           0 :     mannwhitneyu_ucheb(x, -1.109803e-07, &tj, &tj1, &result, _state);
   16767           0 :     return result;
   16768             : }
   16769             : 
   16770             : 
   16771             : /*************************************************************************
   16772             : Tail(S, 14, 100)
   16773             : *************************************************************************/
   16774           0 : static double mannwhitneyu_utbln14n100(double s, ae_state *_state)
   16775             : {
   16776             :     double x;
   16777             :     double tj;
   16778             :     double tj1;
   16779             :     double result;
   16780             : 
   16781             : 
   16782           0 :     result = (double)(0);
   16783           0 :     x = ae_minreal(2*(s-0.000000e+00)/3.750000e+00-1, 1.0, _state);
   16784           0 :     tj = (double)(1);
   16785           0 :     tj1 = x;
   16786           0 :     mannwhitneyu_ucheb(x, -4.429701e+00, &tj, &tj1, &result, _state);
   16787           0 :     mannwhitneyu_ucheb(x, -4.610577e+00, &tj, &tj1, &result, _state);
   16788           0 :     mannwhitneyu_ucheb(x, -9.482675e-01, &tj, &tj1, &result, _state);
   16789           0 :     mannwhitneyu_ucheb(x, -8.605550e-02, &tj, &tj1, &result, _state);
   16790           0 :     mannwhitneyu_ucheb(x, -1.062151e-02, &tj, &tj1, &result, _state);
   16791           0 :     mannwhitneyu_ucheb(x, -2.525154e-03, &tj, &tj1, &result, _state);
   16792           0 :     mannwhitneyu_ucheb(x, -3.835983e-04, &tj, &tj1, &result, _state);
   16793           0 :     mannwhitneyu_ucheb(x, -8.411440e-05, &tj, &tj1, &result, _state);
   16794           0 :     mannwhitneyu_ucheb(x, -1.744901e-05, &tj, &tj1, &result, _state);
   16795           0 :     mannwhitneyu_ucheb(x, -3.318850e-06, &tj, &tj1, &result, _state);
   16796           0 :     mannwhitneyu_ucheb(x, -7.692100e-07, &tj, &tj1, &result, _state);
   16797           0 :     mannwhitneyu_ucheb(x, -1.536270e-07, &tj, &tj1, &result, _state);
   16798           0 :     mannwhitneyu_ucheb(x, -3.705888e-08, &tj, &tj1, &result, _state);
   16799           0 :     mannwhitneyu_ucheb(x, -7.999599e-09, &tj, &tj1, &result, _state);
   16800           0 :     mannwhitneyu_ucheb(x, -2.908395e-09, &tj, &tj1, &result, _state);
   16801           0 :     mannwhitneyu_ucheb(x, 1.546923e-09, &tj, &tj1, &result, _state);
   16802           0 :     return result;
   16803             : }
   16804             : 
   16805             : 
   16806             : /*************************************************************************
   16807             : Tail(S, N1, N2)
   16808             : *************************************************************************/
   16809           0 : static double mannwhitneyu_usigma(double s,
   16810             :      ae_int_t n1,
   16811             :      ae_int_t n2,
   16812             :      ae_state *_state)
   16813             : {
   16814             :     double f0;
   16815             :     double f1;
   16816             :     double f2;
   16817             :     double f3;
   16818             :     double f4;
   16819             :     double s0;
   16820             :     double s1;
   16821             :     double s2;
   16822             :     double s3;
   16823             :     double s4;
   16824             :     double result;
   16825             : 
   16826             : 
   16827           0 :     result = (double)(0);
   16828             :     
   16829             :     /*
   16830             :      * N1=5, N2 = 5, 6, 7, ...
   16831             :      */
   16832           0 :     if( ae_minint(n1, n2, _state)==5 )
   16833             :     {
   16834           0 :         if( ae_maxint(n1, n2, _state)==5 )
   16835             :         {
   16836           0 :             result = mannwhitneyu_utbln5n5(s, _state);
   16837             :         }
   16838           0 :         if( ae_maxint(n1, n2, _state)==6 )
   16839             :         {
   16840           0 :             result = mannwhitneyu_utbln5n6(s, _state);
   16841             :         }
   16842           0 :         if( ae_maxint(n1, n2, _state)==7 )
   16843             :         {
   16844           0 :             result = mannwhitneyu_utbln5n7(s, _state);
   16845             :         }
   16846           0 :         if( ae_maxint(n1, n2, _state)==8 )
   16847             :         {
   16848           0 :             result = mannwhitneyu_utbln5n8(s, _state);
   16849             :         }
   16850           0 :         if( ae_maxint(n1, n2, _state)==9 )
   16851             :         {
   16852           0 :             result = mannwhitneyu_utbln5n9(s, _state);
   16853             :         }
   16854           0 :         if( ae_maxint(n1, n2, _state)==10 )
   16855             :         {
   16856           0 :             result = mannwhitneyu_utbln5n10(s, _state);
   16857             :         }
   16858           0 :         if( ae_maxint(n1, n2, _state)==11 )
   16859             :         {
   16860           0 :             result = mannwhitneyu_utbln5n11(s, _state);
   16861             :         }
   16862           0 :         if( ae_maxint(n1, n2, _state)==12 )
   16863             :         {
   16864           0 :             result = mannwhitneyu_utbln5n12(s, _state);
   16865             :         }
   16866           0 :         if( ae_maxint(n1, n2, _state)==13 )
   16867             :         {
   16868           0 :             result = mannwhitneyu_utbln5n13(s, _state);
   16869             :         }
   16870           0 :         if( ae_maxint(n1, n2, _state)==14 )
   16871             :         {
   16872           0 :             result = mannwhitneyu_utbln5n14(s, _state);
   16873             :         }
   16874           0 :         if( ae_maxint(n1, n2, _state)==15 )
   16875             :         {
   16876           0 :             result = mannwhitneyu_utbln5n15(s, _state);
   16877             :         }
   16878           0 :         if( ae_maxint(n1, n2, _state)==16 )
   16879             :         {
   16880           0 :             result = mannwhitneyu_utbln5n16(s, _state);
   16881             :         }
   16882           0 :         if( ae_maxint(n1, n2, _state)==17 )
   16883             :         {
   16884           0 :             result = mannwhitneyu_utbln5n17(s, _state);
   16885             :         }
   16886           0 :         if( ae_maxint(n1, n2, _state)==18 )
   16887             :         {
   16888           0 :             result = mannwhitneyu_utbln5n18(s, _state);
   16889             :         }
   16890           0 :         if( ae_maxint(n1, n2, _state)==19 )
   16891             :         {
   16892           0 :             result = mannwhitneyu_utbln5n19(s, _state);
   16893             :         }
   16894           0 :         if( ae_maxint(n1, n2, _state)==20 )
   16895             :         {
   16896           0 :             result = mannwhitneyu_utbln5n20(s, _state);
   16897             :         }
   16898           0 :         if( ae_maxint(n1, n2, _state)==21 )
   16899             :         {
   16900           0 :             result = mannwhitneyu_utbln5n21(s, _state);
   16901             :         }
   16902           0 :         if( ae_maxint(n1, n2, _state)==22 )
   16903             :         {
   16904           0 :             result = mannwhitneyu_utbln5n22(s, _state);
   16905             :         }
   16906           0 :         if( ae_maxint(n1, n2, _state)==23 )
   16907             :         {
   16908           0 :             result = mannwhitneyu_utbln5n23(s, _state);
   16909             :         }
   16910           0 :         if( ae_maxint(n1, n2, _state)==24 )
   16911             :         {
   16912           0 :             result = mannwhitneyu_utbln5n24(s, _state);
   16913             :         }
   16914           0 :         if( ae_maxint(n1, n2, _state)==25 )
   16915             :         {
   16916           0 :             result = mannwhitneyu_utbln5n25(s, _state);
   16917             :         }
   16918           0 :         if( ae_maxint(n1, n2, _state)==26 )
   16919             :         {
   16920           0 :             result = mannwhitneyu_utbln5n26(s, _state);
   16921             :         }
   16922           0 :         if( ae_maxint(n1, n2, _state)==27 )
   16923             :         {
   16924           0 :             result = mannwhitneyu_utbln5n27(s, _state);
   16925             :         }
   16926           0 :         if( ae_maxint(n1, n2, _state)==28 )
   16927             :         {
   16928           0 :             result = mannwhitneyu_utbln5n28(s, _state);
   16929             :         }
   16930           0 :         if( ae_maxint(n1, n2, _state)==29 )
   16931             :         {
   16932           0 :             result = mannwhitneyu_utbln5n29(s, _state);
   16933             :         }
   16934           0 :         if( ae_maxint(n1, n2, _state)>29 )
   16935             :         {
   16936           0 :             f0 = mannwhitneyu_utbln5n15(s, _state);
   16937           0 :             f1 = mannwhitneyu_utbln5n30(s, _state);
   16938           0 :             f2 = mannwhitneyu_utbln5n100(s, _state);
   16939           0 :             result = mannwhitneyu_uninterpolate(f0, f1, f2, ae_maxint(n1, n2, _state), _state);
   16940             :         }
   16941           0 :         return result;
   16942             :     }
   16943             :     
   16944             :     /*
   16945             :      * N1=6, N2 = 6, 7, 8, ...
   16946             :      */
   16947           0 :     if( ae_minint(n1, n2, _state)==6 )
   16948             :     {
   16949           0 :         if( ae_maxint(n1, n2, _state)==6 )
   16950             :         {
   16951           0 :             result = mannwhitneyu_utbln6n6(s, _state);
   16952             :         }
   16953           0 :         if( ae_maxint(n1, n2, _state)==7 )
   16954             :         {
   16955           0 :             result = mannwhitneyu_utbln6n7(s, _state);
   16956             :         }
   16957           0 :         if( ae_maxint(n1, n2, _state)==8 )
   16958             :         {
   16959           0 :             result = mannwhitneyu_utbln6n8(s, _state);
   16960             :         }
   16961           0 :         if( ae_maxint(n1, n2, _state)==9 )
   16962             :         {
   16963           0 :             result = mannwhitneyu_utbln6n9(s, _state);
   16964             :         }
   16965           0 :         if( ae_maxint(n1, n2, _state)==10 )
   16966             :         {
   16967           0 :             result = mannwhitneyu_utbln6n10(s, _state);
   16968             :         }
   16969           0 :         if( ae_maxint(n1, n2, _state)==11 )
   16970             :         {
   16971           0 :             result = mannwhitneyu_utbln6n11(s, _state);
   16972             :         }
   16973           0 :         if( ae_maxint(n1, n2, _state)==12 )
   16974             :         {
   16975           0 :             result = mannwhitneyu_utbln6n12(s, _state);
   16976             :         }
   16977           0 :         if( ae_maxint(n1, n2, _state)==13 )
   16978             :         {
   16979           0 :             result = mannwhitneyu_utbln6n13(s, _state);
   16980             :         }
   16981           0 :         if( ae_maxint(n1, n2, _state)==14 )
   16982             :         {
   16983           0 :             result = mannwhitneyu_utbln6n14(s, _state);
   16984             :         }
   16985           0 :         if( ae_maxint(n1, n2, _state)==15 )
   16986             :         {
   16987           0 :             result = mannwhitneyu_utbln6n15(s, _state);
   16988             :         }
   16989           0 :         if( ae_maxint(n1, n2, _state)>15 )
   16990             :         {
   16991           0 :             f0 = mannwhitneyu_utbln6n15(s, _state);
   16992           0 :             f1 = mannwhitneyu_utbln6n30(s, _state);
   16993           0 :             f2 = mannwhitneyu_utbln6n100(s, _state);
   16994           0 :             result = mannwhitneyu_uninterpolate(f0, f1, f2, ae_maxint(n1, n2, _state), _state);
   16995             :         }
   16996           0 :         return result;
   16997             :     }
   16998             :     
   16999             :     /*
   17000             :      * N1=7, N2 = 7, 8, ...
   17001             :      */
   17002           0 :     if( ae_minint(n1, n2, _state)==7 )
   17003             :     {
   17004           0 :         if( ae_maxint(n1, n2, _state)==7 )
   17005             :         {
   17006           0 :             result = mannwhitneyu_utbln7n7(s, _state);
   17007             :         }
   17008           0 :         if( ae_maxint(n1, n2, _state)==8 )
   17009             :         {
   17010           0 :             result = mannwhitneyu_utbln7n8(s, _state);
   17011             :         }
   17012           0 :         if( ae_maxint(n1, n2, _state)==9 )
   17013             :         {
   17014           0 :             result = mannwhitneyu_utbln7n9(s, _state);
   17015             :         }
   17016           0 :         if( ae_maxint(n1, n2, _state)==10 )
   17017             :         {
   17018           0 :             result = mannwhitneyu_utbln7n10(s, _state);
   17019             :         }
   17020           0 :         if( ae_maxint(n1, n2, _state)==11 )
   17021             :         {
   17022           0 :             result = mannwhitneyu_utbln7n11(s, _state);
   17023             :         }
   17024           0 :         if( ae_maxint(n1, n2, _state)==12 )
   17025             :         {
   17026           0 :             result = mannwhitneyu_utbln7n12(s, _state);
   17027             :         }
   17028           0 :         if( ae_maxint(n1, n2, _state)==13 )
   17029             :         {
   17030           0 :             result = mannwhitneyu_utbln7n13(s, _state);
   17031             :         }
   17032           0 :         if( ae_maxint(n1, n2, _state)==14 )
   17033             :         {
   17034           0 :             result = mannwhitneyu_utbln7n14(s, _state);
   17035             :         }
   17036           0 :         if( ae_maxint(n1, n2, _state)==15 )
   17037             :         {
   17038           0 :             result = mannwhitneyu_utbln7n15(s, _state);
   17039             :         }
   17040           0 :         if( ae_maxint(n1, n2, _state)>15 )
   17041             :         {
   17042           0 :             f0 = mannwhitneyu_utbln7n15(s, _state);
   17043           0 :             f1 = mannwhitneyu_utbln7n30(s, _state);
   17044           0 :             f2 = mannwhitneyu_utbln7n100(s, _state);
   17045           0 :             result = mannwhitneyu_uninterpolate(f0, f1, f2, ae_maxint(n1, n2, _state), _state);
   17046             :         }
   17047           0 :         return result;
   17048             :     }
   17049             :     
   17050             :     /*
   17051             :      * N1=8, N2 = 8, 9, 10, ...
   17052             :      */
   17053           0 :     if( ae_minint(n1, n2, _state)==8 )
   17054             :     {
   17055           0 :         if( ae_maxint(n1, n2, _state)==8 )
   17056             :         {
   17057           0 :             result = mannwhitneyu_utbln8n8(s, _state);
   17058             :         }
   17059           0 :         if( ae_maxint(n1, n2, _state)==9 )
   17060             :         {
   17061           0 :             result = mannwhitneyu_utbln8n9(s, _state);
   17062             :         }
   17063           0 :         if( ae_maxint(n1, n2, _state)==10 )
   17064             :         {
   17065           0 :             result = mannwhitneyu_utbln8n10(s, _state);
   17066             :         }
   17067           0 :         if( ae_maxint(n1, n2, _state)==11 )
   17068             :         {
   17069           0 :             result = mannwhitneyu_utbln8n11(s, _state);
   17070             :         }
   17071           0 :         if( ae_maxint(n1, n2, _state)==12 )
   17072             :         {
   17073           0 :             result = mannwhitneyu_utbln8n12(s, _state);
   17074             :         }
   17075           0 :         if( ae_maxint(n1, n2, _state)==13 )
   17076             :         {
   17077           0 :             result = mannwhitneyu_utbln8n13(s, _state);
   17078             :         }
   17079           0 :         if( ae_maxint(n1, n2, _state)==14 )
   17080             :         {
   17081           0 :             result = mannwhitneyu_utbln8n14(s, _state);
   17082             :         }
   17083           0 :         if( ae_maxint(n1, n2, _state)==15 )
   17084             :         {
   17085           0 :             result = mannwhitneyu_utbln8n15(s, _state);
   17086             :         }
   17087           0 :         if( ae_maxint(n1, n2, _state)>15 )
   17088             :         {
   17089           0 :             f0 = mannwhitneyu_utbln8n15(s, _state);
   17090           0 :             f1 = mannwhitneyu_utbln8n30(s, _state);
   17091           0 :             f2 = mannwhitneyu_utbln8n100(s, _state);
   17092           0 :             result = mannwhitneyu_uninterpolate(f0, f1, f2, ae_maxint(n1, n2, _state), _state);
   17093             :         }
   17094           0 :         return result;
   17095             :     }
   17096             :     
   17097             :     /*
   17098             :      * N1=9, N2 = 9, 10, ...
   17099             :      */
   17100           0 :     if( ae_minint(n1, n2, _state)==9 )
   17101             :     {
   17102           0 :         if( ae_maxint(n1, n2, _state)==9 )
   17103             :         {
   17104           0 :             result = mannwhitneyu_utbln9n9(s, _state);
   17105             :         }
   17106           0 :         if( ae_maxint(n1, n2, _state)==10 )
   17107             :         {
   17108           0 :             result = mannwhitneyu_utbln9n10(s, _state);
   17109             :         }
   17110           0 :         if( ae_maxint(n1, n2, _state)==11 )
   17111             :         {
   17112           0 :             result = mannwhitneyu_utbln9n11(s, _state);
   17113             :         }
   17114           0 :         if( ae_maxint(n1, n2, _state)==12 )
   17115             :         {
   17116           0 :             result = mannwhitneyu_utbln9n12(s, _state);
   17117             :         }
   17118           0 :         if( ae_maxint(n1, n2, _state)==13 )
   17119             :         {
   17120           0 :             result = mannwhitneyu_utbln9n13(s, _state);
   17121             :         }
   17122           0 :         if( ae_maxint(n1, n2, _state)==14 )
   17123             :         {
   17124           0 :             result = mannwhitneyu_utbln9n14(s, _state);
   17125             :         }
   17126           0 :         if( ae_maxint(n1, n2, _state)==15 )
   17127             :         {
   17128           0 :             result = mannwhitneyu_utbln9n15(s, _state);
   17129             :         }
   17130           0 :         if( ae_maxint(n1, n2, _state)>15 )
   17131             :         {
   17132           0 :             f0 = mannwhitneyu_utbln9n15(s, _state);
   17133           0 :             f1 = mannwhitneyu_utbln9n30(s, _state);
   17134           0 :             f2 = mannwhitneyu_utbln9n100(s, _state);
   17135           0 :             result = mannwhitneyu_uninterpolate(f0, f1, f2, ae_maxint(n1, n2, _state), _state);
   17136             :         }
   17137           0 :         return result;
   17138             :     }
   17139             :     
   17140             :     /*
   17141             :      * N1=10, N2 = 10, 11, ...
   17142             :      */
   17143           0 :     if( ae_minint(n1, n2, _state)==10 )
   17144             :     {
   17145           0 :         if( ae_maxint(n1, n2, _state)==10 )
   17146             :         {
   17147           0 :             result = mannwhitneyu_utbln10n10(s, _state);
   17148             :         }
   17149           0 :         if( ae_maxint(n1, n2, _state)==11 )
   17150             :         {
   17151           0 :             result = mannwhitneyu_utbln10n11(s, _state);
   17152             :         }
   17153           0 :         if( ae_maxint(n1, n2, _state)==12 )
   17154             :         {
   17155           0 :             result = mannwhitneyu_utbln10n12(s, _state);
   17156             :         }
   17157           0 :         if( ae_maxint(n1, n2, _state)==13 )
   17158             :         {
   17159           0 :             result = mannwhitneyu_utbln10n13(s, _state);
   17160             :         }
   17161           0 :         if( ae_maxint(n1, n2, _state)==14 )
   17162             :         {
   17163           0 :             result = mannwhitneyu_utbln10n14(s, _state);
   17164             :         }
   17165           0 :         if( ae_maxint(n1, n2, _state)==15 )
   17166             :         {
   17167           0 :             result = mannwhitneyu_utbln10n15(s, _state);
   17168             :         }
   17169           0 :         if( ae_maxint(n1, n2, _state)>15 )
   17170             :         {
   17171           0 :             f0 = mannwhitneyu_utbln10n15(s, _state);
   17172           0 :             f1 = mannwhitneyu_utbln10n30(s, _state);
   17173           0 :             f2 = mannwhitneyu_utbln10n100(s, _state);
   17174           0 :             result = mannwhitneyu_uninterpolate(f0, f1, f2, ae_maxint(n1, n2, _state), _state);
   17175             :         }
   17176           0 :         return result;
   17177             :     }
   17178             :     
   17179             :     /*
   17180             :      * N1=11, N2 = 11, 12, ...
   17181             :      */
   17182           0 :     if( ae_minint(n1, n2, _state)==11 )
   17183             :     {
   17184           0 :         if( ae_maxint(n1, n2, _state)==11 )
   17185             :         {
   17186           0 :             result = mannwhitneyu_utbln11n11(s, _state);
   17187             :         }
   17188           0 :         if( ae_maxint(n1, n2, _state)==12 )
   17189             :         {
   17190           0 :             result = mannwhitneyu_utbln11n12(s, _state);
   17191             :         }
   17192           0 :         if( ae_maxint(n1, n2, _state)==13 )
   17193             :         {
   17194           0 :             result = mannwhitneyu_utbln11n13(s, _state);
   17195             :         }
   17196           0 :         if( ae_maxint(n1, n2, _state)==14 )
   17197             :         {
   17198           0 :             result = mannwhitneyu_utbln11n14(s, _state);
   17199             :         }
   17200           0 :         if( ae_maxint(n1, n2, _state)==15 )
   17201             :         {
   17202           0 :             result = mannwhitneyu_utbln11n15(s, _state);
   17203             :         }
   17204           0 :         if( ae_maxint(n1, n2, _state)>15 )
   17205             :         {
   17206           0 :             f0 = mannwhitneyu_utbln11n15(s, _state);
   17207           0 :             f1 = mannwhitneyu_utbln11n30(s, _state);
   17208           0 :             f2 = mannwhitneyu_utbln11n100(s, _state);
   17209           0 :             result = mannwhitneyu_uninterpolate(f0, f1, f2, ae_maxint(n1, n2, _state), _state);
   17210             :         }
   17211           0 :         return result;
   17212             :     }
   17213             :     
   17214             :     /*
   17215             :      * N1=12, N2 = 12, 13, ...
   17216             :      */
   17217           0 :     if( ae_minint(n1, n2, _state)==12 )
   17218             :     {
   17219           0 :         if( ae_maxint(n1, n2, _state)==12 )
   17220             :         {
   17221           0 :             result = mannwhitneyu_utbln12n12(s, _state);
   17222             :         }
   17223           0 :         if( ae_maxint(n1, n2, _state)==13 )
   17224             :         {
   17225           0 :             result = mannwhitneyu_utbln12n13(s, _state);
   17226             :         }
   17227           0 :         if( ae_maxint(n1, n2, _state)==14 )
   17228             :         {
   17229           0 :             result = mannwhitneyu_utbln12n14(s, _state);
   17230             :         }
   17231           0 :         if( ae_maxint(n1, n2, _state)==15 )
   17232             :         {
   17233           0 :             result = mannwhitneyu_utbln12n15(s, _state);
   17234             :         }
   17235           0 :         if( ae_maxint(n1, n2, _state)>15 )
   17236             :         {
   17237           0 :             f0 = mannwhitneyu_utbln12n15(s, _state);
   17238           0 :             f1 = mannwhitneyu_utbln12n30(s, _state);
   17239           0 :             f2 = mannwhitneyu_utbln12n100(s, _state);
   17240           0 :             result = mannwhitneyu_uninterpolate(f0, f1, f2, ae_maxint(n1, n2, _state), _state);
   17241             :         }
   17242           0 :         return result;
   17243             :     }
   17244             :     
   17245             :     /*
   17246             :      * N1=13, N2 = 13, 14, ...
   17247             :      */
   17248           0 :     if( ae_minint(n1, n2, _state)==13 )
   17249             :     {
   17250           0 :         if( ae_maxint(n1, n2, _state)==13 )
   17251             :         {
   17252           0 :             result = mannwhitneyu_utbln13n13(s, _state);
   17253             :         }
   17254           0 :         if( ae_maxint(n1, n2, _state)==14 )
   17255             :         {
   17256           0 :             result = mannwhitneyu_utbln13n14(s, _state);
   17257             :         }
   17258           0 :         if( ae_maxint(n1, n2, _state)==15 )
   17259             :         {
   17260           0 :             result = mannwhitneyu_utbln13n15(s, _state);
   17261             :         }
   17262           0 :         if( ae_maxint(n1, n2, _state)>15 )
   17263             :         {
   17264           0 :             f0 = mannwhitneyu_utbln13n15(s, _state);
   17265           0 :             f1 = mannwhitneyu_utbln13n30(s, _state);
   17266           0 :             f2 = mannwhitneyu_utbln13n100(s, _state);
   17267           0 :             result = mannwhitneyu_uninterpolate(f0, f1, f2, ae_maxint(n1, n2, _state), _state);
   17268             :         }
   17269           0 :         return result;
   17270             :     }
   17271             :     
   17272             :     /*
   17273             :      * N1=14, N2 = 14, 15, ...
   17274             :      */
   17275           0 :     if( ae_minint(n1, n2, _state)==14 )
   17276             :     {
   17277           0 :         if( ae_maxint(n1, n2, _state)==14 )
   17278             :         {
   17279           0 :             result = mannwhitneyu_utbln14n14(s, _state);
   17280             :         }
   17281           0 :         if( ae_maxint(n1, n2, _state)==15 )
   17282             :         {
   17283           0 :             result = mannwhitneyu_utbln14n15(s, _state);
   17284             :         }
   17285           0 :         if( ae_maxint(n1, n2, _state)>15 )
   17286             :         {
   17287           0 :             f0 = mannwhitneyu_utbln14n15(s, _state);
   17288           0 :             f1 = mannwhitneyu_utbln14n30(s, _state);
   17289           0 :             f2 = mannwhitneyu_utbln14n100(s, _state);
   17290           0 :             result = mannwhitneyu_uninterpolate(f0, f1, f2, ae_maxint(n1, n2, _state), _state);
   17291             :         }
   17292           0 :         return result;
   17293             :     }
   17294             :     
   17295             :     /*
   17296             :      * N1 >= 15, N2 >= 15
   17297             :      */
   17298           0 :     if( ae_fp_greater(s,(double)(4)) )
   17299             :     {
   17300           0 :         s = (double)(4);
   17301             :     }
   17302           0 :     if( ae_fp_less(s,(double)(3)) )
   17303             :     {
   17304           0 :         s0 = 0.000000e+00;
   17305           0 :         f0 = mannwhitneyu_usigma000(n1, n2, _state);
   17306           0 :         s1 = 7.500000e-01;
   17307           0 :         f1 = mannwhitneyu_usigma075(n1, n2, _state);
   17308           0 :         s2 = 1.500000e+00;
   17309           0 :         f2 = mannwhitneyu_usigma150(n1, n2, _state);
   17310           0 :         s3 = 2.250000e+00;
   17311           0 :         f3 = mannwhitneyu_usigma225(n1, n2, _state);
   17312           0 :         s4 = 3.000000e+00;
   17313           0 :         f4 = mannwhitneyu_usigma300(n1, n2, _state);
   17314           0 :         f1 = ((s-s0)*f1-(s-s1)*f0)/(s1-s0);
   17315           0 :         f2 = ((s-s0)*f2-(s-s2)*f0)/(s2-s0);
   17316           0 :         f3 = ((s-s0)*f3-(s-s3)*f0)/(s3-s0);
   17317           0 :         f4 = ((s-s0)*f4-(s-s4)*f0)/(s4-s0);
   17318           0 :         f2 = ((s-s1)*f2-(s-s2)*f1)/(s2-s1);
   17319           0 :         f3 = ((s-s1)*f3-(s-s3)*f1)/(s3-s1);
   17320           0 :         f4 = ((s-s1)*f4-(s-s4)*f1)/(s4-s1);
   17321           0 :         f3 = ((s-s2)*f3-(s-s3)*f2)/(s3-s2);
   17322           0 :         f4 = ((s-s2)*f4-(s-s4)*f2)/(s4-s2);
   17323           0 :         f4 = ((s-s3)*f4-(s-s4)*f3)/(s4-s3);
   17324           0 :         result = f4;
   17325             :     }
   17326             :     else
   17327             :     {
   17328           0 :         s0 = 3.000000e+00;
   17329           0 :         f0 = mannwhitneyu_usigma300(n1, n2, _state);
   17330           0 :         s1 = 3.333333e+00;
   17331           0 :         f1 = mannwhitneyu_usigma333(n1, n2, _state);
   17332           0 :         s2 = 3.666667e+00;
   17333           0 :         f2 = mannwhitneyu_usigma367(n1, n2, _state);
   17334           0 :         s3 = 4.000000e+00;
   17335           0 :         f3 = mannwhitneyu_usigma400(n1, n2, _state);
   17336           0 :         f1 = ((s-s0)*f1-(s-s1)*f0)/(s1-s0);
   17337           0 :         f2 = ((s-s0)*f2-(s-s2)*f0)/(s2-s0);
   17338           0 :         f3 = ((s-s0)*f3-(s-s3)*f0)/(s3-s0);
   17339           0 :         f2 = ((s-s1)*f2-(s-s2)*f1)/(s2-s1);
   17340           0 :         f3 = ((s-s1)*f3-(s-s3)*f1)/(s3-s1);
   17341           0 :         f3 = ((s-s2)*f3-(s-s3)*f2)/(s3-s2);
   17342           0 :         result = f3;
   17343             :     }
   17344           0 :     return result;
   17345             : }
   17346             : 
   17347             : 
   17348             : #endif
   17349             : #if defined(AE_COMPILE_JARQUEBERA) || !defined(AE_PARTIAL_BUILD)
   17350             : 
   17351             : 
   17352             : /*************************************************************************
   17353             : Jarque-Bera test
   17354             : 
   17355             : This test checks hypotheses about the fact that a  given  sample  X  is  a
   17356             : sample of normal random variable.
   17357             : 
   17358             : Requirements:
   17359             :     * the number of elements in the sample is not less than 5.
   17360             : 
   17361             : Input parameters:
   17362             :     X   -   sample. Array whose index goes from 0 to N-1.
   17363             :     N   -   size of the sample. N>=5
   17364             : 
   17365             : Output parameters:
   17366             :     P           -   p-value for the test
   17367             : 
   17368             : Accuracy of the approximation used (5<=N<=1951):
   17369             : 
   17370             : p-value             relative error (5<=N<=1951)
   17371             : [1, 0.1]            < 1%
   17372             : [0.1, 0.01]         < 2%
   17373             : [0.01, 0.001]       < 6%
   17374             : [0.001, 0]          wasn't measured
   17375             : 
   17376             : For N>1951 accuracy wasn't measured but it shouldn't be sharply  different
   17377             : from table values.
   17378             : 
   17379             :   -- ALGLIB --
   17380             :      Copyright 09.04.2007 by Bochkanov Sergey
   17381             : *************************************************************************/
   17382           0 : void jarqueberatest(/* Real    */ ae_vector* x,
   17383             :      ae_int_t n,
   17384             :      double* p,
   17385             :      ae_state *_state)
   17386             : {
   17387             :     double s;
   17388             : 
   17389           0 :     *p = 0;
   17390             : 
   17391             :     
   17392             :     /*
   17393             :      * N is too small
   17394             :      */
   17395           0 :     if( n<5 )
   17396             :     {
   17397           0 :         *p = 1.0;
   17398           0 :         return;
   17399             :     }
   17400             :     
   17401             :     /*
   17402             :      * N is large enough
   17403             :      */
   17404           0 :     jarquebera_jarqueberastatistic(x, n, &s, _state);
   17405           0 :     *p = jarquebera_jarqueberaapprox(n, s, _state);
   17406             : }
   17407             : 
   17408             : 
   17409           0 : static void jarquebera_jarqueberastatistic(/* Real    */ ae_vector* x,
   17410             :      ae_int_t n,
   17411             :      double* s,
   17412             :      ae_state *_state)
   17413             : {
   17414             :     ae_int_t i;
   17415             :     double v;
   17416             :     double v1;
   17417             :     double v2;
   17418             :     double stddev;
   17419             :     double mean;
   17420             :     double variance;
   17421             :     double skewness;
   17422             :     double kurtosis;
   17423             : 
   17424           0 :     *s = 0;
   17425             : 
   17426           0 :     mean = (double)(0);
   17427           0 :     variance = (double)(0);
   17428           0 :     skewness = (double)(0);
   17429           0 :     kurtosis = (double)(0);
   17430           0 :     stddev = (double)(0);
   17431           0 :     ae_assert(n>1, "Assertion failed", _state);
   17432             :     
   17433             :     /*
   17434             :      * Mean
   17435             :      */
   17436           0 :     for(i=0; i<=n-1; i++)
   17437             :     {
   17438           0 :         mean = mean+x->ptr.p_double[i];
   17439             :     }
   17440           0 :     mean = mean/n;
   17441             :     
   17442             :     /*
   17443             :      * Variance (using corrected two-pass algorithm)
   17444             :      */
   17445           0 :     if( n!=1 )
   17446             :     {
   17447           0 :         v1 = (double)(0);
   17448           0 :         for(i=0; i<=n-1; i++)
   17449             :         {
   17450           0 :             v1 = v1+ae_sqr(x->ptr.p_double[i]-mean, _state);
   17451             :         }
   17452           0 :         v2 = (double)(0);
   17453           0 :         for(i=0; i<=n-1; i++)
   17454             :         {
   17455           0 :             v2 = v2+(x->ptr.p_double[i]-mean);
   17456             :         }
   17457           0 :         v2 = ae_sqr(v2, _state)/n;
   17458           0 :         variance = (v1-v2)/(n-1);
   17459           0 :         if( ae_fp_less(variance,(double)(0)) )
   17460             :         {
   17461           0 :             variance = (double)(0);
   17462             :         }
   17463           0 :         stddev = ae_sqrt(variance, _state);
   17464             :     }
   17465             :     
   17466             :     /*
   17467             :      * Skewness and kurtosis
   17468             :      */
   17469           0 :     if( ae_fp_neq(stddev,(double)(0)) )
   17470             :     {
   17471           0 :         for(i=0; i<=n-1; i++)
   17472             :         {
   17473           0 :             v = (x->ptr.p_double[i]-mean)/stddev;
   17474           0 :             v2 = ae_sqr(v, _state);
   17475           0 :             skewness = skewness+v2*v;
   17476           0 :             kurtosis = kurtosis+ae_sqr(v2, _state);
   17477             :         }
   17478           0 :         skewness = skewness/n;
   17479           0 :         kurtosis = kurtosis/n-3;
   17480             :     }
   17481             :     
   17482             :     /*
   17483             :      * Statistic
   17484             :      */
   17485           0 :     *s = (double)n/(double)6*(ae_sqr(skewness, _state)+ae_sqr(kurtosis, _state)/4);
   17486           0 : }
   17487             : 
   17488             : 
   17489           0 : static double jarquebera_jarqueberaapprox(ae_int_t n,
   17490             :      double s,
   17491             :      ae_state *_state)
   17492             : {
   17493             :     ae_frame _frame_block;
   17494             :     ae_vector vx;
   17495             :     ae_vector vy;
   17496             :     ae_matrix ctbl;
   17497             :     double t1;
   17498             :     double t2;
   17499             :     double t3;
   17500             :     double t;
   17501             :     double f1;
   17502             :     double f2;
   17503             :     double f3;
   17504             :     double f12;
   17505             :     double f23;
   17506             :     double x;
   17507             :     double result;
   17508             : 
   17509           0 :     ae_frame_make(_state, &_frame_block);
   17510           0 :     memset(&vx, 0, sizeof(vx));
   17511           0 :     memset(&vy, 0, sizeof(vy));
   17512           0 :     memset(&ctbl, 0, sizeof(ctbl));
   17513           0 :     ae_vector_init(&vx, 0, DT_REAL, _state, ae_true);
   17514           0 :     ae_vector_init(&vy, 0, DT_REAL, _state, ae_true);
   17515           0 :     ae_matrix_init(&ctbl, 0, 0, DT_REAL, _state, ae_true);
   17516             : 
   17517           0 :     result = (double)(1);
   17518           0 :     x = s;
   17519           0 :     if( n<5 )
   17520             :     {
   17521           0 :         ae_frame_leave(_state);
   17522           0 :         return result;
   17523             :     }
   17524             :     
   17525             :     /*
   17526             :      * N = 5..20 are tabulated
   17527             :      */
   17528           0 :     if( n>=5&&n<=20 )
   17529             :     {
   17530           0 :         if( n==5 )
   17531             :         {
   17532           0 :             result = ae_exp(jarquebera_jbtbl5(x, _state), _state);
   17533             :         }
   17534           0 :         if( n==6 )
   17535             :         {
   17536           0 :             result = ae_exp(jarquebera_jbtbl6(x, _state), _state);
   17537             :         }
   17538           0 :         if( n==7 )
   17539             :         {
   17540           0 :             result = ae_exp(jarquebera_jbtbl7(x, _state), _state);
   17541             :         }
   17542           0 :         if( n==8 )
   17543             :         {
   17544           0 :             result = ae_exp(jarquebera_jbtbl8(x, _state), _state);
   17545             :         }
   17546           0 :         if( n==9 )
   17547             :         {
   17548           0 :             result = ae_exp(jarquebera_jbtbl9(x, _state), _state);
   17549             :         }
   17550           0 :         if( n==10 )
   17551             :         {
   17552           0 :             result = ae_exp(jarquebera_jbtbl10(x, _state), _state);
   17553             :         }
   17554           0 :         if( n==11 )
   17555             :         {
   17556           0 :             result = ae_exp(jarquebera_jbtbl11(x, _state), _state);
   17557             :         }
   17558           0 :         if( n==12 )
   17559             :         {
   17560           0 :             result = ae_exp(jarquebera_jbtbl12(x, _state), _state);
   17561             :         }
   17562           0 :         if( n==13 )
   17563             :         {
   17564           0 :             result = ae_exp(jarquebera_jbtbl13(x, _state), _state);
   17565             :         }
   17566           0 :         if( n==14 )
   17567             :         {
   17568           0 :             result = ae_exp(jarquebera_jbtbl14(x, _state), _state);
   17569             :         }
   17570           0 :         if( n==15 )
   17571             :         {
   17572           0 :             result = ae_exp(jarquebera_jbtbl15(x, _state), _state);
   17573             :         }
   17574           0 :         if( n==16 )
   17575             :         {
   17576           0 :             result = ae_exp(jarquebera_jbtbl16(x, _state), _state);
   17577             :         }
   17578           0 :         if( n==17 )
   17579             :         {
   17580           0 :             result = ae_exp(jarquebera_jbtbl17(x, _state), _state);
   17581             :         }
   17582           0 :         if( n==18 )
   17583             :         {
   17584           0 :             result = ae_exp(jarquebera_jbtbl18(x, _state), _state);
   17585             :         }
   17586           0 :         if( n==19 )
   17587             :         {
   17588           0 :             result = ae_exp(jarquebera_jbtbl19(x, _state), _state);
   17589             :         }
   17590           0 :         if( n==20 )
   17591             :         {
   17592           0 :             result = ae_exp(jarquebera_jbtbl20(x, _state), _state);
   17593             :         }
   17594           0 :         ae_frame_leave(_state);
   17595           0 :         return result;
   17596             :     }
   17597             :     
   17598             :     /*
   17599             :      * N = 20, 30, 50 are tabulated.
   17600             :      * In-between values are interpolated
   17601             :      * using interpolating polynomial of the second degree.
   17602             :      */
   17603           0 :     if( n>20&&n<=50 )
   17604             :     {
   17605           0 :         t1 = -1.0/20.0;
   17606           0 :         t2 = -1.0/30.0;
   17607           0 :         t3 = -1.0/50.0;
   17608           0 :         t = -1.0/n;
   17609           0 :         f1 = jarquebera_jbtbl20(x, _state);
   17610           0 :         f2 = jarquebera_jbtbl30(x, _state);
   17611           0 :         f3 = jarquebera_jbtbl50(x, _state);
   17612           0 :         f12 = ((t-t2)*f1+(t1-t)*f2)/(t1-t2);
   17613           0 :         f23 = ((t-t3)*f2+(t2-t)*f3)/(t2-t3);
   17614           0 :         result = ((t-t3)*f12+(t1-t)*f23)/(t1-t3);
   17615           0 :         if( ae_fp_greater(result,(double)(0)) )
   17616             :         {
   17617           0 :             result = (double)(0);
   17618             :         }
   17619           0 :         result = ae_exp(result, _state);
   17620           0 :         ae_frame_leave(_state);
   17621           0 :         return result;
   17622             :     }
   17623             :     
   17624             :     /*
   17625             :      * N = 50, 65, 100 are tabulated.
   17626             :      * In-between values are interpolated
   17627             :      * using interpolating polynomial of the second degree.
   17628             :      */
   17629           0 :     if( n>50&&n<=100 )
   17630             :     {
   17631           0 :         t1 = -1.0/50.0;
   17632           0 :         t2 = -1.0/65.0;
   17633           0 :         t3 = -1.0/100.0;
   17634           0 :         t = -1.0/n;
   17635           0 :         f1 = jarquebera_jbtbl50(x, _state);
   17636           0 :         f2 = jarquebera_jbtbl65(x, _state);
   17637           0 :         f3 = jarquebera_jbtbl100(x, _state);
   17638           0 :         f12 = ((t-t2)*f1+(t1-t)*f2)/(t1-t2);
   17639           0 :         f23 = ((t-t3)*f2+(t2-t)*f3)/(t2-t3);
   17640           0 :         result = ((t-t3)*f12+(t1-t)*f23)/(t1-t3);
   17641           0 :         if( ae_fp_greater(result,(double)(0)) )
   17642             :         {
   17643           0 :             result = (double)(0);
   17644             :         }
   17645           0 :         result = ae_exp(result, _state);
   17646           0 :         ae_frame_leave(_state);
   17647           0 :         return result;
   17648             :     }
   17649             :     
   17650             :     /*
   17651             :      * N = 100, 130, 200 are tabulated.
   17652             :      * In-between values are interpolated
   17653             :      * using interpolating polynomial of the second degree.
   17654             :      */
   17655           0 :     if( n>100&&n<=200 )
   17656             :     {
   17657           0 :         t1 = -1.0/100.0;
   17658           0 :         t2 = -1.0/130.0;
   17659           0 :         t3 = -1.0/200.0;
   17660           0 :         t = -1.0/n;
   17661           0 :         f1 = jarquebera_jbtbl100(x, _state);
   17662           0 :         f2 = jarquebera_jbtbl130(x, _state);
   17663           0 :         f3 = jarquebera_jbtbl200(x, _state);
   17664           0 :         f12 = ((t-t2)*f1+(t1-t)*f2)/(t1-t2);
   17665           0 :         f23 = ((t-t3)*f2+(t2-t)*f3)/(t2-t3);
   17666           0 :         result = ((t-t3)*f12+(t1-t)*f23)/(t1-t3);
   17667           0 :         if( ae_fp_greater(result,(double)(0)) )
   17668             :         {
   17669           0 :             result = (double)(0);
   17670             :         }
   17671           0 :         result = ae_exp(result, _state);
   17672           0 :         ae_frame_leave(_state);
   17673           0 :         return result;
   17674             :     }
   17675             :     
   17676             :     /*
   17677             :      * N = 200, 301, 501 are tabulated.
   17678             :      * In-between values are interpolated
   17679             :      * using interpolating polynomial of the second degree.
   17680             :      */
   17681           0 :     if( n>200&&n<=501 )
   17682             :     {
   17683           0 :         t1 = -1.0/200.0;
   17684           0 :         t2 = -1.0/301.0;
   17685           0 :         t3 = -1.0/501.0;
   17686           0 :         t = -1.0/n;
   17687           0 :         f1 = jarquebera_jbtbl200(x, _state);
   17688           0 :         f2 = jarquebera_jbtbl301(x, _state);
   17689           0 :         f3 = jarquebera_jbtbl501(x, _state);
   17690           0 :         f12 = ((t-t2)*f1+(t1-t)*f2)/(t1-t2);
   17691           0 :         f23 = ((t-t3)*f2+(t2-t)*f3)/(t2-t3);
   17692           0 :         result = ((t-t3)*f12+(t1-t)*f23)/(t1-t3);
   17693           0 :         if( ae_fp_greater(result,(double)(0)) )
   17694             :         {
   17695           0 :             result = (double)(0);
   17696             :         }
   17697           0 :         result = ae_exp(result, _state);
   17698           0 :         ae_frame_leave(_state);
   17699           0 :         return result;
   17700             :     }
   17701             :     
   17702             :     /*
   17703             :      * N = 501, 701, 1401 are tabulated.
   17704             :      * In-between values are interpolated
   17705             :      * using interpolating polynomial of the second degree.
   17706             :      */
   17707           0 :     if( n>501&&n<=1401 )
   17708             :     {
   17709           0 :         t1 = -1.0/501.0;
   17710           0 :         t2 = -1.0/701.0;
   17711           0 :         t3 = -1.0/1401.0;
   17712           0 :         t = -1.0/n;
   17713           0 :         f1 = jarquebera_jbtbl501(x, _state);
   17714           0 :         f2 = jarquebera_jbtbl701(x, _state);
   17715           0 :         f3 = jarquebera_jbtbl1401(x, _state);
   17716           0 :         f12 = ((t-t2)*f1+(t1-t)*f2)/(t1-t2);
   17717           0 :         f23 = ((t-t3)*f2+(t2-t)*f3)/(t2-t3);
   17718           0 :         result = ((t-t3)*f12+(t1-t)*f23)/(t1-t3);
   17719           0 :         if( ae_fp_greater(result,(double)(0)) )
   17720             :         {
   17721           0 :             result = (double)(0);
   17722             :         }
   17723           0 :         result = ae_exp(result, _state);
   17724           0 :         ae_frame_leave(_state);
   17725           0 :         return result;
   17726             :     }
   17727             :     
   17728             :     /*
   17729             :      * Asymptotic expansion
   17730             :      */
   17731           0 :     if( n>1401 )
   17732             :     {
   17733           0 :         result = -0.5*x+(jarquebera_jbtbl1401(x, _state)+0.5*x)*ae_sqrt((double)1401/(double)n, _state);
   17734           0 :         if( ae_fp_greater(result,(double)(0)) )
   17735             :         {
   17736           0 :             result = (double)(0);
   17737             :         }
   17738           0 :         result = ae_exp(result, _state);
   17739           0 :         ae_frame_leave(_state);
   17740           0 :         return result;
   17741             :     }
   17742           0 :     ae_frame_leave(_state);
   17743           0 :     return result;
   17744             : }
   17745             : 
   17746             : 
   17747           0 : static double jarquebera_jbtbl5(double s, ae_state *_state)
   17748             : {
   17749             :     double x;
   17750             :     double tj;
   17751             :     double tj1;
   17752             :     double result;
   17753             : 
   17754             : 
   17755           0 :     result = (double)(0);
   17756           0 :     if( ae_fp_less_eq(s,0.4000) )
   17757             :     {
   17758           0 :         x = 2*(s-0.000000)/0.400000-1;
   17759           0 :         tj = (double)(1);
   17760           0 :         tj1 = x;
   17761           0 :         jarquebera_jbcheb(x, -1.097885e-20, &tj, &tj1, &result, _state);
   17762           0 :         jarquebera_jbcheb(x, -2.854501e-20, &tj, &tj1, &result, _state);
   17763           0 :         jarquebera_jbcheb(x, -1.756616e-20, &tj, &tj1, &result, _state);
   17764           0 :         if( ae_fp_greater(result,(double)(0)) )
   17765             :         {
   17766           0 :             result = (double)(0);
   17767             :         }
   17768           0 :         return result;
   17769             :     }
   17770           0 :     if( ae_fp_less_eq(s,1.1000) )
   17771             :     {
   17772           0 :         x = 2*(s-0.400000)/0.700000-1;
   17773           0 :         tj = (double)(1);
   17774           0 :         tj1 = x;
   17775           0 :         jarquebera_jbcheb(x, -1.324545e+00, &tj, &tj1, &result, _state);
   17776           0 :         jarquebera_jbcheb(x, -1.075941e+00, &tj, &tj1, &result, _state);
   17777           0 :         jarquebera_jbcheb(x, -9.772272e-01, &tj, &tj1, &result, _state);
   17778           0 :         jarquebera_jbcheb(x, 3.175686e-01, &tj, &tj1, &result, _state);
   17779           0 :         jarquebera_jbcheb(x, -1.576162e-01, &tj, &tj1, &result, _state);
   17780           0 :         jarquebera_jbcheb(x, 1.126861e-01, &tj, &tj1, &result, _state);
   17781           0 :         jarquebera_jbcheb(x, -3.434425e-02, &tj, &tj1, &result, _state);
   17782           0 :         jarquebera_jbcheb(x, -2.790359e-01, &tj, &tj1, &result, _state);
   17783           0 :         jarquebera_jbcheb(x, 2.809178e-02, &tj, &tj1, &result, _state);
   17784           0 :         jarquebera_jbcheb(x, -5.479704e-01, &tj, &tj1, &result, _state);
   17785           0 :         jarquebera_jbcheb(x, 3.717040e-02, &tj, &tj1, &result, _state);
   17786           0 :         jarquebera_jbcheb(x, -5.294170e-01, &tj, &tj1, &result, _state);
   17787           0 :         jarquebera_jbcheb(x, 2.880632e-02, &tj, &tj1, &result, _state);
   17788           0 :         jarquebera_jbcheb(x, -3.023344e-01, &tj, &tj1, &result, _state);
   17789           0 :         jarquebera_jbcheb(x, 1.601531e-02, &tj, &tj1, &result, _state);
   17790           0 :         jarquebera_jbcheb(x, -7.920403e-02, &tj, &tj1, &result, _state);
   17791           0 :         if( ae_fp_greater(result,(double)(0)) )
   17792             :         {
   17793           0 :             result = (double)(0);
   17794             :         }
   17795           0 :         return result;
   17796             :     }
   17797           0 :     result = -5.188419e+02*(s-1.100000e+00)-4.767297e+00;
   17798           0 :     return result;
   17799             : }
   17800             : 
   17801             : 
   17802           0 : static double jarquebera_jbtbl6(double s, ae_state *_state)
   17803             : {
   17804             :     double x;
   17805             :     double tj;
   17806             :     double tj1;
   17807             :     double result;
   17808             : 
   17809             : 
   17810           0 :     result = (double)(0);
   17811           0 :     if( ae_fp_less_eq(s,0.2500) )
   17812             :     {
   17813           0 :         x = 2*(s-0.000000)/0.250000-1;
   17814           0 :         tj = (double)(1);
   17815           0 :         tj1 = x;
   17816           0 :         jarquebera_jbcheb(x, -2.274707e-04, &tj, &tj1, &result, _state);
   17817           0 :         jarquebera_jbcheb(x, -5.700471e-04, &tj, &tj1, &result, _state);
   17818           0 :         jarquebera_jbcheb(x, -3.425764e-04, &tj, &tj1, &result, _state);
   17819           0 :         if( ae_fp_greater(result,(double)(0)) )
   17820             :         {
   17821           0 :             result = (double)(0);
   17822             :         }
   17823           0 :         return result;
   17824             :     }
   17825           0 :     if( ae_fp_less_eq(s,1.3000) )
   17826             :     {
   17827           0 :         x = 2*(s-0.250000)/1.050000-1;
   17828           0 :         tj = (double)(1);
   17829           0 :         tj1 = x;
   17830           0 :         jarquebera_jbcheb(x, -1.339000e+00, &tj, &tj1, &result, _state);
   17831           0 :         jarquebera_jbcheb(x, -2.011104e+00, &tj, &tj1, &result, _state);
   17832           0 :         jarquebera_jbcheb(x, -8.168177e-01, &tj, &tj1, &result, _state);
   17833           0 :         jarquebera_jbcheb(x, -1.085666e-01, &tj, &tj1, &result, _state);
   17834           0 :         jarquebera_jbcheb(x, 7.738606e-02, &tj, &tj1, &result, _state);
   17835           0 :         jarquebera_jbcheb(x, 7.022876e-02, &tj, &tj1, &result, _state);
   17836           0 :         jarquebera_jbcheb(x, 3.462402e-02, &tj, &tj1, &result, _state);
   17837           0 :         jarquebera_jbcheb(x, 6.908270e-03, &tj, &tj1, &result, _state);
   17838           0 :         jarquebera_jbcheb(x, -8.230772e-03, &tj, &tj1, &result, _state);
   17839           0 :         jarquebera_jbcheb(x, -1.006996e-02, &tj, &tj1, &result, _state);
   17840           0 :         jarquebera_jbcheb(x, -5.410222e-03, &tj, &tj1, &result, _state);
   17841           0 :         jarquebera_jbcheb(x, -2.893768e-03, &tj, &tj1, &result, _state);
   17842           0 :         jarquebera_jbcheb(x, 8.114564e-04, &tj, &tj1, &result, _state);
   17843           0 :         if( ae_fp_greater(result,(double)(0)) )
   17844             :         {
   17845           0 :             result = (double)(0);
   17846             :         }
   17847           0 :         return result;
   17848             :     }
   17849           0 :     if( ae_fp_less_eq(s,1.8500) )
   17850             :     {
   17851           0 :         x = 2*(s-1.300000)/0.550000-1;
   17852           0 :         tj = (double)(1);
   17853           0 :         tj1 = x;
   17854           0 :         jarquebera_jbcheb(x, -6.794311e+00, &tj, &tj1, &result, _state);
   17855           0 :         jarquebera_jbcheb(x, -3.578700e+00, &tj, &tj1, &result, _state);
   17856           0 :         jarquebera_jbcheb(x, -1.394664e+00, &tj, &tj1, &result, _state);
   17857           0 :         jarquebera_jbcheb(x, -7.928290e-01, &tj, &tj1, &result, _state);
   17858           0 :         jarquebera_jbcheb(x, -4.813273e-01, &tj, &tj1, &result, _state);
   17859           0 :         jarquebera_jbcheb(x, -3.076063e-01, &tj, &tj1, &result, _state);
   17860           0 :         jarquebera_jbcheb(x, -1.835380e-01, &tj, &tj1, &result, _state);
   17861           0 :         jarquebera_jbcheb(x, -1.013013e-01, &tj, &tj1, &result, _state);
   17862           0 :         jarquebera_jbcheb(x, -5.058903e-02, &tj, &tj1, &result, _state);
   17863           0 :         jarquebera_jbcheb(x, -1.856915e-02, &tj, &tj1, &result, _state);
   17864           0 :         jarquebera_jbcheb(x, -6.710887e-03, &tj, &tj1, &result, _state);
   17865           0 :         if( ae_fp_greater(result,(double)(0)) )
   17866             :         {
   17867           0 :             result = (double)(0);
   17868             :         }
   17869           0 :         return result;
   17870             :     }
   17871           0 :     result = -1.770029e+02*(s-1.850000e+00)-1.371015e+01;
   17872           0 :     return result;
   17873             : }
   17874             : 
   17875             : 
   17876           0 : static double jarquebera_jbtbl7(double s, ae_state *_state)
   17877             : {
   17878             :     double x;
   17879             :     double tj;
   17880             :     double tj1;
   17881             :     double result;
   17882             : 
   17883             : 
   17884           0 :     result = (double)(0);
   17885           0 :     if( ae_fp_less_eq(s,1.4000) )
   17886             :     {
   17887           0 :         x = 2*(s-0.000000)/1.400000-1;
   17888           0 :         tj = (double)(1);
   17889           0 :         tj1 = x;
   17890           0 :         jarquebera_jbcheb(x, -1.093681e+00, &tj, &tj1, &result, _state);
   17891           0 :         jarquebera_jbcheb(x, -1.695911e+00, &tj, &tj1, &result, _state);
   17892           0 :         jarquebera_jbcheb(x, -7.473192e-01, &tj, &tj1, &result, _state);
   17893           0 :         jarquebera_jbcheb(x, -1.203236e-01, &tj, &tj1, &result, _state);
   17894           0 :         jarquebera_jbcheb(x, 6.590379e-02, &tj, &tj1, &result, _state);
   17895           0 :         jarquebera_jbcheb(x, 6.291876e-02, &tj, &tj1, &result, _state);
   17896           0 :         jarquebera_jbcheb(x, 3.132007e-02, &tj, &tj1, &result, _state);
   17897           0 :         jarquebera_jbcheb(x, 9.411147e-03, &tj, &tj1, &result, _state);
   17898           0 :         jarquebera_jbcheb(x, -1.180067e-03, &tj, &tj1, &result, _state);
   17899           0 :         jarquebera_jbcheb(x, -3.487610e-03, &tj, &tj1, &result, _state);
   17900           0 :         jarquebera_jbcheb(x, -2.436561e-03, &tj, &tj1, &result, _state);
   17901           0 :         if( ae_fp_greater(result,(double)(0)) )
   17902             :         {
   17903           0 :             result = (double)(0);
   17904             :         }
   17905           0 :         return result;
   17906             :     }
   17907           0 :     if( ae_fp_less_eq(s,3.0000) )
   17908             :     {
   17909           0 :         x = 2*(s-1.400000)/1.600000-1;
   17910           0 :         tj = (double)(1);
   17911           0 :         tj1 = x;
   17912           0 :         jarquebera_jbcheb(x, -5.947854e+00, &tj, &tj1, &result, _state);
   17913           0 :         jarquebera_jbcheb(x, -2.772675e+00, &tj, &tj1, &result, _state);
   17914           0 :         jarquebera_jbcheb(x, -4.707912e-01, &tj, &tj1, &result, _state);
   17915           0 :         jarquebera_jbcheb(x, -1.691171e-01, &tj, &tj1, &result, _state);
   17916           0 :         jarquebera_jbcheb(x, -4.132795e-02, &tj, &tj1, &result, _state);
   17917           0 :         jarquebera_jbcheb(x, -1.481310e-02, &tj, &tj1, &result, _state);
   17918           0 :         jarquebera_jbcheb(x, 2.867536e-03, &tj, &tj1, &result, _state);
   17919           0 :         jarquebera_jbcheb(x, 8.772327e-04, &tj, &tj1, &result, _state);
   17920           0 :         jarquebera_jbcheb(x, 5.033387e-03, &tj, &tj1, &result, _state);
   17921           0 :         jarquebera_jbcheb(x, -1.378277e-03, &tj, &tj1, &result, _state);
   17922           0 :         jarquebera_jbcheb(x, -2.497964e-03, &tj, &tj1, &result, _state);
   17923           0 :         jarquebera_jbcheb(x, -3.636814e-03, &tj, &tj1, &result, _state);
   17924           0 :         jarquebera_jbcheb(x, -9.581640e-04, &tj, &tj1, &result, _state);
   17925           0 :         if( ae_fp_greater(result,(double)(0)) )
   17926             :         {
   17927           0 :             result = (double)(0);
   17928             :         }
   17929           0 :         return result;
   17930             :     }
   17931           0 :     if( ae_fp_less_eq(s,3.2000) )
   17932             :     {
   17933           0 :         x = 2*(s-3.000000)/0.200000-1;
   17934           0 :         tj = (double)(1);
   17935           0 :         tj1 = x;
   17936           0 :         jarquebera_jbcheb(x, -7.511008e+00, &tj, &tj1, &result, _state);
   17937           0 :         jarquebera_jbcheb(x, -8.140472e-01, &tj, &tj1, &result, _state);
   17938           0 :         jarquebera_jbcheb(x, 1.682053e+00, &tj, &tj1, &result, _state);
   17939           0 :         jarquebera_jbcheb(x, -2.568561e-02, &tj, &tj1, &result, _state);
   17940           0 :         jarquebera_jbcheb(x, -1.933930e+00, &tj, &tj1, &result, _state);
   17941           0 :         jarquebera_jbcheb(x, -8.140472e-01, &tj, &tj1, &result, _state);
   17942           0 :         jarquebera_jbcheb(x, -3.895025e+00, &tj, &tj1, &result, _state);
   17943           0 :         jarquebera_jbcheb(x, -8.140472e-01, &tj, &tj1, &result, _state);
   17944           0 :         jarquebera_jbcheb(x, -1.933930e+00, &tj, &tj1, &result, _state);
   17945           0 :         jarquebera_jbcheb(x, -2.568561e-02, &tj, &tj1, &result, _state);
   17946           0 :         jarquebera_jbcheb(x, 1.682053e+00, &tj, &tj1, &result, _state);
   17947           0 :         if( ae_fp_greater(result,(double)(0)) )
   17948             :         {
   17949           0 :             result = (double)(0);
   17950             :         }
   17951           0 :         return result;
   17952             :     }
   17953           0 :     result = -1.824116e+03*(s-3.200000e+00)-1.440330e+01;
   17954           0 :     return result;
   17955             : }
   17956             : 
   17957             : 
   17958           0 : static double jarquebera_jbtbl8(double s, ae_state *_state)
   17959             : {
   17960             :     double x;
   17961             :     double tj;
   17962             :     double tj1;
   17963             :     double result;
   17964             : 
   17965             : 
   17966           0 :     result = (double)(0);
   17967           0 :     if( ae_fp_less_eq(s,1.3000) )
   17968             :     {
   17969           0 :         x = 2*(s-0.000000)/1.300000-1;
   17970           0 :         tj = (double)(1);
   17971           0 :         tj1 = x;
   17972           0 :         jarquebera_jbcheb(x, -7.199015e-01, &tj, &tj1, &result, _state);
   17973           0 :         jarquebera_jbcheb(x, -1.095921e+00, &tj, &tj1, &result, _state);
   17974           0 :         jarquebera_jbcheb(x, -4.736828e-01, &tj, &tj1, &result, _state);
   17975           0 :         jarquebera_jbcheb(x, -1.047438e-01, &tj, &tj1, &result, _state);
   17976           0 :         jarquebera_jbcheb(x, -2.484320e-03, &tj, &tj1, &result, _state);
   17977           0 :         jarquebera_jbcheb(x, 7.937923e-03, &tj, &tj1, &result, _state);
   17978           0 :         jarquebera_jbcheb(x, 4.810470e-03, &tj, &tj1, &result, _state);
   17979           0 :         jarquebera_jbcheb(x, 2.139780e-03, &tj, &tj1, &result, _state);
   17980           0 :         jarquebera_jbcheb(x, 6.708443e-04, &tj, &tj1, &result, _state);
   17981           0 :         if( ae_fp_greater(result,(double)(0)) )
   17982             :         {
   17983           0 :             result = (double)(0);
   17984             :         }
   17985           0 :         return result;
   17986             :     }
   17987           0 :     if( ae_fp_less_eq(s,2.0000) )
   17988             :     {
   17989           0 :         x = 2*(s-1.300000)/0.700000-1;
   17990           0 :         tj = (double)(1);
   17991           0 :         tj1 = x;
   17992           0 :         jarquebera_jbcheb(x, -3.378966e+00, &tj, &tj1, &result, _state);
   17993           0 :         jarquebera_jbcheb(x, -7.802461e-01, &tj, &tj1, &result, _state);
   17994           0 :         jarquebera_jbcheb(x, 1.547593e-01, &tj, &tj1, &result, _state);
   17995           0 :         jarquebera_jbcheb(x, -6.241042e-02, &tj, &tj1, &result, _state);
   17996           0 :         jarquebera_jbcheb(x, 1.203274e-02, &tj, &tj1, &result, _state);
   17997           0 :         jarquebera_jbcheb(x, 5.201990e-03, &tj, &tj1, &result, _state);
   17998           0 :         jarquebera_jbcheb(x, -5.125597e-03, &tj, &tj1, &result, _state);
   17999           0 :         jarquebera_jbcheb(x, 1.584426e-03, &tj, &tj1, &result, _state);
   18000           0 :         jarquebera_jbcheb(x, 2.546069e-04, &tj, &tj1, &result, _state);
   18001           0 :         if( ae_fp_greater(result,(double)(0)) )
   18002             :         {
   18003           0 :             result = (double)(0);
   18004             :         }
   18005           0 :         return result;
   18006             :     }
   18007           0 :     if( ae_fp_less_eq(s,5.0000) )
   18008             :     {
   18009           0 :         x = 2*(s-2.000000)/3.000000-1;
   18010           0 :         tj = (double)(1);
   18011           0 :         tj1 = x;
   18012           0 :         jarquebera_jbcheb(x, -6.828366e+00, &tj, &tj1, &result, _state);
   18013           0 :         jarquebera_jbcheb(x, -3.137533e+00, &tj, &tj1, &result, _state);
   18014           0 :         jarquebera_jbcheb(x, -5.016671e-01, &tj, &tj1, &result, _state);
   18015           0 :         jarquebera_jbcheb(x, -1.745637e-01, &tj, &tj1, &result, _state);
   18016           0 :         jarquebera_jbcheb(x, -5.189801e-02, &tj, &tj1, &result, _state);
   18017           0 :         jarquebera_jbcheb(x, -1.621610e-02, &tj, &tj1, &result, _state);
   18018           0 :         jarquebera_jbcheb(x, -6.741122e-03, &tj, &tj1, &result, _state);
   18019           0 :         jarquebera_jbcheb(x, -4.516368e-03, &tj, &tj1, &result, _state);
   18020           0 :         jarquebera_jbcheb(x, 3.552085e-04, &tj, &tj1, &result, _state);
   18021           0 :         jarquebera_jbcheb(x, 2.787029e-03, &tj, &tj1, &result, _state);
   18022           0 :         jarquebera_jbcheb(x, 5.359774e-03, &tj, &tj1, &result, _state);
   18023           0 :         if( ae_fp_greater(result,(double)(0)) )
   18024             :         {
   18025           0 :             result = (double)(0);
   18026             :         }
   18027           0 :         return result;
   18028             :     }
   18029           0 :     result = -5.087028e+00*(s-5.000000e+00)-1.071300e+01;
   18030           0 :     return result;
   18031             : }
   18032             : 
   18033             : 
   18034           0 : static double jarquebera_jbtbl9(double s, ae_state *_state)
   18035             : {
   18036             :     double x;
   18037             :     double tj;
   18038             :     double tj1;
   18039             :     double result;
   18040             : 
   18041             : 
   18042           0 :     result = (double)(0);
   18043           0 :     if( ae_fp_less_eq(s,1.3000) )
   18044             :     {
   18045           0 :         x = 2*(s-0.000000)/1.300000-1;
   18046           0 :         tj = (double)(1);
   18047           0 :         tj1 = x;
   18048           0 :         jarquebera_jbcheb(x, -6.279320e-01, &tj, &tj1, &result, _state);
   18049           0 :         jarquebera_jbcheb(x, -9.277151e-01, &tj, &tj1, &result, _state);
   18050           0 :         jarquebera_jbcheb(x, -3.669339e-01, &tj, &tj1, &result, _state);
   18051           0 :         jarquebera_jbcheb(x, -7.086149e-02, &tj, &tj1, &result, _state);
   18052           0 :         jarquebera_jbcheb(x, -1.333816e-03, &tj, &tj1, &result, _state);
   18053           0 :         jarquebera_jbcheb(x, 3.871249e-03, &tj, &tj1, &result, _state);
   18054           0 :         jarquebera_jbcheb(x, 2.007048e-03, &tj, &tj1, &result, _state);
   18055           0 :         jarquebera_jbcheb(x, 7.482245e-04, &tj, &tj1, &result, _state);
   18056           0 :         jarquebera_jbcheb(x, 2.355615e-04, &tj, &tj1, &result, _state);
   18057           0 :         if( ae_fp_greater(result,(double)(0)) )
   18058             :         {
   18059           0 :             result = (double)(0);
   18060             :         }
   18061           0 :         return result;
   18062             :     }
   18063           0 :     if( ae_fp_less_eq(s,2.0000) )
   18064             :     {
   18065           0 :         x = 2*(s-1.300000)/0.700000-1;
   18066           0 :         tj = (double)(1);
   18067           0 :         tj1 = x;
   18068           0 :         jarquebera_jbcheb(x, -2.981430e+00, &tj, &tj1, &result, _state);
   18069           0 :         jarquebera_jbcheb(x, -7.972248e-01, &tj, &tj1, &result, _state);
   18070           0 :         jarquebera_jbcheb(x, 1.747737e-01, &tj, &tj1, &result, _state);
   18071           0 :         jarquebera_jbcheb(x, -3.808530e-02, &tj, &tj1, &result, _state);
   18072           0 :         jarquebera_jbcheb(x, -7.888305e-03, &tj, &tj1, &result, _state);
   18073           0 :         jarquebera_jbcheb(x, 9.001302e-03, &tj, &tj1, &result, _state);
   18074           0 :         jarquebera_jbcheb(x, -1.378767e-03, &tj, &tj1, &result, _state);
   18075           0 :         jarquebera_jbcheb(x, -1.108510e-03, &tj, &tj1, &result, _state);
   18076           0 :         jarquebera_jbcheb(x, 5.915372e-04, &tj, &tj1, &result, _state);
   18077           0 :         if( ae_fp_greater(result,(double)(0)) )
   18078             :         {
   18079           0 :             result = (double)(0);
   18080             :         }
   18081           0 :         return result;
   18082             :     }
   18083           0 :     if( ae_fp_less_eq(s,7.0000) )
   18084             :     {
   18085           0 :         x = 2*(s-2.000000)/5.000000-1;
   18086           0 :         tj = (double)(1);
   18087           0 :         tj1 = x;
   18088           0 :         jarquebera_jbcheb(x, -6.387463e+00, &tj, &tj1, &result, _state);
   18089           0 :         jarquebera_jbcheb(x, -2.845231e+00, &tj, &tj1, &result, _state);
   18090           0 :         jarquebera_jbcheb(x, -1.809956e-01, &tj, &tj1, &result, _state);
   18091           0 :         jarquebera_jbcheb(x, -7.543461e-02, &tj, &tj1, &result, _state);
   18092           0 :         jarquebera_jbcheb(x, -4.880397e-03, &tj, &tj1, &result, _state);
   18093           0 :         jarquebera_jbcheb(x, -1.160074e-02, &tj, &tj1, &result, _state);
   18094           0 :         jarquebera_jbcheb(x, -7.356527e-03, &tj, &tj1, &result, _state);
   18095           0 :         jarquebera_jbcheb(x, -4.394428e-03, &tj, &tj1, &result, _state);
   18096           0 :         jarquebera_jbcheb(x, 9.619892e-04, &tj, &tj1, &result, _state);
   18097           0 :         jarquebera_jbcheb(x, -2.758763e-04, &tj, &tj1, &result, _state);
   18098           0 :         jarquebera_jbcheb(x, 4.790977e-05, &tj, &tj1, &result, _state);
   18099           0 :         if( ae_fp_greater(result,(double)(0)) )
   18100             :         {
   18101           0 :             result = (double)(0);
   18102             :         }
   18103           0 :         return result;
   18104             :     }
   18105           0 :     result = -2.020952e+00*(s-7.000000e+00)-9.516623e+00;
   18106           0 :     return result;
   18107             : }
   18108             : 
   18109             : 
   18110           0 : static double jarquebera_jbtbl10(double s, ae_state *_state)
   18111             : {
   18112             :     double x;
   18113             :     double tj;
   18114             :     double tj1;
   18115             :     double result;
   18116             : 
   18117             : 
   18118           0 :     result = (double)(0);
   18119           0 :     if( ae_fp_less_eq(s,1.2000) )
   18120             :     {
   18121           0 :         x = 2*(s-0.000000)/1.200000-1;
   18122           0 :         tj = (double)(1);
   18123           0 :         tj1 = x;
   18124           0 :         jarquebera_jbcheb(x, -4.590993e-01, &tj, &tj1, &result, _state);
   18125           0 :         jarquebera_jbcheb(x, -6.562730e-01, &tj, &tj1, &result, _state);
   18126           0 :         jarquebera_jbcheb(x, -2.353934e-01, &tj, &tj1, &result, _state);
   18127           0 :         jarquebera_jbcheb(x, -4.069933e-02, &tj, &tj1, &result, _state);
   18128           0 :         jarquebera_jbcheb(x, -1.849151e-03, &tj, &tj1, &result, _state);
   18129           0 :         jarquebera_jbcheb(x, 8.931406e-04, &tj, &tj1, &result, _state);
   18130           0 :         jarquebera_jbcheb(x, 3.636295e-04, &tj, &tj1, &result, _state);
   18131           0 :         jarquebera_jbcheb(x, 1.178340e-05, &tj, &tj1, &result, _state);
   18132           0 :         jarquebera_jbcheb(x, -8.917749e-05, &tj, &tj1, &result, _state);
   18133           0 :         if( ae_fp_greater(result,(double)(0)) )
   18134             :         {
   18135           0 :             result = (double)(0);
   18136             :         }
   18137           0 :         return result;
   18138             :     }
   18139           0 :     if( ae_fp_less_eq(s,2.0000) )
   18140             :     {
   18141           0 :         x = 2*(s-1.200000)/0.800000-1;
   18142           0 :         tj = (double)(1);
   18143           0 :         tj1 = x;
   18144           0 :         jarquebera_jbcheb(x, -2.537658e+00, &tj, &tj1, &result, _state);
   18145           0 :         jarquebera_jbcheb(x, -9.962401e-01, &tj, &tj1, &result, _state);
   18146           0 :         jarquebera_jbcheb(x, 1.838715e-01, &tj, &tj1, &result, _state);
   18147           0 :         jarquebera_jbcheb(x, 1.055792e-02, &tj, &tj1, &result, _state);
   18148           0 :         jarquebera_jbcheb(x, -2.580316e-02, &tj, &tj1, &result, _state);
   18149           0 :         jarquebera_jbcheb(x, 1.781701e-03, &tj, &tj1, &result, _state);
   18150           0 :         jarquebera_jbcheb(x, 3.770362e-03, &tj, &tj1, &result, _state);
   18151           0 :         jarquebera_jbcheb(x, -4.838983e-04, &tj, &tj1, &result, _state);
   18152           0 :         jarquebera_jbcheb(x, -6.999052e-04, &tj, &tj1, &result, _state);
   18153           0 :         if( ae_fp_greater(result,(double)(0)) )
   18154             :         {
   18155           0 :             result = (double)(0);
   18156             :         }
   18157           0 :         return result;
   18158             :     }
   18159           0 :     if( ae_fp_less_eq(s,7.0000) )
   18160             :     {
   18161           0 :         x = 2*(s-2.000000)/5.000000-1;
   18162           0 :         tj = (double)(1);
   18163           0 :         tj1 = x;
   18164           0 :         jarquebera_jbcheb(x, -5.337524e+00, &tj, &tj1, &result, _state);
   18165           0 :         jarquebera_jbcheb(x, -1.877029e+00, &tj, &tj1, &result, _state);
   18166           0 :         jarquebera_jbcheb(x, 4.734650e-02, &tj, &tj1, &result, _state);
   18167           0 :         jarquebera_jbcheb(x, -4.249254e-02, &tj, &tj1, &result, _state);
   18168           0 :         jarquebera_jbcheb(x, 3.320250e-03, &tj, &tj1, &result, _state);
   18169           0 :         jarquebera_jbcheb(x, -6.432266e-03, &tj, &tj1, &result, _state);
   18170           0 :         if( ae_fp_greater(result,(double)(0)) )
   18171             :         {
   18172           0 :             result = (double)(0);
   18173             :         }
   18174           0 :         return result;
   18175             :     }
   18176           0 :     result = -8.711035e-01*(s-7.000000e+00)-7.212811e+00;
   18177           0 :     return result;
   18178             : }
   18179             : 
   18180             : 
   18181           0 : static double jarquebera_jbtbl11(double s, ae_state *_state)
   18182             : {
   18183             :     double x;
   18184             :     double tj;
   18185             :     double tj1;
   18186             :     double result;
   18187             : 
   18188             : 
   18189           0 :     result = (double)(0);
   18190           0 :     if( ae_fp_less_eq(s,1.2000) )
   18191             :     {
   18192           0 :         x = 2*(s-0.000000)/1.200000-1;
   18193           0 :         tj = (double)(1);
   18194           0 :         tj1 = x;
   18195           0 :         jarquebera_jbcheb(x, -4.339517e-01, &tj, &tj1, &result, _state);
   18196           0 :         jarquebera_jbcheb(x, -6.051558e-01, &tj, &tj1, &result, _state);
   18197           0 :         jarquebera_jbcheb(x, -2.000992e-01, &tj, &tj1, &result, _state);
   18198           0 :         jarquebera_jbcheb(x, -3.022547e-02, &tj, &tj1, &result, _state);
   18199           0 :         jarquebera_jbcheb(x, -9.808401e-04, &tj, &tj1, &result, _state);
   18200           0 :         jarquebera_jbcheb(x, 5.592870e-04, &tj, &tj1, &result, _state);
   18201           0 :         jarquebera_jbcheb(x, 3.575081e-04, &tj, &tj1, &result, _state);
   18202           0 :         jarquebera_jbcheb(x, 2.086173e-04, &tj, &tj1, &result, _state);
   18203           0 :         jarquebera_jbcheb(x, 6.089011e-05, &tj, &tj1, &result, _state);
   18204           0 :         if( ae_fp_greater(result,(double)(0)) )
   18205             :         {
   18206           0 :             result = (double)(0);
   18207             :         }
   18208           0 :         return result;
   18209             :     }
   18210           0 :     if( ae_fp_less_eq(s,2.2500) )
   18211             :     {
   18212           0 :         x = 2*(s-1.200000)/1.050000-1;
   18213           0 :         tj = (double)(1);
   18214           0 :         tj1 = x;
   18215           0 :         jarquebera_jbcheb(x, -2.523221e+00, &tj, &tj1, &result, _state);
   18216           0 :         jarquebera_jbcheb(x, -1.068388e+00, &tj, &tj1, &result, _state);
   18217           0 :         jarquebera_jbcheb(x, 2.179661e-01, &tj, &tj1, &result, _state);
   18218           0 :         jarquebera_jbcheb(x, -1.555524e-03, &tj, &tj1, &result, _state);
   18219           0 :         jarquebera_jbcheb(x, -3.238964e-02, &tj, &tj1, &result, _state);
   18220           0 :         jarquebera_jbcheb(x, 7.364320e-03, &tj, &tj1, &result, _state);
   18221           0 :         jarquebera_jbcheb(x, 4.895771e-03, &tj, &tj1, &result, _state);
   18222           0 :         jarquebera_jbcheb(x, -1.762774e-03, &tj, &tj1, &result, _state);
   18223           0 :         jarquebera_jbcheb(x, -8.201340e-04, &tj, &tj1, &result, _state);
   18224           0 :         if( ae_fp_greater(result,(double)(0)) )
   18225             :         {
   18226           0 :             result = (double)(0);
   18227             :         }
   18228           0 :         return result;
   18229             :     }
   18230           0 :     if( ae_fp_less_eq(s,8.0000) )
   18231             :     {
   18232           0 :         x = 2*(s-2.250000)/5.750000-1;
   18233           0 :         tj = (double)(1);
   18234           0 :         tj1 = x;
   18235           0 :         jarquebera_jbcheb(x, -5.212179e+00, &tj, &tj1, &result, _state);
   18236           0 :         jarquebera_jbcheb(x, -1.684579e+00, &tj, &tj1, &result, _state);
   18237           0 :         jarquebera_jbcheb(x, 8.299519e-02, &tj, &tj1, &result, _state);
   18238           0 :         jarquebera_jbcheb(x, -3.606261e-02, &tj, &tj1, &result, _state);
   18239           0 :         jarquebera_jbcheb(x, 7.310869e-03, &tj, &tj1, &result, _state);
   18240           0 :         jarquebera_jbcheb(x, -3.320115e-03, &tj, &tj1, &result, _state);
   18241           0 :         if( ae_fp_greater(result,(double)(0)) )
   18242             :         {
   18243           0 :             result = (double)(0);
   18244             :         }
   18245           0 :         return result;
   18246             :     }
   18247           0 :     result = -5.715445e-01*(s-8.000000e+00)-6.845834e+00;
   18248           0 :     return result;
   18249             : }
   18250             : 
   18251             : 
   18252           0 : static double jarquebera_jbtbl12(double s, ae_state *_state)
   18253             : {
   18254             :     double x;
   18255             :     double tj;
   18256             :     double tj1;
   18257             :     double result;
   18258             : 
   18259             : 
   18260           0 :     result = (double)(0);
   18261           0 :     if( ae_fp_less_eq(s,1.0000) )
   18262             :     {
   18263           0 :         x = 2*(s-0.000000)/1.000000-1;
   18264           0 :         tj = (double)(1);
   18265           0 :         tj1 = x;
   18266           0 :         jarquebera_jbcheb(x, -2.736742e-01, &tj, &tj1, &result, _state);
   18267           0 :         jarquebera_jbcheb(x, -3.657836e-01, &tj, &tj1, &result, _state);
   18268           0 :         jarquebera_jbcheb(x, -1.047209e-01, &tj, &tj1, &result, _state);
   18269           0 :         jarquebera_jbcheb(x, -1.319599e-02, &tj, &tj1, &result, _state);
   18270           0 :         jarquebera_jbcheb(x, -5.545631e-04, &tj, &tj1, &result, _state);
   18271           0 :         jarquebera_jbcheb(x, 9.280445e-05, &tj, &tj1, &result, _state);
   18272           0 :         jarquebera_jbcheb(x, 2.815679e-05, &tj, &tj1, &result, _state);
   18273           0 :         jarquebera_jbcheb(x, -2.213519e-05, &tj, &tj1, &result, _state);
   18274           0 :         jarquebera_jbcheb(x, 1.256838e-05, &tj, &tj1, &result, _state);
   18275           0 :         if( ae_fp_greater(result,(double)(0)) )
   18276             :         {
   18277           0 :             result = (double)(0);
   18278             :         }
   18279           0 :         return result;
   18280             :     }
   18281           0 :     if( ae_fp_less_eq(s,3.0000) )
   18282             :     {
   18283           0 :         x = 2*(s-1.000000)/2.000000-1;
   18284           0 :         tj = (double)(1);
   18285           0 :         tj1 = x;
   18286           0 :         jarquebera_jbcheb(x, -2.573947e+00, &tj, &tj1, &result, _state);
   18287           0 :         jarquebera_jbcheb(x, -1.515287e+00, &tj, &tj1, &result, _state);
   18288           0 :         jarquebera_jbcheb(x, 3.611880e-01, &tj, &tj1, &result, _state);
   18289           0 :         jarquebera_jbcheb(x, -3.271311e-02, &tj, &tj1, &result, _state);
   18290           0 :         jarquebera_jbcheb(x, -6.495815e-02, &tj, &tj1, &result, _state);
   18291           0 :         jarquebera_jbcheb(x, 4.141186e-02, &tj, &tj1, &result, _state);
   18292           0 :         jarquebera_jbcheb(x, 7.180886e-04, &tj, &tj1, &result, _state);
   18293           0 :         jarquebera_jbcheb(x, -1.388211e-02, &tj, &tj1, &result, _state);
   18294           0 :         jarquebera_jbcheb(x, 4.890761e-03, &tj, &tj1, &result, _state);
   18295           0 :         jarquebera_jbcheb(x, 3.233175e-03, &tj, &tj1, &result, _state);
   18296           0 :         jarquebera_jbcheb(x, -2.946156e-03, &tj, &tj1, &result, _state);
   18297           0 :         if( ae_fp_greater(result,(double)(0)) )
   18298             :         {
   18299           0 :             result = (double)(0);
   18300             :         }
   18301           0 :         return result;
   18302             :     }
   18303           0 :     if( ae_fp_less_eq(s,12.0000) )
   18304             :     {
   18305           0 :         x = 2*(s-3.000000)/9.000000-1;
   18306           0 :         tj = (double)(1);
   18307           0 :         tj1 = x;
   18308           0 :         jarquebera_jbcheb(x, -5.947819e+00, &tj, &tj1, &result, _state);
   18309           0 :         jarquebera_jbcheb(x, -2.034157e+00, &tj, &tj1, &result, _state);
   18310           0 :         jarquebera_jbcheb(x, 6.878986e-02, &tj, &tj1, &result, _state);
   18311           0 :         jarquebera_jbcheb(x, -4.078603e-02, &tj, &tj1, &result, _state);
   18312           0 :         jarquebera_jbcheb(x, 6.990977e-03, &tj, &tj1, &result, _state);
   18313           0 :         jarquebera_jbcheb(x, -2.866215e-03, &tj, &tj1, &result, _state);
   18314           0 :         jarquebera_jbcheb(x, 3.897866e-03, &tj, &tj1, &result, _state);
   18315           0 :         jarquebera_jbcheb(x, 2.512252e-03, &tj, &tj1, &result, _state);
   18316           0 :         jarquebera_jbcheb(x, 2.073743e-03, &tj, &tj1, &result, _state);
   18317           0 :         jarquebera_jbcheb(x, 3.022621e-03, &tj, &tj1, &result, _state);
   18318           0 :         jarquebera_jbcheb(x, 1.501343e-03, &tj, &tj1, &result, _state);
   18319           0 :         if( ae_fp_greater(result,(double)(0)) )
   18320             :         {
   18321           0 :             result = (double)(0);
   18322             :         }
   18323           0 :         return result;
   18324             :     }
   18325           0 :     result = -2.877243e-01*(s-1.200000e+01)-7.936839e+00;
   18326           0 :     return result;
   18327             : }
   18328             : 
   18329             : 
   18330           0 : static double jarquebera_jbtbl13(double s, ae_state *_state)
   18331             : {
   18332             :     double x;
   18333             :     double tj;
   18334             :     double tj1;
   18335             :     double result;
   18336             : 
   18337             : 
   18338           0 :     result = (double)(0);
   18339           0 :     if( ae_fp_less_eq(s,1.0000) )
   18340             :     {
   18341           0 :         x = 2*(s-0.000000)/1.000000-1;
   18342           0 :         tj = (double)(1);
   18343           0 :         tj1 = x;
   18344           0 :         jarquebera_jbcheb(x, -2.713276e-01, &tj, &tj1, &result, _state);
   18345           0 :         jarquebera_jbcheb(x, -3.557541e-01, &tj, &tj1, &result, _state);
   18346           0 :         jarquebera_jbcheb(x, -9.459092e-02, &tj, &tj1, &result, _state);
   18347           0 :         jarquebera_jbcheb(x, -1.044145e-02, &tj, &tj1, &result, _state);
   18348           0 :         jarquebera_jbcheb(x, -2.546132e-04, &tj, &tj1, &result, _state);
   18349           0 :         jarquebera_jbcheb(x, 1.002374e-04, &tj, &tj1, &result, _state);
   18350           0 :         jarquebera_jbcheb(x, 2.349456e-05, &tj, &tj1, &result, _state);
   18351           0 :         jarquebera_jbcheb(x, -7.025669e-05, &tj, &tj1, &result, _state);
   18352           0 :         jarquebera_jbcheb(x, -1.590242e-05, &tj, &tj1, &result, _state);
   18353           0 :         if( ae_fp_greater(result,(double)(0)) )
   18354             :         {
   18355           0 :             result = (double)(0);
   18356             :         }
   18357           0 :         return result;
   18358             :     }
   18359           0 :     if( ae_fp_less_eq(s,3.0000) )
   18360             :     {
   18361           0 :         x = 2*(s-1.000000)/2.000000-1;
   18362           0 :         tj = (double)(1);
   18363           0 :         tj1 = x;
   18364           0 :         jarquebera_jbcheb(x, -2.454383e+00, &tj, &tj1, &result, _state);
   18365           0 :         jarquebera_jbcheb(x, -1.467539e+00, &tj, &tj1, &result, _state);
   18366           0 :         jarquebera_jbcheb(x, 3.270774e-01, &tj, &tj1, &result, _state);
   18367           0 :         jarquebera_jbcheb(x, -8.075763e-03, &tj, &tj1, &result, _state);
   18368           0 :         jarquebera_jbcheb(x, -6.611647e-02, &tj, &tj1, &result, _state);
   18369           0 :         jarquebera_jbcheb(x, 2.990785e-02, &tj, &tj1, &result, _state);
   18370           0 :         jarquebera_jbcheb(x, 8.109212e-03, &tj, &tj1, &result, _state);
   18371           0 :         jarquebera_jbcheb(x, -1.135031e-02, &tj, &tj1, &result, _state);
   18372           0 :         jarquebera_jbcheb(x, 5.915919e-04, &tj, &tj1, &result, _state);
   18373           0 :         jarquebera_jbcheb(x, 3.522390e-03, &tj, &tj1, &result, _state);
   18374           0 :         jarquebera_jbcheb(x, -1.144701e-03, &tj, &tj1, &result, _state);
   18375           0 :         if( ae_fp_greater(result,(double)(0)) )
   18376             :         {
   18377           0 :             result = (double)(0);
   18378             :         }
   18379           0 :         return result;
   18380             :     }
   18381           0 :     if( ae_fp_less_eq(s,13.0000) )
   18382             :     {
   18383           0 :         x = 2*(s-3.000000)/10.000000-1;
   18384           0 :         tj = (double)(1);
   18385           0 :         tj1 = x;
   18386           0 :         jarquebera_jbcheb(x, -5.736127e+00, &tj, &tj1, &result, _state);
   18387           0 :         jarquebera_jbcheb(x, -1.920809e+00, &tj, &tj1, &result, _state);
   18388           0 :         jarquebera_jbcheb(x, 1.175858e-01, &tj, &tj1, &result, _state);
   18389           0 :         jarquebera_jbcheb(x, -4.002049e-02, &tj, &tj1, &result, _state);
   18390           0 :         jarquebera_jbcheb(x, 1.158966e-02, &tj, &tj1, &result, _state);
   18391           0 :         jarquebera_jbcheb(x, -3.157781e-03, &tj, &tj1, &result, _state);
   18392           0 :         jarquebera_jbcheb(x, 2.762172e-03, &tj, &tj1, &result, _state);
   18393           0 :         jarquebera_jbcheb(x, 5.780347e-04, &tj, &tj1, &result, _state);
   18394           0 :         jarquebera_jbcheb(x, -1.193310e-03, &tj, &tj1, &result, _state);
   18395           0 :         jarquebera_jbcheb(x, -2.442421e-05, &tj, &tj1, &result, _state);
   18396           0 :         jarquebera_jbcheb(x, 2.547756e-03, &tj, &tj1, &result, _state);
   18397           0 :         if( ae_fp_greater(result,(double)(0)) )
   18398             :         {
   18399           0 :             result = (double)(0);
   18400             :         }
   18401           0 :         return result;
   18402             :     }
   18403           0 :     result = -2.799944e-01*(s-1.300000e+01)-7.566269e+00;
   18404           0 :     return result;
   18405             : }
   18406             : 
   18407             : 
   18408           0 : static double jarquebera_jbtbl14(double s, ae_state *_state)
   18409             : {
   18410             :     double x;
   18411             :     double tj;
   18412             :     double tj1;
   18413             :     double result;
   18414             : 
   18415             : 
   18416           0 :     result = (double)(0);
   18417           0 :     if( ae_fp_less_eq(s,1.0000) )
   18418             :     {
   18419           0 :         x = 2*(s-0.000000)/1.000000-1;
   18420           0 :         tj = (double)(1);
   18421           0 :         tj1 = x;
   18422           0 :         jarquebera_jbcheb(x, -2.698527e-01, &tj, &tj1, &result, _state);
   18423           0 :         jarquebera_jbcheb(x, -3.479081e-01, &tj, &tj1, &result, _state);
   18424           0 :         jarquebera_jbcheb(x, -8.640733e-02, &tj, &tj1, &result, _state);
   18425           0 :         jarquebera_jbcheb(x, -8.466899e-03, &tj, &tj1, &result, _state);
   18426           0 :         jarquebera_jbcheb(x, -1.469485e-04, &tj, &tj1, &result, _state);
   18427           0 :         jarquebera_jbcheb(x, 2.150009e-05, &tj, &tj1, &result, _state);
   18428           0 :         jarquebera_jbcheb(x, 1.965975e-05, &tj, &tj1, &result, _state);
   18429           0 :         jarquebera_jbcheb(x, -4.710210e-05, &tj, &tj1, &result, _state);
   18430           0 :         jarquebera_jbcheb(x, -1.327808e-05, &tj, &tj1, &result, _state);
   18431           0 :         if( ae_fp_greater(result,(double)(0)) )
   18432             :         {
   18433           0 :             result = (double)(0);
   18434             :         }
   18435           0 :         return result;
   18436             :     }
   18437           0 :     if( ae_fp_less_eq(s,3.0000) )
   18438             :     {
   18439           0 :         x = 2*(s-1.000000)/2.000000-1;
   18440           0 :         tj = (double)(1);
   18441           0 :         tj1 = x;
   18442           0 :         jarquebera_jbcheb(x, -2.350359e+00, &tj, &tj1, &result, _state);
   18443           0 :         jarquebera_jbcheb(x, -1.421365e+00, &tj, &tj1, &result, _state);
   18444           0 :         jarquebera_jbcheb(x, 2.960468e-01, &tj, &tj1, &result, _state);
   18445           0 :         jarquebera_jbcheb(x, 1.149167e-02, &tj, &tj1, &result, _state);
   18446           0 :         jarquebera_jbcheb(x, -6.361109e-02, &tj, &tj1, &result, _state);
   18447           0 :         jarquebera_jbcheb(x, 1.976022e-02, &tj, &tj1, &result, _state);
   18448           0 :         jarquebera_jbcheb(x, 1.082700e-02, &tj, &tj1, &result, _state);
   18449           0 :         jarquebera_jbcheb(x, -8.563328e-03, &tj, &tj1, &result, _state);
   18450           0 :         jarquebera_jbcheb(x, -1.453123e-03, &tj, &tj1, &result, _state);
   18451           0 :         jarquebera_jbcheb(x, 2.917559e-03, &tj, &tj1, &result, _state);
   18452           0 :         jarquebera_jbcheb(x, -1.151067e-05, &tj, &tj1, &result, _state);
   18453           0 :         if( ae_fp_greater(result,(double)(0)) )
   18454             :         {
   18455           0 :             result = (double)(0);
   18456             :         }
   18457           0 :         return result;
   18458             :     }
   18459           0 :     if( ae_fp_less_eq(s,15.0000) )
   18460             :     {
   18461           0 :         x = 2*(s-3.000000)/12.000000-1;
   18462           0 :         tj = (double)(1);
   18463           0 :         tj1 = x;
   18464           0 :         jarquebera_jbcheb(x, -5.746892e+00, &tj, &tj1, &result, _state);
   18465           0 :         jarquebera_jbcheb(x, -2.010441e+00, &tj, &tj1, &result, _state);
   18466           0 :         jarquebera_jbcheb(x, 1.566146e-01, &tj, &tj1, &result, _state);
   18467           0 :         jarquebera_jbcheb(x, -5.129690e-02, &tj, &tj1, &result, _state);
   18468           0 :         jarquebera_jbcheb(x, 1.929724e-02, &tj, &tj1, &result, _state);
   18469           0 :         jarquebera_jbcheb(x, -2.524227e-03, &tj, &tj1, &result, _state);
   18470           0 :         jarquebera_jbcheb(x, 3.192933e-03, &tj, &tj1, &result, _state);
   18471           0 :         jarquebera_jbcheb(x, -4.254730e-04, &tj, &tj1, &result, _state);
   18472           0 :         jarquebera_jbcheb(x, 1.620685e-03, &tj, &tj1, &result, _state);
   18473           0 :         jarquebera_jbcheb(x, 7.289618e-04, &tj, &tj1, &result, _state);
   18474           0 :         jarquebera_jbcheb(x, -2.112350e-03, &tj, &tj1, &result, _state);
   18475           0 :         if( ae_fp_greater(result,(double)(0)) )
   18476             :         {
   18477           0 :             result = (double)(0);
   18478             :         }
   18479           0 :         return result;
   18480             :     }
   18481           0 :     result = -2.590621e-01*(s-1.500000e+01)-7.632238e+00;
   18482           0 :     return result;
   18483             : }
   18484             : 
   18485             : 
   18486           0 : static double jarquebera_jbtbl15(double s, ae_state *_state)
   18487             : {
   18488             :     double x;
   18489             :     double tj;
   18490             :     double tj1;
   18491             :     double result;
   18492             : 
   18493             : 
   18494           0 :     result = (double)(0);
   18495           0 :     if( ae_fp_less_eq(s,2.0000) )
   18496             :     {
   18497           0 :         x = 2*(s-0.000000)/2.000000-1;
   18498           0 :         tj = (double)(1);
   18499           0 :         tj1 = x;
   18500           0 :         jarquebera_jbcheb(x, -1.043660e+00, &tj, &tj1, &result, _state);
   18501           0 :         jarquebera_jbcheb(x, -1.361653e+00, &tj, &tj1, &result, _state);
   18502           0 :         jarquebera_jbcheb(x, -3.009497e-01, &tj, &tj1, &result, _state);
   18503           0 :         jarquebera_jbcheb(x, 4.951784e-02, &tj, &tj1, &result, _state);
   18504           0 :         jarquebera_jbcheb(x, 4.377903e-02, &tj, &tj1, &result, _state);
   18505           0 :         jarquebera_jbcheb(x, 1.003253e-02, &tj, &tj1, &result, _state);
   18506           0 :         jarquebera_jbcheb(x, -1.271309e-03, &tj, &tj1, &result, _state);
   18507           0 :         if( ae_fp_greater(result,(double)(0)) )
   18508             :         {
   18509           0 :             result = (double)(0);
   18510             :         }
   18511           0 :         return result;
   18512             :     }
   18513           0 :     if( ae_fp_less_eq(s,5.0000) )
   18514             :     {
   18515           0 :         x = 2*(s-2.000000)/3.000000-1;
   18516           0 :         tj = (double)(1);
   18517           0 :         tj1 = x;
   18518           0 :         jarquebera_jbcheb(x, -3.582778e+00, &tj, &tj1, &result, _state);
   18519           0 :         jarquebera_jbcheb(x, -8.349578e-01, &tj, &tj1, &result, _state);
   18520           0 :         jarquebera_jbcheb(x, 9.476514e-02, &tj, &tj1, &result, _state);
   18521           0 :         jarquebera_jbcheb(x, -2.717385e-02, &tj, &tj1, &result, _state);
   18522           0 :         jarquebera_jbcheb(x, 1.222591e-02, &tj, &tj1, &result, _state);
   18523           0 :         jarquebera_jbcheb(x, -6.635124e-03, &tj, &tj1, &result, _state);
   18524           0 :         jarquebera_jbcheb(x, 2.815993e-03, &tj, &tj1, &result, _state);
   18525           0 :         if( ae_fp_greater(result,(double)(0)) )
   18526             :         {
   18527           0 :             result = (double)(0);
   18528             :         }
   18529           0 :         return result;
   18530             :     }
   18531           0 :     if( ae_fp_less_eq(s,17.0000) )
   18532             :     {
   18533           0 :         x = 2*(s-5.000000)/12.000000-1;
   18534           0 :         tj = (double)(1);
   18535           0 :         tj1 = x;
   18536           0 :         jarquebera_jbcheb(x, -6.115476e+00, &tj, &tj1, &result, _state);
   18537           0 :         jarquebera_jbcheb(x, -1.655936e+00, &tj, &tj1, &result, _state);
   18538           0 :         jarquebera_jbcheb(x, 8.404310e-02, &tj, &tj1, &result, _state);
   18539           0 :         jarquebera_jbcheb(x, -2.663794e-02, &tj, &tj1, &result, _state);
   18540           0 :         jarquebera_jbcheb(x, 8.868618e-03, &tj, &tj1, &result, _state);
   18541           0 :         jarquebera_jbcheb(x, 1.381447e-03, &tj, &tj1, &result, _state);
   18542           0 :         jarquebera_jbcheb(x, 9.444801e-04, &tj, &tj1, &result, _state);
   18543           0 :         jarquebera_jbcheb(x, -1.581503e-04, &tj, &tj1, &result, _state);
   18544           0 :         jarquebera_jbcheb(x, -9.468696e-04, &tj, &tj1, &result, _state);
   18545           0 :         jarquebera_jbcheb(x, 1.728509e-03, &tj, &tj1, &result, _state);
   18546           0 :         jarquebera_jbcheb(x, 1.206470e-03, &tj, &tj1, &result, _state);
   18547           0 :         if( ae_fp_greater(result,(double)(0)) )
   18548             :         {
   18549           0 :             result = (double)(0);
   18550             :         }
   18551           0 :         return result;
   18552             :     }
   18553           0 :     result = -1.927937e-01*(s-1.700000e+01)-7.700983e+00;
   18554           0 :     return result;
   18555             : }
   18556             : 
   18557             : 
   18558           0 : static double jarquebera_jbtbl16(double s, ae_state *_state)
   18559             : {
   18560             :     double x;
   18561             :     double tj;
   18562             :     double tj1;
   18563             :     double result;
   18564             : 
   18565             : 
   18566           0 :     result = (double)(0);
   18567           0 :     if( ae_fp_less_eq(s,2.0000) )
   18568             :     {
   18569           0 :         x = 2*(s-0.000000)/2.000000-1;
   18570           0 :         tj = (double)(1);
   18571           0 :         tj1 = x;
   18572           0 :         jarquebera_jbcheb(x, -1.002570e+00, &tj, &tj1, &result, _state);
   18573           0 :         jarquebera_jbcheb(x, -1.298141e+00, &tj, &tj1, &result, _state);
   18574           0 :         jarquebera_jbcheb(x, -2.832803e-01, &tj, &tj1, &result, _state);
   18575           0 :         jarquebera_jbcheb(x, 3.877026e-02, &tj, &tj1, &result, _state);
   18576           0 :         jarquebera_jbcheb(x, 3.539436e-02, &tj, &tj1, &result, _state);
   18577           0 :         jarquebera_jbcheb(x, 8.439658e-03, &tj, &tj1, &result, _state);
   18578           0 :         jarquebera_jbcheb(x, -4.756911e-04, &tj, &tj1, &result, _state);
   18579           0 :         if( ae_fp_greater(result,(double)(0)) )
   18580             :         {
   18581           0 :             result = (double)(0);
   18582             :         }
   18583           0 :         return result;
   18584             :     }
   18585           0 :     if( ae_fp_less_eq(s,5.0000) )
   18586             :     {
   18587           0 :         x = 2*(s-2.000000)/3.000000-1;
   18588           0 :         tj = (double)(1);
   18589           0 :         tj1 = x;
   18590           0 :         jarquebera_jbcheb(x, -3.486198e+00, &tj, &tj1, &result, _state);
   18591           0 :         jarquebera_jbcheb(x, -8.242944e-01, &tj, &tj1, &result, _state);
   18592           0 :         jarquebera_jbcheb(x, 1.020002e-01, &tj, &tj1, &result, _state);
   18593           0 :         jarquebera_jbcheb(x, -3.130531e-02, &tj, &tj1, &result, _state);
   18594           0 :         jarquebera_jbcheb(x, 1.512373e-02, &tj, &tj1, &result, _state);
   18595           0 :         jarquebera_jbcheb(x, -8.054876e-03, &tj, &tj1, &result, _state);
   18596           0 :         jarquebera_jbcheb(x, 3.556839e-03, &tj, &tj1, &result, _state);
   18597           0 :         if( ae_fp_greater(result,(double)(0)) )
   18598             :         {
   18599           0 :             result = (double)(0);
   18600             :         }
   18601           0 :         return result;
   18602             :     }
   18603           0 :     if( ae_fp_less_eq(s,20.0000) )
   18604             :     {
   18605           0 :         x = 2*(s-5.000000)/15.000000-1;
   18606           0 :         tj = (double)(1);
   18607           0 :         tj1 = x;
   18608           0 :         jarquebera_jbcheb(x, -6.241608e+00, &tj, &tj1, &result, _state);
   18609           0 :         jarquebera_jbcheb(x, -1.832655e+00, &tj, &tj1, &result, _state);
   18610           0 :         jarquebera_jbcheb(x, 1.340545e-01, &tj, &tj1, &result, _state);
   18611           0 :         jarquebera_jbcheb(x, -3.361143e-02, &tj, &tj1, &result, _state);
   18612           0 :         jarquebera_jbcheb(x, 1.283219e-02, &tj, &tj1, &result, _state);
   18613           0 :         jarquebera_jbcheb(x, 3.484549e-03, &tj, &tj1, &result, _state);
   18614           0 :         jarquebera_jbcheb(x, 1.805968e-03, &tj, &tj1, &result, _state);
   18615           0 :         jarquebera_jbcheb(x, -2.057243e-03, &tj, &tj1, &result, _state);
   18616           0 :         jarquebera_jbcheb(x, -1.454439e-03, &tj, &tj1, &result, _state);
   18617           0 :         jarquebera_jbcheb(x, -2.177513e-03, &tj, &tj1, &result, _state);
   18618           0 :         jarquebera_jbcheb(x, -1.819209e-03, &tj, &tj1, &result, _state);
   18619           0 :         if( ae_fp_greater(result,(double)(0)) )
   18620             :         {
   18621           0 :             result = (double)(0);
   18622             :         }
   18623           0 :         return result;
   18624             :     }
   18625           0 :     result = -2.391580e-01*(s-2.000000e+01)-7.963205e+00;
   18626           0 :     return result;
   18627             : }
   18628             : 
   18629             : 
   18630           0 : static double jarquebera_jbtbl17(double s, ae_state *_state)
   18631             : {
   18632             :     double x;
   18633             :     double tj;
   18634             :     double tj1;
   18635             :     double result;
   18636             : 
   18637             : 
   18638           0 :     result = (double)(0);
   18639           0 :     if( ae_fp_less_eq(s,3.0000) )
   18640             :     {
   18641           0 :         x = 2*(s-0.000000)/3.000000-1;
   18642           0 :         tj = (double)(1);
   18643           0 :         tj1 = x;
   18644           0 :         jarquebera_jbcheb(x, -1.566973e+00, &tj, &tj1, &result, _state);
   18645           0 :         jarquebera_jbcheb(x, -1.810330e+00, &tj, &tj1, &result, _state);
   18646           0 :         jarquebera_jbcheb(x, -4.840039e-02, &tj, &tj1, &result, _state);
   18647           0 :         jarquebera_jbcheb(x, 2.337294e-01, &tj, &tj1, &result, _state);
   18648           0 :         jarquebera_jbcheb(x, -5.383549e-04, &tj, &tj1, &result, _state);
   18649           0 :         jarquebera_jbcheb(x, -5.556515e-02, &tj, &tj1, &result, _state);
   18650           0 :         jarquebera_jbcheb(x, -8.656965e-03, &tj, &tj1, &result, _state);
   18651           0 :         jarquebera_jbcheb(x, 1.404569e-02, &tj, &tj1, &result, _state);
   18652           0 :         jarquebera_jbcheb(x, 6.447867e-03, &tj, &tj1, &result, _state);
   18653           0 :         if( ae_fp_greater(result,(double)(0)) )
   18654             :         {
   18655           0 :             result = (double)(0);
   18656             :         }
   18657           0 :         return result;
   18658             :     }
   18659           0 :     if( ae_fp_less_eq(s,6.0000) )
   18660             :     {
   18661           0 :         x = 2*(s-3.000000)/3.000000-1;
   18662           0 :         tj = (double)(1);
   18663           0 :         tj1 = x;
   18664           0 :         jarquebera_jbcheb(x, -3.905684e+00, &tj, &tj1, &result, _state);
   18665           0 :         jarquebera_jbcheb(x, -6.222920e-01, &tj, &tj1, &result, _state);
   18666           0 :         jarquebera_jbcheb(x, 4.146667e-02, &tj, &tj1, &result, _state);
   18667           0 :         jarquebera_jbcheb(x, -4.809176e-03, &tj, &tj1, &result, _state);
   18668           0 :         jarquebera_jbcheb(x, 1.057028e-03, &tj, &tj1, &result, _state);
   18669           0 :         jarquebera_jbcheb(x, -1.211838e-04, &tj, &tj1, &result, _state);
   18670           0 :         jarquebera_jbcheb(x, -4.099683e-04, &tj, &tj1, &result, _state);
   18671           0 :         jarquebera_jbcheb(x, 1.161105e-04, &tj, &tj1, &result, _state);
   18672           0 :         jarquebera_jbcheb(x, 2.225465e-04, &tj, &tj1, &result, _state);
   18673           0 :         if( ae_fp_greater(result,(double)(0)) )
   18674             :         {
   18675           0 :             result = (double)(0);
   18676             :         }
   18677           0 :         return result;
   18678             :     }
   18679           0 :     if( ae_fp_less_eq(s,24.0000) )
   18680             :     {
   18681           0 :         x = 2*(s-6.000000)/18.000000-1;
   18682           0 :         tj = (double)(1);
   18683           0 :         tj1 = x;
   18684           0 :         jarquebera_jbcheb(x, -6.594282e+00, &tj, &tj1, &result, _state);
   18685           0 :         jarquebera_jbcheb(x, -1.917838e+00, &tj, &tj1, &result, _state);
   18686           0 :         jarquebera_jbcheb(x, 1.455980e-01, &tj, &tj1, &result, _state);
   18687           0 :         jarquebera_jbcheb(x, -2.999589e-02, &tj, &tj1, &result, _state);
   18688           0 :         jarquebera_jbcheb(x, 5.604263e-03, &tj, &tj1, &result, _state);
   18689           0 :         jarquebera_jbcheb(x, -3.484445e-03, &tj, &tj1, &result, _state);
   18690           0 :         jarquebera_jbcheb(x, -1.819937e-03, &tj, &tj1, &result, _state);
   18691           0 :         jarquebera_jbcheb(x, -2.930390e-03, &tj, &tj1, &result, _state);
   18692           0 :         jarquebera_jbcheb(x, 2.771761e-04, &tj, &tj1, &result, _state);
   18693           0 :         jarquebera_jbcheb(x, -6.232581e-04, &tj, &tj1, &result, _state);
   18694           0 :         jarquebera_jbcheb(x, -7.029083e-04, &tj, &tj1, &result, _state);
   18695           0 :         if( ae_fp_greater(result,(double)(0)) )
   18696             :         {
   18697           0 :             result = (double)(0);
   18698             :         }
   18699           0 :         return result;
   18700             :     }
   18701           0 :     result = -2.127771e-01*(s-2.400000e+01)-8.400197e+00;
   18702           0 :     return result;
   18703             : }
   18704             : 
   18705             : 
   18706           0 : static double jarquebera_jbtbl18(double s, ae_state *_state)
   18707             : {
   18708             :     double x;
   18709             :     double tj;
   18710             :     double tj1;
   18711             :     double result;
   18712             : 
   18713             : 
   18714           0 :     result = (double)(0);
   18715           0 :     if( ae_fp_less_eq(s,3.0000) )
   18716             :     {
   18717           0 :         x = 2*(s-0.000000)/3.000000-1;
   18718           0 :         tj = (double)(1);
   18719           0 :         tj1 = x;
   18720           0 :         jarquebera_jbcheb(x, -1.526802e+00, &tj, &tj1, &result, _state);
   18721           0 :         jarquebera_jbcheb(x, -1.762373e+00, &tj, &tj1, &result, _state);
   18722           0 :         jarquebera_jbcheb(x, -5.598890e-02, &tj, &tj1, &result, _state);
   18723           0 :         jarquebera_jbcheb(x, 2.189437e-01, &tj, &tj1, &result, _state);
   18724           0 :         jarquebera_jbcheb(x, 5.971721e-03, &tj, &tj1, &result, _state);
   18725           0 :         jarquebera_jbcheb(x, -4.823067e-02, &tj, &tj1, &result, _state);
   18726           0 :         jarquebera_jbcheb(x, -1.064501e-02, &tj, &tj1, &result, _state);
   18727           0 :         jarquebera_jbcheb(x, 1.014932e-02, &tj, &tj1, &result, _state);
   18728           0 :         jarquebera_jbcheb(x, 5.953513e-03, &tj, &tj1, &result, _state);
   18729           0 :         if( ae_fp_greater(result,(double)(0)) )
   18730             :         {
   18731           0 :             result = (double)(0);
   18732             :         }
   18733           0 :         return result;
   18734             :     }
   18735           0 :     if( ae_fp_less_eq(s,6.0000) )
   18736             :     {
   18737           0 :         x = 2*(s-3.000000)/3.000000-1;
   18738           0 :         tj = (double)(1);
   18739           0 :         tj1 = x;
   18740           0 :         jarquebera_jbcheb(x, -3.818669e+00, &tj, &tj1, &result, _state);
   18741           0 :         jarquebera_jbcheb(x, -6.070918e-01, &tj, &tj1, &result, _state);
   18742           0 :         jarquebera_jbcheb(x, 4.277196e-02, &tj, &tj1, &result, _state);
   18743           0 :         jarquebera_jbcheb(x, -4.879817e-03, &tj, &tj1, &result, _state);
   18744           0 :         jarquebera_jbcheb(x, 6.887357e-04, &tj, &tj1, &result, _state);
   18745           0 :         jarquebera_jbcheb(x, 1.638451e-05, &tj, &tj1, &result, _state);
   18746           0 :         jarquebera_jbcheb(x, 1.502800e-04, &tj, &tj1, &result, _state);
   18747           0 :         jarquebera_jbcheb(x, -3.165796e-05, &tj, &tj1, &result, _state);
   18748           0 :         jarquebera_jbcheb(x, 5.034960e-05, &tj, &tj1, &result, _state);
   18749           0 :         if( ae_fp_greater(result,(double)(0)) )
   18750             :         {
   18751           0 :             result = (double)(0);
   18752             :         }
   18753           0 :         return result;
   18754             :     }
   18755           0 :     if( ae_fp_less_eq(s,20.0000) )
   18756             :     {
   18757           0 :         x = 2*(s-6.000000)/14.000000-1;
   18758           0 :         tj = (double)(1);
   18759           0 :         tj1 = x;
   18760           0 :         jarquebera_jbcheb(x, -6.010656e+00, &tj, &tj1, &result, _state);
   18761           0 :         jarquebera_jbcheb(x, -1.496296e+00, &tj, &tj1, &result, _state);
   18762           0 :         jarquebera_jbcheb(x, 1.002227e-01, &tj, &tj1, &result, _state);
   18763           0 :         jarquebera_jbcheb(x, -2.338250e-02, &tj, &tj1, &result, _state);
   18764           0 :         jarquebera_jbcheb(x, 4.137036e-03, &tj, &tj1, &result, _state);
   18765           0 :         jarquebera_jbcheb(x, -2.586202e-03, &tj, &tj1, &result, _state);
   18766           0 :         jarquebera_jbcheb(x, -9.736384e-04, &tj, &tj1, &result, _state);
   18767           0 :         jarquebera_jbcheb(x, 1.332251e-03, &tj, &tj1, &result, _state);
   18768           0 :         jarquebera_jbcheb(x, 1.877982e-03, &tj, &tj1, &result, _state);
   18769           0 :         jarquebera_jbcheb(x, -1.160963e-05, &tj, &tj1, &result, _state);
   18770           0 :         jarquebera_jbcheb(x, -2.547247e-03, &tj, &tj1, &result, _state);
   18771           0 :         if( ae_fp_greater(result,(double)(0)) )
   18772             :         {
   18773           0 :             result = (double)(0);
   18774             :         }
   18775           0 :         return result;
   18776             :     }
   18777           0 :     result = -1.684623e-01*(s-2.000000e+01)-7.428883e+00;
   18778           0 :     return result;
   18779             : }
   18780             : 
   18781             : 
   18782           0 : static double jarquebera_jbtbl19(double s, ae_state *_state)
   18783             : {
   18784             :     double x;
   18785             :     double tj;
   18786             :     double tj1;
   18787             :     double result;
   18788             : 
   18789             : 
   18790           0 :     result = (double)(0);
   18791           0 :     if( ae_fp_less_eq(s,3.0000) )
   18792             :     {
   18793           0 :         x = 2*(s-0.000000)/3.000000-1;
   18794           0 :         tj = (double)(1);
   18795           0 :         tj1 = x;
   18796           0 :         jarquebera_jbcheb(x, -1.490213e+00, &tj, &tj1, &result, _state);
   18797           0 :         jarquebera_jbcheb(x, -1.719633e+00, &tj, &tj1, &result, _state);
   18798           0 :         jarquebera_jbcheb(x, -6.459123e-02, &tj, &tj1, &result, _state);
   18799           0 :         jarquebera_jbcheb(x, 2.034878e-01, &tj, &tj1, &result, _state);
   18800           0 :         jarquebera_jbcheb(x, 1.113868e-02, &tj, &tj1, &result, _state);
   18801           0 :         jarquebera_jbcheb(x, -4.030922e-02, &tj, &tj1, &result, _state);
   18802           0 :         jarquebera_jbcheb(x, -1.054022e-02, &tj, &tj1, &result, _state);
   18803           0 :         jarquebera_jbcheb(x, 7.525623e-03, &tj, &tj1, &result, _state);
   18804           0 :         jarquebera_jbcheb(x, 5.277360e-03, &tj, &tj1, &result, _state);
   18805           0 :         if( ae_fp_greater(result,(double)(0)) )
   18806             :         {
   18807           0 :             result = (double)(0);
   18808             :         }
   18809           0 :         return result;
   18810             :     }
   18811           0 :     if( ae_fp_less_eq(s,6.0000) )
   18812             :     {
   18813           0 :         x = 2*(s-3.000000)/3.000000-1;
   18814           0 :         tj = (double)(1);
   18815           0 :         tj1 = x;
   18816           0 :         jarquebera_jbcheb(x, -3.744750e+00, &tj, &tj1, &result, _state);
   18817           0 :         jarquebera_jbcheb(x, -5.977749e-01, &tj, &tj1, &result, _state);
   18818           0 :         jarquebera_jbcheb(x, 4.223716e-02, &tj, &tj1, &result, _state);
   18819           0 :         jarquebera_jbcheb(x, -5.363889e-03, &tj, &tj1, &result, _state);
   18820           0 :         jarquebera_jbcheb(x, 5.711774e-04, &tj, &tj1, &result, _state);
   18821           0 :         jarquebera_jbcheb(x, -5.557257e-04, &tj, &tj1, &result, _state);
   18822           0 :         jarquebera_jbcheb(x, 4.254794e-04, &tj, &tj1, &result, _state);
   18823           0 :         jarquebera_jbcheb(x, 9.034207e-05, &tj, &tj1, &result, _state);
   18824           0 :         jarquebera_jbcheb(x, 5.498107e-05, &tj, &tj1, &result, _state);
   18825           0 :         if( ae_fp_greater(result,(double)(0)) )
   18826             :         {
   18827           0 :             result = (double)(0);
   18828             :         }
   18829           0 :         return result;
   18830             :     }
   18831           0 :     if( ae_fp_less_eq(s,20.0000) )
   18832             :     {
   18833           0 :         x = 2*(s-6.000000)/14.000000-1;
   18834           0 :         tj = (double)(1);
   18835           0 :         tj1 = x;
   18836           0 :         jarquebera_jbcheb(x, -5.872768e+00, &tj, &tj1, &result, _state);
   18837           0 :         jarquebera_jbcheb(x, -1.430689e+00, &tj, &tj1, &result, _state);
   18838           0 :         jarquebera_jbcheb(x, 1.136575e-01, &tj, &tj1, &result, _state);
   18839           0 :         jarquebera_jbcheb(x, -1.726627e-02, &tj, &tj1, &result, _state);
   18840           0 :         jarquebera_jbcheb(x, 3.421110e-03, &tj, &tj1, &result, _state);
   18841           0 :         jarquebera_jbcheb(x, -1.581510e-03, &tj, &tj1, &result, _state);
   18842           0 :         jarquebera_jbcheb(x, -5.559520e-04, &tj, &tj1, &result, _state);
   18843           0 :         jarquebera_jbcheb(x, -6.838208e-04, &tj, &tj1, &result, _state);
   18844           0 :         jarquebera_jbcheb(x, 8.428839e-04, &tj, &tj1, &result, _state);
   18845           0 :         jarquebera_jbcheb(x, -7.170682e-04, &tj, &tj1, &result, _state);
   18846           0 :         jarquebera_jbcheb(x, -6.006647e-04, &tj, &tj1, &result, _state);
   18847           0 :         if( ae_fp_greater(result,(double)(0)) )
   18848             :         {
   18849           0 :             result = (double)(0);
   18850             :         }
   18851           0 :         return result;
   18852             :     }
   18853           0 :     result = -1.539373e-01*(s-2.000000e+01)-7.206941e+00;
   18854           0 :     return result;
   18855             : }
   18856             : 
   18857             : 
   18858           0 : static double jarquebera_jbtbl20(double s, ae_state *_state)
   18859             : {
   18860             :     double x;
   18861             :     double tj;
   18862             :     double tj1;
   18863             :     double result;
   18864             : 
   18865             : 
   18866           0 :     result = (double)(0);
   18867           0 :     if( ae_fp_less_eq(s,4.0000) )
   18868             :     {
   18869           0 :         x = 2*(s-0.000000)/4.000000-1;
   18870           0 :         tj = (double)(1);
   18871           0 :         tj1 = x;
   18872           0 :         jarquebera_jbcheb(x, -1.854794e+00, &tj, &tj1, &result, _state);
   18873           0 :         jarquebera_jbcheb(x, -1.948947e+00, &tj, &tj1, &result, _state);
   18874           0 :         jarquebera_jbcheb(x, 1.632184e-01, &tj, &tj1, &result, _state);
   18875           0 :         jarquebera_jbcheb(x, 2.139397e-01, &tj, &tj1, &result, _state);
   18876           0 :         jarquebera_jbcheb(x, -1.006237e-01, &tj, &tj1, &result, _state);
   18877           0 :         jarquebera_jbcheb(x, -3.810031e-02, &tj, &tj1, &result, _state);
   18878           0 :         jarquebera_jbcheb(x, 3.573620e-02, &tj, &tj1, &result, _state);
   18879           0 :         jarquebera_jbcheb(x, 9.951242e-03, &tj, &tj1, &result, _state);
   18880           0 :         jarquebera_jbcheb(x, -1.274092e-02, &tj, &tj1, &result, _state);
   18881           0 :         jarquebera_jbcheb(x, -3.464196e-03, &tj, &tj1, &result, _state);
   18882           0 :         jarquebera_jbcheb(x, 4.882139e-03, &tj, &tj1, &result, _state);
   18883           0 :         jarquebera_jbcheb(x, 1.575144e-03, &tj, &tj1, &result, _state);
   18884           0 :         jarquebera_jbcheb(x, -1.822804e-03, &tj, &tj1, &result, _state);
   18885           0 :         jarquebera_jbcheb(x, -7.061348e-04, &tj, &tj1, &result, _state);
   18886           0 :         jarquebera_jbcheb(x, 5.908404e-04, &tj, &tj1, &result, _state);
   18887           0 :         jarquebera_jbcheb(x, 1.978353e-04, &tj, &tj1, &result, _state);
   18888           0 :         if( ae_fp_greater(result,(double)(0)) )
   18889             :         {
   18890           0 :             result = (double)(0);
   18891             :         }
   18892           0 :         return result;
   18893             :     }
   18894           0 :     if( ae_fp_less_eq(s,15.0000) )
   18895             :     {
   18896           0 :         x = 2*(s-4.000000)/11.000000-1;
   18897           0 :         tj = (double)(1);
   18898           0 :         tj1 = x;
   18899           0 :         jarquebera_jbcheb(x, -5.030989e+00, &tj, &tj1, &result, _state);
   18900           0 :         jarquebera_jbcheb(x, -1.327151e+00, &tj, &tj1, &result, _state);
   18901           0 :         jarquebera_jbcheb(x, 1.346404e-01, &tj, &tj1, &result, _state);
   18902           0 :         jarquebera_jbcheb(x, -2.840051e-02, &tj, &tj1, &result, _state);
   18903           0 :         jarquebera_jbcheb(x, 7.578551e-03, &tj, &tj1, &result, _state);
   18904           0 :         jarquebera_jbcheb(x, -9.813886e-04, &tj, &tj1, &result, _state);
   18905           0 :         jarquebera_jbcheb(x, 5.905973e-05, &tj, &tj1, &result, _state);
   18906           0 :         jarquebera_jbcheb(x, -5.358489e-04, &tj, &tj1, &result, _state);
   18907           0 :         jarquebera_jbcheb(x, -3.450795e-04, &tj, &tj1, &result, _state);
   18908           0 :         jarquebera_jbcheb(x, -6.941157e-04, &tj, &tj1, &result, _state);
   18909           0 :         jarquebera_jbcheb(x, -7.432418e-04, &tj, &tj1, &result, _state);
   18910           0 :         jarquebera_jbcheb(x, -2.070537e-04, &tj, &tj1, &result, _state);
   18911           0 :         jarquebera_jbcheb(x, 9.375654e-04, &tj, &tj1, &result, _state);
   18912           0 :         jarquebera_jbcheb(x, 5.367378e-04, &tj, &tj1, &result, _state);
   18913           0 :         jarquebera_jbcheb(x, 9.890859e-04, &tj, &tj1, &result, _state);
   18914           0 :         jarquebera_jbcheb(x, 6.679782e-04, &tj, &tj1, &result, _state);
   18915           0 :         if( ae_fp_greater(result,(double)(0)) )
   18916             :         {
   18917           0 :             result = (double)(0);
   18918             :         }
   18919           0 :         return result;
   18920             :     }
   18921           0 :     if( ae_fp_less_eq(s,25.0000) )
   18922             :     {
   18923           0 :         x = 2*(s-15.000000)/10.000000-1;
   18924           0 :         tj = (double)(1);
   18925           0 :         tj1 = x;
   18926           0 :         jarquebera_jbcheb(x, -7.015854e+00, &tj, &tj1, &result, _state);
   18927           0 :         jarquebera_jbcheb(x, -7.487737e-01, &tj, &tj1, &result, _state);
   18928           0 :         jarquebera_jbcheb(x, 2.244254e-02, &tj, &tj1, &result, _state);
   18929           0 :         if( ae_fp_greater(result,(double)(0)) )
   18930             :         {
   18931           0 :             result = (double)(0);
   18932             :         }
   18933           0 :         return result;
   18934             :     }
   18935           0 :     result = -1.318007e-01*(s-2.500000e+01)-7.742185e+00;
   18936           0 :     return result;
   18937             : }
   18938             : 
   18939             : 
   18940           0 : static double jarquebera_jbtbl30(double s, ae_state *_state)
   18941             : {
   18942             :     double x;
   18943             :     double tj;
   18944             :     double tj1;
   18945             :     double result;
   18946             : 
   18947             : 
   18948           0 :     result = (double)(0);
   18949           0 :     if( ae_fp_less_eq(s,4.0000) )
   18950             :     {
   18951           0 :         x = 2*(s-0.000000)/4.000000-1;
   18952           0 :         tj = (double)(1);
   18953           0 :         tj1 = x;
   18954           0 :         jarquebera_jbcheb(x, -1.630822e+00, &tj, &tj1, &result, _state);
   18955           0 :         jarquebera_jbcheb(x, -1.724298e+00, &tj, &tj1, &result, _state);
   18956           0 :         jarquebera_jbcheb(x, 7.872756e-02, &tj, &tj1, &result, _state);
   18957           0 :         jarquebera_jbcheb(x, 1.658268e-01, &tj, &tj1, &result, _state);
   18958           0 :         jarquebera_jbcheb(x, -3.573597e-02, &tj, &tj1, &result, _state);
   18959           0 :         jarquebera_jbcheb(x, -2.994157e-02, &tj, &tj1, &result, _state);
   18960           0 :         jarquebera_jbcheb(x, 5.994825e-03, &tj, &tj1, &result, _state);
   18961           0 :         jarquebera_jbcheb(x, 7.394303e-03, &tj, &tj1, &result, _state);
   18962           0 :         jarquebera_jbcheb(x, -5.785029e-04, &tj, &tj1, &result, _state);
   18963           0 :         jarquebera_jbcheb(x, -1.990264e-03, &tj, &tj1, &result, _state);
   18964           0 :         jarquebera_jbcheb(x, -1.037838e-04, &tj, &tj1, &result, _state);
   18965           0 :         jarquebera_jbcheb(x, 6.755546e-04, &tj, &tj1, &result, _state);
   18966           0 :         jarquebera_jbcheb(x, 1.774473e-04, &tj, &tj1, &result, _state);
   18967           0 :         jarquebera_jbcheb(x, -2.821395e-04, &tj, &tj1, &result, _state);
   18968           0 :         jarquebera_jbcheb(x, -1.392603e-04, &tj, &tj1, &result, _state);
   18969           0 :         jarquebera_jbcheb(x, 1.353313e-04, &tj, &tj1, &result, _state);
   18970           0 :         if( ae_fp_greater(result,(double)(0)) )
   18971             :         {
   18972           0 :             result = (double)(0);
   18973             :         }
   18974           0 :         return result;
   18975             :     }
   18976           0 :     if( ae_fp_less_eq(s,15.0000) )
   18977             :     {
   18978           0 :         x = 2*(s-4.000000)/11.000000-1;
   18979           0 :         tj = (double)(1);
   18980           0 :         tj1 = x;
   18981           0 :         jarquebera_jbcheb(x, -4.539322e+00, &tj, &tj1, &result, _state);
   18982           0 :         jarquebera_jbcheb(x, -1.197018e+00, &tj, &tj1, &result, _state);
   18983           0 :         jarquebera_jbcheb(x, 1.396848e-01, &tj, &tj1, &result, _state);
   18984           0 :         jarquebera_jbcheb(x, -2.804293e-02, &tj, &tj1, &result, _state);
   18985           0 :         jarquebera_jbcheb(x, 6.867928e-03, &tj, &tj1, &result, _state);
   18986           0 :         jarquebera_jbcheb(x, -2.768758e-03, &tj, &tj1, &result, _state);
   18987           0 :         jarquebera_jbcheb(x, 5.211792e-04, &tj, &tj1, &result, _state);
   18988           0 :         jarquebera_jbcheb(x, 4.925799e-04, &tj, &tj1, &result, _state);
   18989           0 :         jarquebera_jbcheb(x, 5.046235e-04, &tj, &tj1, &result, _state);
   18990           0 :         jarquebera_jbcheb(x, -9.536469e-05, &tj, &tj1, &result, _state);
   18991           0 :         jarquebera_jbcheb(x, -6.489642e-04, &tj, &tj1, &result, _state);
   18992           0 :         if( ae_fp_greater(result,(double)(0)) )
   18993             :         {
   18994           0 :             result = (double)(0);
   18995             :         }
   18996           0 :         return result;
   18997             :     }
   18998           0 :     if( ae_fp_less_eq(s,25.0000) )
   18999             :     {
   19000           0 :         x = 2*(s-15.000000)/10.000000-1;
   19001           0 :         tj = (double)(1);
   19002           0 :         tj1 = x;
   19003           0 :         jarquebera_jbcheb(x, -6.263462e+00, &tj, &tj1, &result, _state);
   19004           0 :         jarquebera_jbcheb(x, -6.177316e-01, &tj, &tj1, &result, _state);
   19005           0 :         jarquebera_jbcheb(x, 2.590637e-02, &tj, &tj1, &result, _state);
   19006           0 :         if( ae_fp_greater(result,(double)(0)) )
   19007             :         {
   19008           0 :             result = (double)(0);
   19009             :         }
   19010           0 :         return result;
   19011             :     }
   19012           0 :     result = -1.028212e-01*(s-2.500000e+01)-6.855288e+00;
   19013           0 :     return result;
   19014             : }
   19015             : 
   19016             : 
   19017           0 : static double jarquebera_jbtbl50(double s, ae_state *_state)
   19018             : {
   19019             :     double x;
   19020             :     double tj;
   19021             :     double tj1;
   19022             :     double result;
   19023             : 
   19024             : 
   19025           0 :     result = (double)(0);
   19026           0 :     if( ae_fp_less_eq(s,4.0000) )
   19027             :     {
   19028           0 :         x = 2*(s-0.000000)/4.000000-1;
   19029           0 :         tj = (double)(1);
   19030           0 :         tj1 = x;
   19031           0 :         jarquebera_jbcheb(x, -1.436279e+00, &tj, &tj1, &result, _state);
   19032           0 :         jarquebera_jbcheb(x, -1.519711e+00, &tj, &tj1, &result, _state);
   19033           0 :         jarquebera_jbcheb(x, 1.148699e-02, &tj, &tj1, &result, _state);
   19034           0 :         jarquebera_jbcheb(x, 1.001204e-01, &tj, &tj1, &result, _state);
   19035           0 :         jarquebera_jbcheb(x, -3.207620e-03, &tj, &tj1, &result, _state);
   19036           0 :         jarquebera_jbcheb(x, -1.034778e-02, &tj, &tj1, &result, _state);
   19037           0 :         jarquebera_jbcheb(x, -1.220322e-03, &tj, &tj1, &result, _state);
   19038           0 :         jarquebera_jbcheb(x, 1.033260e-03, &tj, &tj1, &result, _state);
   19039           0 :         jarquebera_jbcheb(x, 2.588280e-04, &tj, &tj1, &result, _state);
   19040           0 :         jarquebera_jbcheb(x, -1.851653e-04, &tj, &tj1, &result, _state);
   19041           0 :         jarquebera_jbcheb(x, -1.287733e-04, &tj, &tj1, &result, _state);
   19042           0 :         if( ae_fp_greater(result,(double)(0)) )
   19043             :         {
   19044           0 :             result = (double)(0);
   19045             :         }
   19046           0 :         return result;
   19047             :     }
   19048           0 :     if( ae_fp_less_eq(s,15.0000) )
   19049             :     {
   19050           0 :         x = 2*(s-4.000000)/11.000000-1;
   19051           0 :         tj = (double)(1);
   19052           0 :         tj1 = x;
   19053           0 :         jarquebera_jbcheb(x, -4.234645e+00, &tj, &tj1, &result, _state);
   19054           0 :         jarquebera_jbcheb(x, -1.189127e+00, &tj, &tj1, &result, _state);
   19055           0 :         jarquebera_jbcheb(x, 1.429738e-01, &tj, &tj1, &result, _state);
   19056           0 :         jarquebera_jbcheb(x, -3.058822e-02, &tj, &tj1, &result, _state);
   19057           0 :         jarquebera_jbcheb(x, 9.086776e-03, &tj, &tj1, &result, _state);
   19058           0 :         jarquebera_jbcheb(x, -1.445783e-03, &tj, &tj1, &result, _state);
   19059           0 :         jarquebera_jbcheb(x, 1.311671e-03, &tj, &tj1, &result, _state);
   19060           0 :         jarquebera_jbcheb(x, -7.261298e-04, &tj, &tj1, &result, _state);
   19061           0 :         jarquebera_jbcheb(x, 6.496987e-04, &tj, &tj1, &result, _state);
   19062           0 :         jarquebera_jbcheb(x, 2.605249e-04, &tj, &tj1, &result, _state);
   19063           0 :         jarquebera_jbcheb(x, 8.162282e-04, &tj, &tj1, &result, _state);
   19064           0 :         if( ae_fp_greater(result,(double)(0)) )
   19065             :         {
   19066           0 :             result = (double)(0);
   19067             :         }
   19068           0 :         return result;
   19069             :     }
   19070           0 :     if( ae_fp_less_eq(s,25.0000) )
   19071             :     {
   19072           0 :         x = 2*(s-15.000000)/10.000000-1;
   19073           0 :         tj = (double)(1);
   19074           0 :         tj1 = x;
   19075           0 :         jarquebera_jbcheb(x, -5.921095e+00, &tj, &tj1, &result, _state);
   19076           0 :         jarquebera_jbcheb(x, -5.888603e-01, &tj, &tj1, &result, _state);
   19077           0 :         jarquebera_jbcheb(x, 3.080113e-02, &tj, &tj1, &result, _state);
   19078           0 :         if( ae_fp_greater(result,(double)(0)) )
   19079             :         {
   19080           0 :             result = (double)(0);
   19081             :         }
   19082           0 :         return result;
   19083             :     }
   19084           0 :     result = -9.313116e-02*(s-2.500000e+01)-6.479154e+00;
   19085           0 :     return result;
   19086             : }
   19087             : 
   19088             : 
   19089           0 : static double jarquebera_jbtbl65(double s, ae_state *_state)
   19090             : {
   19091             :     double x;
   19092             :     double tj;
   19093             :     double tj1;
   19094             :     double result;
   19095             : 
   19096             : 
   19097           0 :     result = (double)(0);
   19098           0 :     if( ae_fp_less_eq(s,4.0000) )
   19099             :     {
   19100           0 :         x = 2*(s-0.000000)/4.000000-1;
   19101           0 :         tj = (double)(1);
   19102           0 :         tj1 = x;
   19103           0 :         jarquebera_jbcheb(x, -1.360024e+00, &tj, &tj1, &result, _state);
   19104           0 :         jarquebera_jbcheb(x, -1.434631e+00, &tj, &tj1, &result, _state);
   19105           0 :         jarquebera_jbcheb(x, -6.514580e-03, &tj, &tj1, &result, _state);
   19106           0 :         jarquebera_jbcheb(x, 7.332038e-02, &tj, &tj1, &result, _state);
   19107           0 :         jarquebera_jbcheb(x, 1.158197e-03, &tj, &tj1, &result, _state);
   19108           0 :         jarquebera_jbcheb(x, -5.121233e-03, &tj, &tj1, &result, _state);
   19109           0 :         jarquebera_jbcheb(x, -1.051056e-03, &tj, &tj1, &result, _state);
   19110           0 :         if( ae_fp_greater(result,(double)(0)) )
   19111             :         {
   19112           0 :             result = (double)(0);
   19113             :         }
   19114           0 :         return result;
   19115             :     }
   19116           0 :     if( ae_fp_less_eq(s,15.0000) )
   19117             :     {
   19118           0 :         x = 2*(s-4.000000)/11.000000-1;
   19119           0 :         tj = (double)(1);
   19120           0 :         tj1 = x;
   19121           0 :         jarquebera_jbcheb(x, -4.148601e+00, &tj, &tj1, &result, _state);
   19122           0 :         jarquebera_jbcheb(x, -1.214233e+00, &tj, &tj1, &result, _state);
   19123           0 :         jarquebera_jbcheb(x, 1.487977e-01, &tj, &tj1, &result, _state);
   19124           0 :         jarquebera_jbcheb(x, -3.424720e-02, &tj, &tj1, &result, _state);
   19125           0 :         jarquebera_jbcheb(x, 1.116715e-02, &tj, &tj1, &result, _state);
   19126           0 :         jarquebera_jbcheb(x, -4.043152e-03, &tj, &tj1, &result, _state);
   19127           0 :         jarquebera_jbcheb(x, 1.718149e-03, &tj, &tj1, &result, _state);
   19128           0 :         jarquebera_jbcheb(x, -1.313701e-03, &tj, &tj1, &result, _state);
   19129           0 :         jarquebera_jbcheb(x, 3.097305e-04, &tj, &tj1, &result, _state);
   19130           0 :         jarquebera_jbcheb(x, 2.181031e-04, &tj, &tj1, &result, _state);
   19131           0 :         jarquebera_jbcheb(x, 1.256975e-04, &tj, &tj1, &result, _state);
   19132           0 :         if( ae_fp_greater(result,(double)(0)) )
   19133             :         {
   19134           0 :             result = (double)(0);
   19135             :         }
   19136           0 :         return result;
   19137             :     }
   19138           0 :     if( ae_fp_less_eq(s,25.0000) )
   19139             :     {
   19140           0 :         x = 2*(s-15.000000)/10.000000-1;
   19141           0 :         tj = (double)(1);
   19142           0 :         tj1 = x;
   19143           0 :         jarquebera_jbcheb(x, -5.858951e+00, &tj, &tj1, &result, _state);
   19144           0 :         jarquebera_jbcheb(x, -5.895179e-01, &tj, &tj1, &result, _state);
   19145           0 :         jarquebera_jbcheb(x, 2.933237e-02, &tj, &tj1, &result, _state);
   19146           0 :         if( ae_fp_greater(result,(double)(0)) )
   19147             :         {
   19148           0 :             result = (double)(0);
   19149             :         }
   19150           0 :         return result;
   19151             :     }
   19152           0 :     result = -9.443768e-02*(s-2.500000e+01)-6.419137e+00;
   19153           0 :     return result;
   19154             : }
   19155             : 
   19156             : 
   19157           0 : static double jarquebera_jbtbl100(double s, ae_state *_state)
   19158             : {
   19159             :     double x;
   19160             :     double tj;
   19161             :     double tj1;
   19162             :     double result;
   19163             : 
   19164             : 
   19165           0 :     result = (double)(0);
   19166           0 :     if( ae_fp_less_eq(s,4.0000) )
   19167             :     {
   19168           0 :         x = 2*(s-0.000000)/4.000000-1;
   19169           0 :         tj = (double)(1);
   19170           0 :         tj1 = x;
   19171           0 :         jarquebera_jbcheb(x, -1.257021e+00, &tj, &tj1, &result, _state);
   19172           0 :         jarquebera_jbcheb(x, -1.313418e+00, &tj, &tj1, &result, _state);
   19173           0 :         jarquebera_jbcheb(x, -1.628931e-02, &tj, &tj1, &result, _state);
   19174           0 :         jarquebera_jbcheb(x, 4.264287e-02, &tj, &tj1, &result, _state);
   19175           0 :         jarquebera_jbcheb(x, 1.518487e-03, &tj, &tj1, &result, _state);
   19176           0 :         jarquebera_jbcheb(x, -1.499826e-03, &tj, &tj1, &result, _state);
   19177           0 :         jarquebera_jbcheb(x, -4.836044e-04, &tj, &tj1, &result, _state);
   19178           0 :         if( ae_fp_greater(result,(double)(0)) )
   19179             :         {
   19180           0 :             result = (double)(0);
   19181             :         }
   19182           0 :         return result;
   19183             :     }
   19184           0 :     if( ae_fp_less_eq(s,15.0000) )
   19185             :     {
   19186           0 :         x = 2*(s-4.000000)/11.000000-1;
   19187           0 :         tj = (double)(1);
   19188           0 :         tj1 = x;
   19189           0 :         jarquebera_jbcheb(x, -4.056508e+00, &tj, &tj1, &result, _state);
   19190           0 :         jarquebera_jbcheb(x, -1.279690e+00, &tj, &tj1, &result, _state);
   19191           0 :         jarquebera_jbcheb(x, 1.665746e-01, &tj, &tj1, &result, _state);
   19192           0 :         jarquebera_jbcheb(x, -4.290012e-02, &tj, &tj1, &result, _state);
   19193           0 :         jarquebera_jbcheb(x, 1.487632e-02, &tj, &tj1, &result, _state);
   19194           0 :         jarquebera_jbcheb(x, -5.704465e-03, &tj, &tj1, &result, _state);
   19195           0 :         jarquebera_jbcheb(x, 2.211669e-03, &tj, &tj1, &result, _state);
   19196           0 :         if( ae_fp_greater(result,(double)(0)) )
   19197             :         {
   19198           0 :             result = (double)(0);
   19199             :         }
   19200           0 :         return result;
   19201             :     }
   19202           0 :     if( ae_fp_less_eq(s,25.0000) )
   19203             :     {
   19204           0 :         x = 2*(s-15.000000)/10.000000-1;
   19205           0 :         tj = (double)(1);
   19206           0 :         tj1 = x;
   19207           0 :         jarquebera_jbcheb(x, -5.866099e+00, &tj, &tj1, &result, _state);
   19208           0 :         jarquebera_jbcheb(x, -6.399767e-01, &tj, &tj1, &result, _state);
   19209           0 :         jarquebera_jbcheb(x, 2.498208e-02, &tj, &tj1, &result, _state);
   19210           0 :         if( ae_fp_greater(result,(double)(0)) )
   19211             :         {
   19212           0 :             result = (double)(0);
   19213             :         }
   19214           0 :         return result;
   19215             :     }
   19216           0 :     result = -1.080097e-01*(s-2.500000e+01)-6.481094e+00;
   19217           0 :     return result;
   19218             : }
   19219             : 
   19220             : 
   19221           0 : static double jarquebera_jbtbl130(double s, ae_state *_state)
   19222             : {
   19223             :     double x;
   19224             :     double tj;
   19225             :     double tj1;
   19226             :     double result;
   19227             : 
   19228             : 
   19229           0 :     result = (double)(0);
   19230           0 :     if( ae_fp_less_eq(s,4.0000) )
   19231             :     {
   19232           0 :         x = 2*(s-0.000000)/4.000000-1;
   19233           0 :         tj = (double)(1);
   19234           0 :         tj1 = x;
   19235           0 :         jarquebera_jbcheb(x, -1.207999e+00, &tj, &tj1, &result, _state);
   19236           0 :         jarquebera_jbcheb(x, -1.253864e+00, &tj, &tj1, &result, _state);
   19237           0 :         jarquebera_jbcheb(x, -1.618032e-02, &tj, &tj1, &result, _state);
   19238           0 :         jarquebera_jbcheb(x, 3.112729e-02, &tj, &tj1, &result, _state);
   19239           0 :         jarquebera_jbcheb(x, 1.210546e-03, &tj, &tj1, &result, _state);
   19240           0 :         jarquebera_jbcheb(x, -4.732602e-04, &tj, &tj1, &result, _state);
   19241           0 :         jarquebera_jbcheb(x, -2.410527e-04, &tj, &tj1, &result, _state);
   19242           0 :         if( ae_fp_greater(result,(double)(0)) )
   19243             :         {
   19244           0 :             result = (double)(0);
   19245             :         }
   19246           0 :         return result;
   19247             :     }
   19248           0 :     if( ae_fp_less_eq(s,15.0000) )
   19249             :     {
   19250           0 :         x = 2*(s-4.000000)/11.000000-1;
   19251           0 :         tj = (double)(1);
   19252           0 :         tj1 = x;
   19253           0 :         jarquebera_jbcheb(x, -4.026324e+00, &tj, &tj1, &result, _state);
   19254           0 :         jarquebera_jbcheb(x, -1.331990e+00, &tj, &tj1, &result, _state);
   19255           0 :         jarquebera_jbcheb(x, 1.779129e-01, &tj, &tj1, &result, _state);
   19256           0 :         jarquebera_jbcheb(x, -4.674749e-02, &tj, &tj1, &result, _state);
   19257           0 :         jarquebera_jbcheb(x, 1.669077e-02, &tj, &tj1, &result, _state);
   19258           0 :         jarquebera_jbcheb(x, -5.679136e-03, &tj, &tj1, &result, _state);
   19259           0 :         jarquebera_jbcheb(x, 8.833221e-04, &tj, &tj1, &result, _state);
   19260           0 :         if( ae_fp_greater(result,(double)(0)) )
   19261             :         {
   19262           0 :             result = (double)(0);
   19263             :         }
   19264           0 :         return result;
   19265             :     }
   19266           0 :     if( ae_fp_less_eq(s,25.0000) )
   19267             :     {
   19268           0 :         x = 2*(s-15.000000)/10.000000-1;
   19269           0 :         tj = (double)(1);
   19270           0 :         tj1 = x;
   19271           0 :         jarquebera_jbcheb(x, -5.893951e+00, &tj, &tj1, &result, _state);
   19272           0 :         jarquebera_jbcheb(x, -6.475304e-01, &tj, &tj1, &result, _state);
   19273           0 :         jarquebera_jbcheb(x, 3.116734e-02, &tj, &tj1, &result, _state);
   19274           0 :         if( ae_fp_greater(result,(double)(0)) )
   19275             :         {
   19276           0 :             result = (double)(0);
   19277             :         }
   19278           0 :         return result;
   19279             :     }
   19280           0 :     result = -1.045722e-01*(s-2.500000e+01)-6.510314e+00;
   19281           0 :     return result;
   19282             : }
   19283             : 
   19284             : 
   19285           0 : static double jarquebera_jbtbl200(double s, ae_state *_state)
   19286             : {
   19287             :     double x;
   19288             :     double tj;
   19289             :     double tj1;
   19290             :     double result;
   19291             : 
   19292             : 
   19293           0 :     result = (double)(0);
   19294           0 :     if( ae_fp_less_eq(s,4.0000) )
   19295             :     {
   19296           0 :         x = 2*(s-0.000000)/4.000000-1;
   19297           0 :         tj = (double)(1);
   19298           0 :         tj1 = x;
   19299           0 :         jarquebera_jbcheb(x, -1.146155e+00, &tj, &tj1, &result, _state);
   19300           0 :         jarquebera_jbcheb(x, -1.177398e+00, &tj, &tj1, &result, _state);
   19301           0 :         jarquebera_jbcheb(x, -1.297970e-02, &tj, &tj1, &result, _state);
   19302           0 :         jarquebera_jbcheb(x, 1.869745e-02, &tj, &tj1, &result, _state);
   19303           0 :         jarquebera_jbcheb(x, 1.717288e-04, &tj, &tj1, &result, _state);
   19304           0 :         jarquebera_jbcheb(x, -1.982108e-04, &tj, &tj1, &result, _state);
   19305           0 :         jarquebera_jbcheb(x, 6.427636e-05, &tj, &tj1, &result, _state);
   19306           0 :         if( ae_fp_greater(result,(double)(0)) )
   19307             :         {
   19308           0 :             result = (double)(0);
   19309             :         }
   19310           0 :         return result;
   19311             :     }
   19312           0 :     if( ae_fp_less_eq(s,15.0000) )
   19313             :     {
   19314           0 :         x = 2*(s-4.000000)/11.000000-1;
   19315           0 :         tj = (double)(1);
   19316           0 :         tj1 = x;
   19317           0 :         jarquebera_jbcheb(x, -4.034235e+00, &tj, &tj1, &result, _state);
   19318           0 :         jarquebera_jbcheb(x, -1.455006e+00, &tj, &tj1, &result, _state);
   19319           0 :         jarquebera_jbcheb(x, 1.942996e-01, &tj, &tj1, &result, _state);
   19320           0 :         jarquebera_jbcheb(x, -4.973795e-02, &tj, &tj1, &result, _state);
   19321           0 :         jarquebera_jbcheb(x, 1.418812e-02, &tj, &tj1, &result, _state);
   19322           0 :         jarquebera_jbcheb(x, -3.156778e-03, &tj, &tj1, &result, _state);
   19323           0 :         jarquebera_jbcheb(x, 4.896705e-05, &tj, &tj1, &result, _state);
   19324           0 :         if( ae_fp_greater(result,(double)(0)) )
   19325             :         {
   19326           0 :             result = (double)(0);
   19327             :         }
   19328           0 :         return result;
   19329             :     }
   19330           0 :     if( ae_fp_less_eq(s,25.0000) )
   19331             :     {
   19332           0 :         x = 2*(s-15.000000)/10.000000-1;
   19333           0 :         tj = (double)(1);
   19334           0 :         tj1 = x;
   19335           0 :         jarquebera_jbcheb(x, -6.086071e+00, &tj, &tj1, &result, _state);
   19336           0 :         jarquebera_jbcheb(x, -7.152176e-01, &tj, &tj1, &result, _state);
   19337           0 :         jarquebera_jbcheb(x, 3.725393e-02, &tj, &tj1, &result, _state);
   19338           0 :         if( ae_fp_greater(result,(double)(0)) )
   19339             :         {
   19340           0 :             result = (double)(0);
   19341             :         }
   19342           0 :         return result;
   19343             :     }
   19344           0 :     result = -1.132404e-01*(s-2.500000e+01)-6.764034e+00;
   19345           0 :     return result;
   19346             : }
   19347             : 
   19348             : 
   19349           0 : static double jarquebera_jbtbl301(double s, ae_state *_state)
   19350             : {
   19351             :     double x;
   19352             :     double tj;
   19353             :     double tj1;
   19354             :     double result;
   19355             : 
   19356             : 
   19357           0 :     result = (double)(0);
   19358           0 :     if( ae_fp_less_eq(s,4.0000) )
   19359             :     {
   19360           0 :         x = 2*(s-0.000000)/4.000000-1;
   19361           0 :         tj = (double)(1);
   19362           0 :         tj1 = x;
   19363           0 :         jarquebera_jbcheb(x, -1.104290e+00, &tj, &tj1, &result, _state);
   19364           0 :         jarquebera_jbcheb(x, -1.125800e+00, &tj, &tj1, &result, _state);
   19365           0 :         jarquebera_jbcheb(x, -9.595847e-03, &tj, &tj1, &result, _state);
   19366           0 :         jarquebera_jbcheb(x, 1.219666e-02, &tj, &tj1, &result, _state);
   19367           0 :         jarquebera_jbcheb(x, 1.502210e-04, &tj, &tj1, &result, _state);
   19368           0 :         jarquebera_jbcheb(x, -6.414543e-05, &tj, &tj1, &result, _state);
   19369           0 :         jarquebera_jbcheb(x, 6.754115e-05, &tj, &tj1, &result, _state);
   19370           0 :         if( ae_fp_greater(result,(double)(0)) )
   19371             :         {
   19372           0 :             result = (double)(0);
   19373             :         }
   19374           0 :         return result;
   19375             :     }
   19376           0 :     if( ae_fp_less_eq(s,15.0000) )
   19377             :     {
   19378           0 :         x = 2*(s-4.000000)/11.000000-1;
   19379           0 :         tj = (double)(1);
   19380           0 :         tj1 = x;
   19381           0 :         jarquebera_jbcheb(x, -4.065955e+00, &tj, &tj1, &result, _state);
   19382           0 :         jarquebera_jbcheb(x, -1.582060e+00, &tj, &tj1, &result, _state);
   19383           0 :         jarquebera_jbcheb(x, 2.004472e-01, &tj, &tj1, &result, _state);
   19384           0 :         jarquebera_jbcheb(x, -4.709092e-02, &tj, &tj1, &result, _state);
   19385           0 :         jarquebera_jbcheb(x, 1.105779e-02, &tj, &tj1, &result, _state);
   19386           0 :         jarquebera_jbcheb(x, 1.197391e-03, &tj, &tj1, &result, _state);
   19387           0 :         jarquebera_jbcheb(x, -8.386780e-04, &tj, &tj1, &result, _state);
   19388           0 :         if( ae_fp_greater(result,(double)(0)) )
   19389             :         {
   19390           0 :             result = (double)(0);
   19391             :         }
   19392           0 :         return result;
   19393             :     }
   19394           0 :     if( ae_fp_less_eq(s,25.0000) )
   19395             :     {
   19396           0 :         x = 2*(s-15.000000)/10.000000-1;
   19397           0 :         tj = (double)(1);
   19398           0 :         tj1 = x;
   19399           0 :         jarquebera_jbcheb(x, -6.311384e+00, &tj, &tj1, &result, _state);
   19400           0 :         jarquebera_jbcheb(x, -7.918763e-01, &tj, &tj1, &result, _state);
   19401           0 :         jarquebera_jbcheb(x, 3.626584e-02, &tj, &tj1, &result, _state);
   19402           0 :         if( ae_fp_greater(result,(double)(0)) )
   19403             :         {
   19404           0 :             result = (double)(0);
   19405             :         }
   19406           0 :         return result;
   19407             :     }
   19408           0 :     result = -1.293626e-01*(s-2.500000e+01)-7.066995e+00;
   19409           0 :     return result;
   19410             : }
   19411             : 
   19412             : 
   19413           0 : static double jarquebera_jbtbl501(double s, ae_state *_state)
   19414             : {
   19415             :     double x;
   19416             :     double tj;
   19417             :     double tj1;
   19418             :     double result;
   19419             : 
   19420             : 
   19421           0 :     result = (double)(0);
   19422           0 :     if( ae_fp_less_eq(s,4.0000) )
   19423             :     {
   19424           0 :         x = 2*(s-0.000000)/4.000000-1;
   19425           0 :         tj = (double)(1);
   19426           0 :         tj1 = x;
   19427           0 :         jarquebera_jbcheb(x, -1.067426e+00, &tj, &tj1, &result, _state);
   19428           0 :         jarquebera_jbcheb(x, -1.079765e+00, &tj, &tj1, &result, _state);
   19429           0 :         jarquebera_jbcheb(x, -5.463005e-03, &tj, &tj1, &result, _state);
   19430           0 :         jarquebera_jbcheb(x, 6.875659e-03, &tj, &tj1, &result, _state);
   19431           0 :         if( ae_fp_greater(result,(double)(0)) )
   19432             :         {
   19433           0 :             result = (double)(0);
   19434             :         }
   19435           0 :         return result;
   19436             :     }
   19437           0 :     if( ae_fp_less_eq(s,15.0000) )
   19438             :     {
   19439           0 :         x = 2*(s-4.000000)/11.000000-1;
   19440           0 :         tj = (double)(1);
   19441           0 :         tj1 = x;
   19442           0 :         jarquebera_jbcheb(x, -4.127574e+00, &tj, &tj1, &result, _state);
   19443           0 :         jarquebera_jbcheb(x, -1.740694e+00, &tj, &tj1, &result, _state);
   19444           0 :         jarquebera_jbcheb(x, 2.044502e-01, &tj, &tj1, &result, _state);
   19445           0 :         jarquebera_jbcheb(x, -3.746714e-02, &tj, &tj1, &result, _state);
   19446           0 :         jarquebera_jbcheb(x, 3.810594e-04, &tj, &tj1, &result, _state);
   19447           0 :         jarquebera_jbcheb(x, 1.197111e-03, &tj, &tj1, &result, _state);
   19448           0 :         if( ae_fp_greater(result,(double)(0)) )
   19449             :         {
   19450           0 :             result = (double)(0);
   19451             :         }
   19452           0 :         return result;
   19453             :     }
   19454           0 :     if( ae_fp_less_eq(s,25.0000) )
   19455             :     {
   19456           0 :         x = 2*(s-15.000000)/10.000000-1;
   19457           0 :         tj = (double)(1);
   19458           0 :         tj1 = x;
   19459           0 :         jarquebera_jbcheb(x, -6.628194e+00, &tj, &tj1, &result, _state);
   19460           0 :         jarquebera_jbcheb(x, -8.846221e-01, &tj, &tj1, &result, _state);
   19461           0 :         jarquebera_jbcheb(x, 4.386405e-02, &tj, &tj1, &result, _state);
   19462           0 :         if( ae_fp_greater(result,(double)(0)) )
   19463             :         {
   19464           0 :             result = (double)(0);
   19465             :         }
   19466           0 :         return result;
   19467             :     }
   19468           0 :     result = -1.418332e-01*(s-2.500000e+01)-7.468952e+00;
   19469           0 :     return result;
   19470             : }
   19471             : 
   19472             : 
   19473           0 : static double jarquebera_jbtbl701(double s, ae_state *_state)
   19474             : {
   19475             :     double x;
   19476             :     double tj;
   19477             :     double tj1;
   19478             :     double result;
   19479             : 
   19480             : 
   19481           0 :     result = (double)(0);
   19482           0 :     if( ae_fp_less_eq(s,4.0000) )
   19483             :     {
   19484           0 :         x = 2*(s-0.000000)/4.000000-1;
   19485           0 :         tj = (double)(1);
   19486           0 :         tj1 = x;
   19487           0 :         jarquebera_jbcheb(x, -1.050999e+00, &tj, &tj1, &result, _state);
   19488           0 :         jarquebera_jbcheb(x, -1.059769e+00, &tj, &tj1, &result, _state);
   19489           0 :         jarquebera_jbcheb(x, -3.922680e-03, &tj, &tj1, &result, _state);
   19490           0 :         jarquebera_jbcheb(x, 4.847054e-03, &tj, &tj1, &result, _state);
   19491           0 :         if( ae_fp_greater(result,(double)(0)) )
   19492             :         {
   19493           0 :             result = (double)(0);
   19494             :         }
   19495           0 :         return result;
   19496             :     }
   19497           0 :     if( ae_fp_less_eq(s,15.0000) )
   19498             :     {
   19499           0 :         x = 2*(s-4.000000)/11.000000-1;
   19500           0 :         tj = (double)(1);
   19501           0 :         tj1 = x;
   19502           0 :         jarquebera_jbcheb(x, -4.192182e+00, &tj, &tj1, &result, _state);
   19503           0 :         jarquebera_jbcheb(x, -1.860007e+00, &tj, &tj1, &result, _state);
   19504           0 :         jarquebera_jbcheb(x, 1.963942e-01, &tj, &tj1, &result, _state);
   19505           0 :         jarquebera_jbcheb(x, -2.838711e-02, &tj, &tj1, &result, _state);
   19506           0 :         jarquebera_jbcheb(x, -2.893112e-04, &tj, &tj1, &result, _state);
   19507           0 :         jarquebera_jbcheb(x, 2.159788e-03, &tj, &tj1, &result, _state);
   19508           0 :         if( ae_fp_greater(result,(double)(0)) )
   19509             :         {
   19510           0 :             result = (double)(0);
   19511             :         }
   19512           0 :         return result;
   19513             :     }
   19514           0 :     if( ae_fp_less_eq(s,25.0000) )
   19515             :     {
   19516           0 :         x = 2*(s-15.000000)/10.000000-1;
   19517           0 :         tj = (double)(1);
   19518           0 :         tj1 = x;
   19519           0 :         jarquebera_jbcheb(x, -6.917851e+00, &tj, &tj1, &result, _state);
   19520           0 :         jarquebera_jbcheb(x, -9.817020e-01, &tj, &tj1, &result, _state);
   19521           0 :         jarquebera_jbcheb(x, 5.383727e-02, &tj, &tj1, &result, _state);
   19522           0 :         if( ae_fp_greater(result,(double)(0)) )
   19523             :         {
   19524           0 :             result = (double)(0);
   19525             :         }
   19526           0 :         return result;
   19527             :     }
   19528           0 :     result = -1.532706e-01*(s-2.500000e+01)-7.845715e+00;
   19529           0 :     return result;
   19530             : }
   19531             : 
   19532             : 
   19533           0 : static double jarquebera_jbtbl1401(double s, ae_state *_state)
   19534             : {
   19535             :     double x;
   19536             :     double tj;
   19537             :     double tj1;
   19538             :     double result;
   19539             : 
   19540             : 
   19541           0 :     result = (double)(0);
   19542           0 :     if( ae_fp_less_eq(s,4.0000) )
   19543             :     {
   19544           0 :         x = 2*(s-0.000000)/4.000000-1;
   19545           0 :         tj = (double)(1);
   19546           0 :         tj1 = x;
   19547           0 :         jarquebera_jbcheb(x, -1.026266e+00, &tj, &tj1, &result, _state);
   19548           0 :         jarquebera_jbcheb(x, -1.030061e+00, &tj, &tj1, &result, _state);
   19549           0 :         jarquebera_jbcheb(x, -1.259222e-03, &tj, &tj1, &result, _state);
   19550           0 :         jarquebera_jbcheb(x, 2.536254e-03, &tj, &tj1, &result, _state);
   19551           0 :         if( ae_fp_greater(result,(double)(0)) )
   19552             :         {
   19553           0 :             result = (double)(0);
   19554             :         }
   19555           0 :         return result;
   19556             :     }
   19557           0 :     if( ae_fp_less_eq(s,15.0000) )
   19558             :     {
   19559           0 :         x = 2*(s-4.000000)/11.000000-1;
   19560           0 :         tj = (double)(1);
   19561           0 :         tj1 = x;
   19562           0 :         jarquebera_jbcheb(x, -4.329849e+00, &tj, &tj1, &result, _state);
   19563           0 :         jarquebera_jbcheb(x, -2.095443e+00, &tj, &tj1, &result, _state);
   19564           0 :         jarquebera_jbcheb(x, 1.759363e-01, &tj, &tj1, &result, _state);
   19565           0 :         jarquebera_jbcheb(x, -7.751359e-03, &tj, &tj1, &result, _state);
   19566           0 :         jarquebera_jbcheb(x, -6.124368e-03, &tj, &tj1, &result, _state);
   19567           0 :         jarquebera_jbcheb(x, -1.793114e-03, &tj, &tj1, &result, _state);
   19568           0 :         if( ae_fp_greater(result,(double)(0)) )
   19569             :         {
   19570           0 :             result = (double)(0);
   19571             :         }
   19572           0 :         return result;
   19573             :     }
   19574           0 :     if( ae_fp_less_eq(s,25.0000) )
   19575             :     {
   19576           0 :         x = 2*(s-15.000000)/10.000000-1;
   19577           0 :         tj = (double)(1);
   19578           0 :         tj1 = x;
   19579           0 :         jarquebera_jbcheb(x, -7.544330e+00, &tj, &tj1, &result, _state);
   19580           0 :         jarquebera_jbcheb(x, -1.225382e+00, &tj, &tj1, &result, _state);
   19581           0 :         jarquebera_jbcheb(x, 5.392349e-02, &tj, &tj1, &result, _state);
   19582           0 :         if( ae_fp_greater(result,(double)(0)) )
   19583             :         {
   19584           0 :             result = (double)(0);
   19585             :         }
   19586           0 :         return result;
   19587             :     }
   19588           0 :     result = -2.019375e-01*(s-2.500000e+01)-8.715788e+00;
   19589           0 :     return result;
   19590             : }
   19591             : 
   19592             : 
   19593           0 : static void jarquebera_jbcheb(double x,
   19594             :      double c,
   19595             :      double* tj,
   19596             :      double* tj1,
   19597             :      double* r,
   19598             :      ae_state *_state)
   19599             : {
   19600             :     double t;
   19601             : 
   19602             : 
   19603           0 :     *r = *r+c*(*tj);
   19604           0 :     t = 2*x*(*tj1)-(*tj);
   19605           0 :     *tj = *tj1;
   19606           0 :     *tj1 = t;
   19607           0 : }
   19608             : 
   19609             : 
   19610             : #endif
   19611             : #if defined(AE_COMPILE_VARIANCETESTS) || !defined(AE_PARTIAL_BUILD)
   19612             : 
   19613             : 
   19614             : /*************************************************************************
   19615             : Two-sample F-test
   19616             : 
   19617             : This test checks three hypotheses about dispersions of the given  samples.
   19618             : The following tests are performed:
   19619             :     * two-tailed test (null hypothesis - the dispersions are equal)
   19620             :     * left-tailed test (null hypothesis  -  the  dispersion  of  the first
   19621             :       sample is greater than or equal to  the  dispersion  of  the  second
   19622             :       sample).
   19623             :     * right-tailed test (null hypothesis - the  dispersion  of  the  first
   19624             :       sample is less than or equal to the dispersion of the second sample)
   19625             : 
   19626             : The test is based on the following assumptions:
   19627             :     * the given samples have normal distributions
   19628             :     * the samples are independent.
   19629             : 
   19630             : Input parameters:
   19631             :     X   -   sample 1. Array whose index goes from 0 to N-1.
   19632             :     N   -   sample size.
   19633             :     Y   -   sample 2. Array whose index goes from 0 to M-1.
   19634             :     M   -   sample size.
   19635             : 
   19636             : Output parameters:
   19637             :     BothTails   -   p-value for two-tailed test.
   19638             :                     If BothTails is less than the given significance level
   19639             :                     the null hypothesis is rejected.
   19640             :     LeftTail    -   p-value for left-tailed test.
   19641             :                     If LeftTail is less than the given significance level,
   19642             :                     the null hypothesis is rejected.
   19643             :     RightTail   -   p-value for right-tailed test.
   19644             :                     If RightTail is less than the given significance level
   19645             :                     the null hypothesis is rejected.
   19646             : 
   19647             :   -- ALGLIB --
   19648             :      Copyright 19.09.2006 by Bochkanov Sergey
   19649             : *************************************************************************/
   19650           0 : void ftest(/* Real    */ ae_vector* x,
   19651             :      ae_int_t n,
   19652             :      /* Real    */ ae_vector* y,
   19653             :      ae_int_t m,
   19654             :      double* bothtails,
   19655             :      double* lefttail,
   19656             :      double* righttail,
   19657             :      ae_state *_state)
   19658             : {
   19659             :     ae_int_t i;
   19660             :     double xmean;
   19661             :     double ymean;
   19662             :     double xvar;
   19663             :     double yvar;
   19664             :     ae_int_t df1;
   19665             :     ae_int_t df2;
   19666             :     double stat;
   19667             : 
   19668           0 :     *bothtails = 0;
   19669           0 :     *lefttail = 0;
   19670           0 :     *righttail = 0;
   19671             : 
   19672           0 :     if( n<=2||m<=2 )
   19673             :     {
   19674           0 :         *bothtails = 1.0;
   19675           0 :         *lefttail = 1.0;
   19676           0 :         *righttail = 1.0;
   19677           0 :         return;
   19678             :     }
   19679             :     
   19680             :     /*
   19681             :      * Mean
   19682             :      */
   19683           0 :     xmean = (double)(0);
   19684           0 :     for(i=0; i<=n-1; i++)
   19685             :     {
   19686           0 :         xmean = xmean+x->ptr.p_double[i];
   19687             :     }
   19688           0 :     xmean = xmean/n;
   19689           0 :     ymean = (double)(0);
   19690           0 :     for(i=0; i<=m-1; i++)
   19691             :     {
   19692           0 :         ymean = ymean+y->ptr.p_double[i];
   19693             :     }
   19694           0 :     ymean = ymean/m;
   19695             :     
   19696             :     /*
   19697             :      * Variance (using corrected two-pass algorithm)
   19698             :      */
   19699           0 :     xvar = (double)(0);
   19700           0 :     for(i=0; i<=n-1; i++)
   19701             :     {
   19702           0 :         xvar = xvar+ae_sqr(x->ptr.p_double[i]-xmean, _state);
   19703             :     }
   19704           0 :     xvar = xvar/(n-1);
   19705           0 :     yvar = (double)(0);
   19706           0 :     for(i=0; i<=m-1; i++)
   19707             :     {
   19708           0 :         yvar = yvar+ae_sqr(y->ptr.p_double[i]-ymean, _state);
   19709             :     }
   19710           0 :     yvar = yvar/(m-1);
   19711           0 :     if( ae_fp_eq(xvar,(double)(0))||ae_fp_eq(yvar,(double)(0)) )
   19712             :     {
   19713           0 :         *bothtails = 1.0;
   19714           0 :         *lefttail = 1.0;
   19715           0 :         *righttail = 1.0;
   19716           0 :         return;
   19717             :     }
   19718             :     
   19719             :     /*
   19720             :      * Statistic
   19721             :      */
   19722           0 :     df1 = n-1;
   19723           0 :     df2 = m-1;
   19724           0 :     stat = ae_minreal(xvar/yvar, yvar/xvar, _state);
   19725           0 :     *bothtails = 1-(fdistribution(df1, df2, 1/stat, _state)-fdistribution(df1, df2, stat, _state));
   19726           0 :     *lefttail = fdistribution(df1, df2, xvar/yvar, _state);
   19727           0 :     *righttail = 1-(*lefttail);
   19728             : }
   19729             : 
   19730             : 
   19731             : /*************************************************************************
   19732             : One-sample chi-square test
   19733             : 
   19734             : This test checks three hypotheses about the dispersion of the given sample
   19735             : The following tests are performed:
   19736             :     * two-tailed test (null hypothesis - the dispersion equals  the  given
   19737             :       number)
   19738             :     * left-tailed test (null hypothesis - the dispersion is  greater  than
   19739             :       or equal to the given number)
   19740             :     * right-tailed test (null hypothesis  -  dispersion is  less  than  or
   19741             :       equal to the given number).
   19742             : 
   19743             : Test is based on the following assumptions:
   19744             :     * the given sample has a normal distribution.
   19745             : 
   19746             : Input parameters:
   19747             :     X           -   sample 1. Array whose index goes from 0 to N-1.
   19748             :     N           -   size of the sample.
   19749             :     Variance    -   dispersion value to compare with.
   19750             : 
   19751             : Output parameters:
   19752             :     BothTails   -   p-value for two-tailed test.
   19753             :                     If BothTails is less than the given significance level
   19754             :                     the null hypothesis is rejected.
   19755             :     LeftTail    -   p-value for left-tailed test.
   19756             :                     If LeftTail is less than the given significance level,
   19757             :                     the null hypothesis is rejected.
   19758             :     RightTail   -   p-value for right-tailed test.
   19759             :                     If RightTail is less than the given significance level
   19760             :                     the null hypothesis is rejected.
   19761             : 
   19762             :   -- ALGLIB --
   19763             :      Copyright 19.09.2006 by Bochkanov Sergey
   19764             : *************************************************************************/
   19765           0 : void onesamplevariancetest(/* Real    */ ae_vector* x,
   19766             :      ae_int_t n,
   19767             :      double variance,
   19768             :      double* bothtails,
   19769             :      double* lefttail,
   19770             :      double* righttail,
   19771             :      ae_state *_state)
   19772             : {
   19773             :     ae_int_t i;
   19774             :     double xmean;
   19775             :     double xvar;
   19776             :     double s;
   19777             :     double stat;
   19778             : 
   19779           0 :     *bothtails = 0;
   19780           0 :     *lefttail = 0;
   19781           0 :     *righttail = 0;
   19782             : 
   19783           0 :     if( n<=1 )
   19784             :     {
   19785           0 :         *bothtails = 1.0;
   19786           0 :         *lefttail = 1.0;
   19787           0 :         *righttail = 1.0;
   19788           0 :         return;
   19789             :     }
   19790             :     
   19791             :     /*
   19792             :      * Mean
   19793             :      */
   19794           0 :     xmean = (double)(0);
   19795           0 :     for(i=0; i<=n-1; i++)
   19796             :     {
   19797           0 :         xmean = xmean+x->ptr.p_double[i];
   19798             :     }
   19799           0 :     xmean = xmean/n;
   19800             :     
   19801             :     /*
   19802             :      * Variance
   19803             :      */
   19804           0 :     xvar = (double)(0);
   19805           0 :     for(i=0; i<=n-1; i++)
   19806             :     {
   19807           0 :         xvar = xvar+ae_sqr(x->ptr.p_double[i]-xmean, _state);
   19808             :     }
   19809           0 :     xvar = xvar/(n-1);
   19810           0 :     if( ae_fp_eq(xvar,(double)(0)) )
   19811             :     {
   19812           0 :         *bothtails = 1.0;
   19813           0 :         *lefttail = 1.0;
   19814           0 :         *righttail = 1.0;
   19815           0 :         return;
   19816             :     }
   19817             :     
   19818             :     /*
   19819             :      * Statistic
   19820             :      */
   19821           0 :     stat = (n-1)*xvar/variance;
   19822           0 :     s = chisquaredistribution((double)(n-1), stat, _state);
   19823           0 :     *bothtails = 2*ae_minreal(s, 1-s, _state);
   19824           0 :     *lefttail = s;
   19825           0 :     *righttail = 1-(*lefttail);
   19826             : }
   19827             : 
   19828             : 
   19829             : #endif
   19830             : 
   19831             : }
   19832             : 

Generated by: LCOV version 1.16