comparison liboctave/Array.cc @ 4828:e78bc84ac0d3

[project @ 2004-03-09 22:36:55 by jwe]
author jwe
date Tue, 09 Mar 2004 22:36:55 +0000
parents bb82599f039f
children f9262b65c7d9
comparison
equal deleted inserted replaced
4827:bb82599f039f 4828:e78bc84ac0d3
1985 } 1985 }
1986 else if (nr == 1 && nc == 1) 1986 else if (nr == 1 && nc == 1)
1987 { 1987 {
1988 Array<T> tmp = Array<T>::index1 (idx_arg, resize_ok); 1988 Array<T> tmp = Array<T>::index1 (idx_arg, resize_ok);
1989 1989
1990 if (tmp.length () != 0) 1990 int len = tmp.length ();
1991
1992 if (len == 0 && idx_arg.one_zero_only ())
1993 retval = Array<T> (tmp, dim_vector (0, 0));
1994 else
1991 retval = Array<T> (tmp, dim_vector (idx_orig_rows, idx_orig_columns)); 1995 retval = Array<T> (tmp, dim_vector (idx_orig_rows, idx_orig_columns));
1992 else
1993 retval = Array<T> (tmp, dim_vector (0, 0));
1994 } 1996 }
1995 else if (nr == 1 || nc == 1) 1997 else if (nr == 1 || nc == 1)
1996 { 1998 {
1997 // If indexing a vector with a matrix, return value has same 1999 // If indexing a vector with a matrix, return value has same
1998 // shape as the index. Otherwise, it has same orientation as 2000 // shape as the index. Otherwise, it has same orientation as
1999 // indexed object. 2001 // indexed object.
2000 2002
2001 Array<T> tmp = index1 (idx_arg, resize_ok); 2003 Array<T> tmp = Array<T>::index1 (idx_arg, resize_ok);
2002 2004
2003 int len = tmp.length (); 2005 int len = tmp.length ();
2004 2006
2005 if ((len != 0 && idx_arg.one_zero_only ()) 2007 if ((len != 0 && idx_arg.one_zero_only ())
2006 || idx_orig_rows == 1 || idx_orig_columns == 1) 2008 || idx_orig_rows == 1 || idx_orig_columns == 1)