/*
 * Copyright (c) 1999 Johnny C. Lam.
 * All rights reserved.
 *
 * Permission to use, copy, modify, distribute and sell this software
 * and its documentation for any purpose is hereby granted without fee,
 * provided that the above copyright notice appear in all copies and
 * that both that copyright notice and this permission notice appear
 * in supporting documentation.  The author makes no representations
 * about the suitability of this software for any purpose.  It is
 * provided "as is" without express or implied warranty.
 */

// -*- C++ -*-

#ifndef STD_CMATH_INCLUDED
#include <cmath>
#define STD_CMATH_INCLUDED
#endif

#ifndef STD_LIMITS_INCLUDED
#include <limits>
#define STD_LIMITS_INCLUDED
#endif

inline
bool
Probability::Verbose() const
{
    return _verbose;
}

inline
Probability::size_type
Probability::LeftMask() const
{
    return _left_mask;
}

inline
Probability::size_type
Probability::RightMask() const
{
    return _right_mask;
}

inline
unsigned int
Probability::MutationJump(size_type k) const
{
    return _Jump_at_k[k];
}

inline
probability
Probability::P_mutation_at_k(size_type k) const
{
    return _P_mutation_at_k[k];
}

///////////////////////////////////////////////////////////////////////////
//
// Gaps are numbered from 1 to hap_length.
//
///////////////////////////////////////////////////////////////////////////

inline
probability
Probability::P_recombination_at_k(size_type k) const
{
    assert(k > 0);
    return _P_recombination_at_k[k - 1];
}

inline
log_probability
Probability::log_P_mutation(const Haplotype& s, const Haplotype& t) const
{
    probability p = P_mutation(s, t);
    return (p > 0) ? -logP(p) : std::numeric_limits<log_probability>::max();
}

inline
log_probability
Probability::log_P_recombination(const Haplotype& s, const Haplotype& t,
				 size_type disease) const
{
    probability p = P_recombination(s, t, disease);
    return (p > 0) ? -logP(p) : std::numeric_limits<log_probability>::max();
}
