Skip to content

RFC: add support for evaluating log1mexp(x) #197

@kgryte

Description

@kgryte

Checklist

Please ensure the following tasks are completed before submitting a feature request.

  • Read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.
  • The issue name begins with RFC:.

Description

Description of the feature request.

This RFC proposes to add support for evaluating ln( 1 - exp(x) ) in a more numerically stable manner. The conventional approaches of log1p( -exp(x) ) and ln( -exp1m(x) ) are subject to numerically stability issues when x approaches 0 and thus exp(x) approaches 1 in the former case and when x is large and -exp1m(x) approaches 1 in the latter case.

The proposed implementation would seek to divide the domain and provide appropriate approximations depending on the regime. In particular,

log1mexp(x) = ln( -expm1(-x) ); when 0 < x <= ln(2)
log1mexp(x) = log1p( -exp(-x) ); when x > ln(2)

Package: @stdlib/math/base/special/log1mexp
Alias: log1mexp

Related Issues

Does this feature request have any related issues?

No.

Questions

Any questions for reviewers?

No.

Other

Any other information relevant to this feature request? This may include screenshots, references, sample output, and/or implementation notes.

For further background, see associated numerical analysis.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureIssue or pull request for adding a new feature.Good First IssueA good first issue for new contributors!Help WantedExtra attention is needed.MathIssue or pull request specific to math functionality.RFCRequest for comments. Feature requests and proposed changes.difficulty: 1Low degree of difficulty. Should be straightforward to implement and/or resolve.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions