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