Hi Allan,

Seeing it written out like that, I quite like the multiple dispatch
signature: perhaps verbose, but clear.

It does mean a different way of changing the ufunc structure, but I
actually think it has the advantage of being possible without extending the
structure (though that might still be needed for frozen dimensions...):
currently, the relevant parts of _tagPyUFuncObject are:
```
/* 0 for scalar ufunc; 1 for generalized ufunc */
int core_enabled;
/* number of distinct dimension names in signature */
int core_num_dim_ix;
/* numbers of core dimensions of each argument */
int *core_num_dims;
/* dimension indices in a flatted form */
int *core_dim_ixs;
/* positions of 1st core dimensions of each argument in core_dim_ixs */
int *core_offsets;
```
I think this could be changed without making any serious change if we
slightly repurposed `core_enabled` as meaning `number of signatures`. Then,
the pointers above could become
```
int core_xxx[num_sigs][max_core_num_dim_ixs];
```
Less easy is `core_num_dim_ix`, but that number is not really needed anyway
(nor used much in the code) as it is implicitly encoded in the indices. It
could quite logically become the `max_core_num_dim_ixs` above.

All the best,

Marten
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion

Reply via email to