Skip to content

Commit

Permalink
ENH: Rename the half character code from 'j' to 'e'
Browse files Browse the repository at this point in the history
  • Loading branch information
mwiebe authored and charris committed Dec 2, 2010
1 parent 9b72aa9 commit c6f8dbb
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 67 deletions.
2 changes: 1 addition & 1 deletion doc/source/reference/arrays.scalars.rst
Expand Up @@ -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'``
Expand Down
14 changes: 7 additions & 7 deletions doc/source/reference/c-api.ufunc.rst
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions doc/source/reference/ufuncs.rst
Expand Up @@ -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
Expand All @@ -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
Expand Down
82 changes: 41 additions & 41 deletions numpy/core/code_generators/generate_umath.py
Expand Up @@ -57,7 +57,7 @@ def finish_signature(self, nin, nout):
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 = []
Expand Down Expand Up @@ -173,7 +173,7 @@ def english_upper(s):
'L': 'ulong',
'q': 'longlong',
'Q': 'ulonglong',
'j': 'half',
'e': 'half',
'f': 'float',
'd': 'double',
'g': 'longdouble',
Expand All @@ -188,15 +188,15 @@ def english_upper(s):
'P': 'OBJECT',
}

all = '?bBhHiIlLqQjfdgFDGOMm'
all = '?bBhHiIlLqQefdgFDGOMm'
O = 'O'
P = 'P'
ints = 'bBhHiIlLqQ'
times = 'Mm'
intsO = ints + O
bints = '?' + ints
bintsO = bints + O
flts = 'jfdg'
flts = 'efdg'
fltsO = flts + O
fltsP = flts + P
cmplx = 'FDG'
Expand Down Expand Up @@ -286,7 +286,7 @@ def english_upper(s):
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' :
Expand All @@ -311,7 +311,7 @@ def english_upper(s):
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' :
Expand Down Expand Up @@ -419,12 +419,12 @@ def english_upper(s):
'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' :
Expand Down Expand Up @@ -466,177 +466,177 @@ def english_upper(s):
'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' :
Expand All @@ -648,7 +648,7 @@ def english_upper(s):
'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' :
Expand Down Expand Up @@ -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',
Expand All @@ -714,7 +714,7 @@ def indent(st,spaces):
'O': 'O_O',
'P': 'O_O_method'}

chartotype2 = {'j': 'jj_j',
chartotype2 = {'e': 'ee_e',
'f': 'ff_f',
'd': 'dd_d',
'g': 'gg_g',
Expand Down
12 changes: 6 additions & 6 deletions numpy/core/code_generators/numpy_api.py
Expand Up @@ -291,12 +291,12 @@
'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
Expand Down

0 comments on commit c6f8dbb

Please sign in to comment.