Open adam4130 opened 2 years ago
You can also make PCG go backwards using advance
. I just wanted to check that you were aware of this…
Yes we did initially use advance
but ended up wanting equivalent cost forward and backward.
And also, when you want to go backward with advance, let's say n steps, the cost becomes O(64) instead of O(log n). I noticed that going backward was costlier than going forward when using pcg. I think multiplicative inverse trick like this should make it into the library somehow, would increase its usability.
For the sake of context and motivation for this PR, I am posting a link to our preprint where we use this functionality: https://arxiv.org/abs/2302.02778
We have an application with an adjoint Monte Carlo simulation that requires a reversible PRNG. We implemented a reversal of your PCG family and thought it useful to include in your samples.