|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r73693 - sandbox/numpy/libs/numpy/example
From: ankitdaf_at_[hidden]
Date: 2011-08-12 05:26:23
Author: ankitdaf
Date: 2011-08-12 05:26:22 EDT (Fri, 12 Aug 2011)
New Revision: 73693
URL: http://svn.boost.org/trac/boost/changeset/73693
Log:
Made a few modifications
Text files modified:
sandbox/numpy/libs/numpy/example/fromdata.cpp | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
Modified: sandbox/numpy/libs/numpy/example/fromdata.cpp
==============================================================================
--- sandbox/numpy/libs/numpy/example/fromdata.cpp (original)
+++ sandbox/numpy/libs/numpy/example/fromdata.cpp 2011-08-12 05:26:22 EDT (Fri, 12 Aug 2011)
@@ -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 <boost/numpy.hpp>
-#include <vector>
#include <iostream>
namespace p = boost::python;
@@ -21,7 +21,7 @@
int arr[] = {1,2,3,4} ;
// Create the ndarray in Python
np::ndarray py_array = np::from_data(arr, np::dtype::get_builtin<int>() , 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 @@
// 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<char const *>(p::str(py_array)) << std::endl;
- // Now print it.
-// std::cout << "Pixel array :" << p::extract<char const *>(p::str(py_array)) << std::endl;
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk