00001 #ifndef vnl_chi_squared_h_ 00002 #define vnl_chi_squared_h_ 00003 00004 //: 00005 // \file 00006 // \brief Name space for various chi-squared distribution functions. 00007 // \author Rupert Curwen, GE CRD, August 18th, 1998 00008 // 00009 // \verbatim 00010 // Modifications 00011 // dac (Manchester) 26/03/2001: tidied up documentation 00012 // \endverbatim 00013 // 00014 00015 00016 //: Compute cumulative distribution function value for chi-squared distribution 00017 extern float vnl_chi_squared_cumulative(float chisq, int dof); 00018 00019 //------------------------------------------------------------ 00020 00021 //: Name space for various chi-squared distribution functions. 00022 // 00023 //\verbatim 00024 // A[] and B[] are (pointers to) arrays containing histograms. 00025 // If the 'normalize' parameter is true, each histogram will 00026 // be implicitly normalized (so as to sum to 1) before the 00027 // statistic is calculated : 00028 // 00029 // a[i] = A[i] / \sum_j A[j] 00030 // b[i] = B[i] / \sum_j B[j] 00031 // 00032 // *DO NOT* add scale factors to these functions or you will break 00033 // the code written by those who read the documentation. fsm. 00034 00035 // (a[i] - b[i])^2 00036 // \sum --------------- 00037 // i a[i] 00038 //\endverbatim 00039 // 00040 00041 template <class T> 00042 double vnl_chi_squared_statistic_1 (T const *A, T const *B, 00043 int n, bool normalize); 00044 00045 //: 00046 //\verbatim 00047 // (a[i] - b[i])^2 00048 // \sum --------------- 00049 // i b[i] 00050 //\endverbatim 00051 template <class T> 00052 double vnl_chi_squared_statistic_2 (T const *A, T const *B, 00053 int n, bool normalize); 00054 00055 //: 00056 //\verbatim 00057 // (a[i] - b[i])^2 00058 // \sum --------------- 00059 // i a[i] + b[i] 00060 //\endverbatim 00061 template <class T> 00062 double vnl_chi_squared_statistic_12(T const *A, T const *B, 00063 int n, bool normalize); 00064 00065 #endif // vnl_chi_squared_h_