📅  最后修改于: 2022-03-11 14:45:03.676000             🧑  作者: Mango
def discount(x, gamma):
"""
Compute discounted sum of future values
out[i] = in[i] + gamma * in[i+1] + gamma^2 * in[i+2] + ...
"""
return signal.lfilter([1], [1, -gamma], x[::-1], axis=0)[::-1]