Ignore:
Timestamp:
Nov 12, 2008, 11:10:52 PM (15 years ago)
Author:
Peter
Message:

fixes #461. Also modified implementation of cdf_hypergeometric_P, which may cause conflict with modifications done in trunk (refs #87). If so, go with the trunk version (which uses GSL 1.8).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/0.4-stable/yat/statistics/utility.cc

    r1392 r1624  
    3131#include <gsl/gsl_statistics_double.h>
    3232
     33#include <algorithm>
    3334#include <cassert>
    3435
     
    4142  {
    4243    double p=0;
    43     for (size_t i=0; i<=k; i++)
     44    size_t top = std::min(k, std::min(n1, t));
     45    for (size_t i=std::max(0, static_cast<int>(t-n2)); i<=top; i++)
    4446      p+= gsl_ran_hypergeometric_pdf(i, n1, n2, t);
    4547    return p;
Note: See TracChangeset for help on using the changeset viewer.