numba.targets package

Submodules

numba.targets.arrayobj module

Implementation of operations on Array objects.

numba.targets.arrayobj.array_len(context, builder, sig, args)
numba.targets.arrayobj.array_ndim(context, builder, typ, value, attr)
numba.targets.arrayobj.array_prod(context, builder, sig, args)
numba.targets.arrayobj.array_record_getattr(context, builder, typ, value, attr)
numba.targets.arrayobj.array_shape(context, builder, typ, value, attr)
numba.targets.arrayobj.array_size(context, builder, typ, value, attr)
numba.targets.arrayobj.array_strides(context, builder, typ, value, attr)
numba.targets.arrayobj.array_sum(context, builder, sig, args)
numba.targets.arrayobj.getitem_array1d_intp(context, builder, sig, args)
numba.targets.arrayobj.getitem_array1d_slice(context, builder, sig, args)
numba.targets.arrayobj.getitem_array_tuple(context, builder, sig, args)
numba.targets.arrayobj.getitem_array_unituple(context, builder, sig, args)
numba.targets.arrayobj.getiter_array(context, builder, sig, args)
numba.targets.arrayobj.make_array(array_type)

Return the Structure representation of the given array_type (an instance of types.Array).

numba.targets.arrayobj.make_array_flat_cls(flatiterty)

Return the Structure representation of the given enum_type (an instance of types.EnumerateType).

numba.targets.arrayobj.make_array_flatiter(context, builder, typ, value, attr)
numba.targets.arrayobj.make_arrayiter_cls(iterator_type)

Return the Structure representation of the given iterator_type (an instance of types.ArrayIteratorType).

numba.targets.arrayobj.numpy_prod(context, builder, sig, args)
numba.targets.arrayobj.numpy_sum(context, builder, sig, args)
numba.targets.arrayobj.setitem_array1d(context, builder, sig, args)
numba.targets.arrayobj.setitem_array1d_slice(context, builder, sig, args)
numba.targets.arrayobj.setitem_array_tuple(context, builder, sig, args)
numba.targets.arrayobj.setitem_array_unituple(context, builder, sig, args)

numba.targets.base module

class numba.targets.base.BaseContext(typing_context)

Bases: object

Most objects are lowered as plain-old-data structure in the generated llvm. They are passed around by reference (a pointer to the structure). Only POD structure can life across function boundaries by copying the data.

add_exception(exc)
add_libs(libs)
call_class_method(builder, func, signature, args)
call_external_function(builder, callee, argtys, args)
call_function(builder, callee, resty, argtys, args, env=None)

Call the Numba-compiled callee, using the same calling convention as in get_function_type().

call_function_pointer(builder, funcptr, signature, args)
cast(builder, val, fromty, toty)
compile_internal(builder, impl, sig, args, locals={}, cache_key=None)

Invoke compiler to implement a function for a nopython function

cache_key : hashable
A hashable object to use as the key for caching. If it is None, no caching is performed.
debug_print(builder, text)
declare_external_function(module, fndesc)
declare_function(module, fndesc)
finalize(func, fndesc)

Perform any necessary work to complete the compilation. An implementation of get_executable() should call finalize().

get_abi_sizeof(lty)
get_argument_type(ty)
get_argument_value(builder, ty, val)

Argument representation to local value representation

get_arguments(func)

Get the Python-level arguments of LLVM func. See get_function_type() for the calling convention.

get_attribute(val, typ, attr)
get_bound_function(builder, obj, ty)
get_constant(ty, val)
get_constant_generic(builder, ty, val)

Return a LLVM constant representing value val of Numba type ty.

get_constant_null(ty)
get_constant_struct(builder, ty, val)
get_constant_undef(ty)
get_data_type(ty)

Get a data representation of the type that is safe for storage. Record data are stored as byte array.

Returns None if it is an opaque pointer

get_dummy_type()
get_dummy_value()
get_executable(func, fndesc)
get_external_function_type(fndesc)
get_function(fn, sig)
get_function_type(fndesc)

Get the implemented Function type for the high-level fndesc. Some parameters can be added or shuffled around. This is kept in sync with call_function() and get_arguments().

Returns: -2 for return none in native function;
-1 for failure with python exception set;
0 for success;

>0 for user error code.

Return value is passed by reference as the first argument.

Actual arguments starts at the 2rd argument position. Caller is responsible to allocate space for return value.

get_python_api(builder)
get_return_status(builder, code)
get_return_type(ty)
get_return_value(builder, ty, val)

Local value representation to return type representation

get_setattr(attr, sig)
get_struct_member_type(member_type)

Get the LLVM type for struct member of type member_type.

get_struct_member_value(builder, ty, val)

Local value representation to struct member representation

get_struct_type(struct)

Get the LLVM struct type for the given Structure class struct.

get_user_function(func)
get_value_as_argument(builder, ty, val)

Prepare local value representation as argument type representation

get_value_type(ty)
implement_pow_as_math_call = False
implement_powi_as_math_call = False
init()

For subclasses to add initializer

insert_attr_defn(defns)
insert_class(cls, attrs)
insert_const_string(mod, string)
insert_func_defn(defns)
insert_user_function(func, fndesc, libs=())
is_struct_type(ty)
is_true(builder, typ, val)
localized()

Returns a localized context that contains extra environment information

make_array(typ)
make_complex(typ)
make_constant_array(builder, typ, ary)
make_optional(optionaltype)
make_optional_none(builder, valtype)
make_optional_value(builder, valtype, value)
make_pair(first_type, second_type)

Create a heterogenous pair class parametered for the given types.

mangler = None
optimize(module)
optimize_function(func)

Perform function-level optimization. This may improve generated code and reduce memory usage.

Note: This is called at the end of lowering.

pack_value(builder, ty, value, ptr)

Pack data for array storage

pair_first(builder, val, ty)

Extract the first element of a heterogenous pair.

pair_second(builder, val, ty)

Extract the second element of a heterogenous pair.

print_string(builder, text)
remove_user_function(func)

Remove user function func. KeyError is raised if the function isn’t known to us.

return_errcode(builder, code)
return_errcode_propagate(builder, code)
return_exc(builder)
return_native_none(builder)
return_optional_value(builder, retty, valty, value)
return_user_exc(builder, code)
return_value(builder, retval)
sentry_record_alignment(rectyp, attr)

Assumes offset starts from a properly aligned location

strict_alignment = False
unpack_value(builder, ty, ptr)

Unpack data from array storage

class numba.targets.base.Overloads

Bases: object

append(impl)
find(sig)
class numba.targets.base.Status

Bases: tuple

Status(code, ok, err, exc, none)

code

Alias for field number 0

err

Alias for field number 2

exc

Alias for field number 3

none

Alias for field number 4

ok

Alias for field number 1

numba.targets.builtins module

class numba.targets.builtins.Complex128(context, builder, value=None, ref=None, cast_ref=False)

Bases: numba.cgutils.Structure

class numba.targets.builtins.Complex64(context, builder, value=None, ref=None, cast_ref=False)

Bases: numba.cgutils.Structure

class numba.targets.builtins.Slice(context, builder, value=None, ref=None, cast_ref=False)

Bases: numba.cgutils.Structure

numba.targets.builtins.array_ravel_impl(context, builder, sig, args)
numba.targets.builtins.bool_invert_impl(context, builder, sig, args)
numba.targets.builtins.caster(restype)
numba.targets.builtins.complex128_power_impl(context, builder, sig, args)
numba.targets.builtins.complex_abs_impl(context, builder, sig, args)

abs(z) := hypot(z.real, z.imag)

numba.targets.builtins.complex_add_impl(context, builder, sig, args)
numba.targets.builtins.complex_conjugate_impl(context, builder, sig, args)
numba.targets.builtins.complex_div_impl(context, builder, sig, args)
numba.targets.builtins.complex_eq_impl(context, builder, sig, args)
numba.targets.builtins.complex_imag_impl(context, builder, typ, value, attr)
numba.targets.builtins.complex_impl(context, builder, sig, args)
numba.targets.builtins.complex_mul_impl(context, builder, sig, args)

(a+bi)(c+di)=(ac-bd)+i(ad+bc)

numba.targets.builtins.complex_ne_impl(context, builder, sig, args)
numba.targets.builtins.complex_negate_impl(context, builder, sig, args)
numba.targets.builtins.complex_positive_impl(context, builder, sig, args)
numba.targets.builtins.complex_real_impl(context, builder, typ, value, attr)
numba.targets.builtins.complex_sub_impl(context, builder, sig, args)
numba.targets.builtins.float_impl(context, builder, sig, args)
numba.targets.builtins.get_complex_info(ty)
numba.targets.builtins.getitem_unituple(context, builder, sig, args)
numba.targets.builtins.getiter_unituple(context, builder, sig, args)
numba.targets.builtins.int_abs_impl(context, builder, sig, args)
numba.targets.builtins.int_add_impl(context, builder, sig, args)
numba.targets.builtins.int_and_impl(context, builder, sig, args)
numba.targets.builtins.int_ashr_impl(context, builder, sig, args)
numba.targets.builtins.int_divmod(context, builder, x, y)

Reference Objects/intobject.c xdivy = x / y; xmody = (long)(x - (unsigned long)xdivy * y); /* If the signs of x and y differ, and the remainder is non-0,

  • C89 doesn’t define whether xdivy is now the floor or the
  • ceiling of the infinitely precise quotient. We want the floor,
  • and we have it iff the remainder’s sign matches y’s.

*/

if (xmody && ((y ^ xmody) < 0) /* i.e. and signs differ */) {
xmody += y; –xdivy; assert(xmody && ((y ^ xmody) >= 0));

} *p_xdivy = xdivy; *p_xmody = xmody;

numba.targets.builtins.int_eq_impl(context, builder, sig, args)
numba.targets.builtins.int_impl(context, builder, sig, args)
numba.targets.builtins.int_invert_impl(context, builder, sig, args)
numba.targets.builtins.int_lshr_impl(context, builder, sig, args)
numba.targets.builtins.int_mul_impl(context, builder, sig, args)
numba.targets.builtins.int_ne_impl(context, builder, sig, args)
numba.targets.builtins.int_negate_impl(context, builder, sig, args)
numba.targets.builtins.int_or_impl(context, builder, sig, args)
numba.targets.builtins.int_positive_impl(context, builder, sig, args)
numba.targets.builtins.int_power_func_body(context, builder, x, y)
numba.targets.builtins.int_sdiv_impl(context, builder, sig, args)
numba.targets.builtins.int_sfloordiv_impl(context, builder, sig, args)
numba.targets.builtins.int_sge_impl(context, builder, sig, args)
numba.targets.builtins.int_sgt_impl(context, builder, sig, args)
numba.targets.builtins.int_shl_impl(context, builder, sig, args)
numba.targets.builtins.int_sign_impl(context, builder, sig, args)
numba.targets.builtins.int_sle_impl(context, builder, sig, args)
numba.targets.builtins.int_slt_impl(context, builder, sig, args)
numba.targets.builtins.int_spower_impl(context, builder, sig, args)
numba.targets.builtins.int_srem_impl(context, builder, sig, args)
numba.targets.builtins.int_struediv_impl(context, builder, sig, args)
numba.targets.builtins.int_sub_impl(context, builder, sig, args)
numba.targets.builtins.int_udiv_impl(context, builder, sig, args)
numba.targets.builtins.int_ufloordiv_impl(context, builder, sig, args)
numba.targets.builtins.int_uge_impl(context, builder, sig, args)
numba.targets.builtins.int_ugt_impl(context, builder, sig, args)
numba.targets.builtins.int_ule_impl(context, builder, sig, args)
numba.targets.builtins.int_ult_impl(context, builder, sig, args)
numba.targets.builtins.int_upower_impl(context, builder, sig, args)
numba.targets.builtins.int_urem_impl(context, builder, sig, args)
numba.targets.builtins.int_utruediv_impl(context, builder, sig, args)
numba.targets.builtins.int_xor_impl(context, builder, sig, args)
numba.targets.builtins.make_pair(first_type, second_type)
numba.targets.builtins.make_unituple_iter(tupiter)

Return the Structure representation of the given tupiter (an instance of types.UniTupleIter).

numba.targets.builtins.math_e_impl(context, builder, typ, value, attr)
numba.targets.builtins.math_pi_impl(context, builder, typ, value, attr)
numba.targets.builtins.max_impl(context, builder, sig, args)
numba.targets.builtins.min_impl(context, builder, sig, args)
numba.targets.builtins.number_as_bool_impl(context, builder, sig, args)
numba.targets.builtins.number_not_impl(context, builder, sig, args)
numba.targets.builtins.optional_is_none(context, builder, sig, args)

Check if an Optional value is invalid

numba.targets.builtins.optional_is_not_none(context, builder, sig, args)

Check if an Optional value is valid

numba.targets.builtins.real_abs_impl(context, builder, sig, args)
numba.targets.builtins.real_add_impl(context, builder, sig, args)
numba.targets.builtins.real_conjugate_impl(context, builder, sig, args)
numba.targets.builtins.real_div_impl(context, builder, sig, args)
numba.targets.builtins.real_divmod(context, builder, x, y)
numba.targets.builtins.real_divmod_func_body(context, builder, vx, wx)
numba.targets.builtins.real_eq_impl(context, builder, sig, args)
numba.targets.builtins.real_floordiv_impl(context, builder, sig, args)
numba.targets.builtins.real_ge_impl(context, builder, sig, args)
numba.targets.builtins.real_gt_impl(context, builder, sig, args)
numba.targets.builtins.real_imag_impl(context, builder, typ, value)
numba.targets.builtins.real_le_impl(context, builder, sig, args)
numba.targets.builtins.real_lt_impl(context, builder, sig, args)
numba.targets.builtins.real_mod_impl(context, builder, sig, args)
numba.targets.builtins.real_mul_impl(context, builder, sig, args)
numba.targets.builtins.real_ne_impl(context, builder, sig, args)
numba.targets.builtins.real_negate_impl(context, builder, sig, args)
numba.targets.builtins.real_positive_impl(context, builder, sig, args)
numba.targets.builtins.real_power_impl(context, builder, sig, args)
numba.targets.builtins.real_real_impl(context, builder, typ, value)
numba.targets.builtins.real_sign_impl(context, builder, sig, args)
numba.targets.builtins.real_sub_impl(context, builder, sig, args)
numba.targets.builtins.round_impl_f32(context, builder, sig, args)
numba.targets.builtins.round_impl_f64(context, builder, sig, args)
numba.targets.builtins.slice0_empty_impl(context, builder, sig, args)
numba.targets.builtins.slice0_none_none_impl(context, builder, sig, args)
numba.targets.builtins.slice1_start_impl(context, builder, sig, args)
numba.targets.builtins.slice1_stop_impl(context, builder, sig, args)
numba.targets.builtins.slice2_impl(context, builder, sig, args)
numba.targets.builtins.slice3_impl(context, builder, sig, args)
numba.targets.builtins.uint_abs_impl(context, builder, sig, args)

numba.targets.cmathimpl module

Implement the cmath module functions.

numba.targets.cmathimpl.acos_impl(context, builder, sig, args)
numba.targets.cmathimpl.acosh_impl(context, builder, sig, args)
numba.targets.cmathimpl.asin_impl(context, builder, sig, args)
numba.targets.cmathimpl.asinh_impl(context, builder, sig, args)
numba.targets.cmathimpl.atan_impl(context, builder, sig, args)
numba.targets.cmathimpl.atanh_impl(context, builder, sig, args)
numba.targets.cmathimpl.cos_impl(context, builder, sig, args)
numba.targets.cmathimpl.cosh_impl(context, builder, sig, args)
numba.targets.cmathimpl.exp_impl(context, builder, sig, args)
numba.targets.cmathimpl.intrinsic_complex_unary(inner_func)
numba.targets.cmathimpl.is_finite(builder, z)
numba.targets.cmathimpl.is_inf(builder, z)
numba.targets.cmathimpl.is_nan(builder, z)
numba.targets.cmathimpl.isinf_float_impl(context, builder, sig, args)
numba.targets.cmathimpl.isnan_float_impl(context, builder, sig, args)
numba.targets.cmathimpl.log10_impl(context, builder, sig, args)
numba.targets.cmathimpl.log_base_impl(context, builder, sig, args)

cmath.log(z, base)

numba.targets.cmathimpl.log_impl(context, builder, sig, args)
numba.targets.cmathimpl.phase_impl(context, builder, sig, args)
numba.targets.cmathimpl.polar_impl(context, builder, sig, args)
numba.targets.cmathimpl.rect_impl(context, builder, sig, args)
numba.targets.cmathimpl.sin_impl(context, builder, sig, args)
numba.targets.cmathimpl.sinh_impl(context, builder, sig, args)
numba.targets.cmathimpl.sqrt_impl(context, builder, sig, args)
numba.targets.cmathimpl.tan_impl(context, builder, sig, args)
numba.targets.cmathimpl.tanh_impl(context, builder, sig, args)

numba.targets.cpu module

class numba.targets.cpu.CPUContext(typing_context)

Bases: numba.targets.base.BaseContext

Changes BaseContext calling convention

build_pass_manager()
call_function(builder, callee, resty, argtys, args, env=None)

Call the Numba-compiled callee, using the same calling convention as in get_function_type().

declare_function(module, fndesc)

Override parent to handle get_env_argument

dynamic_map_function(func)
finalize(func, fndesc)

Finalize the compilation. Called by get_executable().

  • Rewrite intrinsics
  • Fix div & rem instructions on 32bit platform
  • Optimize python API calls
get_abi_sizeof(lty)
get_arguments(func)

Override parent to handle enviroment argument Get the Python-level arguments of LLVM func. See get_function_type() for the calling convention.

get_env_argument(func)

Get the environment argument of LLVM func (which can be a declaration).

get_env_body(builder, envptr)

From the given envptr (a pointer to a _dynfunc.Environment object), get a EnvBody allowing structured access to environment fields.

get_env_from_closure(builder, clo)

From the pointer clo to a _dynfunc.Closure, get a pointer to the enclosed _dynfunc.Environment.

get_executable(func, fndesc, env)

(cfunc, fnptr)

  • cfunc

    callable function (Can be None)

  • fnptr

    callable function address

  • env

    an execution environment (from _dynfunc)

get_function_type(fndesc)

Get the implemented Function type for the high-level fndesc. Some parameters can be added or shuffled around. This is kept in sync with call_function() and get_arguments().

(Same return value convention as BaseContext target.) Returns: -2 for return none in native function;

-1 for failure with python exception set;
0 for success;

>0 for user error code.

Return value is passed by reference as the first argument.

The 2nd argument is a _dynfunc.Environment object. It MUST NOT be used if the function is in nopython mode.

Actual arguments starts at the 3rd argument position. Caller is responsible to allocate space for return value.

init()
map_math_functions()
map_numpy_math_functions()
optimize(module)
optimize_function(func)

Run O1 function passes

optimize_pythonapi(func)
prepare_for_call(func, fndesc, env)
remove_native_function(func)

Remove internal references to nonpython mode function func. KeyError is raised if the function isn’t known to us.

class numba.targets.cpu.CPUTargetOptions

Bases: numba.targets.options.TargetOptions

OPTIONS = {'forceobj': <type 'bool'>, 'boundcheck': <type 'bool'>, 'nopython': <type 'bool'>, 'looplift': <type 'bool'>, 'wraparound': <type 'bool'>}
class numba.targets.cpu.ClosureBody(context, builder, value=None, ref=None, cast_ref=False)

Bases: numba.cgutils.Structure

class numba.targets.cpu.EnvBody(context, builder, value=None, ref=None, cast_ref=False)

Bases: numba.cgutils.Structure

numba.targets.cpu.remove_null_refct_call(bb)

Remove refct api calls to NULL pointer

numba.targets.cpu.remove_refct_calls(func)

Remove redundant incref/decref within on a per block basis

numba.targets.cpu.remove_refct_pairs(bb)

Remove incref decref pairs on the same variable

numba.targets.descriptors module

Target Descriptors

class numba.targets.descriptors.TargetDescriptor

Bases: object

numba.targets.imputils module

Utilities to simplify the boilerplate for native lowering.

class numba.targets.imputils.Registry

Bases: object

register(item)
register_attr(item)
numba.targets.imputils.call_getiter(context, builder, iterable_type, val)

Call the getiter() implementation for the given iterable_type of value val, and return the corresponding LLVM inst.

numba.targets.imputils.call_iternext(context, builder, iterator_type, val)

Call the iternext() implementation for the given iterator_type of value val, and return a convenience _IternextResult() object reflecting the results.

numba.targets.imputils.impl_attribute(ty, attr, rtype=None)
numba.targets.imputils.impl_attribute_generic(ty)
numba.targets.imputils.implement(func, *argtys)
numba.targets.imputils.iterator_impl(iterable_type, iterator_type)

Decorator a given class as implementing iterator_type (by providing an iternext() method).

numba.targets.imputils.iternext_impl(func)

Wrap the given iternext() implementation so that it gets passed an _IternextResult() object easing the returning of the iternext() result pair.

The wrapped function will be called with the following signature:
(context, builder, sig, args, iternext_result)
numba.targets.imputils.python_attr_impl(cls, attr, atyp)
numba.targets.imputils.user_function(func, fndesc, libs)

numba.targets.intrinsics module

LLVM pass that converts intrinsic into other math calls

class numba.targets.intrinsics.DivmodFixer

Bases: object

Fix 64-bit div/mod on 32-bit machines

I64 = <llvm.core.IntegerType object at 0x105a95350>
NAMES = ('sdiv', 'udiv', 'srem', 'urem')
declare(module, fname)
run(module)
run_on_func(func)
class numba.targets.intrinsics.IntrinsicMapping(context, mapping=None, availintr=None)

Bases: object

apply_mapping(module)
run(module)
translate_intrinsic_to_cmath(module)
numba.targets.intrinsics.powi_as_pow(context, fn)

numba.targets.iterators module

Implementation of various iterable and iterator types.

numba.targets.iterators.iterator_getiter(context, builder, sig, args)
numba.targets.iterators.make_enumerate_cls(enum_type)

Return the Structure representation of the given enum_type (an instance of types.EnumerateType).

numba.targets.iterators.make_enumerate_object(context, builder, sig, args)
numba.targets.iterators.make_zip_cls(zip_type)

Return the Structure representation of the given zip_type (an instance of types.ZipType).

numba.targets.iterators.make_zip_object(context, builder, sig, args)

numba.targets.mathimpl module

Provide math calls that uses intrinsics or libc math functions.

numba.targets.mathimpl.atan2_f32_impl(context, builder, sig, args)
numba.targets.mathimpl.atan2_f64_impl(context, builder, sig, args)
numba.targets.mathimpl.atan2_s64_impl(context, builder, sig, args)
numba.targets.mathimpl.atan2_u64_impl(context, builder, sig, args)
numba.targets.mathimpl.copysign_f32_impl(context, builder, sig, args)
numba.targets.mathimpl.copysign_f64_impl(context, builder, sig, args)
numba.targets.mathimpl.degrees_f32_impl(context, builder, sig, args)
numba.targets.mathimpl.degrees_f64_impl(context, builder, sig, args)
numba.targets.mathimpl.f32_as_int32(builder, val)

Bitcast a float into a 32-bit integer.

numba.targets.mathimpl.f64_as_int64(builder, val)

Bitcast a double into a 64-bit integer.

numba.targets.mathimpl.hypot_float_impl(context, builder, sig, args)
numba.targets.mathimpl.hypot_s64_impl(context, builder, sig, args)
numba.targets.mathimpl.hypot_u64_impl(context, builder, sig, args)
numba.targets.mathimpl.int32_as_f32(builder, val)

Bitcast a 32-bit integer into a float.

numba.targets.mathimpl.int64_as_f64(builder, val)

Bitcast a 64-bit integer into a double.

numba.targets.mathimpl.is_finite(builder, val)

Return a condition testing whether val is a finite.

numba.targets.mathimpl.is_inf(builder, val)

Return a condition testing whether val is an infinite.

numba.targets.mathimpl.is_nan(builder, val)

Return a condition testing whether val is a NaN.

numba.targets.mathimpl.isinf_float_impl(context, builder, sig, args)
numba.targets.mathimpl.isinf_int_impl(context, builder, sig, args)
numba.targets.mathimpl.isnan_float_impl(context, builder, sig, args)
numba.targets.mathimpl.isnan_int_impl(context, builder, sig, args)
numba.targets.mathimpl.negate_real(builder, val)

Negate real number val, with proper handling of zeros.

numba.targets.mathimpl.radians_f32_impl(context, builder, sig, args)
numba.targets.mathimpl.radians_f64_impl(context, builder, sig, args)
numba.targets.mathimpl.unary_math_extern(fn, f32extern, f64extern, int_restype=False)

Register implementations of Python function fn using the external function named f32extern and f64extern (for float32 and float64 inputs, respectively). If int_restype is true, then the function’s return value should be integral, otherwise floating-point.

numba.targets.mathimpl.unary_math_int_impl(fn, f64impl)
numba.targets.mathimpl.unary_math_intr(fn, intrcode)

numba.targets.npdatetime module

Implementation of operations on numpy timedelta64.

numba.targets.npdatetime.add_constant(builder, val, const)

Add constant const to val.

numba.targets.npdatetime.alloc_boolean_result(builder, name='ret')

Allocate an uninitialized boolean result slot.

numba.targets.npdatetime.alloc_timedelta_result(builder, name='ret')

Allocate a NaT-initialized datetime64 (or timedelta64) result slot.

numba.targets.npdatetime.are_not_nat(builder, vals)

Return a predicate which is true if all of vals are not NaT.

numba.targets.npdatetime.convert_datetime_for_arith(builder, dt_val, src_unit, dest_unit)

Convert datetime dt_val from src_unit to dest_unit.

numba.targets.npdatetime.datetime_eq_datetime_impl(context, builder, sig, args)
numba.targets.npdatetime.datetime_ge_datetime_impl(context, builder, sig, args)
numba.targets.npdatetime.datetime_gt_datetime_impl(context, builder, sig, args)
numba.targets.npdatetime.datetime_le_datetime_impl(context, builder, sig, args)
numba.targets.npdatetime.datetime_lt_datetime_impl(context, builder, sig, args)
numba.targets.npdatetime.datetime_max_impl(context, builder, sig, args)
numba.targets.npdatetime.datetime_min_impl(context, builder, sig, args)
numba.targets.npdatetime.datetime_minus_datetime(context, builder, sig, args)
numba.targets.npdatetime.datetime_minus_timedelta(context, builder, sig, args)
numba.targets.npdatetime.datetime_ne_datetime_impl(context, builder, sig, args)
numba.targets.npdatetime.datetime_plus_timedelta(context, builder, sig, args)
numba.targets.npdatetime.func(context, builder, sig, args)
numba.targets.npdatetime.is_leap_year(builder, year_val)

Return a predicate indicating whether year_val (offset by 1970) is a leap year.

numba.targets.npdatetime.is_not_nat(builder, val)

Return a predicate which is true if val is not NaT.

numba.targets.npdatetime.llvm_datetime_type(context, tp)
numba.targets.npdatetime.llvm_timedelta_type(context, tp)
numba.targets.npdatetime.make_constant_array(vals)
numba.targets.npdatetime.normalize_timedeltas(context, builder, left, right, leftty, rightty)

Scale either left or right to the other’s unit, in order to have homogenous units.

numba.targets.npdatetime.number_times_timedelta(context, builder, sig, args)
numba.targets.npdatetime.reduce_datetime_for_unit(builder, dt_val, src_unit, dest_unit)
numba.targets.npdatetime.scale_by_constant(builder, val, factor)

Multiply val by the constant factor.

numba.targets.npdatetime.scale_timedelta(context, builder, val, srcty, destty)

Scale the timedelta64 val from srcty to destty (both numba.types.NPTimedelta instances)

numba.targets.npdatetime.timedelta_abs_impl(context, builder, sig, args)
numba.targets.npdatetime.timedelta_add_impl(context, builder, sig, args)
numba.targets.npdatetime.timedelta_eq_timedelta_impl(context, builder, sig, args)
numba.targets.npdatetime.timedelta_ge_timedelta_impl(context, builder, sig, args)
numba.targets.npdatetime.timedelta_gt_timedelta_impl(context, builder, sig, args)
numba.targets.npdatetime.timedelta_le_timedelta_impl(context, builder, sig, args)
numba.targets.npdatetime.timedelta_lt_timedelta_impl(context, builder, sig, args)
numba.targets.npdatetime.timedelta_max_impl(context, builder, sig, args)
numba.targets.npdatetime.timedelta_min_impl(context, builder, sig, args)
numba.targets.npdatetime.timedelta_ne_timedelta_impl(context, builder, sig, args)
numba.targets.npdatetime.timedelta_neg_impl(context, builder, sig, args)
numba.targets.npdatetime.timedelta_over_number(context, builder, sig, args)
numba.targets.npdatetime.timedelta_over_timedelta(context, builder, sig, args)
numba.targets.npdatetime.timedelta_plus_datetime(context, builder, sig, args)
numba.targets.npdatetime.timedelta_pos_impl(context, builder, sig, args)
numba.targets.npdatetime.timedelta_sign_impl(context, builder, sig, args)
numba.targets.npdatetime.timedelta_sub_impl(context, builder, sig, args)
numba.targets.npdatetime.timedelta_times_number(context, builder, sig, args)
numba.targets.npdatetime.unscale_by_constant(builder, val, factor)

Divide val by the constant factor.

numba.targets.npdatetime.year_to_days(builder, year_val)

Given a year year_val (offset to 1970), return the number of days since the 1970 epoch.

numba.targets.npyfuncs module

Codegen for functions used as kernels in NumPy functions

Typically, the kernels of several ufuncs that can’t map directly to Python builtins

numba.targets.npyfuncs.np_complex_acos_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_acosh_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_asin_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_asinh_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_atan_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_atanh_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_conjugate_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_cos_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_cosh_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_div_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_eq_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_exp2_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_exp_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_expm1_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_floor_div_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_fmax_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_fmin_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_ge_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_gt_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_isfinite_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_isinf_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_isnan_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_le_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_log10_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_log1p_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_log2_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_log_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_logical_and_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_logical_not_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_logical_or_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_logical_xor_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_lt_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_maximum_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_minimum_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_ne_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_power_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_reciprocal_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_rint_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_sign_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_sin_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_sinh_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_sqrt_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_square_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_tan_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_complex_tanh_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_dummy_return_arg(context, builder, sig, args)
numba.targets.npyfuncs.np_int_fmod_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_int_power_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_int_reciprocal_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_int_sdiv_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_int_smax_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_int_smin_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_int_square_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_int_srem_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_int_truediv_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_int_udiv_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_int_umax_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_int_umin_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_int_urem_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_logical_and_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_logical_not_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_logical_or_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_logical_xor_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_acos_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_acosh_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_asin_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_asinh_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_atan2_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_atan_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_atanh_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_ceil_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_copysign_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_cos_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_cosh_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_deg2rad_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_div_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_exp2_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_exp_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_expm1_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_fabs_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_floor_div_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_floor_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_fmax_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_fmin_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_fmod_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_hypot_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_isfinite_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_isinf_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_isnan_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_ldexp_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_log10_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_log1p_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_log2_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_log_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_logaddexp2_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_logaddexp_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_maximum_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_minimum_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_mod_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_nextafter_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_power_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_rad2deg_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_reciprocal_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_rint_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_signbit_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_sin_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_sinh_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_spacing_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_sqrt_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_square_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_tan_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_tanh_impl(context, builder, sig, args)
numba.targets.npyfuncs.np_real_trunc_impl(context, builder, sig, args)

numba.targets.npyimpl module

class numba.targets.npyimpl.npy

This will be used as an index of the npy_* functions

numba.targets.npyimpl.numpy_ufunc_kernel(context, builder, sig, args, kernel_class, explicit_output=True)
numba.targets.npyimpl.register_binary_ufunc_kernel(ufunc, kernel)
numba.targets.npyimpl.register_unary_ufunc_kernel(ufunc, kernel)

numba.targets.operatorimpl module

Definition of implementations for the operator module.

numba.targets.optional module

numba.targets.optional.always_return_false_impl(context, builder, sig, args)
numba.targets.optional.always_return_true_impl(context, builder, sig, args)
numba.targets.optional.make_optional(valtype)

Return the Structure representation of a optional value

numba.targets.options module

Target Options

class numba.targets.options.TargetOptions

Bases: object

OPTIONS = {}
from_dict(dic)
classmethod parse_as_flags(flags, options)
set_flags(flags)

Provide default flags setting logic. Subclass can override.

numba.targets.printimpl module

This file implements print functionality for the CPU.

numba.targets.printimpl.int_print_impl(context, builder, sig, args)
numba.targets.printimpl.print_charseq(context, builder, sig, args)
numba.targets.printimpl.print_varargs(context, builder, sig, args)
numba.targets.printimpl.real_print_impl(context, builder, sig, args)

numba.targets.rangeobj module

Implementation of the range object for fixed-size integers.

numba.targets.rangeobj.make_range_impl(range_state_type, range_iter_type, int_type)
numba.targets.rangeobj.make_range_iterator(typ)

Return the Structure representation of the given typ (an instance of types.RangeIteratorType).

numba.targets.registry module

class numba.targets.registry.CPUOverloaded(py_func, locals={}, targetoptions={})

Bases: numba.dispatcher.Overloaded

targetdescr = <numba.targets.registry.CPUTarget object at 0x1063daed0>
class numba.targets.registry.CPUTarget

Bases: numba.targets.descriptors.TargetDescriptor

options

alias of CPUTargetOptions

target_context = <numba.targets.cpu.CPUContext object at 0x1063cd290>
typing_context = <numba.typing.context.Context object at 0x1063cd250>
class numba.targets.registry.TargetRegistry(*args, **kws)

Bases: numba.utils.UniqueDict

ondemand:

A dictionary of target-name -> function, where function is executed the first time a target is used. It is used for deferred initialization for some targets (e.g. gpu).

numba.targets.ufunc_db module

This file contains information on how to translate different ufuncs into numba. It is a database of different ufuncs and how each of its loops maps to a function that implements the inner kernel of that ufunc (the inner kernel being the per-element function).

Use the function get_ufunc_info to get the information related to the ufunc

numba.targets.ufunc_db.get_ufunc_info(ufunc_key)

get the lowering information for the ufunc with key ufunc_key.

The lowering information is a dictionary that maps from a numpy loop string (as given by the ufunc types attribute) to a function that handles code generation for a scalar version of the ufunc (that is, generates the “per element” operation”).

raises a KeyError if the ufunc is not in the ufunc_db

numba.targets.ufunc_db.get_ufuncs()

obtain a list of supported ufuncs in the db

Module contents