Hi,
I would like to get a double** from a 2d numpy array in cython in order
to call properly some function written in C++. Can some one to give a
pure cython solution?
From now I have a double* from the np.ndarray[double, ndim=2] .data.
I'm getting the double array in C++ with:
array2D_=new double* [nrows];
for (int i=0; i<nrows; ++i)
{
array2D_[i]=ptr1D;
ptr1D+=ncols;
}
with that I'm responsible to delete the array from C++
// delete [] this->array2D_[0]; // delete the memory pool
delete [] this->array2D_; // delete the row pointers
but this->array2D_[0]; is shared with the numpy array.
I think that it may be more elegant to get directly a double** from
numpy and let to python the responsibility of managing the memory.
Regards
Adrian Martínez Vargas
_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel