pcg-cpp icon indicating copy to clipboard operation
pcg-cpp copied to clipboard

Add sample for reversing the PCG family

Open adam4130 opened this issue 3 years ago • 4 comments

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.

adam4130 avatar May 05 '22 21:05 adam4130

You can also make PCG go backwards using advance. I just wanted to check that you were aware of this…

imneme avatar May 05 '22 22:05 imneme

Yes we did initially use advance but ended up wanting equivalent cost forward and backward.

adam4130 avatar May 05 '22 22:05 adam4130

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.

mfbalin avatar Nov 28 '22 04:11 mfbalin

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

ELoevbak avatar Feb 07 '23 09:02 ELoevbak