00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifdef HAVE_CONFIG_H
00026 #include <config.h>
00027 #endif
00028
00029 #include "Array-util.h"
00030 #include "CNDArray.h"
00031 #include "mx-base.h"
00032 #include "lo-ieee.h"
00033 #include "mx-op-defs.h"
00034 #include "MArray-defs.h"
00035
00036 #include "bsxfun-defs.cc"
00037
00038
00039
00040 boolNDArray
00041 boolNDArray::operator ! (void) const
00042 {
00043 return do_mx_unary_op<bool, bool> (*this, mx_inline_not);
00044 }
00045
00046 boolNDArray&
00047 boolNDArray::invert (void)
00048 {
00049 if (is_shared ())
00050 *this = ! *this;
00051 else
00052 do_mx_inplace_op<bool> (*this, mx_inline_not2);
00053
00054 return *this;
00055 }
00056
00057
00058
00059 boolNDArray
00060 boolNDArray::all (int dim) const
00061 {
00062 return do_mx_red_op<bool, bool> (*this, dim, mx_inline_all);
00063 }
00064
00065 boolNDArray
00066 boolNDArray::any (int dim) const
00067 {
00068 return do_mx_red_op<bool, bool> (*this, dim, mx_inline_any);
00069 }
00070
00071 NDArray
00072 boolNDArray::sum (int dim) const
00073 {
00074
00075
00076 return do_mx_red_op<octave_idx_type, bool> (*this, dim, mx_inline_count);
00077 }
00078
00079 NDArray
00080 boolNDArray::cumsum (int dim) const
00081 {
00082
00083 return do_mx_cum_op<double , bool> (*this, dim, mx_inline_cumcount);
00084 }
00085
00086 boolNDArray
00087 boolNDArray::concat (const boolNDArray& rb, const Array<octave_idx_type>& ra_idx)
00088 {
00089 if (rb.numel () > 0)
00090 insert (rb, ra_idx);
00091 return *this;
00092 }
00093
00094 boolNDArray&
00095 boolNDArray::insert (const boolNDArray& a, octave_idx_type r, octave_idx_type c)
00096 {
00097 Array<bool>::insert (a, r, c);
00098 return *this;
00099 }
00100
00101 boolNDArray&
00102 boolNDArray::insert (const boolNDArray& a, const Array<octave_idx_type>& ra_idx)
00103 {
00104 Array<bool>::insert (a, ra_idx);
00105 return *this;
00106 }
00107
00108
00109
00110 boolMatrix
00111 boolNDArray::matrix_value (void) const
00112 {
00113 return *this;
00114 }
00115
00116 void
00117 boolNDArray::increment_index (Array<octave_idx_type>& ra_idx,
00118 const dim_vector& dimensions,
00119 int start_dimension)
00120 {
00121 ::increment_index (ra_idx, dimensions, start_dimension);
00122 }
00123
00124 octave_idx_type
00125 boolNDArray::compute_index (Array<octave_idx_type>& ra_idx,
00126 const dim_vector& dimensions)
00127 {
00128 return ::compute_index (ra_idx, dimensions);
00129 }
00130
00131 boolNDArray
00132 boolNDArray::diag (octave_idx_type k) const
00133 {
00134 return Array<bool>::diag (k);
00135 }
00136
00137 NDND_BOOL_OPS (boolNDArray, boolNDArray)
00138 NDND_CMP_OPS (boolNDArray, boolNDArray)
00139
00140 NDS_BOOL_OPS (boolNDArray, bool)
00141 NDS_CMP_OPS (boolNDArray, bool)
00142
00143 SND_BOOL_OPS (bool, boolNDArray)
00144 SND_CMP_OPS (bool, boolNDArray)
00145
00146 boolNDArray&
00147 mx_el_and_assign (boolNDArray& a, const boolNDArray& b)
00148 {
00149 if (a.is_shared ())
00150 a = mx_el_and (a, b);
00151 else
00152 do_mm_inplace_op<bool, bool> (a, b, mx_inline_and2, mx_inline_and2,
00153 "operator &=");
00154
00155 return a;
00156 }
00157
00158 boolNDArray&
00159 mx_el_or_assign (boolNDArray& a, const boolNDArray& b)
00160 {
00161 if (a.is_shared ())
00162 a = mx_el_or (a, b);
00163 else
00164 do_mm_inplace_op<bool, bool> (a, b, mx_inline_or2, mx_inline_or2,
00165 "operator |=");
00166
00167 return a;
00168 }
00169
00170 BSXFUN_OP_DEF_MXLOOP (and, boolNDArray, mx_inline_and)
00171 BSXFUN_OP_DEF_MXLOOP (or, boolNDArray, mx_inline_or)