00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #if !defined (octave_sparse_bool_matrix_h)
00025 #define octave_sparse_bool_matrix_h 1
00026
00027 #include <cstdlib>
00028
00029 #include <iosfwd>
00030 #include <string>
00031
00032 #include "mx-base.h"
00033 #include "oct-alloc.h"
00034 #include "str-vec.h"
00035
00036 #include "error.h"
00037 #include "oct-stream.h"
00038 #include "ov-base.h"
00039 #include "ov-typeinfo.h"
00040
00041 #include "boolSparse.h"
00042 #include "ov-base-sparse.h"
00043 #include "ov-re-sparse.h"
00044
00045 class Octave_map;
00046 class octave_value_list;
00047
00048 class tree_walker;
00049
00050 class
00051 OCTINTERP_API
00052 octave_sparse_bool_matrix : public octave_base_sparse<SparseBoolMatrix>
00053 {
00054 public:
00055
00056 octave_sparse_bool_matrix (void)
00057 : octave_base_sparse<SparseBoolMatrix> () { }
00058
00059 octave_sparse_bool_matrix (const SparseBoolMatrix& bnda)
00060 : octave_base_sparse<SparseBoolMatrix> (bnda) { }
00061
00062 octave_sparse_bool_matrix (const SparseBoolMatrix& bnda,
00063 const MatrixType& t)
00064 : octave_base_sparse<SparseBoolMatrix> (bnda, t) { }
00065
00066 octave_sparse_bool_matrix (const boolNDArray& m)
00067 : octave_base_sparse<SparseBoolMatrix> (SparseBoolMatrix (m)) { }
00068
00069 octave_sparse_bool_matrix (const boolMatrix& m)
00070 : octave_base_sparse<SparseBoolMatrix> (SparseBoolMatrix (m)) { }
00071
00072 octave_sparse_bool_matrix (const Sparse<bool>& a)
00073 : octave_base_sparse<SparseBoolMatrix> (a) { }
00074
00075 octave_sparse_bool_matrix (const octave_sparse_bool_matrix& bm)
00076 : octave_base_sparse<SparseBoolMatrix> (bm) { }
00077
00078 ~octave_sparse_bool_matrix (void) { }
00079
00080 octave_base_value *clone (void) const { return new octave_sparse_bool_matrix (*this); }
00081 octave_base_value *empty_clone (void) const { return new octave_sparse_bool_matrix (); }
00082
00083 type_conv_info numeric_conversion_function (void) const;
00084
00085 octave_base_value *try_narrowing_conversion (void);
00086
00087
00088 idx_vector index_vector (void) const
00089 { return idx_vector (bool_array_value ()); }
00090
00091 builtin_type_t builtin_type (void) const { return btyp_bool; }
00092
00093 bool is_bool_matrix (void) const { return true; }
00094
00095 bool is_bool_type (void) const { return true; }
00096
00097 bool is_real_type (void) const { return true; }
00098
00099 double double_value (bool = false) const;
00100
00101 double scalar_value (bool frc_str_conv = false) const
00102 { return double_value (frc_str_conv); }
00103
00104 Matrix matrix_value (bool = false) const;
00105
00106 NDArray array_value (bool = false) const;
00107
00108 Complex complex_value (bool = false) const;
00109
00110 ComplexMatrix complex_matrix_value (bool = false) const;
00111
00112 ComplexNDArray complex_array_value (bool = false) const;
00113
00114 charNDArray char_array_value (bool = false) const;
00115
00116 boolMatrix bool_matrix_value (bool = false) const;
00117
00118 boolNDArray bool_array_value (bool = false) const;
00119
00120 SparseMatrix sparse_matrix_value (bool = false) const;
00121
00122 SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
00123
00124 SparseBoolMatrix sparse_bool_matrix_value (bool = false) const
00125 { return matrix; }
00126
00127 octave_value convert_to_str_internal (bool pad, bool force, char type) const;
00128
00129 bool save_binary (std::ostream& os, bool& save_as_floats);
00130
00131 bool load_binary (std::istream& is, bool swap,
00132 oct_mach_info::float_format fmt);
00133
00134 #if defined (HAVE_HDF5)
00135 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
00136
00137 bool load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug);
00138 #endif
00139
00140 mxArray *as_mxArray (void) const;
00141
00142
00143 #define BOOL_SPARSE_MAPPER(MAP) \
00144 octave_value MAP (void) const \
00145 { \
00146 octave_sparse_matrix m (sparse_matrix_value ()); \
00147 return m.MAP (); \
00148 }
00149
00150 BOOL_SPARSE_MAPPER (abs)
00151 BOOL_SPARSE_MAPPER (acos)
00152 BOOL_SPARSE_MAPPER (acosh)
00153 BOOL_SPARSE_MAPPER (angle)
00154 BOOL_SPARSE_MAPPER (arg)
00155 BOOL_SPARSE_MAPPER (asin)
00156 BOOL_SPARSE_MAPPER (asinh)
00157 BOOL_SPARSE_MAPPER (atan)
00158 BOOL_SPARSE_MAPPER (atanh)
00159 BOOL_SPARSE_MAPPER (ceil)
00160 BOOL_SPARSE_MAPPER (conj)
00161 BOOL_SPARSE_MAPPER (cos)
00162 BOOL_SPARSE_MAPPER (cosh)
00163 BOOL_SPARSE_MAPPER (erf)
00164 BOOL_SPARSE_MAPPER (erfc)
00165 BOOL_SPARSE_MAPPER (exp)
00166 BOOL_SPARSE_MAPPER (expm1)
00167 BOOL_SPARSE_MAPPER (finite)
00168 BOOL_SPARSE_MAPPER (fix)
00169 BOOL_SPARSE_MAPPER (floor)
00170 BOOL_SPARSE_MAPPER (gamma)
00171 BOOL_SPARSE_MAPPER (imag)
00172 BOOL_SPARSE_MAPPER (isinf)
00173 BOOL_SPARSE_MAPPER (isna)
00174 BOOL_SPARSE_MAPPER (isnan)
00175 BOOL_SPARSE_MAPPER (lgamma)
00176 BOOL_SPARSE_MAPPER (log)
00177 BOOL_SPARSE_MAPPER (log2)
00178 BOOL_SPARSE_MAPPER (log10)
00179 BOOL_SPARSE_MAPPER (log1p)
00180 BOOL_SPARSE_MAPPER (real)
00181 BOOL_SPARSE_MAPPER (round)
00182 BOOL_SPARSE_MAPPER (roundb)
00183 BOOL_SPARSE_MAPPER (signum)
00184 BOOL_SPARSE_MAPPER (sin)
00185 BOOL_SPARSE_MAPPER (sinh)
00186 BOOL_SPARSE_MAPPER (sqrt)
00187 BOOL_SPARSE_MAPPER (tan)
00188 BOOL_SPARSE_MAPPER (tanh)
00189
00190 #undef BOOL_SPARSE_MAPPER
00191
00192 protected:
00193
00194 DECLARE_OCTAVE_ALLOCATOR
00195
00196 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
00197 };
00198
00199 #endif
00200
00201
00202
00203
00204
00205