Implementing a Custom Repeated Sampler #682
-
Hi, I want to implement a new sampler in C++ code, but I'm having difficulties. What I want to implement is a repeated sampler. For example, if spp=8, next_1d() of independent sampler creates [r1, r2, r3, r4, r5, r6, r7, r8] where r1-r8 are independent random numbers in [0,1]. I want to implement a repeated sampler that creates [r1, r2, r3, r4, r1, r2, r3, r4] or [r1, r1, r2, r2, r3, r3, r4, r4] (both are okay). I tried to use dr::repeat or dr::gather, but was unsuccessful. Any help would be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Nothing immediately comes to mind as to why this wouldn't be feasible.
This should have worked, what exactly did you try? The naive implementation would be to just wrap the |
Beta Was this translation helpful? Give feedback.
Ah, indeed. In short, we can't use
gather
inside of a recorded loop (basically the main integrator loop).The solution would then be to construct the sampler to have the repetition.
The
inc
variables defines multiples RNS "streams" in the PCG32 sampler. It is initialized here. You should be able to modify it such that is is repeating (it is apublic
member).