Description of a ufunc. Attributes ---------- nin : number of input arguments nout : number of output arguments identity : identity element for a two-argument function (like Zero) docstring : docstring for the ufunc typereso: type resolver function of type PyUFunc_TypeRe
| 186 | return tds |
| 187 | |
| 188 | class Ufunc: |
| 189 | """Description of a ufunc. |
| 190 | |
| 191 | Attributes |
| 192 | ---------- |
| 193 | nin : number of input arguments |
| 194 | nout : number of output arguments |
| 195 | identity : identity element for a two-argument function (like Zero) |
| 196 | docstring : docstring for the ufunc |
| 197 | typereso: type resolver function of type PyUFunc_TypeResolutionFunc |
| 198 | type_descriptions : TypeDescription objects |
| 199 | signature: a generalized ufunc signature (like for matmul) |
| 200 | indexed: add indexed loops (ufunc.at) for these type characters |
| 201 | """ |
| 202 | def __init__(self, nin, nout, identity, docstring, typereso, |
| 203 | *type_descriptions, signature=None, indexed=''): |
| 204 | self.nin = nin |
| 205 | self.nout = nout |
| 206 | if identity is None: |
| 207 | identity = None_ |
| 208 | self.identity = identity |
| 209 | self.docstring = docstring |
| 210 | self.typereso = typereso |
| 211 | self.type_descriptions = [] |
| 212 | self.signature = signature |
| 213 | self.indexed = indexed |
| 214 | for td in type_descriptions: |
| 215 | self.type_descriptions.extend(td) |
| 216 | for td in self.type_descriptions: |
| 217 | td.finish_signature(self.nin, self.nout) |
| 218 | |
| 219 | check_td_order(self.type_descriptions) |
| 220 | |
| 221 | |
| 222 | # String-handling utilities to avoid locale-dependence. |