Cupitor
Cupitor

Reputation: 11637

Returning a C-array in cython

I am trying to write a simple cython function which takes a size and initial value of a 2D array. It only sets the first row and then returns the array. However it doesn't work and it raises Cannot convert 'double **' to Python object. What am I doing wrong here?

cdef ccsolve_eq(int size,double *init_vals):
    cdef double** frozen_ans= <double**> malloc(size*sizeof(double))
    frozen_ans[0]=<double*> malloc(dim*sizeof(double))
    return frozen_ans

Upvotes: 0

Views: 1029

Answers (1)

Veedrac
Veedrac

Reputation: 60127

You need to type the return value:

cdef double** ccsolve_eq...

Upvotes: 2

Related Questions