- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried vslLeapfrogStream and compared the numbers produced with a simple block of randoms.
This worked for the congruential generators MCG31 and 59, but it did not put the numbers in the right places with WH.
If it is not supported, I expected a non-zero status from calling the vslLeapfrogStream method, but it was zero.
My guess is that WH shouldn't be supported and the status is wrong.
This is what I did...
the assert(fabs(a - b) < 1e-12); fails, suggesting inconsistent values.
It works if I change the gen to an MCG near the top.
This is with compiler version 16.0 x64 in VS2015 / Windows 10.
int main() { constexpr int nFrogs = 7; constexpr int nSims = 101; VSLStreamStatePtr streams[nFrogs]; int gen = VSL_BRNG_WH; int seed = 1234567890; // Creating first stream int status = vslNewStream(&streams[0], gen, seed); assert(status == 0); // Copy first stream to others for (int i = 1; i < nFrogs; ++i) { status = vslCopyStream(&streams, streams[0]); assert(status == 0); } // Leapfrogging the streams for (int i = 0; i < nFrogs; ++i) { status = vslLeapfrogStream(streams, i, nFrogs); assert(status == 0); // Unacceptable generator gives status -1002 } // Generating base case random numbers without leap frog for comparison // Same generator and seed VSLStreamStatePtr baseStream; status = vslNewStream(&baseStream, gen, seed); assert(status == 0); double y[nSims*nFrogs]; status = vdRngUniform(VSL_RNG_METHOD_UNIFORM_STD, baseStream, nSims*nFrogs, y, 0.0, 1.0); assert(status == 0); // Generate randoms for each of the leapfrog streams and compare output double x[nSims]; for (int i = 1; i < nFrogs; ++i) { status = vdRngUniform(VSL_RNG_METHOD_UNIFORM_STD, streams, nSims, x, 0.0, 1.0); assert(status == 0); for (int j = 0; j < nSims; ++j) { double a = x; double b = y[j*nFrogs + i]; assert(fabs(a - b) < 1e-12); } } // Deleting the streams for (int i = 1; i < nFrogs; ++i) { status = vslDeleteStream(&streams); assert(status == 0); } vslDeleteStream(&baseStream); }
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Roger,
From our documentation, it should support WH. I can reproduce your result. It seems something is wrong. I will ask our developer to investigate it and get back to you later.
Thanks
Ying

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page