I have two tensors of arbitrary but equal rank n (and equal dimensions): A
and B
, and I want to get a third tensor of rank n + 1, C
.
I want to do a element by element Join
, so the element in A
and the corresponding element in B
are contracted into a list in C
.
For example, with n = 2:
A = {{a[0,0],a[1,0]},{a[0,1],a[1,1]}};
B = {{b[0,0],b[1,0]},{b[0,1],b[1,1]}};
then:
C = {{ {a[0,0],b[0,0]} , {a[1,0],b[1,0]} },{ {a[0,1],b[0,1]} , {a[1,1],b[1,1]} }}
I think it might be doable with some combination of Inner
and List
, but I'm not sure.
C
is a built-in symbol inSystem`
and it's not wise to assign/modify it unless absolutely necessary. $\endgroup$A
,B
andC
as example variables. $\endgroup$