Mercurial > hg > octave-lyh
comparison 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 |
comparison
equal
deleted
inserted
replaced
10714:600bdfb08540 | 10715:53253f796351 |
---|---|
285 } | 285 } |
286 | 286 |
287 return retval; | 287 return retval; |
288 } | 288 } |
289 | 289 |
290 bool empty_2d (void) const | |
291 { | |
292 return length () == 2 && (elem (0) == 0 || elem (1) == 0); | |
293 } | |
294 | |
295 | |
290 bool zero_by_zero (void) const | 296 bool zero_by_zero (void) const |
291 { | 297 { |
292 return length () == 2 && elem (0) == 0 && elem (1) == 0; | 298 return length () == 2 && elem (0) == 0 && elem (1) == 0; |
293 } | 299 } |
294 | 300 |
353 return i < n_dims; | 359 return i < n_dims; |
354 } | 360 } |
355 | 361 |
356 dim_vector squeeze (void) const; | 362 dim_vector squeeze (void) const; |
357 | 363 |
358 bool concat (const dim_vector& dvb, int dim = 0); | 364 // This corresponds to cat(). |
365 bool concat (const dim_vector& dvb, int dim); | |
366 | |
367 // This corresponds to [,] (horzcat, dim = 0) and [;] (vertcat, dim = 1). | |
368 // The rules are more relaxed here. | |
369 bool hvcat (const dim_vector& dvb, int dim); | |
359 | 370 |
360 // Force certain dimensionality, preserving numel (). Missing | 371 // Force certain dimensionality, preserving numel (). Missing |
361 // dimensions are set to 1, redundant are folded into the trailing | 372 // dimensions are set to 1, redundant are folded into the trailing |
362 // one. If n = 1, the result is 2d and the second dim is 1 | 373 // one. If n = 1, the result is 2d and the second dim is 1 |
363 // (dim_vectors are always at least 2D). If the original dimensions | 374 // (dim_vectors are always at least 2D). If the original dimensions |