Bill Allombert on Wed, 07 Jun 2023 18:49:18 +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: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Wed, 7 Jun 2023 18:44:16 +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=1686156245; c=relaxed/relaxed; bh=GpjdM/VTiIOrJv2J1iyw9Acuu9i8hCkwwt/s/MbrUho=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:Mail-Followup-To: References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; b=sVMbURljRrvztk7fOEQIjbqyOolDG2xwEldOyL6Dp0Bps+mO2ZOLzaek1hdJvEk+Qy7uHvkar+dxEep3Ge2YtDCipEc/Kj3N5prdVmUHNiTM1PALT0DOQz6Panwy9WC8G9xsA1Fo455/SqZhkJjMor3ZGXF0X66s3lvc9LwlJaq2yygPE5MKwSLDYnBSuaf27exMqRU0aM75bKRhSd0/7lGJPZFqQPjzK+OLpq8ztd84Azs3Wsx5fEHiuG+ywDLR5rXeUsWtKHMki3oIsb2fZHYC2vY85Gr0VQKS6IpKnk1642s37NcBMK/BjWbyFbuEwmJoygXbWp7NRIz1FZme44iAsylBTWl53pLE8QL/lUqbDOqSL3f+Q/PqqctU/bAEKfuOcrLQQTq0x0kzK7CMpWQDyO9cAErNZ3xa34Css8vPZl6cHJi75ZsDqUypBzb2OD4ngz2barM4Wt+fmDBW9+1pKf9hSBqMal4AYOgRkQEl4nlsf7VDaQmvgXnEYnYnZ1c63Z4duyHqg8/UcwuW4nfnLXVZy7pOxRT00f1iI7yAWDXIwFl8A2JtzR/atJRXLiIVMzE45Y0ANaKocQB/6wVpJ26ZAYuZLOYowl9sTTR5emKOf0VB7PEdGPHaFF3lxiIOg4KugZtbUrJepGpwp178VXP95BP3Kax4QzYW05g=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1686156245; cv=none; b=UBUYHF6SFTxD6KXS5BjYCE3/LCQVMaV1Ou5d2Nw1aogCC+5wu4RERxfhxmpVw15+b+c+OrMuZCCoRrerk3WxdlF6ofav4+r7+iVwm3wQ53gn6KNs32GFTx9bX9IiaIS+Th8fTmeFE1NNOXZmej7IuASopiyWtCn4np+iSHras5LUmglCoFRn+zjYNsRSRnKbeYzXLi0rk9l4p7wcaFTIf9Jidk9RC+aPuGe3icLT0sLIg8HMyWu4M8olurzxX5vw0PBcI5a/PmDAYA0DERte60FevzivQmQaekL0hvoyuK3xztxsqVWbVZ6YTs/MJHTboeT6tDkBUkc7goqB1THsKLluQI9Q67Jn0kFRqmyEfIpLQrX3SupRUpsCYhpHwLjrzBStvvTCGLS8SS8lRxpV9aV23zrDMJRmgISOyTBXCs39woShz+5AGF8uUus382hnEobgp2kqD9qHKAE8Zfw0zek6P+4XsFI7NFTt/nUHytA6r1p9vYRvcSXEMaQAEp4dlkhDvs9NjrfVyDyd2F4dYrNQHaSuJKes96OuV4kS8ujLzwjia5mFkFI05uKLKCWsuZW0gTpQhcPJgmIKglYN0eFiqA1hf86L6LN8oFjg1zwt2d3U/tbKC74SyVsqiBlQGdGQjyz8Uzg3ODtbmytkcjb96Yun0wQBQMIx+wKVTm0=
- Authentication-results: smail; dmarc=none header.from=math.u-bordeaux.fr
- Authentication-results: smail; arc=none
- Delivery-date: Wed, 07 Jun 2023 18:49:18 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1686156245; bh=GpjdM/VTiIOrJv2J1iyw9Acuu9i8hCkwwt/s/MbrUho=; h=Date:From:To:Subject:References:In-Reply-To:From; b=XhtPcvEud6zsn25oyRX8gEJECryJniISRTjXTT7sBsjohU0AM4i6rYdCljetexXOr W+lpWiDIQ3lMN4suSsPRqtHuvR5hJ6qhK+ynA3CLR1na2dIL6GjAuYpoORFNCg/OBd F5yQf2xvubR4xFDIBkzzCal21tRLnPvudOash0B6ZQ2angbKkmFWp1u1cahC+7wJyD eVdKbrJFk/kLl0qult21QY4q9T77vpoRT+W6icNvsMWLAdR0P1RwI8eT7YDuR0SBOM ZPv7cFtKUX0jszSdQ9xI7d9Tm1fy09GCFsGaejTsK2p9B2RjOQW754cyln7gF9LdBp jS38kuwrABTTfkseJmuR40wYxQu93hiLRf5uFbNfihJea3OtFZZjLG2IiUDOWL+QTt 0qNfGyrbZIY8dAqt7D+Aw3rq5Y58VG/8R5opGXyXK/OvWtRCOFn/OdNNCXilF+efZ9 NmOOy9CCwYkCYxlOKE7yq8/hX6HdtzdKupbEwJQoEI6S2fTZKHIA5vriMZNHF29Lxc 3N77F33rORuWp1IcsdpOi4bCMgDbhtKq8VK/Mo3EuBKLgm9jZ9vF9++J5U+RZxC6B+ Z2BBZBZubcispnUxTUoJSW+9aENZ2mEUhQm0bpJnEOkCl0/m04M0OFFEB+rGUDr+1d Z5EmvZafI6g1QH3aaGXt8fbQ=
- In-reply-to: <a10142ae1b7a659595de988a14ae4f19@stamm-wilbrandt.de>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <85b829f5974500a9215307f172e05724@stamm-wilbrandt.de> <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>
On Wed, Jun 07, 2023 at 08:35:38AM +0200, hermann@stamm-wilbrandt.de wrote:
> I created diagram, including (faster) libgmpxx "powm()" (take random value,
> compute
> "powm(rnd, p/4, p)", test whether its square is sqrt(-1) mod p, repeat) with
> runtime
> <10min per try and 2 tries expected. That is faster than >30min of both
> Pari/GP
> options (they are very close).
I have made a git branch bill-gmppow where you can do
install(gmppow,GGG) to use mpz_powm
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.
A similar example, but faster to check:
? p=2^1000*5^3148+1;
? for(i=1,100,Mod(3,p)^((p-1)/4))
? ##
*** last result computed in 9,506 ms.
? for(i=1,100,sqrt(Mod(-1,p)))
? ##
*** last result computed in 25,418 ms.
Note:
To find the square root, you just need to find a small prime number l so
that kronecker(l,p)==-1 and then compute Mod(l,p)^(((p-1)/4)
Cheers,
Bill