Mercurial > hg > octave-lyh
changeset 4757:c48180a45d34
[project @ 2004-02-13 22:13:52 by jwe]
author | jwe |
---|---|
date | Fri, 13 Feb 2004 22:13:52 +0000 |
parents | 60c78bde10e5 |
children | a308566c8b42 |
files | liboctave/Array.cc |
diffstat | 1 files changed, 22 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -1441,13 +1441,13 @@ dim_vector lhs_dims = dims (); int n_lhs_dims = lhs_dims.length (); - + Array<int> idx_is_colon (n_idx, 0); Array<int> idx_is_colon_equiv (n_idx, 0); // Initialization of colon arrays. - + for (int i = 0; i < n_idx; i++) { idx_is_colon_equiv(i) = ra_idx(i).is_colon_equiv (lhs_dims(i), 1); @@ -1464,12 +1464,12 @@ if (! (idx_is_colon(i) || idx_is_colon_equiv(i))) { ra_idx(i).sort (true); - + if (ra_idx(i).max () > lhs_dims(i)) { (*current_liboctave_error_handler) ("index exceeds array dimensions"); - + idx_ok = false; break; } @@ -1483,13 +1483,13 @@ } } } - + if (n_idx <= n_lhs_dims) { int last_idx = ra_idx(n_idx-1).max (); - + int sum_el = lhs_dims(n_idx-1); - + for (int i = n_idx; i < n_lhs_dims; i++) sum_el *= lhs_dims(i); @@ -1500,7 +1500,7 @@ idx_ok = false; } - } + } if (idx_ok) { @@ -1701,19 +1701,19 @@ // A(3:5) = []; A(6)=[] // idx_vector idx_vec = ra_idx(0); - + int num_to_delete = idx_vec.capacity (); - + int lhs_numel = numel (); - - int new_numel = lhs_numel - num_to_delete; + + int new_numel = lhs_numel - num_to_delete; T *new_data = new T[new_numel]; - + Array<int> lhs_ra_idx (ndims (), 0); - + int ii = 0; - int iidx = 0; + int iidx = 0; for (int i = 0; i < lhs_numel; i++) { @@ -1735,7 +1735,7 @@ Array<T>::rep = new typename Array<T>::ArrayRep (new_data, new_numel); dimensions.resize (2); - + if (lhs_dims.length () == 2 && lhs_dims(1) == 1) { dimensions(0) = new_numel; @@ -1981,7 +1981,7 @@ int orig_len = dims().numel (); - dim_vector idx_orig_dims = ra_idx.orig_dimensions (); + dim_vector idx_orig_dims = ra_idx.orig_dimensions (); if (ra_idx.is_colon ()) { @@ -2001,7 +2001,7 @@ retval = Array<T> (tmp, dim_vector (0, 0)); } else if (vector_equivalent (dims ())) - { + { // We're getting elements from a vector equivalent i.e. (1x4x1). Array<T> tmp = Array<T>::index (ra_idx, resize_ok); @@ -2066,7 +2066,7 @@ ra_idx.freeze (orig_len, "nd-array", resize_ok); if (ra_idx) - { + { dim_vector result_dims (idx_orig_dims); if (ra_idx.one_zero_only ()) @@ -2228,7 +2228,7 @@ for (int i = 0; i < n; i++) { - elt_idx = get_elt_idx (ra_idx, result_idx); + elt_idx = get_elt_idx (ra_idx, result_idx); int numelem_elt = get_scalar_idx (elt_idx, this_dims); @@ -2402,7 +2402,7 @@ int rhs_nr = rhs.rows (); int rhs_nc = rhs.cols (); - + if (rhs.length () > 2) { dim_vector dv_tmp = rhs.squeeze().dims (); @@ -2967,7 +2967,7 @@ } lhs.chop_trailing_singletons (); - + lhs.clear_index (); return retval;