Subject: Re: [boost] Low discrepancy sequences (Boost.Random)
From: Justinas V. D. (jvd_at_[hidden])
Date: 2010-04-12 10:32:00
2010.04.11 17:44, Steven Watanabe raÅ¡Ä:
>> Scaling down to the [0, 1]^D unit hypercube you would get more
>> precision this way. (Of course, you could use uint32_t, too, and the
>> typedef would look like this: niederreiter_base2<uint32_t, D, 1, (1U
>> << 32) /*!*/> , but g++ complains about left shift count >= width
>> of type, and spits out a warning in the instantiation site.) I think
>> this option could be best left to users, who know what they want.
> I do find it odd that you use (1 << 31) which is a negative number.
> I'd prefer it if you used <uint32_t, D, 1, ((uint32_t)1 << 31)>
Done. You were right, as usual. I distinctly remember int being a 16
bit type in the times of old, when x286 reigned supreme. Patched and
> I'm not sure that this is a good idea.
> If you want discard to operate on a whole
> vector, then shouldn't operator() return
> a whole vector too? I'm guessing that
> returning a vector from operator() would
> make using the generator more inconvenient.
Yes, all those are very valid points. My rationale behind
vector-discarding version was that I can do that in O(1), whereas
consecutive operator() invocations unnecessarily make it a O(n)
operation. Nevertheless, with a bit of twiddling it is possible to
achieve O(1) for z consecutive elements, too (already done).
So now we have as is told in the Draft:
X u = v;
for( int i = 0; i < N; ++i )
assert( u() == v() );
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk