The Math Forum

Search All of the Math Forum:

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

Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   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
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

This thread that I initiated with a similar question is probably


On Jul 12, 1:57 pm, "Wander " <> wrote:
> "=?iso-8859-15?Q?D._Gr=F6gler?=" <> wrote in message <>...
> > On Mon, 04 Jul 2005 16:31:23 +0200, Pud Ji Janto  
> > <"r.m.p.pudjijanto_nosp4|\/|_"> 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 ;) )

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.