Peter Alexander | 1 Oct 01:42
Picon
Gravatar

Re: [Cython] Updating Documentation

On Wed, Sep 30, 2009 at 1:52 PM, Dag Sverre Seljebotn
<dagss@...> wrote:
> Christopher Barker wrote:
>> Dag Sverre Seljebotn wrote:
>>>  - Numerical computations in Cython (a copy of the corresponding paper)
>>
>>> 4) I think the current Cython/NumPy tutorial should be removed in favour
>>> of the above generic tutorial + numerical Cython paper; opinions on that?
>>
>> Well, one good intro to numpy+cython is better than two that both need
>> to be maintained.
>
> Thanks for your feedback. My thoughts:
>
> Yes, but the existing intro on numpy+cython:
> a) Lacks quite a bit in several areas
> b) Is outdated
>
> While the tutorial + paper is already written now.
>
>> However, maybe it's my personal use-case bias, but I think that numpy is
>> almost a standard part of Cython use -- I can't think of what I'd like
>> to optimize that I wouldn't want to use numpy for! And numpy is why I
>> skipped past pyrex and straight to Cython.
>
> Well, take Stefan Behnel, who doesn't use NumPy at all, but rather works
> with XML documents.
>
> Even within science, the whole Sage project (a very important Cython
> user) don't use that much NumPy either, and in particular not the
(Continue reading)

Peter Alexander | 1 Oct 01:57
Picon
Gravatar

Re: [Cython] Updating Documentation

On Wed, Sep 30, 2009 at 7:42 PM, Peter Alexander <vel.accel@...> wrote:
> On Wed, Sep 30, 2009 at 1:52 PM, Dag Sverre Seljebotn
> <dagss@...> wrote:
>> Christopher Barker wrote:
>>> Dag Sverre Seljebotn wrote:
>>>>  - Numerical computations in Cython (a copy of the corresponding paper)
>>>
>>>> 4) I think the current Cython/NumPy tutorial should be removed in favour
>>>> of the above generic tutorial + numerical Cython paper; opinions on that?
>>>
>>> Well, one good intro to numpy+cython is better than two that both need
>>> to be maintained.
>>
>> Thanks for your feedback. My thoughts:
>>
>> Yes, but the existing intro on numpy+cython:
>> a) Lacks quite a bit in several areas
>> b) Is outdated
>>
>> While the tutorial + paper is already written now.
>>
>>> However, maybe it's my personal use-case bias, but I think that numpy is
>>> almost a standard part of Cython use -- I can't think of what I'd like
>>> to optimize that I wouldn't want to use numpy for! And numpy is why I
>>> skipped past pyrex and straight to Cython.
>>
>> Well, take Stefan Behnel, who doesn't use NumPy at all, but rather works
>> with XML documents.
>>
>> Even within science, the whole Sage project (a very important Cython
(Continue reading)

Christopher Barker | 1 Oct 02:07
Picon
Favicon

Re: [Cython] Updating Documentation

Dag Sverre Seljebotn wrote:
> Christopher Barker wrote:
> Yes, but the existing intro on numpy+cython:
> a) Lacks quite a bit in several areas
> b) Is outdated
> 
> While the tutorial + paper is already written now.

right -- my pint was that we really should have only one -- if the 
tutorial+paper is the better/more up-to-date one, then by all means 
let's make that the one people find.

>> However, maybe it's my personal use-case bias, but I think that numpy is 
>> almost a standard part of Cython use -- I can't think of what I'd like 
>> to optimize that I wouldn't want to use numpy for! And numpy is why I 
>> skipped past pyrex and straight to Cython.
> 
> Well, take Stefan Behnel, who doesn't use NumPy at all, but rather works 
> with XML documents.
> 
> Even within science, the whole Sage project (a very important Cython 
> user) don't use that much NumPy either, and in particular not the 
> Cython/NumPy features, as they need exact math which isn't covered by 
> NumPy's dtypes

OK -- lot's of non-numpy use.

> Then you have any kind of wrappers around native libraries.

yes, but if those native libraries are working with arrays of data, 
(Continue reading)

Brent Pedersen | 1 Oct 02:07
Picon
Gravatar

Re: [Cython] Appending...

On Wed, Sep 30, 2009 at 1:54 PM, Christopher Barker
<Chris.Barker <at> noaa.gov> wrote:
>
>
> Brent Pedersen wrote:
>>>> timing on my machine, that gives:
>>>>
>>>> vector append 1.19197511673
>>>> python append 6.57795596123
>>>> vector get 0.080246925354
>>>> python get 2.01052689552
>
> While you're at it, why not give an array.array implementation a try --
> it might be closer to the C++ version -- it should be!
>
> -Chris

looks like it could actually be faster.

http://gist.github.com/198576

gives:

method: append/get
python: 3.5361 / 1.8621
vector: 1.8887 / 0.5865
array : 0.3319 / 0.1467

think that's a reasonably fair test except i cheated for array.array
on the inserts by doing a resize() and then inserting, not appending.
(Continue reading)

Christopher Barker | 1 Oct 03:12
Picon
Favicon

Re: [Cython] Appending...

Brent Pedersen wrote:
> http://gist.github.com/198576
> 
> gives:
> 
> method: append/get
> python: 3.5361 / 1.8621
> vector: 1.8887 / 0.5865
> array : 0.3319 / 0.1467
> 
> think that's a reasonably fair test except I cheated for array.array
> on the inserts by doing a resize() and then inserting, not appending.

Actually, that is a total cheat, and not testing the right thing at all. 
(IIUC what teh OP was looking for). You've pre-allocated, so of course 
accumulating is going to be blazingly fast. I think the point of this 
was for a situation where you don't know how big it's going to get, so 
you can't pre-allocate.

> otherwise, it's _very_ slow to do the array.append() -- over 30
> seconds instead of .33

wow! that is really, really bad. Something has got to be wrong.

I've been poking into the array.array over-allocations scheme (thanks 
Robert), and it is more conservative than lists, so it may be slower, 
but that seems like too much.

> for array.array, i used the stuff attached to this ticket:
> http://trac.cython.org/cython_trac/ticket/314
(Continue reading)

Robert Kern | 1 Oct 04:57
Picon
Gravatar

Re: [Cython] Updating Documentation

Christopher Barker wrote:
> Dag Sverre Seljebotn wrote:

>> There's enough usecases for Cython without NumPy to make our primary 
>> Cython tutorial generic and not targeted for numerical users IMO.
> 
> agreed, though I may never use the stuff used to process XML docs, but 
> it gets first class treatment...

There really isn't any special "stuff used to process XML docs" in Cython. There 
is special stuff in Cython to interact with numpy arrays.

--

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

Matthew Honnibal | 1 Oct 07:40
Picon

[Cython] Question about buffer interface for Python2.6

Hi,
I've only just started using Cython today, and I'm having trouble with
the buffer interface indexing described here:
http://wiki.cython.org/enhancements/buffer . I want to iterate over a
unicode string getting contiguous subsequences.

My Cython function has the following declaration:

def parseDoc(object[object] string):

I've tried various Python types, but I always get a runtime error like:

TypeError: 'unicode' does not have the buffer interface
TypeError: 'array.array' does not have the buffer interface
TypeError: 'buffer' does not have the buffer interface

The last one was obtained by calling the built-in buffer() function on
the string.

I can get a step further by doing cimport numpy and using a numpy
array, but then unicode is not one of the supported types, and that
doesn't seem like it was the intention --- the docs suggest at Python
2.6+, I shouldn't need the numpy work-around.

What am I doing wrong?

Matthew.

P.S. I tried to post this yesterday but it didn't seem to come up.
Apologies if this double-posts.
(Continue reading)

Robert Bradshaw | 1 Oct 08:53
Favicon

Re: [Cython] Updating Documentation

On Sep 30, 2009, at 3:53 AM, Dag Sverre Seljebotn wrote:

> Peter Alexander wrote:
>> One thing I'd like to have an idea of atm is if you'd like the entire
>> site to be more homogenous. A nice template/theme could run through
>> out the website. Maybe using Sphinx's index.html as the portal page
>> and then linking to tutorial, manual, howto's, wiki, trac, etc.. from
>> there. I not much of a web-site developer but I'm sure I could handle
>> a template and css well enough.
>>
> As far as *system* goes, I personally think the current system is  
> great.
> It's more about *content*.
>
> Brain dump:
>
> I like the current system of:
>
> - cython.org: A *short*, single, static HTML page. It should be as  
> short
> as possible, only providing the essential links ("what is Cython",  
> docs,
> download, mailing list, authors & financial contributions). Everything
> else is either relevant to users and should go into docs, or community
> stuff/dynamic lists which should go into wiki.
>
> - docs.cython.org: Served by Sphinx (which can then also build static
> Windows help files, documentation we can ship etc. etc). Sphinx can
> contain tutorials, howtos etc. in addition to reference manual.
> http://docs.python.org is great; many parts, all of which are  
(Continue reading)

Robert Bradshaw | 1 Oct 09:07
Favicon

Re: [Cython] Updating Documentation

On Sep 30, 2009, at 5:07 PM, Christopher Barker wrote:

> Dag Sverre Seljebotn wrote:
>> Christopher Barker wrote:
>> Yes, but the existing intro on numpy+cython:
>> a) Lacks quite a bit in several areas
>> b) Is outdated
>>
>> While the tutorial + paper is already written now.
>
> right -- my pint was that we really should have only one -- if the
> tutorial+paper is the better/more up-to-date one, then by all means
> let's make that the one people find.
>
>
>>> However, maybe it's my personal use-case bias, but I think that  
>>> numpy is
>>> almost a standard part of Cython use -- I can't think of what I'd  
>>> like
>>> to optimize that I wouldn't want to use numpy for! And numpy is  
>>> why I
>>> skipped past pyrex and straight to Cython.
>>
>> Well, take Stefan Behnel, who doesn't use NumPy at all, but rather  
>> works
>> with XML documents.
>>
>> Even within science, the whole Sage project (a very important Cython
>> user) don't use that much NumPy either, and in particular not the
>> Cython/NumPy features, as they need exact math which isn't covered by
(Continue reading)

Robert Bradshaw | 1 Oct 09:09
Favicon

Re: [Cython] Updating Documentation

BTW, who wants/needs push access to hg.cython.org/cython-docs?  
(Though you can set up your own repos as well.)

- Robert


Gmane