annotate toolboxes/FullBNT-1.0.7/KPMstats/rndcheck.m @ 0:cc4b1211e677 tip

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