<div class="gmail_quote">On Wed, Jan 26, 2011 at 3:18 PM, Hanno Klemm <span dir="ltr"><<a href="mailto:klemm@phys.ethz.ch">klemm@phys.ethz.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Mark,<br>
<br>
interesting idea. Given the fact that in 2-d euclidean metric, the<br>
Einstein summation conventions are only a way to write out<br>
conventional matrix multiplications, do you consider at some point to<br>
include a non-euclidean metric in this thing? (As you have in special<br>
relativity, for example)<br>
<br>
Something along the lines:<br>
<br>
eta = np.diag(-1,1,1,1)<br>
<br>
a = np.array(1,2,3,4)<br>
b = np.array(1,1,1,1)<br>
<br>
such that<br>
<br>
einsum('i,i', a,b, metric=eta) = -1 + 2 + 3 + 4<br></blockquote><div><br></div><div>This particular example is already doable as follows:</div><div><br></div><div><div>>>> eta = np.diag([-1,1,1,1])</div>
<div>>>> eta</div><div>array([[-1,  0,  0,  0],</div><div>       [ 0,  1,  0,  0],</div><div>       [ 0,  0,  1,  0],</div><div>       [ 0,  0,  0,  1]])</div><div>>>> a = np.array([1,2,3,4])</div><div>>>> b = np.array([1,1,1,1])</div>
</div><div><div>>>> np.einsum('i,j,ij', a, b, eta)</div><div>8</div></div><div><br></div><div>I think that's right, did I understand you correctly?</div><div><br></div><div>Cheers,<br>Mark</div></div>