comparison liboctave/Array.cc @ 4737:108c9a93196d

[project @ 2004-02-05 18:25:00 by jwe]
author jwe
date Thu, 05 Feb 2004 18:25:00 +0000
parents 4179c59d82da
children c9e5b9fa7b17
comparison
equal deleted inserted replaced
4736:4179c59d82da 4737:108c9a93196d
2022 // For (3x3x3), the call can be A(2,5), A(2,:,:), A(3,2,3) etc. 2022 // For (3x3x3), the call can be A(2,5), A(2,:,:), A(3,2,3) etc.
2023 2023
2024 Array<T> retval; 2024 Array<T> retval;
2025 2025
2026 int n_dims = dimensions.length (); 2026 int n_dims = dimensions.length ();
2027
2028 // Remove trailing singletons in ra_idx, but leave at least ndims
2029 // elements.
2030
2031 int ra_idx_len = ra_idx.length ();
2032
2033 while (ra_idx_len > n_dims)
2034 {
2035 if (ra_idx(ra_idx_len-1) == 1)
2036 ra_idx_len--;
2037 else
2038 break;
2039 }
2040
2041 ra_idx.resize (ra_idx_len);
2027 2042
2028 if (n_dims < ra_idx.length ()) 2043 if (n_dims < ra_idx.length ())
2029 { 2044 {
2030 (*current_liboctave_error_handler) 2045 (*current_liboctave_error_handler)
2031 ("index exceeds N-d array dimensions"); 2046 ("index exceeds N-d array dimensions");