|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r73551 - sandbox/numpy/libs/numpy/example
From: ankitdaf_at_[hidden]
Date: 2011-08-05 13:04:30
Author: ankitdaf
Date: 2011-08-05 13:04:29 EDT (Fri, 05 Aug 2011)
New Revision: 73551
URL: http://svn.boost.org/trac/boost/changeset/73551
Log:
Added example for custom dtype
Text files modified:
sandbox/numpy/libs/numpy/example/dtype.cpp | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
Modified: sandbox/numpy/libs/numpy/example/dtype.cpp
==============================================================================
--- sandbox/numpy/libs/numpy/example/dtype.cpp (original)
+++ sandbox/numpy/libs/numpy/example/dtype.cpp 2011-08-05 13:04:29 EDT (Fri, 05 Aug 2011)
@@ -4,7 +4,7 @@
*
* @todo Add an example to show type conversion.
* Add an example to show use of user-defined types
- * Doesn't work for char. Works for int, long int, short int, float, double
+ *
*/
#include <boost/numpy.hpp>
@@ -29,5 +29,12 @@
std::cout << "Original array:\n" << p::extract<char const *>(p::str(a)) << std::endl;
// Print the datatype of the elements
std::cout << "Datatype is:\n" << p::extract<char const *>(p::str(a.get_dtype())) << std::endl ;
-
+ // Roundabout way of creating a user defined dtype. Fix this if possible
+/*
+ p::tuple for_custom_dtype = p::make_tuple("ha",dtype) ;
+ p::list list_for_dtype ;
+ list_for_dtype.append(for_custom_dtype) ;
+ np::dtype custom_dtype = np::dtype(list_for_dtype) ;
+ np::ndarray new_array = np::zeros(shape,z);
+*/
}
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