[C++-sig] Simply calling a routine ...
Philip Austin
paustin at eos.ubc.ca
Sun Jun 29 16:49:25 CEST 2003
Charles Leung writes:
> Your example, utilizing num_util, will probably look something like...
>
> ...
> namespace nbpl = num_util;
> namespace py = boost::python;
>
> py::long_ foo( py::numeric::array a, float b,
> py::numeric::array c, int N ){
!!> Array<short, 1> A(N);
!!> A.data() = (short*) nbpl::data(a);
>
> // Do some work
Note that Blitz has a flag to prevent it from invoking
delete on a's data pointer when A goes out of scope --
the lines marked !! need to be replaced with:
short* data = (short*) nbpl::data(a);
Array<short, 1> A(data,shape(N),neverDeleteData);
Regards, Phil
More information about the Cplusplus-sig
mailing list