# speed up tensor expand

I am using the following code

ClearAll[CircleTimes];
CircleTimes /: (a1_\[CircleTimes]b1_\[CircleTimes]c1_).(a2_\\[CircleTimes]b2_\[CircleTimes]c2_) :=
a1.a2\[CircleTimes]b1.b2\[CircleTimes]c1.c2;
CircleTimes /: ({{0, 0}, {0, 0}}\[CircleTimes]b1_\[CircleTimes]c1_) := 0
CircleTimes /: (a1_\[CircleTimes]{{0, 0}, {0, 0}}\[CircleTimes]c1_) := 0
CircleTimes /: (a1_\[CircleTimes]b1_\[CircleTimes]{{0, 0}, {0, 0}}) :=0


I am trying to calculate a quantitity H which is made of approximately 50 summands of the following form.

(E^(I t (w1 + w3))J13 {{0, 0}, {1, 0}}\[CircleTimes]{{1, 0}, {0, 1}}\[CircleTimes]{{0, 0}, {1, 0}}).(-((b3ac E^(2 I t (w2 + w3) - I t (w2 + w3 + wD))J23 w2 w30 {{1, 0}, {0, 1}}\[CircleTimes]{{0, 0}, {1, 0}}\[CircleTimes]{{0, 0}, {1, 0}})/(2 (w2 - w3) (w2 + w3) (w2 + w3 - wD)))) +..


In order to do so I need to explicitely calculate the dot product between the two tensors, therefore I use TensorExpand

TensorExpand[G,  Assumptions -> ( J13 | J23 | w30 | w3ac | b3ac) \[Element] PositiveReals]


However since G has quite a lot terms, this does not evaluate in a reasonable amount of time. On the other hand if I split G into 5 different parts and apply TensorExpand to each part individually it works perfectly fine. Therefore my question is, is there any way to speed up TensorExpand or to apply it only to a part of the terms at a time ?

• Although this is quite old already: Can you provide a minimal example that we can just copy and try out? – Mr Puh Aug 10 at 8:55