boolMatrix.h

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 1996-2012 John W. Eaton
00004 Copyright (C) 2010 VZLU Prague
00005 
00006 This file is part of Octave.
00007 
00008 Octave is free software; you can redistribute it and/or modify it
00009 under the terms of the GNU General Public License as published by the
00010 Free Software Foundation; either version 3 of the License, or (at your
00011 option) any later version.
00012 
00013 Octave is distributed in the hope that it will be useful, but WITHOUT
00014 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00015 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00016 for more details.
00017 
00018 You should have received a copy of the GNU General Public License
00019 along with Octave; see the file COPYING.  If not, see
00020 <http://www.gnu.org/licenses/>.
00021 
00022 */
00023 
00024 #if !defined (octave_boolMatrix_int_h)
00025 #define octave_boolMatrix_int_h 1
00026 
00027 #include "Array.h"
00028 
00029 #include "mx-defs.h"
00030 #include "mx-op-decl.h"
00031 
00032 class
00033 OCTAVE_API
00034 boolMatrix : public Array<bool>
00035 {
00036 public:
00037 
00038   boolMatrix (void) : Array<bool> () { }
00039 
00040   boolMatrix (octave_idx_type r, octave_idx_type c)
00041     : Array<bool> (dim_vector (r, c)) { }
00042 
00043   boolMatrix (octave_idx_type r, octave_idx_type c, bool val)
00044     : Array<bool> (dim_vector (r, c), val) { }
00045 
00046   boolMatrix (const dim_vector& dv) : Array<bool> (dv) { }
00047 
00048   boolMatrix (const dim_vector& dv, bool val) : Array<bool> (dv, val) { }
00049 
00050   boolMatrix (const Array<bool>& a) : Array<bool> (a.as_matrix ()) { }
00051 
00052   boolMatrix (const boolMatrix& a) : Array<bool> (a) { }
00053 
00054   boolMatrix& operator = (const boolMatrix& a)
00055     {
00056       Array<bool>::operator = (a);
00057       return *this;
00058     }
00059 
00060   bool operator == (const boolMatrix& a) const;
00061   bool operator != (const boolMatrix& a) const;
00062 
00063   boolMatrix transpose (void) const { return Array<bool>::transpose (); }
00064 
00065   // destructive insert/delete/reorder operations
00066 
00067   boolMatrix& insert (const boolMatrix& a, octave_idx_type r, octave_idx_type c);
00068 
00069   // unary operations
00070 
00071   boolMatrix operator ! (void) const;
00072 
00073   // other operations
00074 
00075   boolMatrix diag (octave_idx_type k = 0) const;
00076 
00077   boolMatrix all (int dim = -1) const;
00078   boolMatrix any (int dim = -1) const;
00079 
00080 #if 0
00081   // i/o
00082 
00083   friend std::ostream& operator << (std::ostream& os, const Matrix& a);
00084   friend std::istream& operator >> (std::istream& is, Matrix& a);
00085 #endif
00086 
00087   void resize (octave_idx_type nr, octave_idx_type nc,
00088                bool rfv = resize_fill_value ())
00089   {
00090     Array<bool>::resize (dim_vector (nr, nc), rfv);
00091   }
00092 
00093   static bool resize_fill_value (void) { return false; }
00094 
00095 };
00096 
00097 MM_BOOL_OP_DECLS (boolMatrix, boolMatrix, OCTAVE_API)
00098 MS_BOOL_OP_DECLS (boolMatrix, bool, OCTAVE_API)
00099 SM_BOOL_OP_DECLS (bool, boolMatrix, OCTAVE_API)
00100 MM_CMP_OP_DECLS (boolMatrix, boolMatrix, OCTAVE_API)
00101 
00102 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines