def lif_linear_voltage_update(v_cur, v_rest, v_in, alpha_v, v_decay, dt,
    refrac_counts):
    """Calculate change in cell's voltage based on a linear relation between current and incoming voltage, with decay.

    Voltage updates are performed according to the following formula:

    .. math::

        voltage_{t+1} = rest_{t} + (voltage_{t} - rest_{t}) * decay + alpha * incoming_{t}

    :param v_cur: Current voltages
    :param v_rest: Resting voltages
    :param v_in: Incoming voltages
    :param alpha_v: Incoming voltage scaling factor
    :param v_decay: Voltage decay factor, should be < 1
    :param dt: Duration of single timestep
    :param refrac_counts: Number of timesteps left in refractory state for each :class:`Neuron`

    :return: New voltages
    """
    v_delta = (v_cur - v_rest) * v_decay + alpha_v * v_in
    non_refrac = refrac_counts == 0
    v_cur = v_rest + v_delta * non_refrac.to(v_delta.dtype)
    return v_cur
