Karim Belabas on Wed, 12 Feb 2014 23:20:31 +0100


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

Re: Patch for polcyclo_eval()


* Jeroen Demeyer [2014-02-12 22:59]:
> commit e33b86a948bb07792a721d187c3ac02bd98d9aca
> Author: Jeroen Demeyer <jdemeyer@cage.ugent.be>
> Date:   Wed Feb 12 22:55:13 2014 +0100
> 
>     Fix sign of polcyclo_eval(n, x) where x == -1 and typ(x) != t_INT
> 
> diff --git a/src/basemath/bibli2.c b/src/basemath/bibli2.c
> index 587ff13..1642e2c 100644
> --- a/src/basemath/bibli2.c
> +++ b/src/basemath/bibli2.c
> @@ -360,7 +360,7 @@ polcyclo_eval(long n, GEN x)
>        if (l == 1) return gerepileupto(av, gmulgs(x,n));
>        return gerepilecopy(av, x); /* else 1 */
>      }
> -    if (gequalm1(x)) return gerepilecopy(av, x); /* -1 */
> +    if (gequalm1(x)) return gerepilecopy(av, gneg(x)); /* return -x = 1 */
>    }
>    /* Heuristic: evaluation will probably not improve things */
>    if (tx == t_POL || tx == t_MAT || lg(x) > n)

Nice catch. Committed to 'master'. (N.B. No need for gerepilecopy here, 
gerepileupto is fine.)

Thanks !

    K.B.
--
Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
Universite Bordeaux 1          Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation    http://www.math.u-bordeaux1.fr/~kbelabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux1.fr/  [PARI/GP]
`