[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Dot product (nx1).*(nxm)
From: |
Heber Farnsworth |
Subject: |
RE: Dot product (nx1).*(nxm) |
Date: |
Sat, 4 Dec 1999 22:03:40 -0600 |
I'm assuming that what you mean by this is that you the ith row of your nxm
matrix to be multiplied by the ith element of your n vector. If this is the
case then you should write this as
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.
Kron is very slow. It's implemented as an m-file with lots of loops so you
want to avoid it when you need speed. I think the next version of octave
will have a much faster implementation. If you need a fast version of kron
now then look on the archive for a message I sent
http://www.che.wisc.edu/octave/mailing-lists/help-octave/1999/829
which contains the code for an oct-file which is very fast.
Heber Farnsworth
> Hi!
> I'm trying to minimise a function that requires a lot of dot
> products of
> the
> form (dimensions)
> (nx1).*(nxm)
> e.g. p .* v
> where
> p is size nx1
> v is size nxm
>
> Right now I'm using kron(p,ones(1,m)).*v but it's very slow.
> I'm using Octave 2.1.9 on RH6.1, and I've searched the faq's, archives
> etc. but
> don't seem to be able to find any way of doing this.
>
> Can anyone help? Are there any functions out there that may
> be a little
>
> faster than the kron product?
> Andre
>
> --
> Andre Bonfrer
> The Coles Myer Center for Retailing and Marketing
> Melbourne Business School
> 200 Leicester Street
> Carlton, VIC 3053
> AUSTRALIA
> Tel: 61 3 9349 8194
> Fax: 61 3 9349 8193
> Email: address@hidden
>
>
>
>
> --------------------------------------------------------------
> ---------
> 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
> --------------------------------------------------------------
> ---------
>
-----------------------------------------------------------------------
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 <=
- RE: Dot product (nx1).*(nxm), Mike Miller, 1999/12/04
- 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