Suppose I run the following
w = fill(zeros(3,3),3)
w[1] .= rand(3,3)
I expected the result would have the first matrix in w
given random numbers with the remaining two matrices remaining zeros, but this is not the case. I know that if I simply do
w[1] = rand(3,3)
then I will get the answer I want, but I am going to be repeatedly updating the entries in w
and I want to minimize allocations. What is the syntax to use broadcasting to update a single matrix in w
?