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

Add free function for calculation of simple continued fraction coefficients #973

Closed
wants to merge 3 commits into from

Conversation

mborland
Copy link
Member

@mborland mborland commented Apr 4, 2023

I think this solves #971 while keeping the class immutable like @NAThompson wants. Since this header requires C++17 guaranteed copy elision should make passing the data from the class to the user through the free function inexpensive. @Tomaqa I used your use case as the additional test case.

@mborland
Copy link
Member Author

mborland commented Apr 6, 2023

The CI failure is failed to clone.

@mborland mborland linked an issue Apr 6, 2023 that may be closed by this pull request
@Tomaqa
Copy link

Tomaqa commented Apr 11, 2023

It is a way.
However, I need to convert the resulting coefficients back to a rational or floating-point number.
It can again be achieved by a free function which operates upon a vector of coefficients, but I think it is not conceptual. I just want to convert the resulting simple_continued_fraction to rational.

A possible way is to add constructor simple_continued_fraction(std::vector<> coefficients) where the coefficients will be checked whether they are valid, which should be easy to implement and inexpensive to run.
Also, std::move can be used.

If this idea is fine with you, I can implement it, but I will need to use your commits.

@mborland
Copy link
Member Author

If this idea is fine with you, I can implement it, but I will need to use your commits.

Go ahead. This is on a branch in the boost.math tree so you will be able to clone it.

@mborland mborland closed this Apr 13, 2023
@NAThompson NAThompson deleted the simple_continued_fraction branch January 24, 2024 21:33
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.

simple_continued_fraction
3 participants