comparison liboctave/dim-vector.h @ 9511:cc1fd3084cb2

implement dim_vector::first_non_singleton
author Jaroslav Hajek <highegg@gmail.com>
date Mon, 10 Aug 2009 14:20:48 +0200
parents b096d11237be
children 11844593875a
comparison
equal deleted inserted replaced
9510:1b290ce305fb 9511:cc1fd3084cb2
495 bool is_vector (void) const 495 bool is_vector (void) const
496 { 496 {
497 return (length () == 2 && (elem (0) == 1 || elem (1) == 1)); 497 return (length () == 2 && (elem (0) == 1 || elem (1) == 1));
498 } 498 }
499 499
500 int first_non_singleton (int def = 0) const
501 {
502 for (int i = 0; i < length (); i++)
503 {
504 if (elem (i) != 1)
505 return i;
506 }
507
508 return def;
509 }
510
500 }; 511 };
501 512
502 static inline bool 513 static inline bool
503 operator == (const dim_vector& a, const dim_vector& b) 514 operator == (const dim_vector& a, const dim_vector& b)
504 { 515 {