Exporting a gmp_rndstate_t?
Pedro Gimeno Fortea
parigalo at formauri.es
Thu Jun 14 16:48:35 CEST 2007
On 06/06/2007 11:05:18 AM, Christopher Creutzig wrote:
> is it possible to (portably) export and re-import a gmp_rndstate_t,
> as an mpz_t can be via mpz_export and mpz_import (plus storing the
> sign)? (If this limitation is necessary, an answer only valid for the
> MT algorithm would probably be fine.)
It is in the plans, just not yet done. The current version does not
support exporting the state and there's no patch submitted yet.
> On a slightly related note, I'd be happy to find a way of converting
> a gmp_rndstate_t to an (opaque) mpz_t which can be converted back to
> a gmp_rndstate_t without the runtime overhead required for the
> current initialization from an unsigned int. Here, I don't really
> bother whether the random state remains the same, I just need a
> deterministic outcome.
It's also in the plans to speed up the seeding process. A patch for
that is already submitted and hopefully the next version will include
it.
Anyway you're asking for a way to export to mpz_t; do you really need
that format? I mean, the plans are to include an export routine which
stores the result in an opaque structure with the user-supplied address
and with a library-supplied length, plus a complementary import routine
which accepts the result from the export one. I think this should be
enough for all purposes. It puzzles me why you want to use an mpz_t
integer for that; that specific requirement is not in the plans.
Would you please clarify that point?
-- Pedro Gimeno
More information about the gmp-devel
mailing list