comparison liboctave/Array.cc @ 9987:bb30843c4929

fix subscripting of vectors by N-d arrays
author Jaroslav Hajek <highegg@gmail.com>
date Tue, 15 Dec 2009 10:05:38 +0100
parents 7c8392a034e6
children 84b0725f4b09
comparison
equal deleted inserted replaced
9986:672e1b49e01e 9987:bb30843c4929
765 // b(ones(2)) gives ones(2) etc. 765 // b(ones(2)) gives ones(2) etc.
766 // 766 //
767 // As you can see, the behaviour is weird, but the tests end up pretty 767 // As you can see, the behaviour is weird, but the tests end up pretty
768 // simple. Nah, I don't want to suggest that this is ad hoc :) 768 // simple. Nah, I don't want to suggest that this is ad hoc :)
769 769
770 if (ndims () == 2 && n != 1) 770 if (ndims () == 2 && n != 1 && rd.is_vector ())
771 { 771 {
772 if (columns () == 1 && rd(0) == 1) 772 if (columns () == 1)
773 rd = dim_vector (il, 1); 773 rd = dim_vector (il, 1);
774 else if (rows () == 1 && rd(1) == 1) 774 else if (rows () == 1)
775 rd = dim_vector (1, il); 775 rd = dim_vector (1, il);
776 } 776 }
777 777
778 octave_idx_type l, u; 778 octave_idx_type l, u;
779 if (il != 0 && i.is_cont_range (n, l, u)) 779 if (il != 0 && i.is_cont_range (n, l, u))