What size do you expect your result to be?  Are you creating a 1 x (b-1)
row vector?  If so, I would check out the ArrayViews package and do
something like:

using ArrayViews
A1 = view(A,:,1)
C = Float64[dot(A1, view(B,:,i)) for in 2:size(B,2)]

On Mon, Sep 14, 2015 at 7:27 PM, Patrick Kofod Mogensen <
[email protected]> wrote:

> I have a line in my code that seems to really allocate a lot of memory,
> and I think it might be slowing down my program. I have two matrices. The
> first matrix A is n-by-2 and the second matrix B is n-by-b. What I need to
> do is to multiply the first column of A element by element to each row in
> B[:, 2:end]. I use broadcasting (.*) to achieve this along with a transpose
> of A[:,1]:
>
>     C=A[:,1]'.*B[:,2:end]
>
> However, it seems to allocate a lot of temporary memory (the number memory
> number in .mem overflows even for small problems). Is there anything I can
> do here?
>
>
> P
>

Reply via email to