Public Member Functions | Static Public Member Functions | Static Private Member Functions | Friends
boost::numpy::dtype Class Reference

A boost.python "object manager" (subclass of object) for numpy.dtype. More...

#include <dtype.hpp>

List of all members.

Public Member Functions

 BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS (dtype, python::object)
template<typename T >
 dtype (T arg, bool align=false)
 Convert an arbitrary Python object to a data-type descriptor object.
int get_itemsize () const
 Return the size of the data type in bytes.

Static Public Member Functions

template<typename T >
static dtype get_builtin ()
 Get the built-in numpy dtype associated with the given scalar template type.
static void register_scalar_converters ()
 Register from-Python converters for NumPy's built-in array scalar types.

Static Private Member Functions

static
python::detail::new_reference 
convert (python::object::object_cref arg, bool align)

Friends

bool equivalent (dtype const &a, dtype const &b)
 Compare two dtypes for equivalence.

Detailed Description

A boost.python "object manager" (subclass of object) for numpy.dtype.

Todo:
This could have a lot more interesting accessors.

Definition at line 26 of file dtype.hpp.


Constructor & Destructor Documentation

template<typename T >
boost::numpy::dtype::dtype ( arg,
bool  align = false 
) [inline, explicit]

Convert an arbitrary Python object to a data-type descriptor object.

Definition at line 32 of file dtype.hpp.


Member Function Documentation

python::detail::new_reference boost::numpy::dtype::convert ( python::object::object_cref  arg,
bool  align 
) [static, private]

Definition at line 75 of file src/dtype.cpp.

template<typename T >
dtype boost::numpy::dtype::get_builtin ( ) [inline, static]

Get the built-in numpy dtype associated with the given scalar template type.

This is perhaps the most useful part of the numpy API: it returns the dtype object corresponding to a built-in C++ type. This should work for any integer or floating point type supported by numpy, and will also work for std::complex if sizeof(std::complex<T>) == 2*sizeof(T).

It can also be useful for users to add explicit specializations for POD structs that return field-based dtypes.

Definition at line 107 of file dtype.hpp.

Return the size of the data type in bytes.

Definition at line 87 of file src/dtype.cpp.

Register from-Python converters for NumPy's built-in array scalar types.

This is usually called automatically by initialize(), and shouldn't be called twice (doing so just adds unused converters to the Boost.Python registry).

Definition at line 143 of file src/dtype.cpp.


Friends And Related Function Documentation

bool equivalent ( dtype const &  a,
dtype const &  b 
) [friend]

Compare two dtypes for equivalence.

This is more permissive than equality tests. For instance, if long and int are the same size, the dtypes corresponding to each will be equivalent, but not equal.


The documentation for this class was generated from the following files:


boost_numpy
Author(s): Jim Bosch, Ankit Daftery
autogenerated on Fri Aug 28 2015 10:10:40