Message from discussion
Best Practices for passing numpy data pointer to C ?
Received: by 10.205.130.14 with SMTP id hk14mr792874bkc.5.1343427152708;
Fri, 27 Jul 2012 15:12:32 -0700 (PDT)
X-BeenThere: cython-users@googlegroups.com
Received: by 10.204.7.203 with SMTP id e11ls3676768bke.8.gmail; Fri, 27 Jul
2012 15:12:30 -0700 (PDT)
Received: by 10.205.139.2 with SMTP id iu2mr792085bkc.7.1343427150010;
Fri, 27 Jul 2012 15:12:30 -0700 (PDT)
Received: by 10.205.139.2 with SMTP id iu2mr792084bkc.7.1343427149996;
Fri, 27 Jul 2012 15:12:29 -0700 (PDT)
Return-Path: <sturlamol...@yahoo.no>
Received: from mail-forward1.uio.no (mail-forward1.uio.no. [129.240.10.70])
by gmr-mx.google.com with ESMTPS id e23si941791bks.0.2012.07.27.15.12.29
(version=TLSv1/SSLv3 cipher=OTHER);
Fri, 27 Jul 2012 15:12:29 -0700 (PDT)
Received-SPF: neutral (google.com: 129.240.10.70 is neither permitted nor denied by best guess record for domain of sturlamol...@yahoo.no) client-ip=129.240.10.70;
Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 129.240.10.70 is neither permitted nor denied by best guess record for domain of sturlamol...@yahoo.no) smtp.mail=sturlamol...@yahoo.no
Received: from exim by mail-out1.uio.no with local-bsmtp (Exim 4.75)
(envelope-from <sturlamol...@yahoo.no>)
id 1Suslp-0002D1-FH
for cython-users@googlegroups.com; Sat, 28 Jul 2012 00:12:29 +0200
Received: from mail-mx3.uio.no ([129.240.10.44])
by mail-out1.uio.no with esmtp (Exim 4.75)
(envelope-from <sturlamol...@yahoo.no>)
id 1Suslp-0002Cy-EV
for cython-users@googlegroups.com; Sat, 28 Jul 2012 00:12:29 +0200
Received: from ip-18-9-179-93.dialup.ice.net ([93.179.9.18] helo=[192.168.0.3])
by mail-mx3.uio.no with esmtpsa (TLSv1:DHE-RSA-CAMELLIA256-SHA:256)
user sturlamo (Exim 4.80)
(envelope-from <sturlamol...@yahoo.no>)
id 1Suslo-0002Ol-T3
for cython-users@googlegroups.com; Sat, 28 Jul 2012 00:12:29 +0200
Message-ID: <50131250.9050209@yahoo.no>
Date: Sat, 28 Jul 2012 00:12:32 +0200
From: Sturla Molden <sturlamol...@yahoo.no>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2
MIME-Version: 1.0
To: cython-users@googlegroups.com
Subject: Re: [cython-users] Re: Best Practices for passing numpy data pointer
to C ?
References: <CALGmxEJOLLx8VtNtK3jBt-AJ=kNU5i1kbEqgyTv9OErBgOG...@mail.gmail.com> <4666d921-974c-4236-83b3-5dd6ed98d09c@googlegroups.com> <CALGmxE+oftOv4sN6PGE=sp+sVLnmarLTEopEF85QCof9_GS...@mail.gmail.com> <5012E12A.7040...@yahoo.no> <070ba075-6fec-4f47-a293-a753ca4a1...@email.android.com>
In-Reply-To: <070ba075-6fec-4f47-a293-a753ca4a1...@email.android.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-UiO-SPF-Received:
X-UiO-Ratelimit-Test: rcpts/h 1 msgs/h 1 sum rcpts/h 1 sum msgs/h 1 total rcpts 1700 max rcpts/h 15 ratelimit 0
X-UiO-Spam-info: not spam, SpamAssassin (score=-5.0, required=5.0, autolearn=disabled, FREEMAIL_FROM=0.001,FSL_RCVD_USER=0.001,UIO_MAIL_IS_INTERNAL=-5, uiobl=NO, uiouri=NO)
X-UiO-Scanned: C97F616B4C51DECD15ED9642A83B21A4B4170BC3
X-UiO-SPAM-Test: remote_host: 93.179.9.18 spam_score: -49 maxlevel 80 minaction 2 bait 0 mail/h: 1 total 44 max/h 12 blacklist 0 greylist 0 ratelimit 0
Den 27.07.2012 21:35, skrev Dag Sverre Seljebotn:
> Actually there's a half-baked patch to turn arr.data into PyArray_DATA for np.ndarray. The lgoic is that arr.shape is so much used, and we don't want that to break, so we'll throw in some hacks to change that to using a macro, and then we may as well throw in 'data' too.
That might prevent some code from breaking when NumPy completes the
transition to PyArray_DATA...
>
> I think this is all pending a decision about how closely the new memoryviews should emulate the current ndarray/buffer syntax (i.e. can you access the underlying object of a memoryview transparently), and we don't seem to have the energy to discuss that yet.
>
I recently suggested using typed memoryviews in SciPy
(scipy.spatial.cKDTree to begin with), but it got clubbed down for not
being compatible with Python 2.4... We finally settled on using
PyArray_DATA and plain old C style pointer arithmetics. But granted, the
code would have looked much better with memoryviews and multidimensional
arrays :(
Sturla