Added logsumexp way to do iterative