Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Vector multiplication with a row of matrix
Replies: 4   Last Post: Jul 12, 2011 2:41 PM

 Messages: [ Previous | Next ]
 Jim Rockford Posts: 164 Registered: 6/30/06
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:

Jim

On Jul 12, 1:57 pm, "Wander " <wanderwad...@hotmail.com> wrote:
> "=?iso-8859-15?Q?D._Gr=F6gler?=" <metabolismu...@mailforce.net> wrote in message <opstebynddj9i...@pc2-23l44-wxp.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 component-wise:  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 ;) )

Date Subject Author
7/4/05 Pud Ji Janto
7/4/05 Dominik
7/12/11 Wander
7/12/11 Jim Rockford
7/12/11 Florin