Mercurial > octave
comparison scripts/testfun/assert.m @ 17684:1d41b1910531
assert.m: Fix segfault when both inputs are complex, sparse matrices.
* scripts/testfun/assert.m: Convert sparse->full before calling complex().
Convert back to sparse after function call.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 18 Oct 2013 09:01:57 -0700 |
parents | fc4df284efc8 |
children | 79d6af38b96f |
comparison
equal
deleted
inserted
replaced
17683:279d4bde41d5 | 17684:1d41b1910531 |
---|---|
282 A_null_imag = imag (A); | 282 A_null_imag = imag (A); |
283 B_null_imag = imag (B); | 283 B_null_imag = imag (B); |
284 exclude = errseen | ! isfinite (A_null_imag) & ! isfinite (B_null_imag); | 284 exclude = errseen | ! isfinite (A_null_imag) & ! isfinite (B_null_imag); |
285 A_null_imag(exclude) = 0; | 285 A_null_imag(exclude) = 0; |
286 B_null_imag(exclude) = 0; | 286 B_null_imag(exclude) = 0; |
287 A_null = complex (A_null_real, A_null_imag); | 287 if (issparse (A) || issparse (B)) |
288 B_null = complex (B_null_real, B_null_imag); | 288 A_null = sparse (complex (full (A_null_real), full (A_null_imag))); |
289 B_null = sparse (complex (full (B_null_real), full (B_null_imag))); | |
290 else | |
291 A_null = complex (A_null_real, A_null_imag); | |
292 B_null = complex (B_null_real, B_null_imag); | |
293 endif | |
289 if (isscalar (tol)) | 294 if (isscalar (tol)) |
290 mtol = tol * ones (size (A)); | 295 mtol = tol * ones (size (A)); |
291 else | 296 else |
292 mtol = tol; | 297 mtol = tol; |
293 endif | 298 endif |