Hello everyone, 

I am trying to write a macro that transforms an expression like:

@foo v[1,2] + v[1,3]*v[2,4] -> v[I[1,2]] + v[I[1,3]]*v[I[2,4]]

Basically, for each getindex I want to insert a lookup of the index in some 
other variable.
The reason for this is that I am working with matrices encoded as vectors 
and I want to still call them like matrices. The "I" vector in the code
is the lookup from two dimensional indexing to one dimensional.

v is just a normal Vector so I cannot extend getindex which is why I 
thought a macro would be the cleanest solution.

I am a bit lost how to start so any help would be appreciated.

Best regards, Kristoffer.

Reply via email to