Mercurial > forge
comparison extra/NaN/inst/nantest.m @ 12656:ddbd9137910a octave-forge
fix nantest to avoid crashing Octave 4.0.0 on Windows
author | schloegl |
---|---|
date | Thu, 02 Jul 2015 11:14:16 +0000 |
parents | 9a277c75a100 |
children | aca981120490 |
comparison
equal
deleted
inserted
replaced
12655:70d4171ae21a | 12656:ddbd9137910a |
---|---|
225 %(roots([5,0,0])-[0;0]) | 225 %(roots([5,0,0])-[0;0]) |
226 %(roots([2,-10,12])-[3;2]) | 226 %(roots([2,-10,12])-[3;2]) |
227 %(roots([2e-37,-2,2])-[1e37;1]) | 227 %(roots([2e-37,-2,2])-[1e37;1]) |
228 %%%%% check nan/nan %% this test addresses a problem in Matlab 5.3, 6.1 & 6.5 | 228 %%%%% check nan/nan %% this test addresses a problem in Matlab 5.3, 6.1 & 6.5 |
229 p = 4; | 229 p = 4; |
230 tmp1 = repmat(nan, 4); | |
231 tmp2 = repmat(nan, 4); | |
232 if ~ispc | |
230 try | 233 try |
231 tmp1 = repmat(nan,p)/repmat(nan,p); | 234 tmp1 = repmat(nan,p)/repmat(nan,p); |
232 catch % exception error in Octave 3.8.2 of debian wheezy | 235 catch % exception error in Octave 3.8.2 of debian wheezy |
233 tmp1 = repmat(nan, 4); | 236 fprintf(2,'repmat(nan,4)/repmat(nan,4) fails with an exception\n'); |
234 end; | 237 end; |
235 try | 238 try |
236 tmp2 = repmat(nan,p)\repmat(nan,p); | 239 tmp2 = repmat(nan,p)\repmat(nan,p); |
237 catch % exception error in Octave 3.8.2 of debian wheezy | 240 catch % exception error in Octave 3.8.2 of debian wheezy |
238 tmp2 = repmat(nan, 4); | 241 fprintf(2,'repmat(nan,4)\repmat(nan,4) fails with an exception\n'); |
239 end | 242 end |
243 end; | |
240 tmp3 = repmat(0,p)/repmat(0,p); | 244 tmp3 = repmat(0,p)/repmat(0,p); |
241 tmp4 = repmat(0,p)\repmat(0,p); | 245 tmp4 = repmat(0,p)\repmat(0,p); |
242 tmp5 = repmat(0,p)*repmat(inf,p); | 246 tmp5 = repmat(0,p)*repmat(inf,p); |
243 tmp6 = repmat(inf,p)*repmat(0,p); | 247 tmp6 = repmat(inf,p)*repmat(0,p); |
244 x = randn(100,1)*ones(1,p); y=x'*x; | 248 x = randn(100,1)*ones(1,p); y=x'*x; |
276 | 280 |
277 %warning(FLAG_WARNING); | 281 %warning(FLAG_WARNING); |
278 | 282 |
279 | 283 |
280 %%%%% QUANTILE TEST | 284 %%%%% QUANTILE TEST |
281 d = [1 1 2 2 4 4 10 700]; | 285 d = [1 1 2 2 4 4 10 700]'; |
282 q = [-1,0,.05,.1,.25,.49,.5,.51,.75,.8, .999999,1,2]; | 286 q = [-1,0,.05,.1,.25,.49,.5,.51,.75,.8, .999999,1,2]; |
283 r = [ NaN, 1, 1, 1, 1.5, 2, 3, 4, 7, 10, 700, 700, NaN]; | 287 r = [ NaN, 1, 1, 1, 1.5, 2, 3, 4, 7, 10, 700, 700, NaN]; |
284 if any( quantile(d, q) - r>0) | 288 if any( quantile(d, q)' - r>0) |
285 fprintf(1,'Quantile(1): failed\n'); | 289 fprintf(1,'Quantile(1): failed\n'); |
286 else | 290 else |
287 fprintf(1,'Quantile(1): OK\n'); | 291 fprintf(1,'Quantile(1): OK\n'); |
288 end; | 292 end; |
289 if exist('histo3','file') | 293 if exist('histo3','file') |
290 H = histo3(d'); | 294 H = histo3(d); |
291 else | 295 else |
292 H.X = [1;2;4;10;700]; | 296 H.X = [1;2;4;10;700]; |
293 H.H = [2;2;2;1;1]; | 297 H.H = [2;2;2;1;1]; |
294 H.datatype = 'HISTOGRAM'; | 298 H.datatype = 'HISTOGRAM'; |
295 end; | 299 end; |