|
Boost : |
From: Matthias Troyer (troyer_at_[hidden])
Date: 2002-01-30 11:35:47
Hi Dave,
Thanks for the reply. Synge Todo and I will do so if we don't hear
any comments from Jens this week.
Matthias
On Wednesday, January 30, 2002, at 03:35 PM, David Abrahams wrote:
> I think Jens is even busier than I am right now, and has gone mostly
> incommunicado for a while ;-). If you don't hear from him right away, I
> would forge ahead with your idea. It sounds superb to me, FWIW.
>
> -Dave
>
> ----- Original Message -----
> From: "Matthias Troyer" <troyer_at_[hidden]>
> To: <boost_at_[hidden]>
> Sent: Wednesday, January 30, 2002 9:27 AM
> Subject: [boost] Additions to boost::random
>
>
>> Dear Jens, dear Booster
>>
>> We now daily use the boost::random library in our production codes, and
>> have collected our experiences with it. As I have heard that the
>> library
>> has been proposed as a possible addition to the C++ standard, I wish to
>> bring up our experiences, and propose a minor change that would greatly
>> help generic programming with boost::random.
>>
>> The problem we face at the moment is that the arguments to the
>> seed(...)
>> function and to the non-default constructor are dependent on the
>> generator.
>> This makes it impossible to just change generators, without changing
>> the code, when the code needs to seed a generator, which happens
>> in many applications, e.g. when a new generator needs to be
>> spawned dynamically in an application.
>>
>> One solution would be to always require a seed(uint32_t ). However the
>> problem there is that for generators like the LCG many integers are bad
>> seed values, and the good/bad values differ from generator to
>> generator.
>> Also, a lagged Fibonacci generator, or a Mersenne Twister (MT) needs a
>> long
>> seed block instead of a single integer.
>>
>> There are however solutions to this problem, as implemented e.g. in the
>> SPRNG library (http://sprng.cs.fsu.edu/). These solutions take a
>> "sequence number", a nonnegative integer, and convert it into a good
>> seed for lagged Fibonacci generator. Similar algorithms can be
>> implemented
>> for the MT, or also for LCGs. This makes it possible to write more
>> generic
>> codes.
>>
>> Since I do not want to change the semantics of seed(uint32_t) where
>> it is avaiable, I propose to add the following members to the
>> generators:
>>
>>
>> sequence(uint32_t n) ; // seeds the generator with the n-th good
>> seed
>> static const uint32_t max_sequence; // n can take all values
>> 0..max_sequence
>> // whereever possible this
>> should
>> be the
>> // largest possible integer
>>
>> Alternatively we could replace uint32_t by an integral sequence_type,
>> to make it more flexible.
>>
>> Also, these member should be propagated through the adaptors, so that
>> they
>> can also be seeded in this way.
>>
>> If this proposal meets with approval, we will start implementing it and
>> can
>> then present it to Boost for further discussions.
>>
>> Best regards,
>>
>> Matthias
>>
>>
>> Info: http://www.boost.org Send unsubscribe requests to:
> <mailto:boost-unsubscribe_at_[hidden]>
>>
>> Your use of Yahoo! Groups is subject to
>> http://docs.yahoo.com/info/terms/
>>
>>
>
>
> Info: http://www.boost.org Send unsubscribe requests to:
> <mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk