Date: Jun 24, 2011 11:59 PM
Author: Jim Rockford
Subject: Help vectorize this matrix multiplication
I have a matrix M for which I want to multiply each row by a scalar,
which can be different for each row.
One way to do it is as follows. Suppose the set of scalars are put
into a vector v. Then
diag(v) * M
effects this multiplication.
In my case, the problem is that constructing the diagonal matrix
diag(v) will exceed my computer memory. Obviously I could resort to a
loop, but I'm wondering if there is a different way to vectorize this