# HG changeset patch # User jwe # Date 1173291647 0 # Node ID e8c42df3d234b31c1b1f327fc5ac3fb51d3b89a2 # Parent 3f3e86e9fb57eb2de4ce60d0bc9e4731ff1688e8 [project @ 2007-03-07 18:20:46 by jwe] diff -r 3f3e86e9fb57 -r e8c42df3d234 liboctave/Array.cc --- a/liboctave/Array.cc Wed Mar 07 18:14:44 2007 +0000 +++ b/liboctave/Array.cc Wed Mar 07 18:20:47 2007 +0000 @@ -2525,38 +2525,40 @@ retval = 0; } - - if (rhs_len == n || rhs_len == 1) - { - octave_idx_type max_idx = lhs_idx.max () + 1; - if (max_idx > lhs_len) - lhs.resize_and_fill (max_idx, rfv); - } - - if (rhs_len == n) - { - for (octave_idx_type i = 0; i < n; i++) - { - octave_idx_type ii = lhs_idx.elem (i); - lhs.elem (ii) = rhs.elem (i); - } - } - else if (rhs_len == 1) - { - RT scalar = rhs.elem (0); - - for (octave_idx_type i = 0; i < n; i++) - { - octave_idx_type ii = lhs_idx.elem (i); - lhs.elem (ii) = scalar; - } - } else { - (*current_liboctave_error_handler) - ("A(I) = X: X must be a scalar or a vector with same length as I"); - - retval = 0; + if (rhs_len == n || rhs_len == 1) + { + octave_idx_type max_idx = lhs_idx.max () + 1; + if (max_idx > lhs_len) + lhs.resize_and_fill (max_idx, rfv); + } + + if (rhs_len == n) + { + for (octave_idx_type i = 0; i < n; i++) + { + octave_idx_type ii = lhs_idx.elem (i); + lhs.elem (ii) = rhs.elem (i); + } + } + else if (rhs_len == 1) + { + RT scalar = rhs.elem (0); + + for (octave_idx_type i = 0; i < n; i++) + { + octave_idx_type ii = lhs_idx.elem (i); + lhs.elem (ii) = scalar; + } + } + else + { + (*current_liboctave_error_handler) + ("A(I) = X: X must be a scalar or a vector with same length as I"); + + retval = 0; + } } } else if (lhs_idx.is_colon ()) diff -r 3f3e86e9fb57 -r e8c42df3d234 liboctave/ChangeLog --- a/liboctave/ChangeLog Wed Mar 07 18:14:44 2007 +0000 +++ b/liboctave/ChangeLog Wed Mar 07 18:20:47 2007 +0000 @@ -1,5 +1,7 @@ 2007-03-07 John W. Eaton + * Array.cc (assign1): Avoid resizing if there is an error. + * dMatrix.cc, CMatrix.cc (operator *): Only check f77_exception_encountered immediately after calls that use F77_XFCN. diff -r 3f3e86e9fb57 -r e8c42df3d234 scripts/ChangeLog --- a/scripts/ChangeLog Wed Mar 07 18:14:44 2007 +0000 +++ b/scripts/ChangeLog Wed Mar 07 18:20:47 2007 +0000 @@ -1,3 +1,8 @@ +2007-03-07 John W. Eaton + + * testfun/assert.m: Check that number of dimensions match before + checking dimensions. + 2007-03-07 Muthiah Annamalai * specfun/perms.m, specfun/factorial.m: Check args. diff -r 3f3e86e9fb57 -r e8c42df3d234 scripts/testfun/assert.m --- a/scripts/testfun/assert.m Wed Mar 07 18:14:44 2007 +0000 +++ b/scripts/testfun/assert.m Wed Mar 07 18:20:47 2007 +0000 @@ -100,8 +100,8 @@ endif elseif (isstruct (expected)) - if (!isstruct (cond) || any(size(cond) != size(expected)) || ... - rows(struct_elements(cond)) != rows(struct_elements(expected))) + if (!isstruct (cond) || any(size(cond) != size(expected)) + || rows(struct_elements(cond)) != rows(struct_elements(expected))) iserror = 1; else try @@ -121,7 +121,8 @@ elseif (isempty (expected)) iserror = (any (size (cond) != size (expected))); - elseif (any (size (cond) != size (expected))) + elseif (ndims (cond) != ndims (expected) + || any (size (cond) != size (expected))) iserror = 1; coda = "Dimensions don't match";