メインページ   クラス階層   構成   ファイル一覧   構成メンバ   ファイルメンバ  

boolMatrix.cc

解説を見る。
00001 // Matrix manipulations.
00002 /*
00003 
00004 Copyright (C) 1996, 1997 John W. Eaton
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 2, or (at your option) any
00011 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, write to the Free
00020 Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00021 
00022 */
00023 
00024 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION)
00025 #pragma implementation
00026 #endif
00027 
00028 #ifdef HAVE_CONFIG_H
00029 #include <config.h>
00030 #endif
00031 
00032 #include <iostream>
00033 
00034 #include "Array-util.h"
00035 #include "lo-error.h"
00036 #include "str-vec.h"
00037 #include "mx-base.h"
00038 #include "mx-inlines.cc"
00039 
00040 // boolMatrix class.
00041 
00042 bool
00043 boolMatrix::operator == (const boolMatrix& a) const
00044 {
00045   if (rows () != a.rows () || cols () != a.cols ())
00046     return 0;
00047 
00048   return mx_inline_equal (data (), a.data (), length ());
00049 }
00050 
00051 bool
00052 boolMatrix::operator != (const boolMatrix& a) const
00053 {
00054   return !(*this == a);
00055 }
00056 
00057 boolMatrix&
00058 boolMatrix::insert (const boolMatrix& a, int r, int c)
00059 {
00060   Array2<bool>::insert (a, r, c);
00061   return *this;
00062 }
00063 
00064 // unary operations
00065 
00066 boolMatrix
00067 boolMatrix::operator ! (void) const
00068 {
00069   int nr = rows ();
00070   int nc = cols ();
00071 
00072   boolMatrix b (nr, nc);
00073 
00074   for (int j = 0; j < nc; j++)
00075     for (int i = 0; i < nr; i++)
00076       b.elem (i, j) = ! elem (i, j);
00077 
00078   return b;
00079 }
00080 
00081 // other operations
00082 
00083 // XXX FIXME XXX Do these really belong here?  Maybe they should be
00084 // in a base class?
00085 
00086 boolMatrix
00087 boolMatrix::all (int dim) const
00088 {
00089   MX_ALL_OP (dim);
00090 }
00091 
00092 boolMatrix
00093 boolMatrix::any (int dim) const
00094 {
00095   MX_ANY_OP (dim);
00096 }
00097 
00098 MM_CMP_OPS (boolMatrix, , boolMatrix, )
00099 
00100 /*
00101 ;;; Local Variables: ***
00102 ;;; mode: C++ ***
00103 ;;; End: ***
00104 */

Wed Dec 29 11:50:55 2004に生成されました。 doxygen1.2.18
SEO [PR] 爆速!無料ブログ 無料ホームページ開設 無料ライブ放送