Bill Allombert on Fri, 29 Mar 2024 19:57:29 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Array of the multiplicities of a highly non injective function
|
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: Array of the multiplicities of a highly non injective function
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Fri, 29 Mar 2024 19:55:33 +0100
- Arc-authentication-results: i=1; smail; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1711738646; c=relaxed/relaxed; bh=tzTUHYdmxoqhZ7u8xGFbUJd5za1BMoZTNaqKUcJzDXs=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:Mail-Followup-To: References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; b=Je4PgWKd/kDqsVB0B6nYRhLkrYGvi8TonSPcmDDorh0BFGSPr+jfcYzMtHwe4k+p0TrLJvYOa0FIO4vEw6PKIvZer1w/67a4greULs+iBPlOEmQ6fEAQnqj3zWrlNy9xX5TEYjrNyvK5zESdAMkm3prUyRCRlJOYQPrjUBmBMVxqmXFvnz3GBswtphUyTRN3Zt1GiB48yHS8GghhA5+ww6zOqoSstDly0zEF0+udChAc24NehPCbDO0XW4lCQKIdrtIQVMBl08CNPQtCpM5g00fF0zpw9HrM+ATjFTphvwaCBkw6sOs72YnEwf91ePHY+/Omol0v5SOdtRjfDQS2vkosQDw3i4hqQWXSUNy0pzoHrJ6TAWtlVM1+eNE6fdWYpOSD+TLzoD9v1WUJ5Tvjy/QVl5GuGlbwbPqMqo3c/PDPleSnty2yqouWlPNfLa6FfjZOvdl3kNUw94X3baBtkjzytGaguy6BiDz4gfZvBtIPPmn62/U8DkFbxfgIhaFCGN+iGoaFOG0jcSkc9TU9u1/WbBudY4CfMU0M6BKf7ifNQOgCkk9ZNtdM1pCJhvK9cqTIHQlVe//8ilxky3hGHPdyI4hV6r7gEoKHpmuyCesTl/apxoJB8pMGTa/CjP70NB38RqEl2qcE9laWErRgC1U6CAT8X/FYgtryVk2bKZk=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1711738646; cv=none; b=jYASCR/9WEHeT1NN12aOxMX3M45OwPoQj9fjXAuys10gJc3uRgO4kwNjnBdON0v7BH7h9SBWTqo6OQQU4jJxi1hKn6DypWvTLqyJ8zjVl1wX/K5kEFTvJDUXgOiQcnjDZSjreO9Ozrr/lu7O4gKrV/RLxMOmfTNUhbZXhULp12Fr9iFxPXeVbAoaEwlO1H9z8AOsYi9CXVPY5OlOF9vIQCAsyOEGqQyfZda/HUoVCmTX+ZlTZfvvVbrWexPI3dlqJAqnSkZzCBWAXU2jaMuyG7phPjXEGCTeQN225YSqlLA4T/Zkhj3Fiqc56X83gdqdotfZt1P9k6+TDnUag2SIUoJfyPw2BFZhYbREgpDT12UXAdmgk0bh5EW6bne2V3LcEK4cfgxQKjJnq7iZGpEatnwvfjFsSyOM+BahVmxn1inD2zYBu9GSkhi9T2nhNPfLyJ1GbX1D4YftAlRVPeHsNqUKNGRXiiGDdSnx/FyBk2iiMiuODPbuEkVGXZLgusv5Pb1k2u85KzYz2RATiP5fYjrGUjJ4NN7jyYbPv/qKnEyhJPSUtRz70pV9LnJwbZ6+Lj4/0BFPyel0kvMB2HlB2p9jVscduoPBjS0rWAHKbTENC02TYdiUTVHGi/jh5lyg68cMYasPM9I8ZZ7lnhnTrVt9mMhr8X130/HrTUzsSzQ=
- Authentication-results: smail; dmarc=none header.from=math.u-bordeaux.fr
- Authentication-results: smail; arc=none
- Delivery-date: Fri, 29 Mar 2024 19:57:29 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1711738646; bh=tzTUHYdmxoqhZ7u8xGFbUJd5za1BMoZTNaqKUcJzDXs=; h=Date:From:To:Subject:References:In-Reply-To:From; b=p5GpbUFMiWGzTXlicjrVpJNr26TU8D1HxWGbkn+shyOy5C/NG2kh3F2orVBdFK7ld Sp46qbjTDoCsxnb8hkHvSrrnVIE75tNAqV1H0yvga8B9fytTVi/29aEoawnHWX3tiq zgBY/wMQCAd7So+MKk+Na/HumvaQggxMsd/EM1jXYmssWcB9rjcY4lkk2hjU5qkOoE XtNs4C3eSadmhPTymNG0h0kaKcH3ZG+1+0k+eu+H50GhgNEEgLO+fJD+2rfWp16qSm FaEKHncN0l9Ge/LjZ1EtSk0RUqp14meav4WxQjnRTl4vx9zdpVJTXR7XbQnmudzMVo 9WJnKboeL3MyACSOqsQy16eys1i+UslqysfSncGCiNKP77Sl/a85eS4UQLqVGv6R1I ll4jeE+V4uPISKravWFYaHCs+Ueqh1kmHpt4z6vDYQiJkC7yLvfadj11yBpnYNN553 BQhLx52SQPq72ZPSfP5RQJSF7rJMgGmGufuK14rhhNzwnY3o/d6PZjTI9mF4DXPfx5 FNkfIh/PTd6OciNDAVv4cYhg8yM/5dLonluPnylOewje32jssTF0OX9TWNOs2J1w2Q slsGHi7d2/b6muTeAzPHsawFkgD1HTM8aG+DsTQ87cgh3TDn27YpPGiPuERK30N+P/ Dyqt2CfAAqhC/rTr+SDNQJ9Q=
- In-reply-to: <119168317.1937865.1711622420902.JavaMail.zimbra@uca.fr>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <119168317.1937865.1711622420902.JavaMail.zimbra@uca.fr>
On Thu, Mar 28, 2024 at 11:40:20AM +0100, Emmanuel ROYER wrote:
> Dear Pari-users and developers!
>
> Suppose we have a symmetrical function f from [1,K]x[1,K] with values in [1,q] where the integer K is significantly greater than the integer q.
>
> I want to construct a vector V (of size q) such that each V[a] contains the number of pairs (i,j) such that a = f(i,j).
>
> I have two questions
> 1) Is there a more efficient way of doing what I want than the code below?
> 2) Can we imagine parallelizing, for example, the loop on i ?
>
> K = 30;
> q = 7;
> f(i,j) = 1+lift(Mod(i^2+j^2+i*j,q));
> V = vector(q,h,0);
> for(i=1,K,V[f(i,i)] += 1;for(j=1,i-1,V[f(i,j)] += 2));
> V
You can save time by avoiding to compute i^2 several time.
Then you can save time by computing i^2 anj j^2 iteratively by
using the formula
(i+1)^2 = i^2 + (2*i+1)
i*(j+1) = i*j + i
Cheers,
Bill