Mercurial > hg > octave-shane
changeset 2966:458cea5c8356
[project @ 1997-05-12 20:17:35 by jwe]
author | jwe |
---|---|
date | Mon, 12 May 1997 20:17:35 +0000 |
parents | a51926eab51a |
children | 467aae13b70a |
files | liboctave/ChangeLog liboctave/idx-vector.cc |
diffstat | 2 files changed, 27 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,5 +1,8 @@ Mon May 12 02:14:13 1997 John W. Eaton <jwe@bevo.che.wisc.edu> + * idx-vector.cc (IDX_VEC_REP::is_colon_equiv): Make it work when + the vector is not sorted. + * CMatrix.cc (ComplexMatrix::operator !): Return boolMatrix. * dMatrix.cc (Matrix::operator !): Likewise
--- a/liboctave/idx-vector.cc +++ b/liboctave/idx-vector.cc @@ -504,28 +504,39 @@ { colon_equiv = 1; } - else if (len > 0 && len > 1 && ! one_zero) + else if (len > 1 && ! one_zero) { - int *tmp_data = copy_data (data, len); - - int tmp_len = len; - if (sort_uniq) { + int *tmp_data = copy_data (data, len); + sort_data (tmp_data, len); - tmp_len = make_uniq (tmp_data, len); - } + int tmp_len = make_uniq (tmp_data, len); + + colon_equiv = (tmp_len == n + && tmp_data[0] == 0 + && tmp_data[tmp_len-1] == tmp_len - 1); - colon_equiv = ((tmp_len == 0 && n == 0) - || (tmp_len == n - && tmp_data[0] == 0 - && tmp_data[tmp_len-1] == tmp_len - 1)); + delete [] tmp_data; + } + else + { + if (len == n) + { + colon_equiv = 1; - delete [] tmp_data; + for (int ii = 0; ii < n; ii++) + if (data[ii] != ii) + { + colon_equiv = 0; + break; + } + } + } } else - colon_equiv = (len == 1 && n == 1 && data[0] == 0); + colon_equiv = (len == n && (n == 0 || (n == 1 && data[0] == 0))); colon_equiv_checked = 1; }