Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

Whenever you find that you are on the side of the majority, it is time to reform. -- Mark Twain


comp / comp.lang.python / Re: Relatively prime integers in NumPy

SubjectAuthor
o Re: Relatively prime integers in NumPyPopov, Dmitry Yu

1
Subject: Re: Relatively prime integers in NumPy
From: Popov, Dmitry Yu
Newsgroups: comp.lang.python
Date: Fri, 12 Jul 2024 17:12 UTC
References: 1 2 3 4
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: dpopov@anl.gov (Popov, Dmitry Yu)
Newsgroups: comp.lang.python
Subject: Re: Relatively prime integers in NumPy
Date: Fri, 12 Jul 2024 17:12:59 +0000
Lines: 136
Message-ID: <mailman.35.1720804388.2981.python-list@python.org>
References: <SA0PR09MB6363F3E6B493202E73869DF4DBDA2@SA0PR09MB6363.namprd09.prod.outlook.com>
<00e801dad3bf$473daed0$d5b90c70$@gmail.com>
<DM8PR09MB63603191F5509E5013D1BEDCDBA52@DM8PR09MB6360.namprd09.prod.outlook.com>
<DM8PR09MB636055F61171899BF14B01D3DBA62@DM8PR09MB6360.namprd09.prod.outlook.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
X-Trace: news.uni-berlin.de +J6iHlRviKFUhYxZ2+I5ewcYg2e3eVneAeQJJGKWNxCg==
Cancel-Lock: sha1:3nZ9FvS0zKQV7HCWr7Jt9BS/Mbo= sha256:LXmWa8yOq9Ov8v5yEgucS9uqRcIA9e/NMk/NR+0qqKU=
Return-Path: <dpopov@anl.gov>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=anl.gov header.i=@anl.gov header.b=gou6KGSf;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.174
X-Spam-Level: *
X-Spam-Evidence: '*H*': 0.65; '*S*': 0.00; 'looks': 0.02;
'explanation': 0.07; 'matches': 0.07; 'modules': 0.07; 'indeed.':
0.09; 'mechanism': 0.09; 'much,': 0.09; 'numpy': 0.09; 'routine':
0.09; 'skip:z 20': 0.09; '&gt;': 0.14; 'import': 0.15;
'url:mailman': 0.15; '2024': 0.16; '3:10': 0.16; 'divisors': 0.16;
'examples.': 0.16; 'far,': 0.16; 'loops': 0.16; 'numpy.': 0.16;
'numpy?': 0.16; 'patterns.': 0.16; 'prime': 0.16; 'procedure':
0.16; 'prompts': 0.16;
'received:gcc02-bl0-obe.outbound.protection.outlook.com': 0.16;
'received:namprd09.prod.outlook.com': 0.16; 'relatively': 0.16;
'sorry.': 0.16; 'url-ip:3.215/16': 0.16; 'url:urldefense': 0.16;
'url:v3': 0.16; 'using.': 0.16; 'python': 0.16; 'code.': 0.17;
'solve': 0.19; 'implement': 0.19; 'i.e.': 0.22; 'maybe': 0.22;
'to:no real name:2**1': 0.22; 'code': 0.23; 'skip:- 10': 0.25;
'url:listinfo': 0.25; 'cannot': 0.25; '11,': 0.26; 'else': 0.27;
'bit': 0.27; 'function': 0.27; 'done': 0.28; 'expect': 0.28;
'mostly': 0.28; 'purpose': 0.28; 'email addr:python.org&gt;':
0.28; 'example,': 0.28; 'dir="ltr"': 0.31; 'module': 0.31;
'think': 0.32; 'question': 0.32; 'collected': 0.32; 'needed,':
0.32; 'python-list': 0.32; 'structure': 0.32; 'develop': 0.32;
'but': 0.32; "i'm": 0.33; 'there': 0.33; 'someone': 0.34;
'appreciated.': 0.34; 'header:In-Reply-To:1': 0.34; 'trying':
0.35; 'words': 0.35; 'following': 0.35; 'request': 0.35; 'built':
0.36; 'those': 0.36; 'lists': 0.37; 'currently': 0.37; 'using':
0.37; 'skip:_ 30': 0.37; 'could': 0.38; 'put': 0.38; 'list': 0.39;
'use': 0.39; 'block': 0.39; 'methods': 0.39; 'search': 0.61;
'skip:b 30': 0.61; 'skip:o 10': 0.61; 'from:': 0.62; 'to:': 0.62;
'skip:i 20': 0.62; 'dear': 0.62; 'involved': 0.63; 'email
addr:gmail.com': 0.63; 'great': 0.63; 'skip:b 20': 0.63; 'skip:m
20': 0.63; 'skip:b 10': 0.63; 'identify': 0.64; 'pass': 0.64;
'our': 0.64; '8bit%:93': 0.64; 'about.': 0.64; 'explained': 0.64;
'imagine': 0.64; 're:': 0.64; 'your': 0.64; 'top': 0.65; 'came':
0.65; 'skip:t 20': 0.66; 'numbers': 0.67; 'skip:n 30': 0.67;
'back': 0.67; 'outside': 0.67; 'url-ip:18/8': 0.67; 'url-ip:3/8':
0.67; 'skip:# 10': 0.68; '8bit%:69': 0.69; '8bit%:91': 0.69;
'8bit%:96': 0.69; '8bit%:99': 0.69; 'candidate': 0.69; 'compare':
0.69; 'enclosed': 0.69; 'factor': 0.69; 'latter': 0.69; 'skip:\xe2
20': 0.69; 'url:us': 0.69; 'skip:f 30': 0.71; '8bit%:89': 0.75;
'8bit%:92': 0.75; 'skip:f 20': 0.75; 'factors': 0.76; 'sent:':
0.78; 'highly': 0.78; '8bit%:95': 0.84; '16px': 0.84; '8bit%:76':
0.84; '8bit%:97': 0.84; 'axis': 0.84; 'email name:&lt;python-
list': 0.84; 'indices': 0.84; 'lot.': 0.84; 'popov': 0.84; 'skip:&
50': 0.84; '8bit%:98': 0.91; '8px': 0.91; 'skip:\xd0 10': 0.91;
'interest.': 0.93; 'to:2**3': 0.96
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=OvCXLK++UPNrFVhyXIAaHpUHEIOlpVpsetZbkKyedwd5zxM/cuyg41aRceSxx/0bKnE63PV5uAWxNvQUSZBPXWe5SVqTg399+Ty4wPAfaKIN2JJEKmTSvIHu580gS5NN/yF030NZPlm3cwZ/uWtlGgANn/GM6Ui7Vzl522GItAXmSAp68sy7JQHD95SIK3/EOKbPGGJzIVVRlmda0dw4LmaHx/45rmpUIHf8v1ZJLPOpL0sehQXbXh+037chi95RJIDCiUQjFcK62vmmCZg6seXyV/F78iqtl/eZcTRsYI7HWOE7/wvJMJ/y0u+etdywAq9dvr1yCo9brFtol5zMFA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=E5MBR2ZeqOI2KMOOnpSYr23tsvNh8FIGJlJ3St4fyvs=;
b=TsKiMSh2A4Yer0RNPMUrVO8fFp38BpT6tjTBEm/dSayxD2K6B3aSqkgj/KchTcYAUWUtZOFEkuJ4pyhbnmD8TEzb+ifQhbamk1Cx72T349Tt4CnY/SGorwhEXS0E8P9xyFT4o+s1Rw05tSMtSKl1a5QPC0HI0B1YH7qH3/QDet1Q8jXAUvanXfO3/53bMexSmh37yD93pHHyXpk9bSTOEP9zTDo750plZczobjCxTrkHm3BjRHDeP5bBRo1VLbG7/gKozkXLPSA8nSHKZh44gSRDZuANtaHdAuB9mRBcQH24TkwZ89sgTEGiuTE7H64qB1Wj1MJ29TZvy+HpIDIK1w==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=anl.gov; dmarc=pass action=none header.from=anl.gov; dkim=pass
header.d=anl.gov; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anl.gov; s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=E5MBR2ZeqOI2KMOOnpSYr23tsvNh8FIGJlJ3St4fyvs=;
b=gou6KGSfz0I/nZrrGQALjvf3N6ZK7ACHX/kjhTjsB5RtUkdf0RjjFRrI84cF3+30vMavjcVILTgO+xJ1b1V7J6KDSINDh9oVe0P1mSgpwWCWy0OksCCsF5COHmI+SEJ35y1rKHlAqML4pWKIkIDTi1wi7Iun7nsuvHa0BRiktyW4Ky9Xb1zLIZ1Lv9QSwWgTUC4p8UU63osar4NN+bnOuySLg9n9bSiRNBwQplQaTLfIJNj0APtam/iTV4sL32JTlD2b3z76dbKr6Bgfck3lmHbOMpOPT2xjJ5migmW2JfBKNP81XnNCQ+lt7vxQeaQ8pp59tgd3aIiy0JBQPGA3lQ==
Thread-Topic: Relatively prime integers in NumPy
Thread-Index: AQHa0WffJqhGflnACk65nSD3UBURMbHx270AgAADEHaAAW/W/g==
In-Reply-To: <DM8PR09MB63603191F5509E5013D1BEDCDBA52@DM8PR09MB6360.namprd09.prod.outlook.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
msip_labels:
authentication-results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=anl.gov;
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: DM8PR09MB6360:EE_|DM8PR09MB6357:EE_
x-ms-office365-filtering-correlation-id: 29d2ffdd-daa7-435c-7fed-08dca295e188
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|366016|38070700018;
x-microsoft-antispam-message-info: VG9W9/opeylyIsLW5yGniE7VcwTlmHOI1LGiwDBNUmd9S
yqFzsmtP73lia+PrfSxHcmKfFhhlRuppHDKQHpY/k535E
8MoCyFLfvRnL060tri49iiohoo1AZ69bhPDWjC2sFsHFR
lLVWuSz6MJwHRCLpSOSTdoT5v48529KnY1LByn7/XFzma
oOLDvjBciHrXkv+xG/FTv1l7Ifr9CTRYfjwuGfp3uLaVR
BJ+O7NPeWq1OdzQCmQWtuYaBE+Iiwsnf54r0Ji7xjcXic
CHzruJqDCx5TxSRKjE85bSo7wAofIKeCLKAA+qOr1FuVT
mtiwew2qyHJ2vcCS6q8C8T1O+MuqrSZZnCGFEuD+tg1tt
/r6yTvBWHemZh6RULDFBcY5k+N3H4nW3EmwCOyRUNnsRk
oDB36uxt+2Z+blFst4uWkqL0L/07zWoSikycZkvjuOc1j
INb5UI2638ZDxSP6oHjkiSO1lp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jUmjyjCekC4p0uYKxvry
uul58J62qzsKEFtuqNogVfKKNWehw/sZaMaiW9j7/94Ls
2Ym7HPD6LBjQPgZK8Z2o4zoNmuB98tjlZSENT5h/tek5c
Qith6D5+fULv8M64n8Ol6PHMU+KtmYJNXFwaHksy3TMC2
A7dwJ7LLZlL15Zk2Bsu9DD3zkhSe7uyxwca2aAiuP8pTJ
fvCPYkzzJG0ETPbzDN+3V3VQenGdkuSJ0314LxlGhC/n+
XU4TLwyzH/zSNEeeWL76hOtwwfgULq9hG3OAO/UMC8L9M
GMPM62h4UJCPNsMY0tuzLjUH6XN51Y9VQxLZQlqvltLk0
+U0ul31aiftIyov63uyY+wtHmRP86HR3Yty7rNXI73nsT
xRVLLXWPnEEtFn6fc8Yo+Vs5+9jvaw7DHoRwFGszWM+6P
YK6EWfFIkzG+bLGivgVGNUAcq3j2KytOJj9rDM1QJCwhq
a+OOt+35m7nsR8qnA8baRg4sq4Fi0YM+PMp0qUGNXhq1T
PVy1opZwNlRmniiufJxp0hXq+LmKYaR3XcsMwfaqS/FU6
jGr4Y9XR8QwjKn9d4I4IptHOpnVnJgn/6g3DR0RC753/K
QzAw=
X-OriginatorOrg: anl.gov
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: DM8PR09MB6360.namprd09.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 29d2ffdd-daa7-435c-7fed-08dca295e188
X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jul 2024 17:12:59.7362 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 0cfca185-25f7-49e3-8ae7-704d5326e285
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR09MB6357
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <DM8PR09MB636055F61171899BF14B01D3DBA62@DM8PR09MB6360.namprd09.prod.outlook.com>
X-Mailman-Original-References: <SA0PR09MB6363F3E6B493202E73869DF4DBDA2@SA0PR09MB6363.namprd09.prod.outlook.com>
<00e801dad3bf$473daed0$d5b90c70$@gmail.com>
<DM8PR09MB63603191F5509E5013D1BEDCDBA52@DM8PR09MB6360.namprd09.prod.outlook.com>
View all headers

Thank you very much, Oscar.
Using the following code looks like a much better solution than my current Python code indeed.
np.gcd.reduce(np.transpose(a))
or
np.gcd.reduce(a,1)
The next question is how I can generate ndarray of h,k,l indices. This can be easily done from a Python list by using the following code.
import numpy as np
hkl_list=[]
for h in range(0, max_h):
      for k in range(0, max_k):
            for l in range(0, max_l):
                  hkl_local=[]
                  hkl_local.append(h)
                  hkl_local.append(k)
                  hkl_local.append(l)
                  hkl_list.append(hkl_local)
hkl=np.array(hkl_list, dtype=np.int64)
This code will generate a two-dimensional ndarray of h,k,l indices but is it possible to make a faster routine with NumPy?
Regards,
Dmitry


________________________________
From: Python-list <python-list-bounces+dpopov=anl.gov@python.org> on behalf of Popov, Dmitry Yu via Python-list <python-list@python.org>
Sent: Thursday, July 11, 2024 2:25 PM
To: avi.e.gross@gmail.com <avi.e.gross@gmail.com>; 'Popov, Dmitry Yu via Python-list' <python-list@python.org>
Subject: Re: Relatively prime integers in NumPy
Thank you for your interest. My explanation is too concise indeed, sorry. So far, I have used Python code with three enclosed 'for' loops for this purpose which is pretty time consuming. I'm trying to develop a NumPy based code to make this
ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender
This message came from outside your organization.
ZjQcmQRYFpfptBannerEnd
Thank you for your interest. My explanation is too concise indeed, sorry. So far, I have used Python code with three enclosed 'for' loops for this purpose which is pretty time consuming. I'm trying to develop a NumPy based code to make this procedure faster. This routine is kind of 'heart' of the algorithm to index of X-ray Laue diffraction patterns. In our group we have to process huge amount of such patterns. They are collected at a synchrotron radiation facility. Faster indexation routine would help a lot.
This is the code I'm currently using. Any prompts how to implement it in NumPy would be highly appreciated.
for h in range(0, max_h):
      for k in range(0, max_k):
            for l in range(0, max_l):
                  chvec=1
                  maxmult=2
                  if h > 1:                     
                        maxmult=h
                  if k > 1:
                        maxmult=k
                  if l > 1:
                        maxmult=l
                  if h > 1:
                        if maxmult > h:
                              maxmult=h
                  if k > 1:
                        if maxmult > k:
                              maxmult=k
                  if l > 1:
                        if maxmult > l:
                              maxmult=l
                  maxmult=maxmult+1
                  for innen in range(2, maxmult):
                        if h in range(0, (max_h+1), innen):
                              if k in range(0, (max_k+1), innen):
                                    if l in range(0, (max_l+1), innen):
                                          chvec=0
                  if chvec==1:
                        # Only relatively prime integers h,k,l pass to this block of the code

________________________________
From: avi.e.gross@gmail.com <avi.e.gross@gmail.com>
Sent: Thursday, July 11, 2024 1:22 PM
To: Popov, Dmitry Yu <dpopov@anl.gov>; 'Popov, Dmitry Yu via Python-list' <python-list@python.org>
Subject: RE: Relatively prime integers in NumPy
Дмитрий, You may think you explained what you wanted but I do not see what result you expect from your examples. Your request is a bit too esoteric to be a great candidate for being built into a module like numpy for general purpose se but
ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender
This message came from outside your organization.
ZjQcmQRYFpfptBannerEnd
Дмитрий,
You may think you explained what you wanted but I do not see what result you
expect from your examples.
Your request is a bit too esoteric to be a great candidate for being built
into a module like numpy for general purpose se but I can imagine it could
be available in modules build on top of numpy.
Is there a reason you cannot solve this mostly outside numpy?
It looks like you could use numpy to select the numbers you want to compare,
then call one of many methods you can easily search for to see how to use
python to make some list or other data structure for divisors of each number
involved and then use standard methods to compare the lists and exact common
divisors. If needed, you could then put the results back into your original
data structure using numpy albeit the number of matches can vary.
Maybe a better explanation is needed as I cannot see what your latter words
about -1 and 1 are about. Perhaps someone else knows.


-----Original Message-----
From: Python-list <python-list-bounces+avi.e.gross=gmail.com@python.org> On
Behalf Of Popov, Dmitry Yu via Python-list
Sent: Monday, July 8, 2024 3:10 PM
To: Popov, Dmitry Yu via Python-list <python-list@python.org>
Subject: Relatively prime integers in NumPy
Dear Sirs.
Does NumPy provide a simple mechanism to identify relatively prime integers,
i.e. integers which don't have a common factor other than +1 or -1? For
example, in case of this array:
[[1,5,8],
[2,4,8],
[3,3,9]]
I can imagine a function which would return array of common factors along
axis 0: [1,2,3]. Those triples of numbers along axis 1 with the factor of1
or -1 would be relatively prime integers.
Regards,
Dmitry Popov
Argonne, IL
USA
--
https://urldefense.us/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!G_uCfscf7eWS!ZGK1ZXYgmC6cpNa1xTXVTNklhunjYiinwaDe_xE3sJyVs4ZcVgUB_v2FKvDzDspx7IzFCZI7JpFsiV5iH58P$

--
https://urldefense.us/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!G_uCfscf7eWS!avZA_RNHnI2aBy2E2Z3kwPCY3B4aDtoxObit540PzHeIW_4s1Tkkq5NapXL3KzGXv2BTWbYQJHf6AskeTC-IEA$

1

rocksolid light 0.9.8
clearnet tor