A boost.python "object manager" (subclass of object) for numpy.dtype. More...
#include <dtype.hpp>
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. |
A boost.python "object manager" (subclass of object) for numpy.dtype.
boost::numpy::dtype::dtype | ( | T | arg, |
bool | align = false |
||
) | [inline, explicit] |
boost::numpy::dtype::BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS | ( | dtype | , |
python::object | |||
) |
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.
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.
int boost::numpy::dtype::get_itemsize | ( | ) | const |
Return the size of the data type in bytes.
Definition at line 87 of file src/dtype.cpp.
void boost::numpy::dtype::register_scalar_converters | ( | ) | [static] |
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.
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.