# Path: stationary/utils/math_helpers.py
# def multiply_vectors(a, b):
#     c = []
#     for i in range(len(a)):
#         c.append(a[i]*b[i])
#     return c
# 
# def dot_product(a, b):
#     c = 0
#     for i in range(len(a)):
#         c += a[i] * b[i]
#     return c


import numpy
from ..utils.math_helpers import multiply_vectors, dot_product
        return y * fitness(x)
    return g


def logit(fitness, beta=1., q=0.):
    """
    The logit incentive for a power q. For q=0 this reproduces the Logit
    process ratio.

    Parameters
    ----------
    fitness: function
        A fitness landscape
    q: float
        Exponent for the population state
    beta: float
        An inverse temperature / strength of selection parameter

    Returns
    -------
    a function corresponding to the incentive.
    """

    if q == 0:
        def f(x):
            return numpy.exp(numpy.array(fitness(x)) * beta)
        return f

    def g(x):
        y = numpy.power(x, q)

# Path: stationary/utils/math_helpers.py
# def multiply_vectors(a, b):
#     c = []
#     for i in range(len(a)):
#         c.append(a[i]*b[i])
#     return c
# 
# def dot_product(a, b):
#     c = 0
#     for i in range(len(a)):
#         c += a[i] * b[i]
#     return c


# Path: stationary/processes/incentives.py
import numpy
from ..utils.math_helpers import multiply_vectors, dot_product

        return y * fitness(x)
    return g


def logit(fitness, beta=1., q=0.):
    """
    The logit incentive for a power q. For q=0 this reproduces the Logit
    process ratio.

    Parameters
    ----------
    fitness: function
        A fitness landscape
    q: float
        Exponent for the population state
    beta: float
        An inverse temperature / strength of selection parameter

    Returns
    -------
    a function corresponding to the incentive.
    """

    if q == 0:
        def f(x):
            return numpy.exp(numpy.array(fitness(x)) * beta)
        return f

    def g(x):
        y = numpy.power(x, q)

        return multiply_vectors(y, numpy.exp(numpy.array(fitness(x)) * beta))