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