Debian Codegraph @

matio-1.5.30/test/datasets/matio_test_cases.m

raw
1 % Generate test datasets for matio library
2 %
3 % Copyright 2010-2013 Christopher C. Hulbert. All rights reserved.
4 %
5 % Redistribution and use in source and binary forms, with or without
6 % modification, are permitted provided that the following conditions are met:
7 %
8 % 1. Redistributions of source code must retain the above copyright notice,
9 % this list of conditions and the following disclaimer.
10 %
11 % 2. Redistributions in binary form must reproduce the above copyright
12 % notice, this list of conditions and the following disclaimer in the
13 % documentation and/or other materials provided with the distribution.
14 %
15 % THIS SOFTWARE IS PROVIDED BY CHRISTOPHER C. HULBERT ``AS IS'' AND ANY EXPRESS
16 % OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 % OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
18 % EVENT SHALL CHRISTOPHER C. HULBERT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
19 % INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 % (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 % LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 % ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 % (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 % SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
26 [c,m,e]=computer;
27 if e == 'B'
28 e_str = '_be';
29 else
30 e_str = '_le';
31 end
32 rand('seed',931316785);
33
34 var1 = reshape(1:20,4,5);
35 var2 = reshape(single(1:20),4,5);
36 var3 = reshape(int64(1:20),4,5);
37 var4 = reshape(uint64(1:20),4,5);
38 var5 = reshape(int32(1:20),4,5);
39 var6 = reshape(uint32(1:20),4,5);
40 var7 = reshape(int16(1:20),4,5);
41 var8 = reshape(uint16(1:20),4,5);
42 var9 = reshape(int8(1:20),4,5);
43 var10 = reshape(uint8(1:20),4,5);
44 var11 = reshape(complex(1:20,21:40),4,5);
45 var12 = reshape(single(complex(1:20,21:40)),4,5);
46 var13 = reshape(int64(complex(1:20,21:40)),4,5);
47 var14 = reshape(uint64(complex(1:20,21:40)),4,5);
48 var15 = reshape(int32(complex(1:20,21:40)),4,5);
49 var16 = reshape(uint32(complex(1:20,21:40)),4,5);
50 var17 = reshape(int16(complex(1:20,21:40)),4,5);
51 var18 = reshape(uint16(complex(1:20,21:40)),4,5);
52 var19 = reshape(int8(complex(1:20,21:40)),4,5);
53 var20 = reshape(uint8(complex(1:20,21:40)),4,5);
54 var21 = sparse(diag(1:5));
55 var22 = sparse(diag(complex(1:5,6:10)));
56 var23 = [];
57 var24 = ['abcdefghijklmnopqrstuvwxyz';
58 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
59 '1234567890!@#$%^&*()-_=+`~';
60 '[{]}\|;:''",<.>/? '];
61
62 %% Structure Variables
63 var25 = struct();
64 var26 = repmat(struct('field1',[],'field2',[]),0,1);
65 var27(1).field1 = zeros(0,1);
66 var27(1).field2 = repmat(' ',0,1);
67 var27(2).field1 = repmat(struct,0,1);
68 var27(2).field2 = repmat({zeros(0,0)},0,1);
69 var28 = [struct('field1',1,'field2',reshape(2:13,3,4));
70 struct('field1',14,'field2',reshape(15:26,3,4))];
71 var29 = [struct('field1',single(1),'field2',reshape(single(2:13),3,4));
72 struct('field1',single(14),'field2',reshape(single(15:26),3,4))];
73 var30 = [struct('field1',int64(1),'field2',reshape(int64(2:13),3,4));
74 struct('field1',int64(14),'field2',reshape(int64(15:26),3,4))];
75 var31 = [struct('field1',uint64(1),'field2',reshape(uint64(2:13),3,4));
76 struct('field1',uint64(14),'field2',reshape(uint64(15:26),3,4))];
77 var32 = [struct('field1',int32(1),'field2',reshape(int32(2:13),3,4));
78 struct('field1',int32(14),'field2',reshape(int32(15:26),3,4))];
79 var33 = [struct('field1',uint32(1),'field2',reshape(uint32(2:13),3,4));
80 struct('field1',uint32(14),'field2',reshape(uint32(15:26),3,4))];
81 var34 = [struct('field1',int16(1),'field2',reshape(int16(2:13),3,4));
82 struct('field1',int16(14),'field2',reshape(int16(15:26),3,4))];
83 var35 = [struct('field1',uint16(1),'field2',reshape(uint16(2:13),3,4));
84 struct('field1',uint16(14),'field2',reshape(uint16(15:26),3,4))];
85 var36 = [struct('field1',int8(1),'field2',reshape(int8(2:13),3,4));
86 struct('field1',int8(14),'field2',reshape(int8(15:26),3,4))];
87 var37 = [struct('field1',uint8(1),'field2',reshape(uint8(2:13),3,4));
88 struct('field1',uint8(14),'field2',reshape(uint8(15:26),3,4))];
89 var38 = [struct('field1',1+51*j,'field2',reshape((2:13)+(52:63)*j,3,4));
90 struct('field1',14+64*j,'field2',reshape((15:26)+(65:76)*j,3,4))];
91 var39 = [struct('field1',single(1+51*j),...
92 'field2',reshape(single((2:13)+(52:63)*j),3,4));
93 struct('field1',single(14+64*j),...
94 'field2',reshape(single((15:26)+(65:76)*j),3,4))];
95 var40 = [struct('field1',int64(1+51*j),...
96 'field2',reshape(int64((2:13)+(52:63)*j),3,4));
97 struct('field1',int64(14+64*j),...
98 'field2',reshape(int64((15:26)+(65:76)*j),3,4))];
99 var41 = [struct('field1',uint64(1+51*j),...
100 'field2',reshape(uint64((2:13)+(52:63)*j),3,4));
101 struct('field1',uint64(14+64*j),...
102 'field2',reshape(uint64((15:26)+(65:76)*j),3,4))];
103 var42 = [struct('field1',int32(1+51*j),...
104 'field2',reshape(int32((2:13)+(52:63)*j),3,4));
105 struct('field1',int32(14+64*j),...
106 'field2',reshape(int32((15:26)+(65:76)*j),3,4))];
107 var43 = [struct('field1',uint32(1+51*j),...
108 'field2',reshape(uint32((2:13)+(52:63)*j),3,4));
109 struct('field1',uint32(14+64*j),...
110 'field2',reshape(uint32((15:26)+(65:76)*j),3,4))];
111 var44 = [struct('field1',int16(1+51*j),...
112 'field2',reshape(int16((2:13)+(52:63)*j),3,4));
113 struct('field1',int16(14+64*j),...
114 'field2',reshape(int16((15:26)+(65:76)*j),3,4))];
115 var45 = [struct('field1',uint16(1+51*j),...
116 'field2',reshape(uint16((2:13)+(52:63)*j),3,4));
117 struct('field1',uint16(14+64*j),...
118 'field2',reshape(uint16((15:26)+(65:76)*j),3,4))];
119 var46 = [struct('field1',int8(1+51*j),...
120 'field2',reshape(int8((2:13)+(52:63)*j),3,4));
121 struct('field1',int8(14+64*j),...
122 'field2',reshape(int8((15:26)+(65:76)*j),3,4))];
123 var47 = [struct('field1',uint8(1+51*j),...
124 'field2',reshape(uint8((2:13)+(52:63)*j),3,4));
125 struct('field1',uint8(14+64*j),...
126 'field2',reshape(uint8((15:26)+(65:76)*j),3,4))];
127 var48 = struct('field1',sparse(triu(reshape(1:20,4,5))),...
128 'field2',sparse(triu(reshape(1:20,4,5))'));
129 var49 = struct('field1',sparse(triu(reshape((1:20)+j*(21:40),4,5))),...
130 'field2',sparse(triu(reshape((1:20)+j*(21:40),4,5))'));
131 var50 = [struct('field1','abcdefghijklmnopqrstuvwxyz',...;
132 'field2','ABCDEFGHIJKLMNOPQRSTUVWXYZ');
133 struct('field1','1234567890!@#$%^&*()-_=+`~',...
134 'field2','[{]}\|;:''",<.>/? ')];
135
136 %% Cell-Array Variables
137 var51 = {};
138 var52 = {[] single([]) int64([]) uint64([]) int32([]) uint32([]) int16([]) uint16([]) int8([]) uint8([])};
139 var53 = {[1 2;3 4] [5 6 7;8 9 10] [11 12 13 14;15 16 17 18];
140 [19 20;21 22] [23 24;25 26;27 28] [29 30;31 32;33 34;35 36]};
141 var54 = {single([1 2;3 4]) single([5 6 7;8 9 10]) ...
142 single([11 12 13 14;15 16 17 18]); single([19 20;21 22]) ...
143 single([23 24;25 26;27 28]) single([29 30;31 32;33 34;35 36])};
144 var55 = {int64([1 2;3 4]) int64([5 6 7;8 9 10]) ...
145 int64([11 12 13 14;15 16 17 18]); int64([19 20;21 22]) ...
146 int64([23 24;25 26;27 28]) int64([29 30;31 32;33 34;35 36])};
147 var56 = {uint64([1 2;3 4]) uint64([5 6 7;8 9 10]) ...
148 uint64([11 12 13 14;15 16 17 18]); uint64([19 20;21 22]) ...
149 uint64([23 24;25 26;27 28]) uint64([29 30;31 32;33 34;35 36])};
150 var57 = {int32([1 2;3 4]) int32([5 6 7;8 9 10]) ...
151 int32([11 12 13 14;15 16 17 18]); int32([19 20;21 22]) ...
152 int32([23 24;25 26;27 28]) int32([29 30;31 32;33 34;35 36])};
153 var58 = {uint32([1 2;3 4]) uint32([5 6 7;8 9 10]) ...
154 uint32([11 12 13 14;15 16 17 18]); uint32([19 20;21 22]) ...
155 uint32([23 24;25 26;27 28]) uint32([29 30;31 32;33 34;35 36])};
156 var59 = {int16([1 2;3 4]) int16([5 6 7;8 9 10]) ...
157 int16([11 12 13 14;15 16 17 18]); int16([19 20;21 22]) ...
158 int16([23 24;25 26;27 28]) int16([29 30;31 32;33 34;35 36])};
159 var60 = {uint16([1 2;3 4]) uint16([5 6 7;8 9 10]) ...
160 uint16([11 12 13 14;15 16 17 18]); uint16([19 20;21 22]) ...
161 uint16([23 24;25 26;27 28]) uint16([29 30;31 32;33 34;35 36])};
162 var61 = {int8([1 2;3 4]) int8([5 6 7;8 9 10]) ...
163 int8([11 12 13 14;15 16 17 18]); int8([19 20;21 22]) ...
164 int8([23 24;25 26;27 28]) int8([29 30;31 32;33 34;35 36])};
165 var62 = {uint8([1 2;3 4]) uint8([5 6 7;8 9 10]) ...
166 uint8([11 12 13 14;15 16 17 18]); uint8([19 20;21 22]) ...
167 uint8([23 24;25 26;27 28]) uint8([29 30;31 32;33 34;35 36])};
168 var63 = {sparse(triu(reshape(1:20,4,5))) sparse(triu(reshape(1:20,4,5))')};
169 var64 = {sparse(triu(reshape((1:20)+j*(21:40),4,5)));
170 sparse(triu(reshape((1:20)+j*(21:40),4,5))')};
171 var65 = {'abcdefghijklmnopqrstuvwxyz' '1234567890!@#$%^&*()-_=+`~';
172 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' '[{]}\|;:''",<.>/? '};
173 var66 = {var25 var26 var27};
174 var67 = {var28 var29 var30 var31 var32 var33 var34 var35 var36 var37;
175 var38 var39 var40 var41 var42 var43 var44 var45 var46 var47};
176 var68 = {struct('field1',sparse(triu(reshape(1:20,4,5))),...
177 'field2',sparse(triu(reshape(1:20,4,5))'));
178 struct('field1',sparse(triu(reshape((1:20)+j*(21:40),4,5))),...
179 'field2',sparse(triu(reshape((1:20)+j*(21:40),4,5))'))};
180 var69 = {struct('field1','abcdefghijklmnopqrstuvwxyz',...;
181 'field2','ABCDEFGHIJKLMNOPQRSTUVWXYZ');
182 struct('field1','1234567890!@#$%^&*()-_=+`~',...
183 'field2','[{]}\|;:''",<.>/? ')};
184
185 int16_data = intmin('int16'):intmax('int16');
186 uint16_data = intmin('uint16'):intmax('uint16');
187 int8_data = int8(-128:127);
188 uint8_data = uint8(0:255);
189 var70 = reshape(1:32*32*32,32,32,32);
190 var71 = reshape(single(1:32*32*32),32,32,32);
191 var72 = reshape(int64(1:32*32*32),32,32,32);
192 var73 = reshape(uint64(1:32*32*32),32,32,32);
193 var74 = reshape(int32(1:32*32*32),32,32,32);
194 var75 = reshape(uint32(1:32*32*32),32,32,32);
195 var76 = reshape(int16(1:32*32*32),32,32,32);
196 var77 = reshape(uint16(1:32*32*32),32,32,32);
197 I = round(1+(numel(int8_data)-1)*rand(32,32,32));
198 J = round(1+(numel(int8_data)-1)*rand(32,32,32));
199 var78 = reshape(int8_data(I),32,32,32);
200 I = round(1+(numel(uint8_data)-1)*rand(32,32,32));
201 J = round(1+(numel(uint8_data)-1)*rand(32,32,32));
202 var79 = reshape(uint8_data(I),32,32,32);
203 var80 = reshape((1:2:2*32^3) + j*(2:2:2*32^3),32,32,32);
204 var81 = reshape(single((1:2:2*32^3) + j*(2:2:2*32^3)),32,32,32);
205 var82 = reshape(int64((1:2:2*32^3) + j*(2:2:2*32^3)),32,32,32);
206 var83 = reshape(uint64((1:2:2*32^3) + j*(2:2:2*32^3)),32,32,32);
207 var84 = reshape(int32((1:2:2*32^3) + j*(2:2:2*32^3)),32,32,32);
208 var85 = reshape(uint32((1:2:2*32^3) + j*(2:2:2*32^3)),32,32,32);
209 I = round(1+(numel(int16_data)-1)*rand(32,32,32));
210 J = round(1+(numel(int16_data)-1)*rand(32,32,32));
211 var86 = reshape(complex(int16_data(I),int16_data(J)),32,32,32);
212 I = round(1+(numel(uint16_data)-1)*rand(32,32,32));
213 J = round(1+(numel(uint16_data)-1)*rand(32,32,32));
214 var87 = reshape(complex(uint16_data(I),uint16_data(J)),32,32,32);
215 I = round(1+(numel(int8_data)-1)*rand(32,32,32));
216 J = round(1+(numel(int8_data)-1)*rand(32,32,32));
217 var88 = reshape(complex(int8_data(I),int8_data(J)),32,32,32);
218 I = round(1+(numel(uint8_data)-1)*rand(32,32,32));
219 J = round(1+(numel(uint8_data)-1)*rand(32,32,32));
220 var89 = reshape(complex(uint8_data(I),uint8_data(J)),32,32,32);
221
222 var90 = tril(true(5));
223 var91 = [struct('field1',logical(mod(reshape(0:19,4,5),2)),...
224 'field2',~mod(reshape(0:19,4,5),2));...
225 struct('field1',tril(true(5)),'field2',triu(true(5)))];
226 var92 = {logical(mod(reshape(0:19,4,5),2));~mod(reshape(0:19,4,5),2);...
227 tril(true(5));triu(true(5))};
228
229 var93 = cell(2,3);
230 var94 = cell2struct(var93, {'field1', 'field2'}, 1);
231 % slCharacterEncoding('UTF-8');
232 global var95;
233 var95 = char([1576, 1580, 1604, 1740; 273, 105, 7879, 110]);
234
235 save('-v6',['matio_test_cases_uncompressed' e_str '.mat'],'var*');
236 save('-v7',['matio_test_cases_compressed' e_str '.mat'],'var*');
237 save('-v7.3',['matio_test_cases_compressed_hdf' e_str '.mat'],'var*');
238 save('-v7.3','-nocompression',['matio_test_cases_uncompressed_hdf' e_str '.mat'],'var*');
239 save('-v4',['matio_test_cases_v4' e_str '.mat'],'var1','var11','var21',...
240 'var22','var24','var95');
241
242 x = pi;
243 save('-v4',['small_v4' e_str '.mat'],'x');