@@ -10,28 +10,28 @@ WARNING: DO NOT edit .pxi FILE directly, .pxi is generated from .pxi.in
1010
1111{{py:
1212
13- # name, dest, c_type_in, c_type_out, preval, postval, can_copy, nogil
13+ # c_type_in, c_type_out, preval, postval
1414dtypes = [
15- ('bool', 'bool', ' uint8_t', 'uint8_t', '', '', True ),
16- ('bool ', 'object', 'uint8_t ', 'object' ,
17- 'True if ', ' > 0 else False', False ),
18- ('int8', 'int8', ' int8_t', 'int8_t ', '', '', True ),
19- ('int8', 'int32', ' int8_t', 'int32_t ', '', '', False ),
20- ('int8', 'int64', ' int8_t', 'int64_t ', '', '', False ),
21- ('int8 ', 'float64 ', 'int8_t ', 'float64_t', '', '', False ),
22- ('int16', 'int16', ' int16_t', 'int16_t ', '', '', True ),
23- ('int16', 'int32', ' int16_t', 'int32_t ', '', '', False ),
24- ('int16', 'int64', ' int16_t', 'int64_t ', '', '', False ),
25- ('int16 ', 'float64 ', 'int16_t ', 'float64_t', '', '', False ),
26- ('int32', 'int32', ' int32_t', 'int32_t ', '', '', True ),
27- ('int32', 'int64', ' int32_t', 'int64_t ', '', '', False ),
28- ('int32 ', 'float64 ', 'int32_t ', 'float64_t', '', '', False ),
29- ('int64', 'int64', ' int64_t', 'int64_t ', '', '', True ),
30- ('int64 ', 'float64 ', 'int64_t ', 'float64_t', '', '', False ),
31- ('float32', 'float32', ' float32_t', 'float32_t ', '', '', True ),
32- ('float32 ', 'float64', 'float32_t', ' float64_t', '', '', False ),
33- ('float64 ', 'float64 ', 'float64_t ', 'float64_t', '', '', True ),
34- ('object', 'object', 'object', 'object', '', '', False) ]
15+ ('uint8_t', 'uint8_t', '', ''),
16+ ('uint8_t ', 'object', 'True if ', ' > 0 else False') ,
17+ ('int8_t ', 'int8_t', '', '' ),
18+ ('int8_t', 'int32_t ', '', ''),
19+ ('int8_t', 'int64_t ', '', ''),
20+ ('int8_t', 'float64_t ', '', ''),
21+ ('int16_t ', 'int16_t ', '', '' ),
22+ ('int16_t', 'int32_t ', '', ''),
23+ ('int16_t', 'int64_t ', '', ''),
24+ ('int16_t', 'float64_t ', '', ''),
25+ ('int32_t ', 'int32_t ', '', '' ),
26+ ('int32_t', 'int64_t ', '', ''),
27+ ('int32_t', 'float64_t ', '', ''),
28+ ('int64_t ', 'int64_t ', '', '' ),
29+ ('int64_t', 'float64_t ', '', ''),
30+ ('float32_t ', 'float32_t ', '', '' ),
31+ ('float32_t', 'float64_t ', '', ''),
32+ ('float64_t ', 'float64_t', '', ''),
33+ ('object ', 'object ', '', '' ),
34+ ]
3535
3636
3737def get_dispatch(dtypes):
@@ -117,9 +117,9 @@ def get_dispatch(dtypes):
117117 out[i, j] = %(preval)svalues[i, idx]%(postval)s
118118"""
119119
120- for (name, dest, c_type_in, c_type_out, preval, postval,
121- can_copy) in dtypes:
120+ for (c_type_in, c_type_out, preval, postval) in dtypes:
122121
122+ can_copy = c_type_in == c_type_out != "object"
123123 nogil = c_type_out != "object"
124124 if nogil:
125125 nogil_str = "with nogil:"
@@ -128,6 +128,16 @@ def get_dispatch(dtypes):
128128 nogil_str = ''
129129 tab = ''
130130
131+ def get_name(dtype_name):
132+ if dtype_name == "object":
133+ return "object"
134+ if dtype_name == "uint8_t":
135+ return "bool"
136+ return dtype_name[:-2]
137+
138+ name = get_name(c_type_in)
139+ dest = get_name(c_type_out)
140+
131141 args = dict(name=name, dest=dest, c_type_in=c_type_in,
132142 c_type_out=c_type_out, preval=preval, postval=postval,
133143 can_copy=can_copy, nogil_str=nogil_str, tab=tab)
@@ -291,9 +301,3 @@ cdef _take_2d(ndarray[take_t, ndim=2] values, object idx):
291301 for j in range(K):
292302 result[i, j] = values[i, indexer[i, j]]
293303 return result
294-
295-
296- _take_2d_object = _take_2d[object]
297- _take_2d_float64 = _take_2d[float64_t]
298- _take_2d_int64 = _take_2d[int64_t]
299- _take_2d_uint64 = _take_2d[uint64_t]
0 commit comments