[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: Efficient multiplication by a diagonal matrix

**From**: |
John W. Eaton |

**Subject**: |
Re: Efficient multiplication by a diagonal matrix |

**Date**: |
Wed, 13 Nov 1996 00:18:11 -0600 |

On 13-Nov-1996, Ted Harding <address@hidden> wrote:
: A good while ago I wrote to John Eaton suggesting an extension of the
: octave ".*" multiplication operator so that, if A (m x n) is a matrix,
: u (m x 1) and v (1 x n) are vectors, then the following could be written:
[...]
: John reacted favourably at the time, but I have heard no more since.
I do want to add this feature. Someone has even offered patches. The
problem is mostly lack of time on my part, though I expect that
eventually Octave will have this feature.
: I certainly have frequent call for such operations: in Statistics,
I also found just yesterday that I could have used this feature, but
for a different operator. What I wanted to do was subtract the mean
of each column of a matrix from the elements of the corresponding
column. What I ended up doing was
x - ones (rows (x), :) * mean (x)
but it would have been much simpler to be able to just write
x .- mean (x)
jwe