John Cremona on Mon, 09 Nov 2015 14:56:04 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: real polynomials


In case you are all wondering why I have not yet reported back with
success, there are two reasons: first, the program works but it is
much too slow; and second, I have been travelling without proper
internet access.

I may have some more questions as I try to speed things up.  At the
moment my program uses plain C (doubles) throughout except where it
has to (rather frequently) find out about whether a polynomial has
real roots, at which point I do this conversion to GEN types.  I will
try to convert the whole thing into proper pari, though multiprecision
is not needed.  For the degree 4 case where I know how to test for the
number of real roots algebraically, my old program in pure C is about
100 times faster than the new one.  And I need to run it in hiogher
degrees where the condiition is a lot more complicated (and also not
known to me!).

John

On 8 November 2015 at 12:09, Karim Belabas
<Karim.Belabas@math.u-bordeaux.fr> wrote:
> * John Cremona [2015-11-06 17:51]:
>> For some reason I thought that calling gdiv on two t_INTs would give a
>> truncated answer.
>
> - gdiv() implements the '/' GP operator [ which doesn't truncate ]
>
> - divii() returns the Euclidean quotient of two integers (hence truncates)
>
>> In fact I wanted to make a t_INT out of the
>> mantissa and then right-shift it by e places, but the function which
>> does that does (I think?) truncate.
>
> Shifting functions come in two variants:
>
> - gshift() [ truncates, implements the << and >> operators ]
>
> - gmul2n() [ multiplies by 2^n; never truncates, so safe for use when n < 0 ]
>
>
> Cheers,
>
>     K.B.
> --
> Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
> Universite de Bordeaux         Fax: (+33) (0)5 40 00 69 50
> 351, cours de la Liberation    http://www.math.u-bordeaux.fr/~kbelabas/
> F-33405 Talence (France)       http://pari.math.u-bordeaux.fr/  [PARI/GP]
> `
>