Re: BZDEV: Re: Initial thoughts about tensors

From: jeremic@sokocalo.cee.clarkson.edu
Date: Thu Jun 18 1998 - 14:56:00 EST


Hello Steve and Others,

>
> This I'm not as sure of. We would have arrays of millions of these things
> and we would be looping over them hoping for uncompromizing efficiency.
> Clearly the importance of the overhead depends on the size of the tensors
> involved. What has your experience been with the size of these tensors per
> dimension?

I am using mostly 3D tensors. That is, an order 2 tensor is 3x3 or order
4 tensor is 3x3x3x3 . . .

The main operator* has to know what to contract or expand so parsing
part must be there. You can make many small functions that will do
specific contractions or expansions, like for example:

tensor test = A("ijkl") * B("klpq");

might be done with:

tensor test = TensorMultiply_0011_1100(A,B);

In this case there is no parsing of indices. This specific function only
does contraction of last two and first two indices for two fourth order
tensors. Probably very efficient since you can then manually unroll the
whole thing inside and have no loop at all. This is all for general
tensor without taking into account any symmetries. I figured that it's
cheaper to save in memory 3x3x3x3=81 members than, in the case of major
symmetry for a 4-th order tensor in 3D (3x3 * 3x3+1)/2 = 45 doubles and
have to do some more integer musing for getting the other symmetric
part...

It might be worth doing some timing experiments.

>
> If each component counts over {1..N} then the fully general tensor of rank
> R has pow(N,R) elements, which gets big fast. If there are symmetries
> though it is (prod_{i=0}^{R-1}(N+i))/factorial(R), which can be tractable
> if you take full advantage of the symmetries. N=3 and R=4 is then just 15
> elements instead of 81.
>

> The goal then is to have the tensor products evaluate with zero overhead
> compared to writing it out by hand, including taking advantage of symmetries.
>
>

Best regards, Boris

Boris Jeremic
Assistant Professor
Rowley Labs 236
Department of Civil and Environmental Engineering
Clarkson University
Potsdam, NY 13699-5710
Phone (315) 268-4435
Fax (315) 268-7985
Jeremic@Polaris.Clarkson.edu
http://www.clarkson.edu/~jeremic

--------------------- 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