Mercurial > hg > octave-lyh
diff scripts/linear-algebra/dmult.m @ 4890:e7da90a1cc11
[project @ 2004-05-06 20:36:29 by jwe]
author | jwe |
---|---|
date | Thu, 06 May 2004 20:36:29 +0000 |
parents | 38c61cbf086c |
children | 4c8a2e4e0717 |
line wrap: on
line diff
--- a/scripts/linear-algebra/dmult.m +++ b/scripts/linear-algebra/dmult.m @@ -31,12 +31,11 @@ if (nargin != 2) usage ("dmult (a, B)"); endif - - s = size (a); - if ((min (s) > 1) || (max (s) != rows (B))) + if (! isvector (a)) error ("dmult: a must be a vector of length rows (B)"); endif - - M = (reshape (a, max (s), 1) * ones (1, columns (B))) .* B; - + a = a(:); + sb = size (B); + sb(1) = 1; + M = repmat (a(:), sb) .* B; endfunction