Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/math/distributions/negative_binomial.hpp @ 101:c530137014c0
Update Boost headers (1.58.0)
author | Chris Cannam |
---|---|
date | Mon, 07 Sep 2015 11:12:49 +0100 |
parents | 2665513ce2d3 |
children |
comparison
equal
deleted
inserted
replaced
100:793467b5e61c | 101:c530137014c0 |
---|---|
458 } | 458 } |
459 if (P <= pow(dist.success_fraction(), dist.successes())) | 459 if (P <= pow(dist.success_fraction(), dist.successes())) |
460 { // p <= pdf(dist, 0) == cdf(dist, 0) | 460 { // p <= pdf(dist, 0) == cdf(dist, 0) |
461 return 0; | 461 return 0; |
462 } | 462 } |
463 if(p == 0) | |
464 { // Would need +infinity failures for total confidence. | |
465 result = policies::raise_overflow_error<RealType>( | |
466 function, | |
467 "Success fraction is 0, which implies infinite failures !", Policy()); | |
468 return result; | |
469 // usually means return +std::numeric_limits<RealType>::infinity(); | |
470 // unless #define BOOST_MATH_THROW_ON_OVERFLOW_ERROR | |
471 } | |
463 /* | 472 /* |
464 // Calculate quantile of negative_binomial using the inverse incomplete beta function. | 473 // Calculate quantile of negative_binomial using the inverse incomplete beta function. |
465 using boost::math::ibeta_invb; | 474 using boost::math::ibeta_invb; |
466 return ibeta_invb(r, p, P, Policy()) - 1; // | 475 return ibeta_invb(r, p, P, Policy()) - 1; // |
467 */ | 476 */ |
525 if(Q == 1) | 534 if(Q == 1) |
526 { // There may actually be no answer to this question, | 535 { // There may actually be no answer to this question, |
527 // since the probability of zero failures may be non-zero, | 536 // since the probability of zero failures may be non-zero, |
528 return 0; // but zero is the best we can do: | 537 return 0; // but zero is the best we can do: |
529 } | 538 } |
530 if (-Q <= boost::math::powm1(dist.success_fraction(), dist.successes(), Policy())) | |
531 { // q <= cdf(complement(dist, 0)) == pdf(dist, 0) | |
532 return 0; // | |
533 } | |
534 if(Q == 0) | 539 if(Q == 0) |
535 { // Probability 1 - Q == 1 so infinite failures to achieve certainty. | 540 { // Probability 1 - Q == 1 so infinite failures to achieve certainty. |
536 // Would need +infinity failures for total confidence. | 541 // Would need +infinity failures for total confidence. |
537 result = policies::raise_overflow_error<RealType>( | 542 result = policies::raise_overflow_error<RealType>( |
538 function, | 543 function, |
539 "Probability argument complement is 0, which implies infinite failures !", Policy()); | 544 "Probability argument complement is 0, which implies infinite failures !", Policy()); |
545 return result; | |
546 // usually means return +std::numeric_limits<RealType>::infinity(); | |
547 // unless #define BOOST_MATH_THROW_ON_OVERFLOW_ERROR | |
548 } | |
549 if (-Q <= boost::math::powm1(dist.success_fraction(), dist.successes(), Policy())) | |
550 { // q <= cdf(complement(dist, 0)) == pdf(dist, 0) | |
551 return 0; // | |
552 } | |
553 if(p == 0) | |
554 { // Success fraction is 0 so infinite failures to achieve certainty. | |
555 // Would need +infinity failures for total confidence. | |
556 result = policies::raise_overflow_error<RealType>( | |
557 function, | |
558 "Success fraction is 0, which implies infinite failures !", Policy()); | |
540 return result; | 559 return result; |
541 // usually means return +std::numeric_limits<RealType>::infinity(); | 560 // usually means return +std::numeric_limits<RealType>::infinity(); |
542 // unless #define BOOST_MATH_THROW_ON_OVERFLOW_ERROR | 561 // unless #define BOOST_MATH_THROW_ON_OVERFLOW_ERROR |
543 } | 562 } |
544 //return ibetac_invb(r, p, Q, Policy()) -1; | 563 //return ibetac_invb(r, p, Q, Policy()) -1; |