The tensor functionality will not produce a mixed output of explicit and symbolic matrices. That is, the tensor will remain symbolic unless all of the parts are explicit matrices/arrays. Also, it is better to use TensorTranspose
instead of Transpose
when dealing with tensors. At any rate, we can write your expression as both a mixed expression and as a tensor expression as follows:
mixed = {{P, P}};
tensor = TensorProduct[{{1, 1}}, P];
Let's check that the two are equivalent by substituting an explicit matrix for P
:
mixed == tensor /. P->Array[a, {3,3}]
True
Now, the tensor framework, and in particular TensorTranspose
, does not know how to deal with this mixed form. For example:
$Assumptions = P ∈ Arrays[{n, n}];
TensorTranspose[{{P, P}}, {1, 2, 4, 3}]
TensorTranspose::lowlen: Required length 2 is smaller than maximum 4 of support of {1,2,4,3}.
TensorTranspose[{{P, P}}, {1, 2, 4, 3}]
On the other hand, TensorTranspose
(as well as Transpose
) knows how to deal with the tensor form:
transpose = TensorReduce @ TensorTranspose[tensor, {1, 2, 4, 3}]
TensorTranspose[P \[TensorProduct] {{1, 1}}, {4, 3, 1, 2}]
Let's check that this agrees with your expected result when substituting an explicit matrix for P
:
expected = {{Transpose[P], Transpose[P]}};
expected == transpose /. P->Array[a, {3,3}]
True
Summarizing, if you use:
TensorProduct[{{1, 1}}, P]
instead of:
{{P, P}}
then the tensor framework is more likely able to do some transformations of the input.