2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-23 17:52:17 +00:00

Added from_data implementation, zeros(..) examples

This commit is contained in:
Ankit Daftery
2011-08-04 17:39:04 +00:00
parent 37a73f344b
commit 45e52301e9
2 changed files with 15 additions and 1 deletions

View File

@@ -21,6 +21,8 @@ int main(int argc, char **argv)
np::dtype dtype = np::dtype::get_builtin<float>();
// Construct an array with the above shape and type
np::ndarray a = np::zeros(shape, dtype);
// Construct an empty array with the above shape and dtype as well
np::ndarray b = np::empty(shape,dtype);
// Print the array
std::cout << "Original array:\n" << p::extract<char const *>(p::str(a)) << std::endl;
// Reshape the array into a 1D array