annotate test/test_func.m @ 8920:eb63fbe60fab

update copyright notices
author John W. Eaton <jwe@octave.org>
date Sat, 07 Mar 2009 10:41:27 -0500
parents a41df65f3f00
children d9c8916bb9dd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8920
eb63fbe60fab update copyright notices
John W. Eaton <jwe@octave.org>
parents: 7815
diff changeset
1 ## Copyright (C) 2008 David Bateman
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
2 ##
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
3 ## This file is part of Octave.
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
4 ##
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
8 ## your option) any later version.
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
9 ##
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
13 ## General Public License for more details.
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
14 ##
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
18
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
19 ## This piece of test code ensures that all operations which work on
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
20 ## dimensions alone (squeeze, triu, etc.) work for all objects and
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
21 ## preserve type. Even if the object is an empty matrix. This code is
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
22 ## not to check that the function itself returns teh correct result,
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
23 ## just that the results are consistent for all types.
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
24
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
25 %!function __fntestfunc__ (fn, mn, varargin)
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
26 %! typ = {'double', 'complex', 'logical', 'sparse', 'complex sparse', ...
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
27 %! 'logical sparse', 'int8', 'int16', 'int32', 'int64', 'uint8', ...
7815
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7618
diff changeset
28 %! 'uint16', 'uint32', 'uint64', 'char', 'cell', 'struct', ...
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7618
diff changeset
29 %! 'single', 'single complex'};
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
30 %!
7815
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7618
diff changeset
31 %! cmplx = [2, 5, 18];
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
32 %! nlogical = [3, 6];
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
33 %! ninteger = [7, 8, 9, 10, 11, 12, 13, 14];
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
34 %! nsparse = [4, 5, 6];
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
35 %! skip = {};
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
36 %!
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
37 %! if (length (varargin) > 0 && iscell (varargin{1}))
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
38 %! skip = varargin{1};
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
39 %! varargin(1) = [];
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
40 %! endif
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
41 %!
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
42 %! for i = 1 : length(typ)
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
43 %! if (any (strcmp (skip, typ {i})))
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
44 %! continue;
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
45 %! endif
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
46 %! m = mn;
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
47 %!
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
48 %! if (any (nsparse == i))
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
49 %! if (ndims (m) > 2)
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
50 %! sz = size (m);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
51 %! m = reshape (m, [sz(1), prod(sz (2:end))]);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
52 %! endif
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
53 %! if (any (cmplx == i))
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
54 %! m = sparse ((1 + 1i) * m);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
55 %! else
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
56 %! m = sparse (m);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
57 %! endif
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
58 %! else
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
59 %! if (any (cmplx == i))
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
60 %! m = (1 + 1i) * m;
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
61 %! endif
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
62 %! endif
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
63 %! if (any (nlogical == i))
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
64 %! m = cast (m, 'logical');
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
65 %! endif
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
66 %! if (any (ninteger == i))
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
67 %! m = cast (m, typ{i});
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
68 %! endif
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
69 %! if (strcmp (typ{i}, 'cell'))
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
70 %! m = num2cell (m);
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
71 %! elseif (strcmp (typ{i}, 'struct'))
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
72 %! m = struct ('fld', num2cell (m));
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
73 %! endif
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
74 %!
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
75 %! y = feval (fn, m, varargin{:});
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
76 %! y2 = feval (fn, reshape (mn, size (m)), varargin{:});
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
77 %! if (!strcmp (class (y), class (m)) ||
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
78 %! issparse (y) != issparse (m) || !size_equal (y, y2))
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
79 %! error ('failed for type %s\n', typ{i});
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
80 %! endif
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
81 %! if (!(strcmp (typ{i}, 'cell') || strcmp (typ{i}, 'struct')) &&
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
82 %! any (vec (cast (real (y), 'double')) !=
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
83 %! vec (feval (fn , cast (real (m), 'double'), varargin{:}))))
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
84 %! error ('failed for type %s\n', typ{i});
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
85 %! endif
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
86 %! endfor
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
87 %! endfunction
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
88
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
89 %!shared m0, m1, m2, m3
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
90 %! m0 = [1:5];
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
91 %! m1 = reshape ([1 : 30], [5, 6]);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
92 %! m2 = reshape ([1 : 30], [5, 1, 6]);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
93 %! m3 = [];
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
94
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
95 %!test
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
96 %! __fntestfunc__('triu', m1, {'struct'});
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
97 %!test
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
98 %! __fntestfunc__ ('triu', m1, {'struct'}, -1);
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
99 %!test
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
100 %! __fntestfunc__ ('triu', m1, {'struct'}, 1);
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
101 %!test
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
102 %! __fntestfunc__('triu', m3, {'struct'});
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
103 %!test
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
104 %! __fntestfunc__ ('tril', m1, {'struct'});
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
105 %!test
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
106 %! __fntestfunc__ ('tril', m1, {'struct'}, -1);
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
107 %!test
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
108 %! __fntestfunc__ ('tril', m1, {'struct'}, 1);
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
109 %!test
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
110 %! __fntestfunc__('tril', m3, {'struct'});
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
111 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
112 %! __fntestfunc__ ('squeeze', m2);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
113 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
114 %! __fntestfunc__ ('squeeze', m3);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
115 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
116 %! __fntestfunc__ ('permute', m1, [2, 1]);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
117 %!test
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
118 %! __fntestfunc__ ('permute', m2, {'sparse', 'logical sparse', 'complex sparse'}, [3, 1, 2]);
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
119 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
120 %! __fntestfunc__ ('permute', m3, [2, 1]);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
121 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
122 %! __fntestfunc__ ('ipermute', m1, [2, 1]);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
123 %!test
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
124 %! __fntestfunc__ ('ipermute', m2, {'sparse', 'logical sparse', 'complex sparse'}, [3, 1, 2]);
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
125 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
126 %! __fntestfunc__ ('ipermute', m3, [2, 1]);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
127 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
128 %! __fntestfunc__ ('shiftdim', m2, 1);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
129 %!test
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
130 %! __fntestfunc__ ('shiftdim', m2, {'sparse', 'logical sparse', 'complex sparse'}, -1);
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
131 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
132 %! __fntestfunc__ ('shiftdim', m3, 1);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
133 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
134 %! __fntestfunc__ ('circshift', m2, 1);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
135 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
136 %! __fntestfunc__ ('circshift', m2, [1, -1]);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
137 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
138 %! __fntestfunc__ ('circshift', m3, 1);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
139 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
140 %! __fntestfunc__ ('reshape', m2, [6, 5]);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
141 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
142 %! __fntestfunc__ ('reshape', m3, [1, 0]);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
143 %!test
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
144 %! __fntestfunc__ ('diag', m0, {'struct'});
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
145 %!test
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
146 %! __fntestfunc__ ('diag', m0, {'struct'}, 1);
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
147 %!test
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
148 %! __fntestfunc__ ('diag', m0, {'struct'}, -1);
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
149 %!test
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
150 %! __fntestfunc__ ('diag', m1, {'struct'});
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
151 %!test
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
152 %! __fntestfunc__ ('diag', m1, {'struct'}, 1);
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
153 %!test
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
154 %! __fntestfunc__ ('diag', m1, {'struct'}, -1);
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
155 %!test
7618
3209a584e1ac Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents: 7613
diff changeset
156 %! __fntestfunc__ ('diag', m3, {'struct'});
7613
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
157 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
158 %! __fntestfunc__ ('fliplr', m1);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
159 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
160 %! __fntestfunc__ ('fliplr', m3);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
161 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
162 %! __fntestfunc__ ('flipud', m1);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
163 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
164 %! __fntestfunc__ ('flipud', m3);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
165 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
166 %! __fntestfunc__ ('flipdim', m1, 2);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
167 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
168 %! __fntestfunc__ ('flipdim', m3, 2);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
169 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
170 %! __fntestfunc__ ('transpose', m1);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
171 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
172 %! __fntestfunc__ ('transpose', m3);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
173 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
174 %! __fntestfunc__ ('ctranspose', m1);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
175 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
176 %! __fntestfunc__ ('ctranspose', m3);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
177 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
178 %! __fntestfunc__ ('rot90', m1);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
179 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
180 %! __fntestfunc__ ('rot90', m1, 2);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
181 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
182 %! __fntestfunc__ ('rot90', m1, -1);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
183 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
184 %! __fntestfunc__ ('rot90', m3);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
185 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
186 %! __fntestfunc__ ('rotdim', m2, 1, [1, 2]);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
187 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
188 %! __fntestfunc__ ('rotdim', m2, 2, [1, 2]);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
189 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
190 %! __fntestfunc__ ('rotdim', m2, -1, [1, 2]);
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
191 %!test
4fc7c16ee564 Add tests for preservation of type for functions that work on dimensions of the matrices
David Bateman <dbateman@free.fr>
parents:
diff changeset
192 %! __fntestfunc__ ('rotdim', m3, 1, [1, 2]);