Passing pointer to ndarray to a function

20 views
Skip to first unread message

Joon Ro

unread,
Apr 23, 2012, 12:33:07 AM4/23/12
to cython-users
Hi,

I was wondering if it is possible to pass pointer to an ndarray to a
function. For example in the following function (from CythonGSL example):


cdef double normal(double x, void * params) nogil:
cdef double mu = (<double_ptr> params)[0]
cdef double sigma = (<double_ptr> params)[1]

return gsl_ran_gaussian_pdf(x - mu, sigma)


I wonder if I can pass an ndarray as one of the params as well. I want to
use GSL's minimizers to minimize a function and the funcion need a ndarray
as data.

Best,
Joon

Reply all
Reply to author
Forward
0 new messages