コード例 #1
0
import math
from numba.core import types
from numba.core.typing.templates import ConcreteTemplate, signature, Registry


registry = Registry()
infer_global = registry.register_global


@infer_global(math.acos)
@infer_global(math.acosh)
@infer_global(math.asin)
@infer_global(math.asinh)
@infer_global(math.atan)
@infer_global(math.atanh)
@infer_global(math.ceil)
@infer_global(math.cos)
@infer_global(math.cosh)
@infer_global(math.degrees)
@infer_global(math.erf)
@infer_global(math.erfc)
@infer_global(math.exp)
@infer_global(math.expm1)
@infer_global(math.fabs)
@infer_global(math.floor)
@infer_global(math.gamma)
@infer_global(math.lgamma)
@infer_global(math.log)
@infer_global(math.log2)
@infer_global(math.log10)
@infer_global(math.log1p)
コード例 #2
0
ファイル: mathimpl.py プロジェクト: angelisamaria/rbc
import math
from rbc.externals import gen_codegen, dispatch_codegen
from numba.core import imputils
from numba.core.typing.templates import ConcreteTemplate, signature, Registry
from numba.types import float32, float64, int32, int64, uint64, intp


# Typing
typing_registry = Registry()
infer_global = typing_registry.register_global

# Adding missing cases in Numba
@infer_global(math.log2)  # noqa: E302
class Math_unary(ConcreteTemplate):
    cases = [
        signature(float64, int64),
        signature(float64, uint64),
        signature(float32, float32),
        signature(float64, float64),
    ]


@infer_global(math.remainder)
class Math_remainder(ConcreteTemplate):
    cases = [
        signature(float32, float32, float32),
        signature(float64, float64, float64),
    ]


@infer_global(math.floor)