Karim Belabas on Fri, 14 Oct 2022 19:22:54 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: polcyclo: overflow in precp().
|
- To: Max Alekseyev <maxale@gmail.com>
- Subject: Re: polcyclo: overflow in precp().
- From: Karim Belabas <Karim.Belabas@math.u-bordeaux.fr>
- Date: Fri, 14 Oct 2022 19:21:51 +0200
- Arc-authentication-results: i=1; smail; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1665768112; c=relaxed/relaxed; bh=GycMnG2oQh19Y5D8jbx4PivQuF3sxnmexwS8Lc0ms2Y=; h=DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: Mail-Followup-To:References:MIME-Version:Content-Type: Content-Disposition:Content-Transfer-Encoding:In-Reply-To; b=hD8DmccHIzyUBKdLuh26t8EDJjePd4VEOcQiXBqhQ0B1waLdB7vz70VsOyji5bApylLUHbAeAjRGzrvX2UTUxG7gG34Ld19NBcD/RO6a2lHTOcxI8CG/m69SG0yeSYDagoJk2iFuF9n+UL6BQFg9fo+8ZuXVF8KiJCmeY5iuHEpCPZF800OhOm1X5Wtxe1iy+CI9w72k7oq6fWMb6c92Hv8H1VEKaPRnk9emfNr+6ABGcuxPSGAdu2WhzZxc+dBX/FQwfAZgSsjmrRO55PxOOM2ilUizEGYwjnKtOu9F2Jlek125QCCmlvPzeC2qvlJ2rWVT58aUAaWbrMMkfgq96Zhpcu58W4GEUtGoH1IJsxPbc4aZm5i5x891q6r9VGOQabIiBSrAhE1vQxL+EEPKMTo+G41YySfwlG1ZXlezhcKR+7ISCh1FAXH4DJH+LcsYI8tVtRg+3ATaCDoY6+udewR6qGKlhQD1hgrv+0zE97NanfRVMqCaN3RvWBCwfXD0FK/YZvoaYZOYPgb3qEvKh6QOXnLpM2OA6i//g+cFYahwX/RQB70X4XGZw8zQvkJh82V2aIuIw4wfZGU8QfG770sbbUx5GKJ+IZSCXgUbVgMAewdcGzNaq1BzQx8wHLd+GWFGhHarTg6Mzajz7a0OkgulG2YS7MjISEuRFTl0coQ=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1665768112; cv=none; b=a5jzWJURDydzyPqqEfiaVa7Ueh9M4OEB8WLhGRMD4vpOyM5mJBu/8e2RWyqwmgR/eVJFPC/zsZQfMbAubRXiLzf4m+nsNUKItOOg9x1tAo+Y9BCO4WDZTPfeincoZenG80up5Ie0g0mmTn1zKiTfYdUgfDCS2IFvns3qPvbSCHKwZpZ1PSlUqQ2pQbXVpwlx8L1R8qgNCmvJVfvPi6+E2EKJ1yq3hBUH3Zbs6AlfFeJEtLYUjaBOheAjFs4sp56MLIxUEVQVuD5QoHvlSNeL9XafdFXZopzhBowJWUCoV9d4KC3AJomdby6oH4N3z36v7kgI/ibl4Fe2Sva5I1dvOJLVi5dHvTkHqnPzDnAaZ0vgXbvl3y59tY2VSAfBUCdeDZK/8kE3SDk8V29ZRoA1AsxyLHLIMwEs64roGA0ILNvSU4kD6bv96MnTt4smXMmcCGlubNAXR3Q+0TBLuMv4o3/riSfjhPbY9NutDmI2iI/RJmNquHju/kK5+L24/CJGs/VSc1rk3UuKzVO1/jJAde5lt/9I+TyYMlp3hx+sB5CNBRxdE3Jl3qXsz4yPnXgQ3TIenHXf0aKkVvoxO8tRcCJt5BtW4NQr2Ln9V6gETG7MpCe4Q/IB3A8Kg05P0nSjJmIL8wi1LHo/LRR1Fqx0N7tHJY99Q2whVQocrt4k5Vw=
- Authentication-results: smail; arc=none
- Cc: pari-users@pari.math.u-bordeaux.fr
- Delivery-date: Fri, 14 Oct 2022 19:22:54 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1665768112; bh=GycMnG2oQh19Y5D8jbx4PivQuF3sxnmexwS8Lc0ms2Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RtGZDBaWN9HdjQ4EO4AQBSVRtS+/JyxV/c37MeWOvDMK7D3OegBBXGyluBArPLa1J ZCQR0ou/cqONq4IvEOLknw9zPo6rHyuAkmcQ1Rz7Ssf9tuNTW21tvx0o4Fvgu5s4K6 S09wj25Zg7Sb9WxY7mGbQUcjFMvzXAdzn5+iyNVd3AYgPzXii1mzakSBgSulFiJ4nU V0bkKhXLcQ+hK6F10fguCkmNk83OhRx86bXn6NGQfzOLxK6x4v8Ye1Qfur4iW9Iaa7 IFD3MFsu4lqMLvq2Zt6lx2BQuLr5cC7r74NtwIGEmCyrOtWw+baZ6HKWjQhILWjhTR lMH2UDrDBh21UKbXVpmFL/KnAur48UX7bVp43M/TE51OmDk+QE0Unx3S28PPj8WSpc FeY7GPBqWMbiGXEseBMi8GJhRJlQP+zggH32StdmvuHjroLQPymS97U6H9nkD9xA4y QVHSsMT7K1kEHPzNlB6c6dYIvTtdpL+R5d4UMkOaqvcj6ppaagxL8H/FIWqvF1U+OB CyiEfw61YbSOSQ5fl7TfjsF2rFlY7Jaj0ZoaQUhEDWC91a79uzzPaS8YZOBoyb3Dae SMywyyz3pJTD4PP3Pyyxsvxg9Sc8uSBW+NeKbD8bqPP2c8dw7Qzp/Eow6DM+jM2L9U 4J0/F6ug0eWPjfKEy6UqahMU=
- In-reply-to: <CAJkPp5MtUWJfkWrHzvzjpO3Qi0_P9Lt1TJBEMikJkgJCwin1MA@mail.gmail.com>
- Mail-followup-to: Max Alekseyev <maxale@gmail.com>, pari-users@pari.math.u-bordeaux.fr
- References: <CAJkPp5MtUWJfkWrHzvzjpO3Qi0_P9Lt1TJBEMikJkgJCwin1MA@mail.gmail.com>
Hi Max,
* Max Alekseyev [2022-10-14 16:34]:
> Can anything be done about this error?
>
> ? allocatemem(2^31)
> *** Warning: new stack size = 2147483648 (2048.000 Mbytes).
> ? polcyclo(524308,10+O(2^2))
> *** at top-level: polcyclo(524308,10+O(2^2))
> *** ^--------------------------
> *** polcyclo: overflow in precp().
1) Yes, t_PADICs are very inefficient and provided for convenience if
denominators are involved, when the much more efficient t_INTMOD are not
an option. Use a t_INTMOD !
Here, polcyclo(524308, Mod(10,4)) works and is instantaneous.
2) The real problem here is
? 2^262154*(1 + O(2)) - 1
*** _+_: overflow in precp().
because we're trying to construct a t_PADIC with so many significant
digits it can't even be represented given the current design of the
t_PADIC type.
The fact that we don't encode the p-adic precision or valuation in 64
bits is a known design bug in the t_PADIC type: we packed both together
in 64 bits to save on memory (and copying costs) instead of allowing one
codeword for each... It's silly nowadays but I won't change this: it's a
lot of work to remove those limits, and there is no application (our
handling of most of these "huge" t_PADICs being so bad anyway).
There are other analogous hardcoded limitations of other types, see
http://pari.math.u-bordeaux.fr/faq.html#limits
3) This occurs because we compute Phi_n(x) as
(*) Prod_{d|n} (x^d - 1) ^ mu(n/d)
and our n = 524308 has large divisors: so x^d - 1 kills us as explained above.
This formula, x^d - 1 computes a t_PADIC which is as precise as
possible given the input, which is ridiculous because it gets multiplied
by other t_PADICs whose precision is much smaller and will kill the
precision of x^d - 1.
4) Finally, the problem boils down to using (*) formally as written,
without bothering to analyze what "x" stands for, in which case we could
adapt our strategy whenever x is an inexact object.
It's doable and not very exciting. Also, we have lots of
'polynomial-evaluation functions' besides this one which may (or may not)
suffer from analogous inefficiencies or problems.
I don't think I'll do it ... :-)
Cheers,
K.B.
--
Karim Belabas, IMB (UMR 5251), Université de Bordeaux
Vice-président en charge du Numérique
T: (+33) 05 40 00 29 77; http://www.math.u-bordeaux.fr/~kbelabas/
`