|
LvArray
|
Contains methods to help with conversion to python objects. More...
#include "pythonForwardDeclarations.hpp"#include "pythonHelpers.hpp"#include "../limits.hpp"#include <vector>#include <typeindex>#include <type_traits>

Go to the source code of this file.
Namespaces | |
| LvArray | |
| The top level namespace. | |
| LvArray::python | |
| Contains all the Python code. | |
Functions | |
| PyObject * | LvArray::python::internal::createNumpyArrayImpl (void *const data, std::type_index const type, bool const dataIsConst, int const ndim, long long const *const dims, long long const *const strides) |
Return a NumPy ndarray that is a view into data. More... | |
| PyObject * | LvArray::python::internal::createCupyArrayImpl (void *const data, std::type_index const type, bool const dataIsConst, int const ndim, long long const *const dims, long long const *const strides) |
Return a CuPy ndarray that is a view into data. More... | |
| bool | LvArray::python::import_array_wrapper () |
Attempt to import the NumPy API if it was not already imported, return true iff successful. More... | |
| template<typename T , typename INDEX_TYPE > | |
| std::enable_if_t< internal::canExportToNumpy< T >, PyObject *> | LvArray::python::createNumPyArray (T *const data, bool const modify, int const ndim, INDEX_TYPE const *const dimsPtr, INDEX_TYPE const *const stridesPtr) |
Return a NumPy ndarray view of data. More... | |
| template<typename T > | |
| std::enable_if_t< internal::canExportToNumpy< T >, PyObject *> | LvArray::python::create (T &value) |
Create a NumPy 1D array of length 1 containing the scalar value. More... | |
| std::tuple< PyObjectRef< PyObject >, void const *, long long > | LvArray::python::parseNumPyArray (PyObject *const obj, std::type_index const expectedType) |
Attempt to parse obj into a NumPy ndarray of type expectedType. More... | |
| std::type_index | LvArray::python::getTypeIndexFromNumPy (int const numpyType) |
Return the std::type_index corresponding to the NumPy type numpyType. More... | |
| std::string | LvArray::python::getNumPyTypeName (int const numpyType) |
Return the name corresponding to the NumPy type numpyType. More... | |
| PyObject * | LvArray::python::getNumPyTypeObject (std::type_index const typeIndex) |
Return the NumPy type object corresponding to typeIndex. More... | |
Variables | |
| template<typename T > | |
| constexpr bool | LvArray::python::internal::canExportToNumpy = std::is_arithmetic< T >::value |
True if T can be represented by a NumPy native data type. More... | |
Contains methods to help with conversion to python objects.
| PyObject * LvArray::python::internal::createCupyArrayImpl | ( | void *const | data, |
| std::type_index const | type, | ||
| bool const | dataIsConst, | ||
| int const | ndim, | ||
| long long const *const | dims, | ||
| long long const *const | strides | ||
| ) |
Return a CuPy ndarray that is a view into data.
| data | A pointer to the data to export. |
| type | The type of the data to export. |
| dataIsConst | True iff the data should be immutable. Note that unlike NumPy this is not honored by CuPy, although this may change in the future. |
| ndim | The number of dimensions of data. |
| dims | The size of each dimension. |
| strides | The strides of each dimension. |
data, or nullptr if there was an error. | PyObject * LvArray::python::internal::createNumpyArrayImpl | ( | void *const | data, |
| std::type_index const | type, | ||
| bool const | dataIsConst, | ||
| int const | ndim, | ||
| long long const *const | dims, | ||
| long long const *const | strides | ||
| ) |
Return a NumPy ndarray that is a view into data.
| data | A pointer to the data to export. |
| type | The type of the data to export. |
| dataIsConst | True iff the data should be immutable. When this is true modifying the values in the returned ndarray raises an exception. |
| ndim | The number of dimensions of data. |
| dims | The size of each dimension. |
| strides | The strides of each dimension. |
data, or nullptr if there was an error. | constexpr bool LvArray::python::internal::canExportToNumpy = std::is_arithmetic< T >::value |
True if T can be represented by a NumPy native data type.
| T | The type to query. |
1.8.13