00001 // Copyright Jim Bosch & Ankit Daftery 2010-2012. 00002 // Distributed under the Boost Software License, Version 1.0. 00003 // (See accompanying file LICENSE_1_0.txt or copy at 00004 // http://www.boost.org/LICENSE_1_0.txt) 00005 00006 #include <boost/numpy.hpp> 00007 00008 namespace p = boost::python; 00009 namespace np = boost::numpy; 00010 00011 np::ndarray reshape(np::ndarray old_array, p::tuple shape) 00012 { 00013 np::ndarray local_shape = old_array.reshape(shape); 00014 return local_shape; 00015 } 00016 00017 BOOST_PYTHON_MODULE(shapes_mod) 00018 { 00019 np::initialize(); 00020 p::def("reshape", reshape); 00021 }