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