8826
|
1 ## Copyright (C) 1995, 1996, 1997, 1998, 2000, 2002, 2004, 2005, 2006, |
|
2 ## 2007 Kurt Hornik |
|
3 ## |
|
4 ## This file is part of Octave. |
|
5 ## |
|
6 ## Octave is free software; you can redistribute it and/or modify it |
|
7 ## under the terms of the GNU General Public License as published by |
|
8 ## the Free Software Foundation; either version 3 of the License, or (at |
|
9 ## your option) any later version. |
|
10 ## |
|
11 ## Octave is distributed in the hope that it will be useful, but |
|
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 ## General Public License for more details. |
|
15 ## |
|
16 ## You should have received a copy of the GNU General Public License |
|
17 ## along with Octave; see the file COPYING. If not, see |
|
18 ## <http://www.gnu.org/licenses/>. |
|
19 |
|
20 ## -*- texinfo -*- |
|
21 ## @deftypefn {Function File} {} dmult (@var{a}, @var{b}) |
|
22 ## This function has been deprecated. Use the direct syntax @code{diag(A)*B} |
|
23 ## which is more readable and now also more efficient. |
|
24 ## @end deftypefn |
|
25 |
|
26 ## Author: KH <Kurt.Hornik@wu-wien.ac.at> |
|
27 ## Description: Rescale the rows of a matrix |
|
28 |
|
29 function M = dmult (a, B) |
|
30 |
|
31 persistent warned = false; |
|
32 if (! warned) |
|
33 warned = true; |
|
34 warning ("Octave:deprecated-function", |
|
35 "dmult is obsolete and will be removed from a future version of Octave; please use the straightforward (and now efficient) syntax ""diag(A)*B""."); |
|
36 endif |
|
37 |
|
38 if (nargin != 2) |
|
39 print_usage (); |
|
40 endif |
|
41 if (! isvector (a)) |
|
42 error ("dmult: a must be a vector of length rows (B)"); |
|
43 endif |
|
44 a = a(:); |
|
45 sb = size (B); |
|
46 sb(1) = 1; |
|
47 M = repmat (a(:), sb) .* B; |
|
48 endfunction |