GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
boolSparse.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1998-2022 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if ! defined (octave_boolSparse_h)
27#define octave_boolSparse_h 1
28
29#include "octave-config.h"
30
31#include "PermMatrix.h"
32#include "Sparse-op-decls.h"
33#include "Sparse.h"
34#include "boolMatrix.h"
35#include "boolNDArray.h"
36#include "mx-fwd.h"
37
38class
41{
42public:
43
44 // Corresponding dense matrix type for this sparse matrix type.
46
47 SparseBoolMatrix (void) : Sparse<bool> () { }
48
50 : Sparse<bool> (r, c) { }
51
53 : Sparse<bool> (r, c, val) { }
54
56 : Sparse<bool> (dv, nz) { }
57
59
61
63 : Sparse<bool> (a, dv) { }
64
65 explicit SparseBoolMatrix (const boolMatrix& a) : Sparse<bool> (a) { }
66
67 explicit SparseBoolMatrix (const boolNDArray& a) : Sparse<bool> (a) { }
68
69 explicit SparseBoolMatrix (const PermMatrix& a) : Sparse<bool> (a) { };
70
72 const octave::idx_vector& c, octave_idx_type nr = -1,
73 octave_idx_type nc = -1, bool sum_terms = true,
74 octave_idx_type nzm = -1)
75 : Sparse<bool> (a, r, c, nr, nc, sum_terms, nzm) { }
76
78 octave_idx_type num_nz) : Sparse<bool> (r, c, num_nz) { }
79
80 SparseBoolMatrix& operator = (const SparseBoolMatrix& a)
81 {
83 return *this;
84 }
85
86 OCTAVE_API bool operator == (const SparseBoolMatrix& a) const;
87 OCTAVE_API bool operator != (const SparseBoolMatrix& a) const;
88
90 { return Sparse<bool>::transpose (); }
91
92 // destructive insert/delete/reorder operations
93
95 insert (const SparseBoolMatrix& a, octave_idx_type r, octave_idx_type c);
96
98 insert (const SparseBoolMatrix& a, const Array<octave_idx_type>& indx);
99
102
104
105 OCTAVE_API boolMatrix matrix_value (void) const;
106
107 OCTAVE_API SparseBoolMatrix squeeze (void) const;
108
110 index (const octave::idx_vector& i, bool resize_ok) const;
111
113 index (const octave::idx_vector& i, const octave::idx_vector& j,
114 bool resize_ok) const;
115
116 OCTAVE_API SparseBoolMatrix reshape (const dim_vector& new_dims) const;
117
119 permute (const Array<octave_idx_type>& vec, bool inv = false) const;
120
122 ipermute (const Array<octave_idx_type>& vec) const;
123
124 // unary operations
125
127
128 // other operations
129
130 OCTAVE_API SparseBoolMatrix all (int dim = -1) const;
131 OCTAVE_API SparseBoolMatrix any (int dim = -1) const;
132 OCTAVE_API SparseMatrix sum (int dim = -1) const;
133
134 // i/o
135
136 friend OCTAVE_API std::ostream& operator << (std::ostream& os,
137 const SparseBoolMatrix& a);
138 friend OCTAVE_API std::istream& operator >> (std::istream& is,
140};
141
144
147
150
151#endif
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
ComplexNDArray concat(NDArray &ra, ComplexNDArray &rb, const Array< octave_idx_type > &ra_idx)
Definition: CNDArray.cc:418
#define SPARSE_SMSM_BOOL_OP_DECLS(M1, M2, API)
#define SPARSE_SMSM_EQNE_OP_DECLS(M1, M2, API)
#define SPARSE_SMS_BOOL_OP_DECLS(M, S, API)
#define SPARSE_SSM_BOOL_OP_DECLS(S, M, API)
#define SPARSE_SSM_EQNE_OP_DECLS(S, M, API)
#define SPARSE_SMS_EQNE_OP_DECLS(M, S, API)
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
Definition: boolSparse.cc:279
SparseBoolMatrix transpose(void) const
Definition: boolSparse.h:89
SparseBoolMatrix(const boolNDArray &a)
Definition: boolSparse.h:67
SparseBoolMatrix(octave_idx_type r, octave_idx_type c)
Definition: boolSparse.h:49
SparseBoolMatrix(const Sparse< bool > &a)
Definition: boolSparse.h:58
SparseBoolMatrix(octave_idx_type r, octave_idx_type c, octave_idx_type num_nz)
Definition: boolSparse.h:77
SparseBoolMatrix(const SparseBoolMatrix &a, const dim_vector &dv)
Definition: boolSparse.h:62
SparseBoolMatrix(octave_idx_type r, octave_idx_type c, bool val)
Definition: boolSparse.h:52
SparseBoolMatrix(const boolMatrix &a)
Definition: boolSparse.h:65
boolMatrix dense_matrix_type
Definition: boolSparse.h:45
SparseBoolMatrix(const Array< bool > &a, const octave::idx_vector &r, const octave::idx_vector &c, octave_idx_type nr=-1, octave_idx_type nc=-1, bool sum_terms=true, octave_idx_type nzm=-1)
Definition: boolSparse.h:71
SparseBoolMatrix(const SparseBoolMatrix &a)
Definition: boolSparse.h:60
SparseBoolMatrix(void)
Definition: boolSparse.h:47
SparseBoolMatrix(const dim_vector &dv, octave_idx_type nz=0)
Definition: boolSparse.h:55
SparseBoolMatrix(const PermMatrix &a)
Definition: boolSparse.h:69
OCTAVE_API Sparse< T, Alloc > transpose(void) const
Definition: Sparse.cc:1138
OCTAVE_API Sparse< T, Alloc > & operator=(const Sparse< T, Alloc > &a)
Definition: Sparse.cc:716
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:94
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:536
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:520
#define OCTAVE_API
Definition: main.in.cc:55
class OCTAVE_API SparseBoolMatrix
Definition: mx-fwd.h:57
const octave_base_value const Array< octave_idx_type > & ra_idx
octave_value operator!(const octave_value &a)
Definition: ov.h:1835