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

boolNDArray.cc

解説を見る。
00001 // N-D Array  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 "Array-util.h"
00033 #include "CNDArray.h"
00034 #include "mx-base.h"
00035 #include "lo-ieee.h"
00036 
00037 // unary operations
00038 
00039 boolNDArray
00040 boolNDArray::operator ! (void) const
00041 {
00042   boolNDArray b (dims ());
00043 
00044   for (int i = 0; i < length (); i++)
00045     b.elem (i) = ! elem (i);
00046 
00047   return b;
00048 }
00049 
00050 // XXX FIXME XXX -- this is not quite the right thing.
00051 
00052 boolNDArray
00053 boolNDArray::all (int dim) const
00054 {
00055   MX_ND_ANY_ALL_REDUCTION (MX_ND_ALL_EVAL (MX_ND_ALL_EXPR), true);
00056 }
00057 
00058 boolNDArray
00059 boolNDArray::any (int dim) const
00060 {
00061   MX_ND_ANY_ALL_REDUCTION (MX_ND_ANY_EVAL (MX_ND_ANY_EXPR), false);
00062 }
00063 
00064 boolNDArray
00065 boolNDArray::concat (const boolNDArray& rb, const Array<int>& ra_idx)
00066 {
00067   if (rb.numel () > 0)
00068     insert (rb, ra_idx);
00069   return *this;
00070 }
00071 
00072 boolNDArray&
00073 boolNDArray::insert (const boolNDArray& a, int r, int c)
00074 {
00075   Array<bool>::insert (a, r, c);
00076   return *this;
00077 }
00078 
00079 boolNDArray&
00080 boolNDArray::insert (const boolNDArray& a, const Array<int>& ra_idx)
00081 {
00082   Array<bool>::insert (a, ra_idx);
00083   return *this;
00084 }
00085 
00086 
00087 
00088 boolMatrix
00089 boolNDArray::matrix_value (void) const
00090 {
00091   boolMatrix retval;
00092 
00093   int nd = ndims ();
00094 
00095   switch (nd)
00096     {
00097     case 1:
00098       retval = boolMatrix (Array2<bool> (*this, dimensions(0), 1));
00099       break;
00100 
00101     case 2:
00102       retval = boolMatrix (Array2<bool> (*this, dimensions(0),
00103                                          dimensions(1)));
00104       break;
00105 
00106     default:
00107       (*current_liboctave_error_handler)
00108         ("invalid conversion of boolNDArray to boolMatrix");
00109       break;
00110     }
00111 
00112   return retval;
00113 }
00114 
00115 void
00116 boolNDArray::increment_index (Array<int>& ra_idx,
00117                               const dim_vector& dimensions,
00118                               int start_dimension)
00119 {
00120   ::increment_index (ra_idx, dimensions, start_dimension);
00121 }
00122 
00123 int
00124 boolNDArray::compute_index (Array<int>& ra_idx,
00125                             const dim_vector& dimensions)
00126 {
00127   return ::compute_index (ra_idx, dimensions);
00128 }
00129 
00130 NDND_BOOL_OPS (boolNDArray, boolNDArray, false)
00131 NDND_CMP_OPS (boolNDArray, , boolNDArray, )
00132 
00133 NDS_BOOL_OPS (boolNDArray, bool, false)
00134 NDS_CMP_OPS (boolNDArray, , bool, )
00135 
00136 SND_BOOL_OPS (bool, boolNDArray, false)
00137 SND_CMP_OPS (bool, , boolNDArray, )
00138 
00139 /*
00140 ;;; Local Variables: ***
00141 ;;; mode: C++ ***
00142 ;;; End: ***
00143 */

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