Changeset 2382
- Timestamp:
- Dec 21, 2010, 2:16:58 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/0.6-stable merged: 2258,2271-2272,2304,2310,2314-2315,2317-2320,2322,2378-2380
- Property svn:mergeinfo changed
-
trunk/NEWS
r2297 r2382 12 12 13 13 yat 0.6.x series from http://dev.thep.lu.se/yat/svn/branches/0.6-stable 14 15 Version 0.6.3 (released 21 December 2010) 16 17 - fixed overflow in statistics::Fisher (#638) 18 - fixed bug that double was hard-coded in function load<T>(6) (r2271) 19 20 A complete list of closed tickets can be found here [[br]] 21 http://dev.thep.lu.se/yat/query?status=closed&milestone=yat+0.6.3 14 22 15 23 Version 0.6.2 (released 18 May 2010) -
trunk/doc/Makefile.am
r2354 r2382 6 6 # Copyright (C) 2005 Peter Johansson 7 7 # Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 8 # Copyright (C) 2009 Peter Johansson8 # Copyright (C) 2009, 2010 Peter Johansson 9 9 # 10 10 # This file is part of the yat library, http://dev.thep.lu.se/yat … … 67 67 68 68 $(DX_HTML_OUTPUT)/index.html: $(DOXYGEN_DEPS) 69 (cat doxygen.config && echo "INPUT = $(DOXYGEN_INPUT)" && \69 @(cat doxygen.config && echo "INPUT = $(DOXYGEN_INPUT)" && \ 70 70 echo GENERATE_HTML = YES) | $(DOXYGEN) -; 71 72 71 73 72 install-data-hook: -
trunk/m4/version.m4
r2257 r2382 64 64 # yat-0.6.1 3:1:0 65 65 # yat-0.6.2 3:2:0 66 # yat-0.6.3 3:3:0 66 67 # 67 68 # *Accidently, the libtool number was not updated for yat 0.5 -
trunk/test/commandline.cc
r2370 r2382 30 30 31 31 #include <cassert> 32 #include <cstdlib> 32 33 #include <fstream> 33 34 #include <stdexcept> -
trunk/test/fisher.cc
r2370 r2382 2 2 3 3 /* 4 Copyright (C) 2008, 2009 Peter Johansson4 Copyright (C) 2008, 2009, 2010 Peter Johansson 5 5 6 6 This file is part of the yat library, http://dev.thep.lu.se/yat … … 24 24 #include "yat/statistics/Fisher.h" 25 25 26 #include <climits> 27 26 28 using namespace theplu::yat; 27 29 void test_p_value(test::Suite&); 28 30 void test_p_value_approximative(test::Suite&); 29 31 void test_p_value_exact(test::Suite&); 32 void test_large_numbers(test::Suite&); 30 33 31 34 int main(int argc, char* argv[]) … … 65 68 } 66 69 test_p_value(suite); 70 test_large_numbers(suite); 67 71 return suite.return_value(); 72 } 73 74 75 void test_large_numbers(test::Suite& suite) 76 { 77 // skip test if unsigned int is 16 bit 78 if ((UINT_MAX >> 16) == 0) { 79 suite.out() << "skipping test_large_numbers\n"; 80 return; 81 } 82 83 statistics::Fisher f; 84 double oddsratio = f.oddsratio(1166,63326825-1166,1095,66074759-1095); 85 if (oddsratio<0.5 || oddsratio>2) { 86 suite.err() << "oddsratio: " << oddsratio << "\n"; 87 suite.err() << "expected ~ 1\n"; 88 suite.xadd(false); 89 } 90 suite.add(suite.equal_fix(f.p_value(), 0.0123, 0.0001)); 91 f.p_value_one_sided(); 68 92 } 69 93 -
trunk/yat/statistics/Fisher.cc
r2316 r2382 5 5 Copyright (C) 2005 Peter Johansson 6 6 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 7 Copyright (C) 2009 Peter Johansson7 Copyright (C) 2009, 2010 Peter Johansson 8 8 9 9 This file is part of the yat library, http://dev.thep.lu.se/yat … … 32 32 33 33 #include <algorithm> 34 #include <cassert> 34 35 35 36 namespace theplu { … … 66 67 void Fisher::expected(double& a, double& b, double& c, double& d) const 67 68 { 68 double N = a_+b_+c_+d_; 69 a =((a_+b_)*(a_+c_)) / N; 70 b =((a_+b_)*(b_+d_)) / N; 71 c =((c_+d_)*(a_+c_)) / N; 72 d =((c_+d_)*(b_+d_)) / N; 69 // use floting point arithmetic to avoid overflow 70 double a1 = a_; 71 double b1 = b_; 72 double c1 = c_; 73 double d1 = d_; 74 double N = a1 + b1 + c1 + d1; 75 a =((a1+b1)*(a1+c1)) / N; 76 b =((a1+b1)*(b1+d1)) / N; 77 c =((c1+d1)*(a1+c1)) / N; 78 d =((c1+d1)*(b1+d1)) / N; 73 79 } 74 80 … … 100 106 d_ = d; 101 107 102 oddsratio_=static_cast<double>(a*d)/static_cast<double>(b*c); 108 oddsratio_= (static_cast<double>(a) / static_cast<double>(b) * 109 static_cast<double>(d) / static_cast<double>(c) ); 103 110 return oddsratio_; 104 111 } … … 120 127 return p_value_approximative()/2.0; 121 128 } 129 // check for overflow 130 assert(c_ <= c_+d_ && d_ <= c_+d_); 131 assert(a_ <= a_+b_ && b_ <= a_+b_); 132 assert(a_ <= a_+c_ && c_ <= a_+c_); 133 122 134 return statistics::cdf_hypergeometric_P(c_, c_+d_, a_+b_, a_+c_); 123 135 } … … 149 161 } 150 162 151 152 163 }}} // of namespace statistics, yat, and theplu -
trunk/yat/utility/PCA.h
r2323 r2382 10 10 Copyright (C) 2006 Jari Häkkinen 11 11 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 12 Copyright (C) 2010 Peter Johansson 12 13 13 14 This file is part of the yat library, http://dev.thep.lu.se/yat … … 43 44 this space, all Nx1 vectors will have dimension Mx1. Hence 44 45 the projection will have dimension MxM where each column is 45 a point in the new space. Also, it assumes that M>N. The opposite 46 problem is added in the functions: process_transposed_problem and 47 projection_transposed()... 46 a point in the new space. 47 48 \note Currently number of rows, N, must be larger (or equal) than 49 number of columns, M. 48 50 */ 49 51 class PCA … … 89 91 3: Calculate eigenvalues according to \n 90 92 \f$ \lambda_{ii} = s_{ii}/N_{rows} \f$ \n 91 4: Sort eigenvectors (from matrix V) according to descending eigenvalues\n92 93 */ 93 94 void process(void);
Note: See TracChangeset
for help on using the changeset viewer.