Boost logo

Boost :

Subject: Re: [boost] New Boost.XInt Library, request preliminary review
From: Chad Nelson (chad.thecomfychair_at_[hidden])
Date: 2010-03-27 00:02:25


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>> Hi! I'm a long-time user (and admirer) of the Boost libraries, and I've
>> just uploaded a new one to the Boost Vault for consideration: the
>> Extended Integer (XInt) library, a unlimited-precision integer library
>> that I've been working on for the last few months. [...]
>
> Chad, your offering does indeed look like a very promising edition to
> Boost. Thank-you for the effort, though I do have some questions for its
> future incarnations:

I've been living and breathing this library for the past few weeks, I'd
love to talk about it. :-)

> Question 1: Will you be adding an extensions module so that people can
> use GMP (or other bigint packages) for operation implementations?

As I said in a message earlier this evening:

- -----------------------8<--------------------------
> (But the ghost of GMP's GPL licence haunts Big Integer proposals. As
> I've said elsewhere, a really good solution must be switchable to use
> GMP, if your license requirements permit).

I can see the desirability of that. But that said, it shouldn't be all
that difficult to write a wrapper for pretty much any external library,
to adapt it to whatever interface xint ends up using. I'm aiming for a
Boost-licensed native C++ implementation for now, as that seems to be
what has been missing to date.
- -----------------------8<--------------------------

> Question 2: Will you be adding any performance comparisons, say between
> this library and others?

I hadn't planned to, primarily because I'm not aiming for the highest
performance. GMP and others have that aspect sewn up already; if someone
wants high performance, they'll go to those.

I'm aiming for the more casual user of large integers. Somebody who
needs a large-integer package to do specific calculations in his
closed-source software, for example, and needs a Boost-licensed
implementation a lot more than the highest performance. Or the person
who needs an open-source large-integer package that's 100% portable, so
he can compile it on some weird system cobbled together from old
supercomputer parts. Or the guy who just needs a large-integer package
to solve a particular mathematical programming puzzle and doesn't want
the headaches of installing GMP, compiling it, and figuring it out.

Don't think that those people don't exist -- the whole reason I started
writing it was because I was in the first camp myself. :-) I suspect
that people like that make up the vast majority of those who need a
large integer library.

> Question 3: Are there any plans to update the interface to make use of
> expression templates? - certain combinations of operations offer far
> superior performance when merged (at compile time) as opposed to being
> computed sequentially.

Can you give me an example? There are a few things already in there that
might fall into that category, like mulmod and expmod (vital for stuff
like RSA encryption). Is that the kind of thing you had in mind?

> Question 4: Will there be a conversion interface for scientific notion
> based integers representations? eg: -123e+300 (or even conversion from
> PODs such as doubles, long doubles or floats to xint::integer)

The first can be done easily, if there's any call for it. The rest...
there's no reason they couldn't be done, but I don't really see much
need for it with an integer-only library. If you're using any kind of
floating-point number to represent something that's too big for the
system's standard integers, then it's probably too late to convert it to
XInt -- you've already lost the precision that a large-integer library
would provide.

That said, once there's a standard large-integer library, it would be
easy to build an arbitrary-precision floating-point type on top of it
with those conversions. But again, I'm only concentrating on the first
step right now, the large-integer library.

> Question 5: Seeing as you touched on the topic of cryptography, will
> there be a very simple RSA example? (most bigint libraries do this as a
> cursory indicator of their operational validity)

I can show the core parts of it -- how to generate the keys, and how to
do the encryption and decryption, using XInt. But I'll have to leave it
to someone else to put it all together, because I wrote exactly that for
another company very recently, and I might get into lawyer trouble if
the code I came up with is too similar to what I wrote for them.
- --
Chad Nelson
Oak Circle Software, Inc.
*
*
*
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkutg04ACgkQp9x9jeZ9/wTMqQCglQ53+GWKwI9jGuEhHcaA4/MK
xgYAoOAAHt0F+nzY+4dm97CNBkWukQEW
=l/UK
-----END PGP SIGNATURE-----


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk