[C++-sig] Re: trying to compile simple test example with numeric arrays
David Abrahams
dave at boost-consulting.com
Mon Apr 12 20:39:46 CEST 2004
Faheem Mitha <faheem at email.unc.edu> writes:
> Dear People,
>
> I'm trying to compile the following and getting errors.
What errors?
> My C++ is
> rather rusty and I may be making other (non C++ related)
> errors. Specifically, I may not be understanding the proper use of the
> take function. Any help would be appreciated.
>
> Also, I notice when I remove `const' from the function argument `const
> numeric::array y' I get a whole scad of errors, for reasons that are
> not clear to me.
What errors?
> I'd appreciate any enlightenment about this.
More data please.
> Faheem.
>
> *********************************************************************
> #include <boost/python/numeric.hpp>
> #include <boost/python/tuple.hpp>
> #include <boost/python/extract.hpp>
> #include <boost/python/object.hpp>
> #include <boost/python/module.hpp>
> #include <boost/python/def.hpp>
> using namespace boost::python;
>
> // select designated rows from a 2d numeric array
> numeric::array rem_row(const numeric::array y, const tuple ind)
> {
> return extract<numeric::array>(y.take<tuple>(ind));
^^^^^^^
Should be unneccessary.
> }
>
> BOOST_PYTHON_MODULE(arr)
> {
> def("rem_row", rem_row);
> }
--
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com
More information about the Cplusplus-sig
mailing list