Mercurial > hg > octave-lyh
diff liboctave/dim-vector.h @ 10715:53253f796351
make [] (hopefully) more Matlab compatible
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 18 Jun 2010 14:12:24 +0200 |
parents | 0ba9bd294421 |
children | 6683f0c9d742 |
line wrap: on
line diff
--- a/liboctave/dim-vector.h +++ b/liboctave/dim-vector.h @@ -287,6 +287,12 @@ return retval; } + bool empty_2d (void) const + { + return length () == 2 && (elem (0) == 0 || elem (1) == 0); + } + + bool zero_by_zero (void) const { return length () == 2 && elem (0) == 0 && elem (1) == 0; @@ -355,7 +361,12 @@ dim_vector squeeze (void) const; - bool concat (const dim_vector& dvb, int dim = 0); + // This corresponds to cat(). + bool concat (const dim_vector& dvb, int dim); + + // This corresponds to [,] (horzcat, dim = 0) and [;] (vertcat, dim = 1). + // The rules are more relaxed here. + bool hvcat (const dim_vector& dvb, int dim); // Force certain dimensionality, preserving numel (). Missing // dimensions are set to 1, redundant are folded into the trailing