Esempio n. 1
0
int64 = ''
uint64 = ''
for code in 'bhilq':
    if struct.calcsize(code) == 8:
        int64 = code
        uint64 = english_upper(code)
        break

# This dictionary describes all the ufunc implementations, generating
# all the function names and their corresponding ufunc signatures.  TD is
# an object which expands a list of character codes into an array of
# TypeDescriptions.
defdict = {
'add' :
    Ufunc(2, 1, Zero,
          docstrings.get('numpy.core.umath.add'),
          'PyUFunc_AdditionTypeResolver',
          TD(notimes_or_obj),
          [TypeDescription('M', FullTypeDescr, 'Mm', 'M'),
           TypeDescription('m', FullTypeDescr, 'mm', 'm'),
           TypeDescription('M', FullTypeDescr, 'mM', 'M'),
          ],
          TD(O, f='PyNumber_Add'),
          ),
'subtract' :
    Ufunc(2, 1, None, # Zero is only a unit to the right, not the left
          docstrings.get('numpy.core.umath.subtract'),
          'PyUFunc_SubtractionTypeResolver',
          TD(notimes_or_obj),
          [TypeDescription('M', FullTypeDescr, 'Mm', 'M'),
           TypeDescription('m', FullTypeDescr, 'mm', 'm'),
nocmplx = bints + flts
nocmplxO = nocmplx + O
nocmplxP = nocmplx + P
notimes_or_obj = bints + inexact

# Find which code corresponds to int64.
int64 = ""
uint64 = ""
for code in "bhilq":
    if struct.calcsize(code) == 8:
        int64 = code
        uint64 = english_upper(code)
        break

defdict = {
    "add": Ufunc(2, 1, Zero, docstrings.get("numpy.core.umath.add"), TD(notimes_or_obj), TD(O, f="PyNumber_Add")),
    "subtract": Ufunc(
        2, 1, Zero, docstrings.get("numpy.core.umath.subtract"), TD(notimes_or_obj), TD(O, f="PyNumber_Subtract")
    ),
    "multiply": Ufunc(
        2, 1, One, docstrings.get("numpy.core.umath.multiply"), TD(notimes_or_obj), TD(O, f="PyNumber_Multiply")
    ),
    "divide": Ufunc(2, 1, One, docstrings.get("numpy.core.umath.divide"), TD(intfltcmplx), TD(O, f="PyNumber_Divide")),
    "floor_divide": Ufunc(
        2, 1, One, docstrings.get("numpy.core.umath.floor_divide"), TD(intfltcmplx), TD(O, f="PyNumber_FloorDivide")
    ),
    "true_divide": Ufunc(
        2,
        1,
        One,
        docstrings.get("numpy.core.umath.true_divide"),
Esempio n. 3
0
    if struct.calcsize(code) == 8:
        int64 = code
        uint64 = english_upper(code)
        break

# This dictionary describes all the ufunc implementations, generating
# all the function names and their corresponding ufunc signatures.  TD is
# an object which expands a list of character codes into an array of
# TypeDescriptions.
defdict = {
    'add':
    Ufunc(
        2,
        1,
        Zero,
        docstrings.get('numpy.core.umath.add'),
        'PyUFunc_AdditionTypeResolver',
        TD(notimes_or_obj, simd=[('avx2', ints)]),
        [
            TypeDescription('M', FullTypeDescr, 'Mm', 'M'),
            TypeDescription('m', FullTypeDescr, 'mm', 'm'),
            TypeDescription('M', FullTypeDescr, 'mM', 'M'),
        ],
        TD(O, f='PyNumber_Add'),
    ),
    'subtract':
    Ufunc(
        2,
        1,
        None,  # Zero is only a unit to the right, not the left
        docstrings.get('numpy.core.umath.subtract'),
Esempio n. 4
0
for code in "bhilq":
    if struct.calcsize(code) == 8:
        int64 = code
        uint64 = english_upper(code)
        break

# This dictionary describes all the ufunc implementations, generating
# all the function names and their corresponding ufunc signatures.  TD is
# an object which expands a list of character codes into an array of
# TypeDescriptions.
defdict = {
    "add": Ufunc(
        2,
        1,
        Zero,
        docstrings.get("numpy.core.umath.add"),
        "PyUFunc_AdditionTypeResolver",
        TD(notimes_or_obj),
        [
            TypeDescription("M", FullTypeDescr, "Mm", "M"),
            TypeDescription("m", FullTypeDescr, "mm", "m"),
            TypeDescription("M", FullTypeDescr, "mM", "M"),
        ],
        TD(O, f="PyNumber_Add"),
    ),
    "subtract": Ufunc(
        2,
        1,
        None,  # Zero is only a unit to the right, not the left
        docstrings.get("numpy.core.umath.subtract"),
        "PyUFunc_SubtractionTypeResolver",