To help distinguish the various dimensions, I have a model which outputs a vector in a series of time intervals, I then construct a list of these models. Next, I would like to compute the outer product of the vector at each time step. I think I can do something like the following
tdim = 100;
vecdim = 3;
modeldim = 2;
(*veclist is supposed to represent the output for 2 models*)
veclist = Table[v[model, t, a], {model, modeldim}, {t, tdim}, {a, vecdim}];
outerproduct[x_, y_] := Outer[Times, x, y];
MapThread[outerproduct, {veclist, veclist}, 2]
I think this does the right thing. It does not mix the models or the time steps. As far as I can tell it is taking the outer product at the appropriate level. However, I would like to be able to do this in the case where model 1 and model 2 have a different number of time steps and I can't see a neat way to do this. If I do the same as above but for 2 models with a different number of time steps, I get an error because the rank of the list has changed:
tdim1 = 3;
tdim2 = 4;
veclist1 = Table[v1[model, t, a], {model, 1, 1}, {t, tdim1}, {a, vecdim}];
veclist2 = Table[v2[model, t, a], {model, 2, 2}, {t, tdim2}, {a, vecdim}];
veclistall = Join[veclist1, veclist2];
MapThread[outerproduct, {veclistall, veclistall}, 2]
For the problem I have in mind these lists are much much larger, so finding an efficient way of doing this would be a great help. Any suggestions would be hugely appreciated