← Back to team overview

ufl team mailing list archive

Re: The role of * in UFL

 

Martin Sandve Alnæs wrote:
2008/4/7, Pearu Peterson <pearu@xxxxxxxxx>:
Martin Sandve Alnæs wrote:

 > I don't agree with the x.T stuff. There is no differentiation between
 > columns and rows in tensor algebra, so the transpose has no meaning
 > for a rank 1 tensor. This has to generalize to where x is a rank 1
 > expression and not only an explicitly constructed vector. If you have
 > a rank 4 tensor and pick a sub-tensor of rank 1 from it, is it a
 > column or row? Columns and rows doesn't generalize, and special cases
 > are evil.


Transpose is well-defined also for arbitrary rank tensors. It swaps
 the first two indices:

   transpose(t_ijkl..) -> t_jikl..

 One can also defined generalised transpose:

   transpose(t_ijkl.., [p_i, p_j, p_k, p_l, ..]) -> t_(p_i)(p_j)(p_k)(p_l)..

We _could_ support something like that, but I don't think it's worth
the trouble since the more general index notation covers this without
making detailed definitions:

# reference components
Aijkl = A[i,j,k,l]
# make tensor with different axis ordering
B = Tensor(Aijkl, (j,i,k,l))

Nice:)

Pearu


Follow ups

References