> Personally, I consider the notation with the explicit
>summation to be a very minor tweak on the notation without it. Writing the
>last line as:
>
> sum(t2("ij")*sum(t4("ijkl")*sum(t4("klpq")*t2("pq"),"pq"),"kl"),"ij" )
What if you have an expression in which the indices are a bit less
ordered; e.g. instead of
tensor tst1 = t2("ij")*t4("ijkl")*t4("klpq")*t2("pq");
we have
tensor tst1 = t2("ik")*t4("ijlp")*t4("kjlq")*t2("pq");
I guess you have to then do
tst1 =
sum(t2("ik")*sum(sum(t4("ijlp")*t4("kjlq"),"jl")*t2("pq"),"pq"),"ik");
or
tst1 =
contract<i,k>(contract<p,q>(contract<j,l>(t4(i,j,l,p)*t4(k,j,l,q))*t2(p,q)));
This is certainly not easy to read, and it produces an 8th rank temporary
if we don't use some sort of proxys. And my first naive writing produced a
10th rank temporary:
tst1 = sum(t2("ik")*sum(t4("ijlp")*t4("kjlq")*t2("pq"),"jlpq"),"ik");
Ugh.
Also, if we don't defer evaluation (with something like expression
templates), then expressions like
A_i = epsilon_ipq * B_p * C_q
will be hard to do efficiently, won't they? Sure, we can use engines so
that epsilon doesn't store anything, but it would be nice if we also only
evaluated the terms that matter in the above expression, and didn't create
a fifth rank temporary with tons of zeros.
Jim
--------------------- blitz-dev list --------------------------------
* To subscribe/unsubscribe: mail to majordomo@oonumerics.org, with
"subscribe blitz-dev" or "unsubscribe blitz-dev" in the body of the message
* Blitz++ web page: http://oonumerics.org/blitz/
This archive was generated by hypermail 2b29 : Wed Feb 20 2002 - 04:30:05 EST