[C++-sig] (David Abrahams)numpy.ndarray did not match PyArrayObject *
Qinfeng(Javen) Shi
shiqinfeng at gmail.com
Tue Sep 26 17:53:07 CEST 2006
Hi David,
>boost::python::lvalue_from_pytype<extract_array_object,&PyArrayObject_Type>();
>struct extract_array_object
> {
> static PyArrayObject& execute(PyArrayObject& x)
> {
> return x;
> }
> };
> Yes, the very subtle trick at the bottom of my posting
> "replace the indicated with the name of NumPy's python type object
> for ndarray."
Sorry, I don't get you.
The Python type of the ndarray is PyArray_Type. InC, every ndarray is a
pointer to a PyArrayObject structure.
So what is the extract_array_object and what is PyArrayObject_Type?
I tried
boost::python::lvalue_from_pytype<PyArray_Type,&PyArrayObject>();
boost::python::lvalue_from_pytype<extract_array_object,&PyArray_Type>();
boost::python::lvalue_from_pytype<ndarray,&PyArray_Type>();
boost::python::lvalue_from_pytype<extract_array_object,&PyArrayObject_Type>();
boost::python::lvalue_from_pytype<extract_array_object,&ndarray>();
boost::python::lvalue_from_pytype<PyArray_Type,&PyArray_Type>();
boost::python::lvalue_from_pytype<ndarray,&ndarray>();
boost::python::lvalue_from_pytype<PyArray_Type,&ndarray>();
They all failed.
Could you please tell me exactly?
--
Qinfeng(Javen) Shi
Research School of Information Sciences and Engineering
Australian National University
Locked Bag 8001
Canberra ACT 2601
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20060927/37cf6634/attachment.htm>
More information about the Cplusplus-sig
mailing list