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

Use dqrng::dqrrademacher #134

Open
s3alfisc opened this issue Jul 15, 2023 · 3 comments
Open

Use dqrng::dqrrademacher #134

s3alfisc opened this issue Jul 15, 2023 · 3 comments

Comments

@s3alfisc
Copy link
Owner

  • for performance improvements
@s3alfisc s3alfisc linked a pull request Sep 1, 2023 that will close this issue
@s3alfisc s3alfisc linked a pull request Sep 13, 2023 that will close this issue
@rstub
Copy link

rstub commented Apr 16, 2024

Anyway I could help with this change?

BTW, I know you have been waiting a long time for weighted sampling in dqrng. For the time being, you could just throw an unfair coin:

                            mammen = function(n) {
                              ifelse(
                                dqrng::dqrunif(n) < (sqrt(5) + 1) / (2 * sqrt(5)),
                                (1 - sqrt(5)) / 2, 
                                (1 + sqrt(5)) / 2 
                              )
                            },

This is slower than you current implementation with sample(), but it would be controlled by the same state / seed as the other "dqrng" weights.

@s3alfisc
Copy link
Owner Author

Hi @rstub - this is already implemented =) I am only waiting for me to address a few changes for an ropensci review yet.

Changing the Mammen weights as in your suggestions sounds like a great plan. I'd be happy to accept a PR but can also just implement it myself =) I definitely agree that seed state uniformity definitely beats performance in this case!

Best, Alex

@rstub
Copy link

rstub commented Apr 17, 2024

OK, I got confused by the two closed PRs. Great if things are working already. I think it is easier if you do the changes for the Mammen weights on your end. I might contribute a (faster) C++ version once the upcoming {dqrng} release is on CRAN.

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