AST nodes for native slicing.
Bases: numba.nodes.basenodes.ExprNode
Broadcast a bunch of operands:
- set strides of single-sized dimensions to zero
- find big shape
Bases: ast.NodeVisitor
Mark array slicing nodes as nopython, which allows them to use stack-allocated fake arrays.
Bases: numba.nodes.basenodes.ExprNode
Aggregate of slices in all dimensions.
In nopython context, uses a fake stack-allocated PyArray struct.
In python context, it builds an actual heap-allocated numpy array. In this case, the following attributes are patched during code generation time that sets the llvm values:
dst_data, dst_shape, dst_strides
Bases: numba.nodes.basenodes.ExprNode
Array is sliced, and this dimension contains an integer index or newaxis.
Bases: numba.support.numpy_support.slicenodes.SliceDimNode
Array is sliced, and this dimension contains a slice.
Rewrites array slices to its native equivalent without using the Python API.
node: ast.Subscript with an array type as result nopython: whether the node is encountered in a nopython context
Bases: numba.utility.cbuilder.numbacdef.NumbaCDefinition
Transliteration of
@cname(‘__pyx_memoryview_broadcast’) cdef bint __pyx_broadcast(Py_ssize_t *dst_shape,
cdef Py_ssize_t i cdef int dim_offset = max_ndim - ndim
- for i in range(ndim):
src_extent = input_shape[i] dst_extent = dst_shape[i + dim_offset]
- if src_extent == 1:
- p_broadcast[0] = True strides[i] = 0
- elif dst_extent == 1:
- dst_shape[i + dim_offset] = src_extent
- elif src_extent != dst_extent:
- __pyx_err_extents(i, dst_shape[i], input_shape[i])
Bases: numba.utility.cbuilder.numbacdef.NumbaCDefinition
Bases: numba.utility.cbuilder.numbacdef.NumbaCDefinition
Bases: llvm_cbuilder.builder.CDefinition
Module that deals with NumPy array slicing.
- normalize ellipses
- recognize newaxes
- track how contiguity is affected (C or Fortran)
Given an array node node, process all AST slices and create the final type:
- process newaxes (None or numpy.newaxis)
- replace Ellipsis with a bunch of ast.Slice objects
- process integer indices
- append any missing slices in trailing dimensions