Changeset 2382


Ignore:
Timestamp:
Dec 21, 2010, 2:16:58 PM (11 years ago)
Author:
Peter
Message:

merged patch release 0.6.3 into trunk.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/NEWS

    r2297 r2382  
    1212
    1313yat 0.6.x series from http://dev.thep.lu.se/yat/svn/branches/0.6-stable
     14
     15Version 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
    1422
    1523Version 0.6.2 (released 18 May 2010)
  • trunk/doc/Makefile.am

    r2354 r2382  
    66# Copyright (C) 2005 Peter Johansson
    77# Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    8 # Copyright (C) 2009 Peter Johansson
     8# Copyright (C) 2009, 2010 Peter Johansson
    99#
    1010# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    6767
    6868$(DX_HTML_OUTPUT)/index.html: $(DOXYGEN_DEPS)
    69   (cat doxygen.config && echo "INPUT = $(DOXYGEN_INPUT)" && \
     69  @(cat doxygen.config && echo "INPUT = $(DOXYGEN_INPUT)" && \
    7070  echo GENERATE_HTML = YES) | $(DOXYGEN) -;
    71 
    7271
    7372install-data-hook:
  • trunk/m4/version.m4

    r2257 r2382  
    6464# yat-0.6.1  3:1:0
    6565# yat-0.6.2  3:2:0
     66# yat-0.6.3  3:3:0
    6667#
    6768# *Accidently, the libtool number was not updated for yat 0.5
  • trunk/test/commandline.cc

    r2370 r2382  
    3030
    3131#include <cassert>
     32#include <cstdlib>
    3233#include <fstream>
    3334#include <stdexcept>
  • trunk/test/fisher.cc

    r2370 r2382  
    22
    33/*
    4   Copyright (C) 2008, 2009 Peter Johansson
     4  Copyright (C) 2008, 2009, 2010 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2424#include "yat/statistics/Fisher.h"
    2525
     26#include <climits>
     27
    2628using namespace theplu::yat;
    2729void test_p_value(test::Suite&);
    2830void test_p_value_approximative(test::Suite&);
    2931void test_p_value_exact(test::Suite&);
     32void test_large_numbers(test::Suite&);
    3033
    3134int main(int argc, char* argv[])
     
    6568  }
    6669  test_p_value(suite);
     70  test_large_numbers(suite);
    6771  return suite.return_value();
     72}
     73
     74
     75void 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();
    6892}
    6993
  • trunk/yat/statistics/Fisher.cc

    r2316 r2382  
    55  Copyright (C) 2005 Peter Johansson
    66  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    7   Copyright (C) 2009 Peter Johansson
     7  Copyright (C) 2009, 2010 Peter Johansson
    88
    99  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    3232
    3333#include <algorithm>
     34#include <cassert>
    3435
    3536namespace theplu {
     
    6667  void Fisher::expected(double& a, double& b, double& c, double& d) const
    6768  {
    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;
    7379  }
    7480
     
    100106    d_ = d;
    101107
    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) );
    103110    return oddsratio_;
    104111  }
     
    120127      return p_value_approximative()/2.0;
    121128    }
     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
    122134    return statistics::cdf_hypergeometric_P(c_, c_+d_, a_+b_, a_+c_);
    123135  }
     
    149161  }
    150162
    151 
    152163}}} // of namespace statistics, yat, and theplu
  • trunk/yat/utility/PCA.h

    r2323 r2382  
    1010  Copyright (C) 2006 Jari Häkkinen
    1111  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     12  Copyright (C) 2010 Peter Johansson
    1213
    1314  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    4344     this space, all Nx1 vectors will have dimension Mx1. Hence
    4445     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.
    4850  */
    4951  class PCA
     
    8991       3: Calculate eigenvalues according to \n
    9092          \f$ \lambda_{ii} = s_{ii}/N_{rows} \f$ \n
    91        4: Sort eigenvectors (from matrix V) according to descending eigenvalues\n
    9293    */
    9394    void process(void);
Note: See TracChangeset for help on using the changeset viewer.