def map_decode(sys_symbols, non_sys_symbols, trellis, noise_variance, L_int, mode='decode'):

    k = trellis.k
    n = trellis.n
    rate = float(k)/n
    number_states = trellis.number_states
    number_inputs = trellis.number_inputs

    msg_length = len(sys_symbols)

    # Initialize forward state metrics (alpha)
    f_state_metrics = zeros([number_states, 2])
    f_state_metrics[0][0] = 1
    #print f_state_metrics

    # Initialize backward state metrics (beta)
    b_state_metrics = zeros([number_states, msg_length+1])
    b_state_metrics[:,msg_length] = 1

    # Initialize branch transition probabilities (gamma)
    branch_probs = zeros([number_inputs, number_states, msg_length+1])

    app = zeros(number_inputs)

    lappr = 0

    decoded_bits = zeros(msg_length, 'int')
    L_ext = zeros(msg_length)

    priors = empty([2, msg_length])
    priors[0,:] = 1/(1 + exp(L_int))
    priors[1,:] = 1 - priors[0,:]

    # Backward recursion
    _backward_recursion(trellis, msg_length, noise_variance, sys_symbols,
                       non_sys_symbols, branch_probs, priors, b_state_metrics)

    # Forward recursion
    _forward_recursion_decoding(trellis, mode, msg_length, noise_variance, sys_symbols,
                                non_sys_symbols, b_state_metrics, f_state_metrics,
                                branch_probs, app, L_int, priors, L_ext, decoded_bits)

    return [L_ext, decoded_bits]
Test that portal adder factory graciously returns empty list when
dataset/ETHPy150Open veeresht/CommPy/commpy/channelcoding/turbo.py/map_decode--crossover with--dataset/ETHPy150Open tuturto/pyherc/src/pyherc/test/unit/test_portaladder.py/TestPortalAdderFactory.test_handling_no_matches