Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the Lambert W function as a wrapper around the lambert_w crate. #63

Merged
merged 5 commits into from
Jul 30, 2024

Conversation

JSorngard
Copy link
Contributor

@JSorngard JSorngard commented Jul 30, 2024

This PR implements a version of the Lambert W function in special::function (and thus also in fuga) that is flexible in terms of speed and accuracy, and then exports only the accurate (but still fast) version in prelude.

The method used is described in this article by Toshio Fukushima: https://www.researchgate.net/publication/346309410_Precise_and_fast_computation_of_Lambert_W_function_by_piecewise_minimax_rational_function_approximation_with_variable_transformation

See related discussion in #64.

Copy link
Owner

@Axect Axect left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your excellent work on implementing the Lambert W function, @JSorngard. I've thoroughly reviewed your code, and I'm impressed with its quality and attention to detail. Here's my review:

  1. Dependency Addition:

    • The dependency has been appropriately added to Cargo.toml.
  2. Function Imports:
    I've checked that the following functions have been correctly imported:

    • gaussian
    • gamma
    • ln_gamma
    • poch
    • inc_gamma
    • inv_inc_gamma
    • erf
    • erfc
    • inv_erf
    • inv_erfc
    • beta
    • inc_beta
    • inv_inv_beta (this is my typo - I'll fix it)
    • phi
  3. Code Structure and Style:

    • The code is well-organized and follows Rust best practices.
    • The implementation is concise yet readable.
  4. Documentation:

    • Excellent job on the documentation. It's comprehensive and clear.
    • Reference to Fukushima's method is very helpful.
    • The examples in the doc comments will be valuable for users.
  5. Functionality:

    • The flexible implementation is well done.
    • I appreciate the accurate version being made available in prelude.
    • The error handling looks appropriate, returning NAN for out-of-domain inputs.

Overall, this is a high-quality contribution that fits well with Peroxide's goals and structure. Great work!

@JSorngard
Copy link
Contributor Author

Thank you so much for the review!

@Axect
Copy link
Owner

Axect commented Jul 30, 2024

Thank you, @JSorngard, for this excellent contribution! Your implementation of the Lambert W function is top-notch and aligns perfectly with Peroxide's goals.

I've reviewed the code thoroughly, and I'm impressed with its quality, efficiency, and the thoughtful balance between flexibility and ease of use.

I'm happy to inform you that I'll be merging this Pull Request right away. We'll include your contribution in the next release of Peroxide, which I plan to push out soon.

Once again, thank you for your hard work. Your contribution is greatly appreciated and will certainly benefit many Peroxide users.

@Axect Axect merged commit f9e8b56 into Axect:dev Jul 30, 2024
Axect added a commit that referenced this pull request Jul 30, 2024
- Integrate with Lambert W crate (#63)
Axect added a commit that referenced this pull request Jul 30, 2024
- Integrate with Lambert W crate (#63)
@Axect
Copy link
Owner

Axect commented Jul 30, 2024

I'm pleased to inform you that your Lambert W function implementation has been officially published as part of Peroxide version 0.37.8. Users can now take advantage of your excellent work by updating to this latest version.

To all Peroxide users: The Lambert W function is now available starting from version 0.37.8. You can update your dependency in Cargo.toml to access this new feature:

[dependencies]
peroxide = "0.37.8"

@JSorngard, thank you once again for your valuable contribution. It's now live and ready to benefit the entire Peroxide community. Your work is greatly appreciated!

If anyone encounters any issues or has questions about the new Lambert W function, please don't hesitate to open a new issue on our GitHub repository.

@JSorngard
Copy link
Contributor Author

Ooh, this is exciting!

I'll check the issues every now and then to see if there are any problems with the implementations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants