Karim Belabas on Wed, 07 Jun 2023 19:49:17 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Abnormous memory use for gaussian gcd()?
|
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: Abnormous memory use for gaussian gcd()?
- From: Karim Belabas <Karim.Belabas@math.u-bordeaux.fr>
- Date: Wed, 7 Jun 2023 19:44:17 +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=1686159847; c=relaxed/relaxed; bh=iepzaARbG3n8lHfRMJCE2/gOThz0Urg+nHeBm8ZLUGo=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:Mail-Followup-To: References:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; b=Z6YFjXVi+Lkb/XfVm71LHIM9PBLW1x3p9+MdHeQ4Ly6UUjjlahzWuDrXdWllRWqON6IsIF2mhCOLfwlUv60jprmHfIgXwlLlEQ+OtEIgWQbC8BMp2KgSsRdShtbdx/eHSQkGU8s9jAOHEnQvlHyVr5wrUplZUxUZR+5ysr1gKHuOij8ZHk1xckiM2dGFS5bXkRo2qdm8UjIlcHI3zyyz4qREPtVh+mUAY0C9l5lFEIqyE5rxZbEAsbBijNl+/Psq9oN4j0YyZn4OZFocjZoafAIW7pShzAlIDhbZ06cIMgPmGZEp41ZVUUfcindsijF+LybxTdi3V/jAgG0p2tmMm3abL0aVlYqB3jjPgMUxJWIOokL3e5ccuvXHByRoc7ALD7vQ6cponSsF1ZNh0gGWkrR6pQgFzCTD/AK9zkUvfXEMW/Qq5fIntF+3BtyopUg4j023YYCh9YpShdM1cPUtAu+mq6T239hPd2hReE9QGNfJ0lIegAncytqC6Ei7kSVO7pjt/nEUo2KWgkJ5KApHoPQIVmOYRbJ+X5Xyf1BB+nxg9JTo31i8Xyh3qtqZubm2tHFRflmpBb3YMevrFs06nq1XkZ/5rTOuTpoqXUockfQvY7t8oJaYV+TXWeWubN9UjrM6RiDJQHNLE2+RNP9Nrvm1a5X5/hlopeHYPEBJnJU=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1686159847; cv=none; b=orB0vJY7ZRQmeUU1rp5OlMMi9I8ZTGcqMqoQP0gSne52j8OjPNdqggPVFW7kctLkrZSoSnP82IETuxvQcuavXuYNMLWUV03fVnHtJN3lFlIvcPLWNYrUT1zuoFvi1ojYv3JvDhQCndFHHO9U7iPSlOofX7gOqIonb8lEBpDbmGAmjEpiUYCZuBlxCPReFhr65VORtctanTJxZEY46IX1GITIBm4fc1vHSEle8Nu9arAs+MztDiJkdgF6BYcnt3QPvzecw7W8PWNQHnIfaNgr/7VEfo4bbFGgAfOjmIY6ooxsOOCg/z6k2B2nMxS20gZbEvsv2OYbE+fW0TTbWZ00z5cB3GIL2o2fZWk5HG0Gk1Pam2Bi8/T7BtMcrHDhAt6DxQfskA6nhox3TnmV//dV2l0UpV55fHlGPY6fQpkmBOiAQeLHp2i95lrQ/sNOcDfWIlTYObC9QieW5lnhzowSeJGzfQnMwBEOGIYIVosCZVnAIdZweKpSq0ss2u6w/f8RxSHKYBqCqY+abT4ffV7epfJr6JM7b9aF3ufsn16ZC3+C+IN47cKv3rECnGiaWt7k/Ey8MwOzKbZW6m2KSPqcKoLOn9J3LsbGZB4dw0Lz+Chx3EYIVeh6PZJroqlnQvMaYz1JQFfmibQhEDiUkKPDE2IWZNZpDKnrRtgCnjFlVYw=
- Authentication-results: smail; dmarc=none header.from=math.u-bordeaux.fr
- Authentication-results: smail; arc=none
- Delivery-date: Wed, 07 Jun 2023 19:49:17 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1686159847; bh=iepzaARbG3n8lHfRMJCE2/gOThz0Urg+nHeBm8ZLUGo=; h=Date:From:To:Subject:References:In-Reply-To:From; b=NNyAHEuragzwHwgy/g7eQ/SFjuITJ1ayqF4ZzLxZBQ9UegiLLcP6VwShff1NgJRiM bDp/zD0nDXB+tctGiLlglVzYOjO7wivnkH1bgCJ7z0CeWDQBiE4lmbdcyaD5uSITkl 7gfbjVM/zNn9ZkIrWQ2Dxo8olnlgiNFCXPhFnZtJ/KRRbWTZAbwwzgYjc2/8hz/YQT G59UhUmRoCiLI4Tbnkv0SfnB4fHxvI2lPGMmuAJxBWknbh5YS/islUvLfnB4aRgVU5 yADfPcJ9rTSaY8aHpjLMI83oOZQO9i1s1cRzpl9XnzScRwDgCW2tLRhrjQbpbpBYqt GrI3dnRh1T92CfrUQOuC+81kuKqBx7VZWHP9fHZKxCkSP7+KzzcGyybux7TmmL+Umf 2otZsVwucAEtmmE/+El8BqG7QJCVh9fyOY/AKGzRyi9+nPCvWL+IaVKsjvFty91ESq Ood9FVssGrxUp4qYJ8ZZC1pQ4+UfDlCWZMnHq5QAmf7XtgD1SY9KlMk4Ecz3jCPZDT 3CnA2o76ooHMI/uq4qBI0YDbZNbPnSmnQ0GKTwxay24DM/DDLxHJKLhoj3qAl9Z/NY dhrAgDGg9efO4Ltcih7k0Lmtx8ratPLrqIR+4T4SWIbdJjG4uKF3+BO+IUCVKEMLkE QzWrLx35nq2WVJBMHi2Lb8JE=
- In-reply-to: <ZICz4BFnHKoLJPTS@seventeen>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <ZH4K05Ocjnpj2L8M@seventeen> <5601edb4464767069d9f9c5138a2867e@stamm-wilbrandt.de> <c50d16c794bbe0f7854119c7732cbaa2@stamm-wilbrandt.de> <ZH4+sminS6Dl7iBw@seventeen> <29f5f72b12eddcca3bc96e8b8feb05a7@stamm-wilbrandt.de> <ZH87VbDWIsbSkKYx@seventeen> <14fb32efc08ccda94006a5d745d037d4@stamm-wilbrandt.de> <ZH+mHSba5o2Q7AHl@seventeen> <a10142ae1b7a659595de988a14ae4f19@stamm-wilbrandt.de> <ZICz4BFnHKoLJPTS@seventeen>
* Bill Allombert [2023-06-07 18:44]:
[...]
> I have done some tests:
> p = 65516468355 * 2 ^ 333333 + 1;
> Mod(7,p)^((p-1)/4)
> PARI Fp_pow:
> 19min, 1,255 ms
> gmppow(7,(p-1)/4,p);
> 16min, 8,960 ms
> Then I tried:
> ? S=sqrt(Mod(-1,p));
> *** last result computed in 52min, 3,954 ms.
> which looks like a bug.
> This is due to misuses of Cipolla algorithm.
> We should fix it.
We use a proven formula for optimality of Cipolla wrt Tonelli-Shanks,
but there's a catch: it only proves optimality for given prime p when
averaging over all quadratic residues. It says nothing about a given
input.
It so happens that sqrt(-1) is always faster using Tonelli-Shanks
rather than Cipolla. In fact, Bill's variant raising a quadratic non
residue to the appropriate power will be a little faster.
It's very easy to fix for -1 (an important special case !), but
arbitrary elements of the 2-Sylow of (F_p^*)^2 can be similarly accelerated,
although it becomes non trivial to test it ( I don't see anything better
than taking at most v_2(p - 1) - 1 successive squares, stopping whenever the
result is -1 ).
Cheers,
K.B.
--
Pr. Karim Belabas, U. Bordeaux, Vice-président en charge du Numérique
Institut de Mathématiques de Bordeaux UMR 5251 - (+33) 05 40 00 29 77
http://www.math.u-bordeaux.fr/~kbelabas/