Mercurial > hg > octave-lyh
comparison 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 |
comparison
equal
deleted
inserted
replaced
4889:658aad1c1b05 | 4890:e7da90a1cc11 |
---|---|
29 function M = dmult (a, B) | 29 function M = dmult (a, B) |
30 | 30 |
31 if (nargin != 2) | 31 if (nargin != 2) |
32 usage ("dmult (a, B)"); | 32 usage ("dmult (a, B)"); |
33 endif | 33 endif |
34 | 34 if (! isvector (a)) |
35 s = size (a); | |
36 if ((min (s) > 1) || (max (s) != rows (B))) | |
37 error ("dmult: a must be a vector of length rows (B)"); | 35 error ("dmult: a must be a vector of length rows (B)"); |
38 endif | 36 endif |
39 | 37 a = a(:); |
40 M = (reshape (a, max (s), 1) * ones (1, columns (B))) .* B; | 38 sb = size (B); |
41 | 39 sb(1) = 1; |
40 M = repmat (a(:), sb) .* B; | |
42 endfunction | 41 endfunction |