Go to the documentation of this file.00001
00002
00003
00004
00005
00006 #include <boost/numpy.hpp>
00007 #include <iostream>
00008
00009 namespace p = boost::python;
00010 namespace np = boost::numpy;
00011
00012 int main(int argc, char **argv)
00013 {
00014
00015 Py_Initialize();
00016
00017 np::initialize();
00018
00019 p::tuple shape = p::make_tuple(3, 3);
00020
00021 np::dtype dtype = np::dtype::get_builtin<float>();
00022
00023 np::ndarray a = np::zeros(shape, dtype);
00024
00025 np::ndarray b = np::empty(shape,dtype);
00026
00027 std::cout << "Original array:\n" << p::extract<char const *>(p::str(a)) << std::endl;
00028
00029 a = a.reshape(p::make_tuple(9));
00030
00031 std::cout << "Reshaped array:\n" << p::extract<char const *>(p::str(a)) << std::endl;
00032 }