code/Heterogenous/ADI_Hetero_I.cpp
double Poisson_PMF(double lambda, int k)
{
    if ((k < 0) | (lambda < 0))
        return 0;
    else if (lambda == 0)
        return (k == 0) ? 1 : 0;
    else
    {
        double logP = - lambda + k * log(lambda);
        
        for (int i = k; i > 1; i--)
            logP -= log(i);
        
        return exp(logP);
    }
}
//============================================================================
// Probability Mass Function of Poisson Distribution

Probability Mass Function of Poisson Distribution
Probability Mass Function of Poisson Distribution
double Poisson_PMF(double lambda, int k)
{
    if ((k < 0) | (lambda < 0))
        return 0;
    else if (lambda == 0)
        return (k == 0) ? 1 : 0;
    else
    {
        double logP = - lambda + k * log(lambda);
        for (int i = k; i > 1; i--)
            logP -= log(i);
        return exp(logP);
    }
}
double Poisson_PMF ( double lambda , int k ) { if ( ( k < 0 ) | ( lambda < 0 ) ) return 0 ; else if ( lambda == 0 ) return ( k == 0 ) ? 1 : 0 ; else { double logP = - lambda + k * log ( lambda ) ; for ( int i = k ; i > 1 ; i -- ) logP -= log ( i ) ; return exp ( logP ) ; } }
Probability Mass Function of Poisson Distribution
Probability Mass Function of Poisson Distribution