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_boolSparse_h)
00025 #define octave_boolSparse_h 1
00026
00027 #include "Sparse.h"
00028 #include "MSparse-defs.h"
00029 #include "Sparse-op-defs.h"
00030
00031 class SparseMatrix;
00032
00033 class
00034 OCTAVE_API
00035 SparseBoolMatrix : public Sparse<bool>
00036 {
00037 public:
00038
00039 SparseBoolMatrix (void) : Sparse<bool> () { }
00040
00041 SparseBoolMatrix (octave_idx_type r, octave_idx_type c) : Sparse<bool> (r, c) { }
00042
00043 explicit SparseBoolMatrix (octave_idx_type r, octave_idx_type c, bool val)
00044 : Sparse<bool> (r, c, val) { }
00045
00046 SparseBoolMatrix (const dim_vector& dv, octave_idx_type nz = 0) :
00047 Sparse<bool> (dv, nz) { }
00048
00049 SparseBoolMatrix (const Sparse<bool>& a) : Sparse<bool> (a) { }
00050
00051 SparseBoolMatrix (const SparseBoolMatrix& a) : Sparse<bool> (a) { }
00052
00053 SparseBoolMatrix (const SparseBoolMatrix& a, const dim_vector& dv)
00054 : Sparse<bool> (a, dv) { }
00055
00056 explicit SparseBoolMatrix (const boolMatrix& a) : Sparse<bool> (a) { }
00057
00058 explicit SparseBoolMatrix (const boolNDArray& a) : Sparse<bool> (a) { }
00059
00060 explicit SparseBoolMatrix (const PermMatrix& a) : Sparse<bool> (a) { };
00061
00062 SparseBoolMatrix (const Array<bool>& a, const idx_vector& r,
00063 const idx_vector& c, octave_idx_type nr = -1,
00064 octave_idx_type nc = -1, bool sum_terms = true,
00065 octave_idx_type nzm = -1)
00066 : Sparse<bool> (a, r, c, nr, nc, sum_terms, nzm) { }
00067
00068 SparseBoolMatrix (octave_idx_type r, octave_idx_type c, octave_idx_type num_nz) : Sparse<bool> (r, c, num_nz) { }
00069
00070 SparseBoolMatrix& operator = (const SparseBoolMatrix& a)
00071 {
00072 Sparse<bool>::operator = (a);
00073 return *this;
00074 }
00075
00076 bool operator == (const SparseBoolMatrix& a) const;
00077 bool operator != (const SparseBoolMatrix& a) const;
00078
00079 SparseBoolMatrix transpose (void) const
00080 { return Sparse<bool>::transpose (); }
00081
00082
00083
00084 SparseBoolMatrix& insert (const SparseBoolMatrix& a, octave_idx_type r, octave_idx_type c);
00085
00086 SparseBoolMatrix& insert (const SparseBoolMatrix& a, const Array<octave_idx_type>& indx);
00087
00088 SparseBoolMatrix concat (const SparseBoolMatrix& rb,
00089 const Array<octave_idx_type>& ra_idx);
00090
00091 SparseBoolMatrix diag (octave_idx_type k = 0) const;
00092
00093 boolMatrix matrix_value (void) const;
00094
00095 SparseBoolMatrix squeeze (void) const;
00096
00097 SparseBoolMatrix index (const idx_vector& i, bool resize_ok) const;
00098
00099 SparseBoolMatrix index (const idx_vector& i, const idx_vector& j, bool resize_ok) const;
00100
00101 SparseBoolMatrix reshape (const dim_vector& new_dims) const;
00102
00103 SparseBoolMatrix permute (const Array<octave_idx_type>& vec, bool inv = false) const;
00104
00105 SparseBoolMatrix ipermute (const Array<octave_idx_type>& vec) const;
00106
00107
00108
00109 SparseBoolMatrix operator ! (void) const;
00110
00111
00112
00113 SparseBoolMatrix all (int dim = -1) const;
00114 SparseBoolMatrix any (int dim = -1) const;
00115 SparseMatrix sum (int dim = -1) const;
00116
00117
00118
00119 friend OCTAVE_API std::ostream& operator << (std::ostream& os, const SparseBoolMatrix& a);
00120 friend OCTAVE_API std::istream& operator >> (std::istream& is, SparseBoolMatrix& a);
00121 };
00122
00123 SPARSE_SMS_EQNE_OP_DECLS (SparseBoolMatrix, bool, OCTAVE_API)
00124 SPARSE_SMS_BOOL_OP_DECLS (SparseBoolMatrix, bool, OCTAVE_API)
00125
00126 SPARSE_SSM_EQNE_OP_DECLS (bool, SparseBoolMatrix, OCTAVE_API)
00127 SPARSE_SSM_BOOL_OP_DECLS (bool, SparseBoolMatrix, OCTAVE_API)
00128
00129 SPARSE_SMSM_EQNE_OP_DECLS (SparseBoolMatrix, SparseBoolMatrix, OCTAVE_API)
00130 SPARSE_SMSM_BOOL_OP_DECLS (SparseBoolMatrix, SparseBoolMatrix, OCTAVE_API)
00131
00132 #endif