Package numpy :: Module ctypeslib
[hide private]
[frames] | no frames]

Module ctypeslib

source code

Classes [hide private]
  _ndptr
  c_intp
Functions [hide private]
 
_flags_fromnum(num) source code
 
_num_fromflags(flaglist) source code
 
ctypes_load_library(*args, **kwds)
ctypes_load_library is DEPRECATED in numpy: use load_library instead
 
load_library(libname, loader_path) source code
 
ndpointer(dtype=None, ndim=None, shape=None, flags=None)
Array-checking restype/argtypes.
source code
 
test(level=1, verbosity=1) source code
Variables [hide private]
  _flagdict = {'A': 256, 'ALIGNED': 256, 'C': 1, 'CONTIGUOUS': 1...
  _flagnames = ['C_CONTIGUOUS', 'F_CONTIGUOUS', 'ALIGNED', 'WRIT...
  _pointer_type_cache = {}
Function Details [hide private]

ndpointer(dtype=None, ndim=None, shape=None, flags=None)

source code 
Array-checking restype/argtypes.

An ndpointer instance is used to describe an ndarray in restypes
and argtypes specifications.  This approach is more flexible than
using, for example,

POINTER(c_double)

since several restrictions can be specified, which are verified
upon calling the ctypes function.  These include data type
(dtype), number of dimensions (ndim), shape and flags (e.g.
'C_CONTIGUOUS' or 'F_CONTIGUOUS').  If a given array does not satisfy the
specified restrictions, a TypeError is raised.

Example:

    clib.somefunc.argtypes = [ndpointer(dtype=float64,
                                        ndim=1,
                                        flags='C_CONTIGUOUS')]
    clib.somefunc(array([1,2,3],dtype=float64))


Variables Details [hide private]

_flagdict

Value:
{'A': 256,
 'ALIGNED': 256,
 'C': 1,
 'CONTIGUOUS': 1,
 'C_CONTIGUOUS': 1,
 'F': 2,
 'FORTRAN': 2,
 'F_CONTIGUOUS': 2,
...

_flagnames

Value:
['C_CONTIGUOUS',
 'F_CONTIGUOUS',
 'ALIGNED',
 'WRITEABLE',
 'OWNDATA',
 'UPDATEIFCOPY']