On Wed, Jan 26, 2011 at 8:29 PM, Joshua Holbrook <[hidden email]> wrote:
>> The only disadvantage I see, is that choosing the axes to operate on
>> in a program or function requires string manipulation.
> One possibility would be for the Python exposure to accept lists or tuples
> of integers. The subscript 'ii' could be [(0,0)], and 'ij,jk->ik' could be
> [(0,1), (1,2), (0,2)]. Internally it would convert this directly to a
> C-string to pass to the API function.
What if you made objects i, j, etc. such that i*j = (0, 1) and
etcetera? Maybe you could generate them with something like (i, j, k)
= einstein((1, 2, 3)) .
Feel free to disregard me since I haven't really thought too hard
about things and might not even really understand what the problem is
*anyway*. I'm just trying to help brainstorm. :)
No worries. :) The problem is that someone will probably want to dynamically generate the axes to process in a loop, rather than having them hardcoded beforehand. For example, generalizing the diag function as follows. Within Python, creating lists and tuples is probably more natural.