Hi,
From the vector
v = CTensor[{1, 2, 3}, {ch}]
there are basically two ways of performing the tensor product v * v : either via indices or in index-free form:
- The formula you gave, using HeadOfTensor, is the right way to do this operation with indices: you first put indices in both v vectors, let the product happen (with the indices taking care of order), and finally remove the indices again to get T (with HeadOfTensor).
- Internally xCoba converts that operation with indices into an index-free operation, using this internal function:
In[ ]:= T = xAct`xCoba`Private`CTensorProduct[v, v]
Out[ ]= CTensor[{{1, 2, 3}, {2, 4, 6}, {3, 6, 9}}, {ch, ch}, 0]
The three fundamental operations of tensor algebra (tensor products, transpositions and contractions) can be performed with indices or in index-free form, and there are respective internal functions for those operations (CTensorProduct, CTensorTranspose and CTensorContract). For simple cases the index-free functions may be useful and more efficient, but as soon as the computations get complicated, the indexed approach is easier to read/write, and hence safer, in my opinion.
Cheers,
Jose.