# HG changeset patch # User jwe # Date 831086405 0 # Node ID 320f5463c2012ecbe8693747d48af66547500edb # Parent 07227f04abc5105b657f4c80fc8dd0be4fc172ee [project @ 1996-05-03 01:19:22 by jwe] diff -r 07227f04abc5 -r 320f5463c201 liboctave/Array-idx.h --- a/liboctave/Array-idx.h Thu May 02 15:50:53 1996 +0000 +++ b/liboctave/Array-idx.h Fri May 03 01:20:05 1996 +0000 @@ -204,6 +204,19 @@ retval = 0; } } + else if (idx.is_colon ()) + { + if (lhs_len == 0) + { + lhs.resize (rhs_len); + + for (int i = 0; i < rhs_len; i++) + lhs.elem (i) = rhs.elem (i); + } + else + (*current_liboctave_error_handler) + ("A(:) = X: A must be the same size as X"); + } else { (*current_liboctave_error_handler) diff -r 07227f04abc5 -r 320f5463c201 liboctave/Array2-idx.h --- a/liboctave/Array2-idx.h Thu May 02 15:50:53 1996 +0000 +++ b/liboctave/Array2-idx.h Fri May 03 01:20:05 1996 +0000 @@ -392,8 +392,9 @@ } else if (n_idx == 1) { - if (lhs_nr == 0 || lhs_nc == 0 - || (lhs_nr == 1 && lhs_nc == 1)) + int lhs_is_empty = lhs_nr == 0 || lhs_nc == 0; + + if (lhs_is_empty || (lhs_nr == 1 && lhs_nc == 1)) { idx_vector *tmp = lhs.get_idx (); @@ -414,6 +415,13 @@ lhs.maybe_delete_elements (idx, tmp); } } + else if (! liboctave_dfi_flag && lhs_is_empty + && idx.is_colon () + && ! (rhs_nr == 1 || rhs_nc == 1)) + { + (*current_liboctave_error_handler) + ("A(:) = X: X must be a vector"); + } else { if (assign ((Array&) lhs, (Array&) rhs)) @@ -425,6 +433,9 @@ int idx_nr = idx.orig_rows (); int idx_nc = idx.orig_columns (); + // lhs_is_empty now means that lhs was + // *originally* empty. + if (liboctave_dfi_flag || (idx_nr == 1 && idx_nc == 1)) { @@ -439,6 +450,11 @@ lhs.d2 = lhs.length (); } } + else if (lhs_is_empty && idx.is_colon ()) + { + lhs.d1 = rhs.d1; + lhs.d2 = rhs.d2; + } else if (idx_nr == 1 && rhs_nr == 1) { lhs.d1 = 1;