Skip to content

improve accuracy of logaddexp.reduce #4260

@juliantaylor

Description

@juliantaylor

scipy has the logsumexp function which avoids unnecessary calls to log and thus probably saves a couple ulp of rounding errors.
The underflow avoidance should already be present in numpys current version.

I don't see a reason why we couldn't do this directly in logaddexp.reduce. The only possible issue is that the reduce loop is blocked to a few thousand elements by nditer so the maximum in the kernel is no global maximum. But I don't think that makes a big difference in numeric terms as only the largest terms even contribute to the sum.
But I would appreciate input of an expert in this regard.

A prototype implementation is available here:
https://github.com/juliantaylor/numpy/tree/logaddexp

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions