Mercurial > octave-nkf
comparison liboctave/Array.cc @ 4832:f9262b65c7d9
[project @ 2004-03-10 06:57:03 by jwe]
author | jwe |
---|---|
date | Wed, 10 Mar 2004 06:57:03 +0000 |
parents | e78bc84ac0d3 |
children | 8f669cc5a901 |
comparison
equal
deleted
inserted
replaced
4831:4ec7d24b4943 | 4832:f9262b65c7d9 |
---|---|
1969 int nr = dim1 (); | 1969 int nr = dim1 (); |
1970 int nc = dim2 (); | 1970 int nc = dim2 (); |
1971 | 1971 |
1972 int orig_len = nr * nc; | 1972 int orig_len = nr * nc; |
1973 | 1973 |
1974 dim_vector idx_orig_dims = idx_arg.orig_dimensions (); | |
1975 | |
1974 int idx_orig_rows = idx_arg.orig_rows (); | 1976 int idx_orig_rows = idx_arg.orig_rows (); |
1975 int idx_orig_columns = idx_arg.orig_columns (); | 1977 int idx_orig_columns = idx_arg.orig_columns (); |
1976 | 1978 |
1977 if (idx_arg.is_colon ()) | 1979 if (idx_arg.is_colon ()) |
1978 { | 1980 { |
1990 int len = tmp.length (); | 1992 int len = tmp.length (); |
1991 | 1993 |
1992 if (len == 0 && idx_arg.one_zero_only ()) | 1994 if (len == 0 && idx_arg.one_zero_only ()) |
1993 retval = Array<T> (tmp, dim_vector (0, 0)); | 1995 retval = Array<T> (tmp, dim_vector (0, 0)); |
1994 else | 1996 else |
1995 retval = Array<T> (tmp, dim_vector (idx_orig_rows, idx_orig_columns)); | 1997 retval = Array<T> (tmp, idx_orig_dims); |
1996 } | 1998 } |
1997 else if (nr == 1 || nc == 1) | 1999 else if (nr == 1 || nc == 1) |
1998 { | 2000 { |
1999 // If indexing a vector with a matrix, return value has same | 2001 // If indexing a vector with a matrix, return value has same |
2000 // shape as the index. Otherwise, it has same orientation as | 2002 // shape as the index. Otherwise, it has same orientation as |
2011 retval = Array<T> (tmp, dim_vector (1, len)); | 2013 retval = Array<T> (tmp, dim_vector (1, len)); |
2012 else | 2014 else |
2013 retval = Array<T> (tmp, dim_vector (len, 1)); | 2015 retval = Array<T> (tmp, dim_vector (len, 1)); |
2014 } | 2016 } |
2015 else | 2017 else |
2016 retval = Array<T> (tmp, dim_vector (idx_orig_rows, idx_orig_columns)); | 2018 retval = Array<T> (tmp, idx_orig_dims); |
2017 } | 2019 } |
2018 else | 2020 else |
2019 { | 2021 { |
2020 if (liboctave_wfi_flag | 2022 if (liboctave_wfi_flag |
2021 && ! (idx_arg.one_zero_only () | 2023 && ! (idx_arg.one_zero_only () |