Karim Belabas on Sat, 29 Oct 2022 14:49:50 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: unordered but memory-friendly fordiv() (without calling to divisors())
|
- To: Max Alekseyev <maxale@gmail.com>
- Subject: Re: unordered but memory-friendly fordiv() (without calling to divisors())
- From: Karim Belabas <Karim.Belabas@math.u-bordeaux.fr>
- Date: Sat, 29 Oct 2022 14:48:47 +0200
- Authentication-results: smail; dmarc=none header.from=math.u-bordeaux.fr
- Cc: pari-users@pari.math.u-bordeaux.fr
- Delivery-date: Sat, 29 Oct 2022 14:49:50 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1667047726; bh=fNnPcRHgOFC2OiMMueRMRxiSkiA+lB3ncVI9BMJGHOw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YzUfpi+CrJ4WabFnxDYQxsVN9xRl0x2fAYGZ/B5F3HFJ5YlEdI4xieegMNoCDGDQD Xi5V8vhVl1WSRQ3phyoPeF/algG7sLu6hPcJiPIXY99KwgGPW3nmJjbRKH/5EWqRiX ssr+ZbpIZoRlpkirsbo4sAaQrI2uTeM0v3+OuGin0+ooo/s6LOZ7NHQG5fFzcNETfC kdKDVPC1y46ERMhnnVhQNXvpghUbIWzdVNq0FFeDifbi+52spETK8rOaBJPlBTtL7A 7HEcIywBU+g9cmrHj9qxL4cjgthaOyxDQa64RHpCmTVZv1Ega5znWZugA+xJPshX6z einauhoAeaQesaUReupv9uVMoPNgt2c4V6i5j9REy14VNyh9M0zlht7YAdS3raKu7y PX9J4L6nfF7jqUaEjkOI40uOZvX1pD+EFdLTHSHWtF/YWcoXRNNTQ/7O4V6tpJjKXV yjO8D5b8STARAIlbnaSFM8Si9BY6zucs9DxUWc7q4NqsJUlVYQvyzjDCnAEdNXFiME fj0cIQkoW6ewLywIfZ0V2FN33Q6f64K8WGGdMMmb/ebnrxhAHVcHWZ5+M68hHhdMit ESHvU7/uyrlhWBH9sxpWbM2Ys2qHwW0CbPqGCwucgAENv0rLM3mmnm4u2ZQ4KtXxGX HmlDD8/U7/wIOaSAPFAHWRV0=
- In-reply-to: <CAJkPp5NQ5KwbeXgNWrrrKar0LP4RmqwU+UNdAUEHdgR_LZ8S7A@mail.gmail.com>
- Mail-followup-to: Max Alekseyev <maxale@gmail.com>, pari-users@pari.math.u-bordeaux.fr
- References: <CAJkPp5OdpHQLeKK=iwDJbPXXRfaNou8P0cT89WWL+=URANFL=A@mail.gmail.com> <CAJkPp5NQ5KwbeXgNWrrrKar0LP4RmqwU+UNdAUEHdgR_LZ8S7A@mail.gmail.com>
* Max Alekseyev [2022-10-28 23:30]:
[...]
> Formally speaking the divisors of any number form a recursively enumerable
> set, and its structure can be exploited to produce the divisor values
> efficiently. (Perhaps, this is already done internally by the divisors()
> function.)
It is. Given PARI's memory model, it's not easy to do this while
bounding memory (it's trivial to do in optimal space if all divisors are
to be stord: the memory used is the memory occupied by the divisors).
> Can we have a variant of fordiv() / fordivfactored() that will not call to
> divisors() but generate the divisors on-fly at the cost of not enforcing
> them be in order?
Easy to do directly in GP, with acceptable inefficiencies. Little
motivation to include it in PARI, compared to the work involved.
Adapting fordivfactored from forvec/parforvec is particularly easy, with
low overhead ! (fordiv is much harder, as seen above).
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/
`