Probably, for numbers with 512 BITs (8 64 BIT words) (in particular with a hard, small bound), I could imagine, that is appropriate to store the data in place, instead of using dynamically allocated memory, as it increases the locality of reference and doesn't use extra memory for pointers/space after dynamically allocated memory. Of course, good pooling solutions can also help to reduce memory overhead.
Regarding the arithmetic needs, Alexander knows probably better. Michael On 27 Jan., 01:43, Carl Witty <carl.wi...@gmail.com> wrote: > On Mon, Jan 26, 2009 at 2:06 AM, Alexander Dreyer > > <jan.alexander.dre...@googlemail.com> wrote: > > > Hello everybody, > > I'm about to implement a C++-class for polynomials in the style of > > PolyBoRi, but with integer-valued coefficients. In fact, the Integers > > may be quite large, let's say up to 2^512. > > Since this data type might be interesting for the SAGE community > > somewhen, I would like to ask you for your opinion: What would you > > suggest as data type for those coefficients? > > > Best regards, > > Alexander Dreyer > > I'm not sure it matters to Sage... no matter what data structure you > use, whoever writes the Sage interface can write code to translate > back and forth to the normal Sage data types. > > I'm not sure I understand what these polynomials are. Are the > coefficients really just integers mod 2^512 (so that multiplication is > integer multiplication, followed by discarding the high-order words)? > Do you need to do any operations on them besides addition, > subtraction, and multiplication? How much effort are you willing to > spend on micro-optimizations? > > I would recommend using GMP, and using either the mpz or mpn layers, > depending on the answers to the above questions. If you only need > addition, subtraction, and multiplication, then using mpn is faster > and probably easier (since you control the memory being used, and you > don't have to worry about mpz_init() and mpz_clear()). If you need > more integer operations, then it would probably be better to use the > mpz layer. > > Carl --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---