# Tensor double dot product

I have two tensors that i must calculate double dot product. matrix A is rank 2 and matrix B is rank 4. I want to multiply them with Matlab and I know in Matlab it becomes: A : B = trace (A*B) but it has one error and it says: Inner matrix dimensions must agree So how can I solve this problem? anybody help me? Thanks

-
What size are A and B? – apnorton Jul 2 '13 at 15:46
A is 3*3 and B is 6*6 – Sara sky Jul 2 '13 at 19:18

I think you can only calculate this explictly if you have dyadic- and polyadic-product forms of your two tensors, i.e., A = a b and B = c d e f, where a, b, c, d, e, f are vectors. Beware that there are two definitions for double dot product, even for matrices both of rank 2: (a b) : (c d) = (a.c) (b.d) or (a.d) (b.c), where "." is the usual single-dot scalar product for vectors. One possible answer would thus be (a.c) (b.d) (e f); another would be (a.d) (b.c) (e f), i.e., a matrix of rank 2 in any case. Of course A:B $\not =$ B:A in general, if A and B do not have same rank, so be careful in which order you wish to double-dot them as well.