diff options
author | Mark Wiebe <mwwiebe@gmail.com> | 2010-11-27 16:45:12 -0800 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2010-12-01 20:02:16 -0700 |
commit | c6f8dbbd240ada8d0edd0527cd218cfc46deec41 (patch) | |
tree | 39b447663a83c021c34b8cdf32a3644e1bfe9ebc | |
parent | 9b72aa96cec9d182062f378fca869aaa303f1ca9 (diff) | |
download | numpy-c6f8dbbd240ada8d0edd0527cd218cfc46deec41.tar.gz |
ENH: Rename the half character code from 'j' to 'e'
-rw-r--r-- | doc/source/reference/arrays.scalars.rst | 2 | ||||
-rw-r--r-- | doc/source/reference/c-api.ufunc.rst | 14 | ||||
-rw-r--r-- | doc/source/reference/ufuncs.rst | 4 | ||||
-rw-r--r-- | numpy/core/code_generators/generate_umath.py | 82 | ||||
-rw-r--r-- | numpy/core/code_generators/numpy_api.py | 12 | ||||
-rw-r--r-- | numpy/core/include/numpy/ndarraytypes.h | 2 | ||||
-rw-r--r-- | numpy/core/numerictypes.py | 6 | ||||
-rw-r--r-- | numpy/core/src/umath/loops.c.src | 12 |
8 files changed, 67 insertions, 67 deletions
diff --git a/doc/source/reference/arrays.scalars.rst b/doc/source/reference/arrays.scalars.rst index 001227af4..0d5d3f59e 100644 --- a/doc/source/reference/arrays.scalars.rst +++ b/doc/source/reference/arrays.scalars.rst @@ -138,7 +138,7 @@ Unsigned integers: Floating-point numbers: =================== ============================= =============== -:class:`half` ``'j'`` +:class:`half` ``'e'`` :class:`single` compatible: C float ``'f'`` :class:`double` compatible: C double :class:`float_` compatible: Python float ``'d'`` diff --git a/doc/source/reference/c-api.ufunc.rst b/doc/source/reference/c-api.ufunc.rst index 27977de99..f299251cb 100644 --- a/doc/source/reference/c-api.ufunc.rst +++ b/doc/source/reference/c-api.ufunc.rst @@ -234,20 +234,20 @@ structure. .. cfunction:: void PyUFunc_G_G(char** args, npy_intp* dimensions, npy_intp* steps, void* func) -.. cfunction:: void PyUFunc_j_j(char** args, npy_intp* dimensions, +.. cfunction:: void PyUFunc_e_e(char** args, npy_intp* dimensions, npy_intp* steps, void* func) -.. cfunction:: void PyUFunc_j_j_As_f_f(char** args, npy_intp* dimensions, +.. cfunction:: void PyUFunc_e_e_As_f_f(char** args, npy_intp* dimensions, npy_intp* steps, void* func) -.. cfunction:: void PyUFunc_j_j_As_d_d(char** args, npy_intp* dimensions, +.. cfunction:: void PyUFunc_e_e_As_d_d(char** args, npy_intp* dimensions, npy_intp* steps, void* func) Type specific, core 1-d functions for ufuncs where each calculation is obtained by calling a function taking one input argument and returning one output. This function is passed in ``func``. The letters correspond to dtypechar's of the supported - data types ( ``j`` - half, ``f`` - float, ``d`` - double, + data types ( ``e`` - half, ``f`` - float, ``d`` - double, ``g`` - long double, ``F`` - cfloat, ``D`` - cdouble, ``G`` - clongdouble). The argument *func* must support the same signature. The _As_X_X variants assume ndarray's of one data type @@ -280,13 +280,13 @@ structure. .. cfunction:: void PyUFunc_GG_G(char** args, npy_intp* dimensions, npy_intp* steps, void* func) -.. cfunction:: void PyUFunc_jj_j(char** args, npy_intp* dimensions, +.. cfunction:: void PyUFunc_ee_e(char** args, npy_intp* dimensions, npy_intp* steps, void* func) -.. cfunction:: void PyUFunc_jj_j_As_ff_f(char** args, npy_intp* dimensions, +.. cfunction:: void PyUFunc_ee_e_As_ff_f(char** args, npy_intp* dimensions, npy_intp* steps, void* func) -.. cfunction:: void PyUFunc_jj_j_As_dd_d(char** args, npy_intp* dimensions, +.. cfunction:: void PyUFunc_ee_e_As_dd_d(char** args, npy_intp* dimensions, npy_intp* steps, void* func) Type specific, core 1-d functions for ufuncs where each diff --git a/doc/source/reference/ufuncs.rst b/doc/source/reference/ufuncs.rst index 680232a36..dedbf2929 100644 --- a/doc/source/reference/ufuncs.rst +++ b/doc/source/reference/ufuncs.rst @@ -224,7 +224,7 @@ can generate this table for your system with the code given in the Figure. ... print int(np.can_cast(row, col)), ... print >>> print_table(np.typecodes['All']) - X ? b h i l q p B H I L Q P j f d g F D G S U V O M m + X ? b h i l q p B H I L Q P e f d g F D G S U V O M m ? 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 b 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 h 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 @@ -238,7 +238,7 @@ can generate this table for your system with the code given in the Figure. L 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 0 1 1 1 1 1 1 0 0 Q 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 0 1 1 1 1 1 1 0 0 P 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 0 1 1 1 1 1 1 0 0 - j 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 + e 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 f 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 d 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 1 1 1 1 0 0 g 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1 1 1 0 0 diff --git a/numpy/core/code_generators/generate_umath.py b/numpy/core/code_generators/generate_umath.py index 905a3e27f..9382b1fae 100644 --- a/numpy/core/code_generators/generate_umath.py +++ b/numpy/core/code_generators/generate_umath.py @@ -57,7 +57,7 @@ class TypeDescription(object): assert len(self.out) == nout self.astype = self.astype_dict.get(self.type, None) -_fdata_map = dict(j='npy_%sf', f='npy_%sf', d='npy_%s', g='npy_%sl', +_fdata_map = dict(e='npy_%sf', f='npy_%sf', d='npy_%s', g='npy_%sl', F='nc_%sf', D='nc_%s', G='nc_%sl') def build_func_data(types, f): func_data = [] @@ -173,7 +173,7 @@ chartoname = {'?': 'bool', 'L': 'ulong', 'q': 'longlong', 'Q': 'ulonglong', - 'j': 'half', + 'e': 'half', 'f': 'float', 'd': 'double', 'g': 'longdouble', @@ -188,7 +188,7 @@ chartoname = {'?': 'bool', 'P': 'OBJECT', } -all = '?bBhHiIlLqQjfdgFDGOMm' +all = '?bBhHiIlLqQefdgFDGOMm' O = 'O' P = 'P' ints = 'bBhHiIlLqQ' @@ -196,7 +196,7 @@ times = 'Mm' intsO = ints + O bints = '?' + ints bintsO = bints + O -flts = 'jfdg' +flts = 'efdg' fltsO = flts + O fltsP = flts + P cmplx = 'FDG' @@ -286,7 +286,7 @@ defdict = { Ufunc(2, 1, Zero, docstrings.get('numpy.core.umath.fmod'), TD(ints), - TD(flts, f='fmod', astype={'j':'f'}), + TD(flts, f='fmod', astype={'e':'f'}), TD(P, f='fmod'), ), 'square' : @@ -311,7 +311,7 @@ defdict = { Ufunc(2, 1, One, docstrings.get('numpy.core.umath.power'), TD(ints), - TD(inexact, f='pow', astype={'j':'f'}), + TD(inexact, f='pow', astype={'e':'f'}), TD(O, f='npy_ObjectPower'), ), 'absolute' : @@ -419,12 +419,12 @@ defdict = { 'logaddexp' : Ufunc(2, 1, None, docstrings.get('numpy.core.umath.logaddexp'), - TD(flts, f="logaddexp", astype={'j':'f'}) + TD(flts, f="logaddexp", astype={'e':'f'}) ), 'logaddexp2' : Ufunc(2, 1, None, docstrings.get('numpy.core.umath.logaddexp2'), - TD(flts, f="logaddexp2", astype={'j':'f'}) + TD(flts, f="logaddexp2", astype={'e':'f'}) ), # FIXME: decide if the times should have the bitwise operations. 'bitwise_and' : @@ -466,177 +466,177 @@ defdict = { 'degrees' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.degrees'), - TD(fltsP, f='degrees', astype={'j':'f'}), + TD(fltsP, f='degrees', astype={'e':'f'}), ), 'rad2deg' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.rad2deg'), - TD(fltsP, f='rad2deg', astype={'j':'f'}), + TD(fltsP, f='rad2deg', astype={'e':'f'}), ), 'radians' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.radians'), - TD(fltsP, f='radians', astype={'j':'f'}), + TD(fltsP, f='radians', astype={'e':'f'}), ), 'deg2rad' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.deg2rad'), - TD(fltsP, f='deg2rad', astype={'j':'f'}), + TD(fltsP, f='deg2rad', astype={'e':'f'}), ), 'arccos' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.arccos'), - TD(inexact, f='acos', astype={'j':'f'}), + TD(inexact, f='acos', astype={'e':'f'}), TD(P, f='arccos'), ), 'arccosh' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.arccosh'), - TD(inexact, f='acosh', astype={'j':'f'}), + TD(inexact, f='acosh', astype={'e':'f'}), TD(P, f='arccosh'), ), 'arcsin' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.arcsin'), - TD(inexact, f='asin', astype={'j':'f'}), + TD(inexact, f='asin', astype={'e':'f'}), TD(P, f='arcsin'), ), 'arcsinh' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.arcsinh'), - TD(inexact, f='asinh', astype={'j':'f'}), + TD(inexact, f='asinh', astype={'e':'f'}), TD(P, f='arcsinh'), ), 'arctan' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.arctan'), - TD(inexact, f='atan', astype={'j':'f'}), + TD(inexact, f='atan', astype={'e':'f'}), TD(P, f='arctan'), ), 'arctanh' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.arctanh'), - TD(inexact, f='atanh', astype={'j':'f'}), + TD(inexact, f='atanh', astype={'e':'f'}), TD(P, f='arctanh'), ), 'cos' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.cos'), - TD(inexact, f='cos', astype={'j':'f'}), + TD(inexact, f='cos', astype={'e':'f'}), TD(P, f='cos'), ), 'sin' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.sin'), - TD(inexact, f='sin', astype={'j':'f'}), + TD(inexact, f='sin', astype={'e':'f'}), TD(P, f='sin'), ), 'tan' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.tan'), - TD(inexact, f='tan', astype={'j':'f'}), + TD(inexact, f='tan', astype={'e':'f'}), TD(P, f='tan'), ), 'cosh' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.cosh'), - TD(inexact, f='cosh', astype={'j':'f'}), + TD(inexact, f='cosh', astype={'e':'f'}), TD(P, f='cosh'), ), 'sinh' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.sinh'), - TD(inexact, f='sinh', astype={'j':'f'}), + TD(inexact, f='sinh', astype={'e':'f'}), TD(P, f='sinh'), ), 'tanh' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.tanh'), - TD(inexact, f='tanh', astype={'j':'f'}), + TD(inexact, f='tanh', astype={'e':'f'}), TD(P, f='tanh'), ), 'exp' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.exp'), - TD(inexact, f='exp', astype={'j':'f'}), + TD(inexact, f='exp', astype={'e':'f'}), TD(P, f='exp'), ), 'exp2' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.exp2'), - TD(inexact, f='exp2', astype={'j':'f'}), + TD(inexact, f='exp2', astype={'e':'f'}), TD(P, f='exp2'), ), 'expm1' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.expm1'), - TD(inexact, f='expm1', astype={'j':'f'}), + TD(inexact, f='expm1', astype={'e':'f'}), TD(P, f='expm1'), ), 'log' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.log'), - TD(inexact, f='log', astype={'j':'f'}), + TD(inexact, f='log', astype={'e':'f'}), TD(P, f='log'), ), 'log2' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.log2'), - TD(inexact, f='log2', astype={'j':'f'}), + TD(inexact, f='log2', astype={'e':'f'}), TD(P, f='log2'), ), 'log10' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.log10'), - TD(inexact, f='log10', astype={'j':'f'}), + TD(inexact, f='log10', astype={'e':'f'}), TD(P, f='log10'), ), 'log1p' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.log1p'), - TD(inexact, f='log1p', astype={'j':'f'}), + TD(inexact, f='log1p', astype={'e':'f'}), TD(P, f='log1p'), ), 'sqrt' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.sqrt'), - TD(inexact, f='sqrt', astype={'j':'f'}), + TD(inexact, f='sqrt', astype={'e':'f'}), TD(P, f='sqrt'), ), 'ceil' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.ceil'), - TD(flts, f='ceil', astype={'j':'f'}), + TD(flts, f='ceil', astype={'e':'f'}), TD(P, f='ceil'), ), 'trunc' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.trunc'), - TD(flts, f='trunc', astype={'j':'f'}), + TD(flts, f='trunc', astype={'e':'f'}), TD(P, f='trunc'), ), 'fabs' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.fabs'), - TD(flts, f='fabs', astype={'j':'f'}), + TD(flts, f='fabs', astype={'e':'f'}), TD(P, f='fabs'), ), 'floor' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.floor'), - TD(flts, f='floor', astype={'j':'f'}), + TD(flts, f='floor', astype={'e':'f'}), TD(P, f='floor'), ), 'rint' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.rint'), - TD(inexact, f='rint', astype={'j':'f'}), + TD(inexact, f='rint', astype={'e':'f'}), TD(P, f='rint'), ), 'arctan2' : Ufunc(2, 1, None, docstrings.get('numpy.core.umath.arctan2'), - TD(flts, f='atan2', astype={'j':'f'}), + TD(flts, f='atan2', astype={'e':'f'}), TD(P, f='arctan2'), ), 'remainder' : @@ -648,7 +648,7 @@ defdict = { 'hypot' : Ufunc(2, 1, None, docstrings.get('numpy.core.umath.hypot'), - TD(flts, f='hypot', astype={'j':'f'}), + TD(flts, f='hypot', astype={'e':'f'}), TD(P, f='hypot'), ), 'isnan' : @@ -704,7 +704,7 @@ def indent(st,spaces): indented = re.sub(r' +$',r'',indented) return indented -chartotype1 = {'j': 'j_j', +chartotype1 = {'e': 'e_e', 'f': 'f_f', 'd': 'd_d', 'g': 'g_g', @@ -714,7 +714,7 @@ chartotype1 = {'j': 'j_j', 'O': 'O_O', 'P': 'O_O_method'} -chartotype2 = {'j': 'jj_j', +chartotype2 = {'e': 'ee_e', 'f': 'ff_f', 'd': 'dd_d', 'g': 'gg_g', diff --git a/numpy/core/code_generators/numpy_api.py b/numpy/core/code_generators/numpy_api.py index 1356fda8f..9474a131a 100644 --- a/numpy/core/code_generators/numpy_api.py +++ b/numpy/core/code_generators/numpy_api.py @@ -291,12 +291,12 @@ ufunc_funcs_api = { 'PyUFunc_ReplaceLoopBySignature': 30, 'PyUFunc_FromFuncAndDataAndSignature': 31, 'PyUFunc_SetUsesArraysAsData': 32, - 'PyUFunc_j_j': 33, - 'PyUFunc_j_j_As_f_f': 34, - 'PyUFunc_j_j_As_d_d': 35, - 'PyUFunc_jj_j': 36, - 'PyUFunc_jj_j_As_ff_f': 37, - 'PyUFunc_jj_j_As_dd_d': 38, + 'PyUFunc_e_e': 33, + 'PyUFunc_e_e_As_f_f': 34, + 'PyUFunc_e_e_As_d_d': 35, + 'PyUFunc_ee_e': 36, + 'PyUFunc_ee_e_As_ff_f': 37, + 'PyUFunc_ee_e_As_dd_d': 38, } # List of all the dicts which define the C API diff --git a/numpy/core/include/numpy/ndarraytypes.h b/numpy/core/include/numpy/ndarraytypes.h index 3eaeb2c77..98d02287a 100644 --- a/numpy/core/include/numpy/ndarraytypes.h +++ b/numpy/core/include/numpy/ndarraytypes.h @@ -116,7 +116,7 @@ enum NPY_TYPECHAR { NPY_BOOLLTR = '?', NPY_ULONGLTR = 'L', NPY_LONGLONGLTR = 'q', NPY_ULONGLONGLTR = 'Q', - NPY_HALFLTR = 'j', + NPY_HALFLTR = 'e', NPY_FLOATLTR = 'f', NPY_DOUBLELTR = 'd', NPY_LONGDOUBLELTR = 'g', diff --git a/numpy/core/numerictypes.py b/numpy/core/numerictypes.py index 06d9458f3..4f16d2e3a 100644 --- a/numpy/core/numerictypes.py +++ b/numpy/core/numerictypes.py @@ -829,12 +829,12 @@ del key typecodes = {'Character':'c', 'Integer':'bhilqp', 'UnsignedInteger':'BHILQP', - 'Float':'jfdg', + 'Float':'efdg', 'Complex':'FDG', 'AllInteger':'bBhHiIlLqQpP', - 'AllFloat':'jfdgFDG', + 'AllFloat':'efdgFDG', 'Datetime': 'Mm', - 'All':'?bhilqpBHILQPjfdgFDGSUVOMm'} + 'All':'?bhilqpBHILQPefdgFDGSUVOMm'} # backwards compatibility --- deprecated name typeDict = sctypeDict diff --git a/numpy/core/src/umath/loops.c.src b/numpy/core/src/umath/loops.c.src index 023bac74b..0c777e464 100644 --- a/numpy/core/src/umath/loops.c.src +++ b/numpy/core/src/umath/loops.c.src @@ -94,7 +94,7 @@ typedef longdouble longdoubleBinaryFunc(longdouble x, longdouble y); /*UFUNC_API*/ NPY_NO_EXPORT void -PyUFunc_j_j(char **args, intp *dimensions, intp *steps, void *func) +PyUFunc_e_e(char **args, intp *dimensions, intp *steps, void *func) { halfUnaryFunc *f = (halfUnaryFunc *)func; UNARY_LOOP { @@ -105,7 +105,7 @@ PyUFunc_j_j(char **args, intp *dimensions, intp *steps, void *func) /*UFUNC_API*/ NPY_NO_EXPORT void -PyUFunc_j_j_As_f_f(char **args, intp *dimensions, intp *steps, void *func) +PyUFunc_e_e_As_f_f(char **args, intp *dimensions, intp *steps, void *func) { floatUnaryFunc *f = (floatUnaryFunc *)func; UNARY_LOOP { @@ -116,7 +116,7 @@ PyUFunc_j_j_As_f_f(char **args, intp *dimensions, intp *steps, void *func) /*UFUNC_API*/ NPY_NO_EXPORT void -PyUFunc_j_j_As_d_d(char **args, intp *dimensions, intp *steps, void *func) +PyUFunc_e_e_As_d_d(char **args, intp *dimensions, intp *steps, void *func) { doubleUnaryFunc *f = (doubleUnaryFunc *)func; UNARY_LOOP { @@ -149,7 +149,7 @@ PyUFunc_f_f_As_d_d(char **args, intp *dimensions, intp *steps, void *func) /*UFUNC_API*/ NPY_NO_EXPORT void -PyUFunc_jj_j(char **args, intp *dimensions, intp *steps, void *func) +PyUFunc_ee_e(char **args, intp *dimensions, intp *steps, void *func) { halfBinaryFunc *f = (halfBinaryFunc *)func; BINARY_LOOP { @@ -161,7 +161,7 @@ PyUFunc_jj_j(char **args, intp *dimensions, intp *steps, void *func) /*UFUNC_API*/ NPY_NO_EXPORT void -PyUFunc_jj_j_As_ff_f(char **args, intp *dimensions, intp *steps, void *func) +PyUFunc_ee_e_As_ff_f(char **args, intp *dimensions, intp *steps, void *func) { floatBinaryFunc *f = (floatBinaryFunc *)func; BINARY_LOOP { @@ -173,7 +173,7 @@ PyUFunc_jj_j_As_ff_f(char **args, intp *dimensions, intp *steps, void *func) /*UFUNC_API*/ NPY_NO_EXPORT void -PyUFunc_jj_j_As_dd_d(char **args, intp *dimensions, intp *steps, void *func) +PyUFunc_ee_e_As_dd_d(char **args, intp *dimensions, intp *steps, void *func) { doubleBinaryFunc *f = (doubleBinaryFunc *)func; BINARY_LOOP { |