Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/22/10 00:44:01 (14 years ago)
Author:
swagner
Message:

Sorted usings and removed unused usings in entire solution (#1094)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.ALGLIB/2.5.0/ALGLIB-2.5.0/chisquaredistr.cs

    r3839 r4068  
    2626*************************************************************************/
    2727
    28 using System;
    2928
    30 namespace alglib
    31 {
    32     public class chisquaredistr
    33     {
    34         /*************************************************************************
    35         Chi-square distribution
     29namespace alglib {
     30  public class chisquaredistr {
     31    /*************************************************************************
     32    Chi-square distribution
    3633
    37         Returns the area under the left hand tail (from 0 to x)
    38         of the Chi square probability density function with
    39         v degrees of freedom.
     34    Returns the area under the left hand tail (from 0 to x)
     35    of the Chi square probability density function with
     36    v degrees of freedom.
    4037
    4138
    42                                           x
    43                                            -
    44                                1          | |  v/2-1  -t/2
    45          P( x | v )   =   -----------     |   t      e     dt
    46                            v/2  -       | |
    47                           2    | (v/2)   -
    48                                           0
     39                                      x
     40                                       -
     41                           1          | |  v/2-1  -t/2
     42     P( x | v )   =   -----------     |   t      e     dt
     43                       v/2  -       | |
     44                      2    | (v/2)   -
     45                                      0
    4946
    50         where x is the Chi-square variable.
     47    where x is the Chi-square variable.
    5148
    52         The incomplete gamma integral is used, according to the
    53         formula
     49    The incomplete gamma integral is used, according to the
     50    formula
    5451
    55         y = chdtr( v, x ) = igam( v/2.0, x/2.0 ).
     52    y = chdtr( v, x ) = igam( v/2.0, x/2.0 ).
    5653
    57         The arguments must both be positive.
     54    The arguments must both be positive.
    5855
    59         ACCURACY:
     56    ACCURACY:
    6057
    61         See incomplete gamma function
     58    See incomplete gamma function
    6259
    6360
    64         Cephes Math Library Release 2.8:  June, 2000
    65         Copyright 1984, 1987, 2000 by Stephen L. Moshier
    66         *************************************************************************/
    67         public static double chisquaredistribution(double v,
    68             double x)
    69         {
    70             double result = 0;
     61    Cephes Math Library Release 2.8:  June, 2000
     62    Copyright 1984, 1987, 2000 by Stephen L. Moshier
     63    *************************************************************************/
     64    public static double chisquaredistribution(double v,
     65        double x) {
     66      double result = 0;
    7167
    72             System.Diagnostics.Debug.Assert((double)(x)>=(double)(0) & (double)(v)>=(double)(1), "Domain error in ChiSquareDistribution");
    73             result = igammaf.incompletegamma(v/2.0, x/2.0);
    74             return result;
    75         }
     68      System.Diagnostics.Debug.Assert((double)(x) >= (double)(0) & (double)(v) >= (double)(1), "Domain error in ChiSquareDistribution");
     69      result = igammaf.incompletegamma(v / 2.0, x / 2.0);
     70      return result;
     71    }
    7672
    7773
    78         /*************************************************************************
    79         Complemented Chi-square distribution
     74    /*************************************************************************
     75    Complemented Chi-square distribution
    8076
    81         Returns the area under the right hand tail (from x to
    82         infinity) of the Chi square probability density function
    83         with v degrees of freedom:
     77    Returns the area under the right hand tail (from x to
     78    infinity) of the Chi square probability density function
     79    with v degrees of freedom:
    8480
    85                                          inf.
    86                                            -
    87                                1          | |  v/2-1  -t/2
    88          P( x | v )   =   -----------     |   t      e     dt
    89                            v/2  -       | |
    90                           2    | (v/2)   -
    91                                           x
     81                                     inf.
     82                                       -
     83                           1          | |  v/2-1  -t/2
     84     P( x | v )   =   -----------     |   t      e     dt
     85                       v/2  -       | |
     86                      2    | (v/2)   -
     87                                      x
    9288
    93         where x is the Chi-square variable.
     89    where x is the Chi-square variable.
    9490
    95         The incomplete gamma integral is used, according to the
    96         formula
     91    The incomplete gamma integral is used, according to the
     92    formula
    9793
    98         y = chdtr( v, x ) = igamc( v/2.0, x/2.0 ).
     94    y = chdtr( v, x ) = igamc( v/2.0, x/2.0 ).
    9995
    100         The arguments must both be positive.
     96    The arguments must both be positive.
    10197
    102         ACCURACY:
     98    ACCURACY:
    10399
    104         See incomplete gamma function
     100    See incomplete gamma function
    105101
    106         Cephes Math Library Release 2.8:  June, 2000
    107         Copyright 1984, 1987, 2000 by Stephen L. Moshier
    108         *************************************************************************/
    109         public static double chisquarecdistribution(double v,
    110             double x)
    111         {
    112             double result = 0;
     102    Cephes Math Library Release 2.8:  June, 2000
     103    Copyright 1984, 1987, 2000 by Stephen L. Moshier
     104    *************************************************************************/
     105    public static double chisquarecdistribution(double v,
     106        double x) {
     107      double result = 0;
    113108
    114             System.Diagnostics.Debug.Assert((double)(x)>=(double)(0) & (double)(v)>=(double)(1), "Domain error in ChiSquareDistributionC");
    115             result = igammaf.incompletegammac(v/2.0, x/2.0);
    116             return result;
    117         }
     109      System.Diagnostics.Debug.Assert((double)(x) >= (double)(0) & (double)(v) >= (double)(1), "Domain error in ChiSquareDistributionC");
     110      result = igammaf.incompletegammac(v / 2.0, x / 2.0);
     111      return result;
     112    }
    118113
    119114
    120         /*************************************************************************
    121         Inverse of complemented Chi-square distribution
     115    /*************************************************************************
     116    Inverse of complemented Chi-square distribution
    122117
    123         Finds the Chi-square argument x such that the integral
    124         from x to infinity of the Chi-square density is equal
    125         to the given cumulative probability y.
     118    Finds the Chi-square argument x such that the integral
     119    from x to infinity of the Chi-square density is equal
     120    to the given cumulative probability y.
    126121
    127         This is accomplished using the inverse gamma integral
    128         function and the relation
     122    This is accomplished using the inverse gamma integral
     123    function and the relation
    129124
    130            x/2 = igami( df/2, y );
     125       x/2 = igami( df/2, y );
    131126
    132         ACCURACY:
     127    ACCURACY:
    133128
    134         See inverse incomplete gamma function
     129    See inverse incomplete gamma function
    135130
    136131
    137         Cephes Math Library Release 2.8:  June, 2000
    138         Copyright 1984, 1987, 2000 by Stephen L. Moshier
    139         *************************************************************************/
    140         public static double invchisquaredistribution(double v,
    141             double y)
    142         {
    143             double result = 0;
     132    Cephes Math Library Release 2.8:  June, 2000
     133    Copyright 1984, 1987, 2000 by Stephen L. Moshier
     134    *************************************************************************/
     135    public static double invchisquaredistribution(double v,
     136        double y) {
     137      double result = 0;
    144138
    145             System.Diagnostics.Debug.Assert((double)(y)>=(double)(0) & (double)(y)<=(double)(1) & (double)(v)>=(double)(1), "Domain error in InvChiSquareDistribution");
    146             result = 2*igammaf.invincompletegammac(0.5*v, y);
    147             return result;
    148         }
     139      System.Diagnostics.Debug.Assert((double)(y) >= (double)(0) & (double)(y) <= (double)(1) & (double)(v) >= (double)(1), "Domain error in InvChiSquareDistribution");
     140      result = 2 * igammaf.invincompletegammac(0.5 * v, y);
     141      return result;
    149142    }
     143  }
    150144}
Note: See TracChangeset for help on using the changeset viewer.