Mercurial > hg > octave-nkf
annotate test/test_func.m @ 7618:3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
author | David Bateman <dbateman@free.fr> |
---|---|
date | Thu, 20 Mar 2008 20:54:19 +0100 |
parents | 4fc7c16ee564 |
children | a41df65f3f00 |
rev | line source |
---|---|
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
|
1 ## Copyright (C) 2008 David Bateman |
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', ... |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
28 %! 'uint16', 'uint32', 'uint64', 'char', 'cell', '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
|
29 %! |
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 %! cmplx = [2, 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
|
31 %! 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
|
32 %! 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
|
33 %! 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
|
34 %! 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
|
35 %! |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
36 %! 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
|
37 %! 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
|
38 %! 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
|
39 %! 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
|
40 %! |
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 %! 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
|
42 %! 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
|
43 %! 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
|
44 %! endif |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
45 %! 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
|
46 %! |
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 %! 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
|
48 %! 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
|
49 %! 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
|
50 %! 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
|
51 %! 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
|
52 %! 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
|
53 %! 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
|
54 %! 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
|
55 %! 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
|
56 %! 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
|
57 %! 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
|
58 %! 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
|
59 %! 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
|
60 %! 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
|
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 %! 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
|
63 %! 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
|
64 %! 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
|
65 %! 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
|
66 %! 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
|
67 %! endif |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
68 %! 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
|
69 %! m = num2cell (m); |
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
70 %! 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
|
71 %! 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
|
72 %! 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
|
73 %! |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
74 %! 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
|
75 %! 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
|
76 %! 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
|
77 %! 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
|
78 %! 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
|
79 %! endif |
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
80 %! 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
|
81 %! 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
|
82 %! 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
|
83 %! 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
|
84 %! 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
|
85 %! 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
|
86 %! 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
|
87 |
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 %!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
|
89 %! 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
|
90 %! 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
|
91 %! 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
|
92 %! 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
|
93 |
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 %!test |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
95 %! __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
|
96 %!test |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
97 %! __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
|
98 %!test |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
99 %! __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
|
100 %!test |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
101 %! __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
|
102 %!test |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
103 %! __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
|
104 %!test |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
105 %! __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
|
106 %!test |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
107 %! __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
|
108 %!test |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
109 %! __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
|
110 %!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
|
111 %! __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
|
112 %!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
|
113 %! __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
|
114 %!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
|
115 %! __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
|
116 %!test |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
117 %! __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
|
118 %!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
|
119 %! __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
|
120 %!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
|
121 %! __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
|
122 %!test |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
123 %! __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
|
124 %!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
|
125 %! __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
|
126 %!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
|
127 %! __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
|
128 %!test |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
129 %! __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
|
130 %!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
|
131 %! __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
|
132 %!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
|
133 %! __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
|
134 %!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
|
135 %! __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
|
136 %!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
|
137 %! __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
|
138 %!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
|
139 %! __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
|
140 %!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
|
141 %! __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
|
142 %!test |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
143 %! __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
|
144 %!test |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
145 %! __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
|
146 %!test |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
147 %! __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
|
148 %!test |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
149 %! __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
|
150 %!test |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
151 %! __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
|
152 %!test |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
153 %! __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
|
154 %!test |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7613
diff
changeset
|
155 %! __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
|
156 %!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
|
157 %! __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
|
158 %!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
|
159 %! __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
|
160 %!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
|
161 %! __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
|
162 %!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
|
163 %! __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
|
164 %!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
|
165 %! __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
|
166 %!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
|
167 %! __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
|
168 %!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
|
169 %! __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
|
170 %!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
|
171 %! __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
|
172 %!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
|
173 %! __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
|
174 %!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
|
175 %! __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
|
176 %!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
|
177 %! __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
|
178 %!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
|
179 %! __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
|
180 %!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
|
181 %! __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
|
182 %!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
|
183 %! __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
|
184 %!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
|
185 %! __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
|
186 %!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
|
187 %! __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
|
188 %!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
|
189 %! __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
|
190 %!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
|
191 %! __fntestfunc__ ('rotdim', m3, 1, [1, 2]); |