implement logsumexp() in cython code