System configurationΒΆ
When NumPy is built, information about system configuration is
recorded, and is made available for extension modules using NumPyβs C
API. These are mostly defined in numpyconfig.h
(included in
ndarrayobject.h
). The public symbols are prefixed by NPY_*
.
NumPy also offers some functions for querying information about the
platform in use.
For private use, NumPy also constructs a config.h
in the NumPy
include directory, which is not exported by NumPy (that is a python
extension which use the numpy C API will not see those symbols), to
avoid namespace pollution.
Data type sizesΒΆ
The NPY_SIZEOF_{CTYPE}
constants are defined so that sizeof
information is available to the pre-processor.
-
NPY_SIZEOF_SHORT
ΒΆ
-
NPY_SIZEOF_INT
ΒΆ
-
NPY_SIZEOF_LONG
ΒΆ
-
NPY_SIZEOF_LONGLONG
ΒΆ sizeof(longlong) where longlong is defined appropriately on the platform.
-
NPY_SIZEOF_PY_LONG_LONG
ΒΆ
-
NPY_SIZEOF_FLOAT
ΒΆ
-
NPY_SIZEOF_DOUBLE
ΒΆ
-
NPY_SIZEOF_LONG_DOUBLE
ΒΆ
-
NPY_SIZEOF_PY_INTPTR_T
ΒΆ Size of a pointer on this platform (sizeof(void *)) (A macro defines NPY_SIZEOF_INTP as well.)
Platform informationΒΆ
-
NPY_CPU_X86
ΒΆ
-
NPY_CPU_AMD64
ΒΆ
-
NPY_CPU_IA64
ΒΆ
-
NPY_CPU_PPC
ΒΆ
-
NPY_CPU_PPC64
ΒΆ
-
NPY_CPU_SPARC
ΒΆ
-
NPY_CPU_SPARC64
ΒΆ
-
NPY_CPU_S390
ΒΆ
-
NPY_CPU_PARISC
ΒΆ New in version 1.3.0.
CPU architecture of the platform; only one of the above is defined.
Defined in
numpy/npy_cpu.h
-
NPY_LITTLE_ENDIAN
ΒΆ
-
NPY_BIG_ENDIAN
ΒΆ
-
NPY_BYTE_ORDER
ΒΆ New in version 1.3.0.
Portable alternatives to the
endian.h
macros of GNU Libc. If big endian,NPY_BYTE_ORDER
==NPY_BIG_ENDIAN
, and similarly for little endian architectures.Defined in
numpy/npy_endian.h
.
-
PyArray_GetEndianness
()ΒΆ New in version 1.3.0.
Returns the endianness of the current platform. One of
NPY_CPU_BIG
,NPY_CPU_LITTLE
, orNPY_CPU_UNKNOWN_ENDIAN
.