Mercurial > hg > camir-aes2014
comparison toolboxes/FullBNT-1.0.7/KPMstats/rndcheck.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
1 function [errorcode, rows, columns] = rndcheck(nargs,nparms,arg1,arg2,arg3,arg4,arg5) | |
2 %RNDCHECK error checks the argument list for the random number generators. | |
3 | |
4 % B.A. Jones 1-22-93 | |
5 % Copyright (c) 1993-98 by The MathWorks, Inc. | |
6 % $Revision: 1.1.1.1 $ $Date: 2005/04/26 02:29:22 $ | |
7 | |
8 sizeinfo = nargs - nparms; | |
9 errorcode = 0; | |
10 | |
11 if nparms == 3 | |
12 [r1 c1] = size(arg1); | |
13 [r2 c2] = size(arg2); | |
14 [r3 c3] = size(arg3); | |
15 end | |
16 | |
17 if nparms == 2 | |
18 [r1 c1] = size(arg1); | |
19 [r2 c2] = size(arg2); | |
20 end | |
21 | |
22 if sizeinfo == 0 | |
23 if nparms == 1 | |
24 [rows columns] = size(arg1); | |
25 end | |
26 | |
27 if nparms == 2 | |
28 scalararg1 = (prod(size(arg1)) == 1); | |
29 scalararg2 = (prod(size(arg2)) == 1); | |
30 if ~scalararg1 & ~scalararg2 | |
31 if r1 ~= r2 | c1 ~= c2 | |
32 errorcode = 1; | |
33 return; | |
34 end | |
35 end | |
36 if ~scalararg1 | |
37 [rows columns] = size(arg1); | |
38 elseif ~scalararg2 | |
39 [rows columns] = size(arg2); | |
40 else | |
41 [rows columns] = size(arg1); | |
42 end | |
43 end | |
44 | |
45 if nparms == 3 | |
46 scalararg1 = (prod(size(arg1)) == 1); | |
47 scalararg2 = (prod(size(arg2)) == 1); | |
48 scalararg3 = (prod(size(arg3)) == 1); | |
49 | |
50 if ~scalararg1 & ~scalararg2 | |
51 if r1 ~= r2 | c1 ~= c2 | |
52 errorcode = 1; | |
53 return; | |
54 end | |
55 end | |
56 | |
57 if ~scalararg1 & ~scalararg3 | |
58 if r1 ~= r3 | c1 ~= c3 | |
59 errorcode = 1; | |
60 return; | |
61 end | |
62 end | |
63 | |
64 if ~scalararg3 & ~scalararg2 | |
65 if r3 ~= r2 | c3 ~= c2 | |
66 errorcode = 1; | |
67 return; | |
68 end | |
69 end | |
70 if ~scalararg1 | |
71 [rows columns] = size(arg1); | |
72 elseif ~scalararg2 | |
73 [rows columns] = size(arg2); | |
74 else | |
75 [rows columns] = size(arg3); | |
76 end | |
77 end | |
78 end | |
79 | |
80 if sizeinfo == 1 | |
81 scalararg1 = (prod(size(arg1)) == 1); | |
82 if nparms == 1 | |
83 if prod(size(arg2)) ~= 2 | |
84 errorcode = 2; | |
85 return; | |
86 end | |
87 if ~scalararg1 & arg2 ~= size(arg1) | |
88 errorcode = 3; | |
89 return; | |
90 end | |
91 if (arg2(1) < 0 | arg2(2) < 0 | arg2(1) ~= round(arg2(1)) | arg2(2) ~= round(arg2(2))), | |
92 errorcode = 4; | |
93 return; | |
94 end | |
95 rows = arg2(1); | |
96 columns = arg2(2); | |
97 end | |
98 | |
99 if nparms == 2 | |
100 if prod(size(arg3)) ~= 2 | |
101 errorcode = 2; | |
102 return; | |
103 end | |
104 scalararg2 = (prod(size(arg2)) == 1); | |
105 if ~scalararg1 & ~scalararg2 | |
106 if r1 ~= r2 | c1 ~= c2 | |
107 errorcode = 1; | |
108 return; | |
109 end | |
110 end | |
111 if (arg3(1) < 0 | arg3(2) < 0 | arg3(1) ~= round(arg3(1)) | arg3(2) ~= round(arg3(2))), | |
112 errorcode = 4; | |
113 return; | |
114 end | |
115 if ~scalararg1 | |
116 if any(arg3 ~= size(arg1)) | |
117 errorcode = 3; | |
118 return; | |
119 end | |
120 [rows columns] = size(arg1); | |
121 elseif ~scalararg2 | |
122 if any(arg3 ~= size(arg2)) | |
123 errorcode = 3; | |
124 return; | |
125 end | |
126 [rows columns] = size(arg2); | |
127 else | |
128 rows = arg3(1); | |
129 columns = arg3(2); | |
130 end | |
131 end | |
132 | |
133 if nparms == 3 | |
134 if prod(size(arg4)) ~= 2 | |
135 errorcode = 2; | |
136 return; | |
137 end | |
138 scalararg1 = (prod(size(arg1)) == 1); | |
139 scalararg2 = (prod(size(arg2)) == 1); | |
140 scalararg3 = (prod(size(arg3)) == 1); | |
141 | |
142 if (arg4(1) < 0 | arg4(2) < 0 | arg4(1) ~= round(arg4(1)) | arg4(2) ~= round(arg4(2))), | |
143 errorcode = 4; | |
144 return; | |
145 end | |
146 | |
147 if ~scalararg1 & ~scalararg2 | |
148 if r1 ~= r2 | c1 ~= c2 | |
149 errorcode = 1; | |
150 return; | |
151 end | |
152 end | |
153 | |
154 if ~scalararg1 & ~scalararg3 | |
155 if r1 ~= r3 | c1 ~= c3 | |
156 errorcode = 1; | |
157 return; | |
158 end | |
159 end | |
160 | |
161 if ~scalararg3 & ~scalararg2 | |
162 if r3 ~= r2 | c3 ~= c2 | |
163 errorcode = 1; | |
164 return; | |
165 end | |
166 end | |
167 if ~scalararg1 | |
168 if any(arg4 ~= size(arg1)) | |
169 errorcode = 3; | |
170 return; | |
171 end | |
172 [rows columns] = size(arg1); | |
173 elseif ~scalararg2 | |
174 if any(arg4 ~= size(arg2)) | |
175 errorcode = 3; | |
176 return; | |
177 end | |
178 [rows columns] = size(arg2); | |
179 elseif ~scalararg3 | |
180 if any(arg4 ~= size(arg3)) | |
181 errorcode = 3; | |
182 return; | |
183 end | |
184 [rows columns] = size(arg3); | |
185 else | |
186 rows = arg4(1); | |
187 columns = arg4(2); | |
188 end | |
189 end | |
190 end | |
191 | |
192 if sizeinfo == 2 | |
193 if nparms == 1 | |
194 scalararg1 = (prod(size(arg1)) == 1); | |
195 if ~scalararg1 | |
196 [rows columns] = size(arg1); | |
197 if rows ~= arg2 | columns ~= arg3 | |
198 errorcode = 3; | |
199 return; | |
200 end | |
201 end | |
202 if (arg2 < 0 | arg3 < 0 | arg2 ~= round(arg2) | arg3 ~= round(arg3)), | |
203 errorcode = 4; | |
204 return; | |
205 end | |
206 rows = arg2; | |
207 columns = arg3; | |
208 end | |
209 | |
210 if nparms == 2 | |
211 scalararg1 = (prod(size(arg1)) == 1); | |
212 scalararg2 = (prod(size(arg2)) == 1); | |
213 if ~scalararg1 & ~scalararg2 | |
214 if r1 ~= r2 | c1 ~= c2 | |
215 errorcode = 1; | |
216 return; | |
217 end | |
218 end | |
219 if ~scalararg1 | |
220 [rows columns] = size(arg1); | |
221 if rows ~= arg3 | columns ~= arg4 | |
222 errorcode = 3; | |
223 return; | |
224 end | |
225 elseif ~scalararg2 | |
226 [rows columns] = size(arg2); | |
227 if rows ~= arg3 | columns ~= arg4 | |
228 errorcode = 3; | |
229 return; | |
230 end | |
231 else | |
232 if (arg3 < 0 | arg4 < 0 | arg3 ~= round(arg3) | arg4 ~= round(arg4)), | |
233 errorcode = 4; | |
234 return; | |
235 end | |
236 rows = arg3; | |
237 columns = arg4; | |
238 end | |
239 end | |
240 | |
241 if nparms == 3 | |
242 scalararg1 = (prod(size(arg1)) == 1); | |
243 scalararg2 = (prod(size(arg2)) == 1); | |
244 scalararg3 = (prod(size(arg3)) == 1); | |
245 | |
246 if ~scalararg1 & ~scalararg2 | |
247 if r1 ~= r2 | c1 ~= c2 | |
248 errorcode = 1; | |
249 return; | |
250 end | |
251 end | |
252 | |
253 if ~scalararg1 & ~scalararg3 | |
254 if r1 ~= r3 | c1 ~= c3 | |
255 errorcode = 1; | |
256 return; | |
257 end | |
258 end | |
259 | |
260 if ~scalararg3 & ~scalararg2 | |
261 if r3 ~= r2 | c3 ~= c2 | |
262 errorcode = 1; | |
263 return; | |
264 end | |
265 end | |
266 | |
267 if ~scalararg1 | |
268 [rows columns] = size(arg1); | |
269 if rows ~= arg4 | columns ~= arg5 | |
270 errorcode = 3; | |
271 return; | |
272 end | |
273 elseif ~scalararg2 | |
274 [rows columns] = size(arg2); | |
275 if rows ~= arg4 | columns ~= arg5 | |
276 errorcode = 3; | |
277 return; | |
278 end | |
279 elseif ~scalararg3 | |
280 [rows columns] = size(arg3); | |
281 if rows ~= arg4 | columns ~= arg5 | |
282 errorcode = 3; | |
283 return; | |
284 end | |
285 else | |
286 if (arg4 < 0 | arg5 < 0 | arg4 ~= round(arg4) | arg5 ~= round(arg5)), | |
287 errorcode = 4; | |
288 return; | |
289 end | |
290 rows = arg4; | |
291 columns = arg5; | |
292 end | |
293 end | |
294 end |