Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

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
relevant:
http://groups.google.com/group/comp.soft-sys.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:
> "=?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 ;) )





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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.