#include <boost/python.hpp>
#include <numarray/arrayobject.h>
#include <iostream>
#include <sstream>
#include <vector>
#include <map>
Include dependency graph for num_util.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Namespaces | |
namespace | num_util |
Typedefs | |
typedef std::map< PyArray_TYPES, char > | num_util::KindCharMap |
Mapping from a PyArray_TYPE to its corresponding typeID in char. | |
typedef std::map< PyArray_TYPES, std::string > | num_util::KindStringMap |
Mapping from a PyArray_TYPE to its corresponding name in string. | |
typedef std::map< char, PyArray_TYPES > | num_util::KindTypeMap |
Mapping from a typeID to its corresponding PyArray_TYPE. | |
Functions | |
numeric::array | num_util::astype (boost::python::numeric::array arr, PyArray_TYPES t) |
Returns a clone of this array with a new type. | |
PyArray_TYPES | num_util::char2type (char e_type) |
Coverts a single character typecode to its PyArray_TYPES. | |
void | num_util::check_contiguous (boost::python::numeric::array arr) |
Throws an exception if the array is not contiguous. | |
void | num_util::check_dim (boost::python::numeric::array arr, int dimnum, int dimsize) |
Throws an exception if a specific dimension from a Numeric array does not match the expected size. | |
void | num_util::check_PyArrayElementType (boost::python::object newo) |
Throws an exception if the element of a Numeric array is type casted to PyArray_OBJECT. | |
void | num_util::check_rank (boost::python::numeric::array arr, int expected_rank) |
Throws an exception if the actual rank is not equal to the expected rank. | |
void | num_util::check_shape (boost::python::numeric::array arr, std::vector< int > expected_dims) |
Throws an exception if the actual dimensions of the array are not equal to the expected dimensions. | |
void | num_util::check_size (boost::python::numeric::array arr, int expected_size) |
Throw an exception if the actual total size of the array is not equal to the expected size. | |
void | num_util::check_size_match (std::vector< int > dims, int n) |
Throws an exception if the total size computed from a vector of integer does not match with the expected size. | |
void | num_util::check_type (boost::python::numeric::array arr, PyArray_TYPES expected_type) |
Throws an exception if the actual array type is not equal to the expected type. | |
boost::python::numeric::array | num_util::clone (boost::python::numeric::array arr) |
Returns a clone of this array. | |
void | num_util::copy_data (boost::python::numeric::array arr, char *new_data) |
Copies data into the array. | |
char * | num_util::data (boost::python::numeric::array arr) |
Returns a pointer to the data in the array. | |
int | num_util::get_dim (boost::python::numeric::array arr, int dimnum) |
Returns the size of a specific dimension. | |
bool | num_util::iscontiguous (boost::python::numeric::array arr) |
Returns true if the array is contiguous. | |
boost::python::numeric::array | num_util::makeNum (boost::python::object x) |
A free function that extracts a PyArrayObject from any sequential PyObject. | |
int | num_util::rank (boost::python::numeric::array arr) |
A free function that retrieves the number of dimensions of a Numeric array. | |
int | num_util::refcount (boost::python::numeric::array arr) |
Returns the reference count of the array. | |
void | num_util::savespace (boost::python::numeric::array arr, bool set_savespace) |
Changes the savespace property of the array. | |
std::vector< int > | num_util::shape (boost::python::numeric::array arr) |
Returns the dimensions in a vector. | |
int | num_util::size (boost::python::numeric::array arr) |
A free function that returns the total size of the array. | |
bool | num_util::spacesaver (boost::python::numeric::array arr) |
Returns true if the array is a spacesaver array. | |
std::vector< int > | num_util::strides (boost::python::numeric::array arr) |
Returns the strides array in a vector of integer. | |
PyArray_TYPES | num_util::type (boost::python::numeric::array arr) |
A free function that retrieves the Numeric type of a Numeric array. | |
char | num_util::type2char (PyArray_TYPES t_type) |
Converts a PyArray_TYPE to its single character typecode. | |
std::string | num_util::type2string (PyArray_TYPES t_type) |
Converts a PyArray_TYPE to its name in string. | |
template<class T> | |
std::string | num_util::vector_str (const std::vector< T > &vec) |
Constructs a string which contains a list of elements extracted from the input vector. |