Maybe I'm beginning to realize why... I had a place where I did something
like copy(duM), and then changed the elements of the copy. This changed the
original duM, and that was very confusing for me!
The problem is, I wasn't thinking about what duM actually contains. If I
slice(duM, 2) what I get is not the array, but the reference to the array,
correct? So when I did a duM2 = copy(duM), all that is copied is the
references, not the arrays at duM[1] and duM[2].
On Friday, November 6, 2015 at 7:59:08 AM UTC+1, Patrick Kofod Mogensen
wrote:
>
> So I have a Matrix{Matrix{Float64}}, and I want to access the first
> Matrix, and multiply it by a parameter vector.
>
> nX = 175
> X = 0:1:nX-1
> duM = Matrix{Float64}[[zeros(nX) -0.001*X],
> [-ones(nX) zeros(nX)]];
>
> Say I have a parameter Vector b = [9; 2], and want to perform uM[:, 1] =
> duM[1]*b (uM is just a nX - by - 2 Array{Float64,2}), but I don't want to
> make a copy each time. I thought maybe slice(duM, 2), slice(duM, 2, :, :)
> would work, but it doesn't really seem to do the trick. What is it exactly
> I'm missing here?
>
> Best,
> Patrick
>