[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Dot product (nx1).*(nxm)
From: |
Mike Miller |
Subject: |
RE: Dot product (nx1).*(nxm) |
Date: |
Sat, 4 Dec 1999 22:27:45 -0600 (CST) |
On Sat, 4 Dec 1999, Heber Farnsworth wrote:
> p(:,ones(1,m)).*v
>
> where p is nx1 and v is nxm. What this does is to multiply v by a nxm
> natrix which has p as every column.
Apparently, Heber's method is faster in this example than the one I
suggested:
octave:1> p=rand(100,1);
octave:2> q=ones(1,50);
octave:3> p2=p*q;
octave:4> t0=cputime; for i=1:1000, p2=p*q; end , cputime-t0
ans = 2.4600
octave:5> t0=cputime; for i=1:1000, p2=p(:,q); end , cputime-t0
ans = 2.0100
Regards,
Mike
--
Michael B. Miller
University of Missouri--Columbia
http://taxa.psyc.missouri.edu/~mbmiller/
-----------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.che.wisc.edu/octave/octave.html
How to fund new projects: http://www.che.wisc.edu/octave/funding.html
Subscription information: http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------
- Dot product (nx1).*(nxm), Andre Bonfrer, 1999/12/04
- RE: Dot product (nx1).*(nxm), Heber Farnsworth, 1999/12/04
- RE: Dot product (nx1).*(nxm),
Mike Miller <=
- Re: Dot product (nx1).*(nxm), Joao Cardoso, 1999/12/05
- Re: Dot product (nx1).*(nxm), Joao Cardoso, 1999/12/05
- Re: Dot product (nx1).*(nxm), Mike Miller, 1999/12/06
- Re: Dot product (nx1).*(nxm), John W. Eaton, 1999/12/06
- Re: Dot product (nx1).*(nxm), Joao Cardoso, 1999/12/06
- Re: Dot product (nx1).*(nxm), Mike Miller, 1999/12/06
- speed issues (was Re: Dot product (nx1).*(nxm)), Mike Miller, 1999/12/06
Re: Dot product (nx1).*(nxm), Dr Andre Bonfrer, 1999/12/05