Regarding question 1, be careful about initializing a vector of vectors using fill
.
This is a confusing aspect of Julia at first → link to post where this is explained.
All 3 entries of Tsten
will point to the same location and the inplace assignment Tsten[1] .= T
will keep all 3 pointing to the new replaced T
values.
Do instead: Tsten[1] = T
, or keep the inplace assignment but then you will have to pre-assign the individual arrays of zeros independently using a loop or comprehension as in the linked post .