pyrex+Numeric

Pawel Oleksik oleksik at galaxy.uci.agh.edu.pl
Tue Mar 30 11:38:11 EST 2004


Hi,

I have no idea, how to properly declare/use Numeric functions in pyrex.
For example the code below causes segmentation fault:

--in pyrex--------------
[... some lines from Pyrex-0.9/Demos/numeric_demo.pyx, plus: ]

cdef extern from "Numeric/arrayobject.h":

	object PyArray_ContiguousFromObject ( object, int, int, int )

def contiguous_tst ( ArrayType A ) :

    if A.nd != 1 :
        raise ValueError("1D array expected.")
        
    B = PyArray_ContiguousFromObject(<object>A,A.descr.type,1,1)

    print '***'

    return B


--in python--------------
>>> from Numeric import *
>>> A = array((1,2,3,4,5))
>>> contiguous_tst(A)

My environment is 'quite new': python 2.3.3, Numeric 23.1, pyrex 0.9.

I hope you will give me some light on this problem, please.

Best regards
p.o.



More information about the Python-list mailing list