Hi, I think I figured out by using numeric::array::set_module_and_type( "numpy", "ndarray"); thanks!
yong On Fri, Jun 18, 2010 at 8:17 PM, Yongning Zhu <[email protected]> wrote: > Hi, > > I am new to boost python, thanks for the list, and hopefully, I will > find some one to help me. > I am adding the boost python example: > > #include <boost/python/numeric.hpp> > #include <boost/python/tuple.hpp> > // sets the first element in a 2d numeric array > void set_first_element(::boost::python::numeric::array& y, float value) > { > y[::boost::python::make_tuple(0,0)] = value; > } > > into quickstart project, and I belive it compiles and run without this > function. > > When I add this function, in python, I did: > > a=array([1.]) > set_first_element(a,3.) > > and come up with the following error message: > > Boost.Python.ArgumentError: Python argument types in > extending.set_first_element(numpy.ndarray, float) > did not match C++ signature: > set_first_element(boost::python::numeric::array {lvalue}, float) > > Could any one please help me with what's wrong? > > Thanks in advance! > > Yong > _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
