Mercurial > hg > octave-nkf
changeset 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 | 279d4bde41d5 |
children | 3d862202c4f6 |
files | scripts/testfun/assert.m |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/testfun/assert.m +++ b/scripts/testfun/assert.m @@ -284,8 +284,13 @@ exclude = errseen | ! isfinite (A_null_imag) & ! isfinite (B_null_imag); A_null_imag(exclude) = 0; B_null_imag(exclude) = 0; - A_null = complex (A_null_real, A_null_imag); - B_null = complex (B_null_real, B_null_imag); + if (issparse (A) || issparse (B)) + A_null = sparse (complex (full (A_null_real), full (A_null_imag))); + B_null = sparse (complex (full (B_null_real), full (B_null_imag))); + else + A_null = complex (A_null_real, A_null_imag); + B_null = complex (B_null_real, B_null_imag); + endif if (isscalar (tol)) mtol = tol * ones (size (A)); else