From c33460c2657652a7463e4309ad5145ed77e90991 Mon Sep 17 00:00:00 2001 From: Ankit Daftery Date: Fri, 12 Aug 2011 09:26:22 +0000 Subject: [PATCH] Made a few modifications --- libs/numpy/example/fromdata.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libs/numpy/example/fromdata.cpp b/libs/numpy/example/fromdata.cpp index 3cfcdc36..dc5a3a2a 100644 --- a/libs/numpy/example/fromdata.cpp +++ b/libs/numpy/example/fromdata.cpp @@ -1,10 +1,10 @@ /** - * @brief An example to show how to create ndarrays from C++ containers of (almost) arbitrary type. + * @brief An example to show how to access data using raw pointers.This shows that you can use and manipulate data in either Python or C++ and have the changes + * reflected in both * */ #include -#include #include namespace p = boost::python; @@ -21,7 +21,7 @@ int main(int argc, char **argv) int arr[] = {1,2,3,4} ; // Create the ndarray in Python np::ndarray py_array = np::from_data(arr, np::dtype::get_builtin() , p::make_tuple(4), p::make_tuple(4), p::object()); - // Print the ndarray that we created, just to be sure + // Print the ndarray that we just created, and the source C++ array std::cout << "C++ array :" << std::endl ; for (int j=0;j<4;j++) { @@ -41,6 +41,4 @@ int main(int argc, char **argv) // And see if the changes are reflected in the Python ndarray std::cout << std::endl << "Is the change reflected in the Python ndarray ?" << std::endl << p::extract(p::str(py_array)) << std::endl; - // Now print it. -// std::cout << "Pixel array :" << p::extract(p::str(py_array)) << std::endl; }