Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Re: Vector multiplication with a row of matrix
Posted:
Jul 12, 2011 2:41 PM


This thread that I initiated with a similar question is probably relevant: http://groups.google.com/group/comp.softsys.matlab/browse_frm/thread/e05c074a771972f7/0e708f9743a9ab3d?hl=en&lnk=gst&q=jim+rockford
Jim
On Jul 12, 1:57 pm, "Wander " <wanderwad...@hotmail.com> wrote: > "=?iso885915?Q?D._Gr=F6gler?=" <metabolismu...@mailforce.net> wrote in message <opstebynddj9i...@pc223l44wxp.physiol.win2000.unizh.ch>... > > On Mon, 04 Jul 2005 16:31:23 +0200, Pud Ji Janto > > <"r.m.p.pudjijanto_nosp4\/_"@hotmail.com> wrote: > > > > Hi all, > > > > I want to know if it's possible to multiply this in vectorized way > > > Let V a vector of size 1xn > > > M a matrix of size mxn > > > > How can I multiply componentwise: V.* M(i,:) without loop? > > > > Thanks in advance for any helps > > > > Pud > > > Hi Pud, > > > V1 = repmat(V,m,1); % Produces a mxn Matrix whos rows are all equal to V > > M1 = V.*M; % Elementwise Multiplication > > > Dominik > > Hi Pud and Dominik, > > Yes, this works, but evaluating V1.*M (I assume you meant this instead of your V.*M) gets computationally intensive for large m. Is there a way in MatLab to do this that does not grow that much in m? > > (Theoretically, there should be a way: for very large m, I would say it will eventually pay off to use a for loop in which you multiply a row of M by a single elements of V, instead of Dominiks method. However, MatLab wouldn't be MatLab if one could replace any forloop ;) )



