Mercurial > hg > octave-nkf
annotate liboctave/array/boolSparse.h @ 19198:96751a74bbbb
Start doxygenising sources
* Screen.cpp Screen.h Vt102Emulation.cpp files-dock-widget.h
main-window.h octave-qt-link.h parser.h: Reformat existing Doxygen
commands to use @ instead of \ to start a command.
* Array.h: Convert existing comments into Doxygen comments.
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Tue, 12 Aug 2014 15:27:16 -0400 |
parents | 49a5a4be04a1 |
children | 65554f5847ac |
rev | line source |
---|---|
5164 | 1 /* |
2 | |
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
3 Copyright (C) 2004-2013 David Bateman |
11523 | 4 Copyright (C) 1998-2004 Andy Adler |
7016 | 5 |
6 This file is part of Octave. | |
5164 | 7 |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
5164 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
5164 | 21 |
22 */ | |
23 | |
24 #if !defined (octave_boolSparse_h) | |
25 #define octave_boolSparse_h 1 | |
26 | |
27 #include "Sparse.h" | |
28 #include "MSparse-defs.h" | |
29 #include "Sparse-op-defs.h" | |
30 | |
10983
4b51c0a20a98
optimize sum of sparse logical matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
10527
diff
changeset
|
31 class SparseMatrix; |
4b51c0a20a98
optimize sum of sparse logical matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
10527
diff
changeset
|
32 |
5164 | 33 class |
6108 | 34 OCTAVE_API |
5164 | 35 SparseBoolMatrix : public Sparse<bool> |
36 { | |
37 public: | |
38 | |
39 SparseBoolMatrix (void) : Sparse<bool> () { } | |
40 | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
41 SparseBoolMatrix (octave_idx_type r, octave_idx_type c) |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
42 : Sparse<bool> (r, c) { } |
5164 | 43 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
44 explicit SparseBoolMatrix (octave_idx_type r, octave_idx_type c, bool val) |
5164 | 45 : Sparse<bool> (r, c, val) { } |
46 | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
47 SparseBoolMatrix (const dim_vector& dv, octave_idx_type nz = 0) |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
48 : Sparse<bool> (dv, nz) { } |
6823 | 49 |
5164 | 50 SparseBoolMatrix (const Sparse<bool>& a) : Sparse<bool> (a) { } |
51 | |
52 SparseBoolMatrix (const SparseBoolMatrix& a) : Sparse<bool> (a) { } | |
53 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
54 SparseBoolMatrix (const SparseBoolMatrix& a, const dim_vector& dv) |
5164 | 55 : Sparse<bool> (a, dv) { } |
56 | |
57 explicit SparseBoolMatrix (const boolMatrix& a) : Sparse<bool> (a) { } | |
58 | |
59 explicit SparseBoolMatrix (const boolNDArray& a) : Sparse<bool> (a) { } | |
60 | |
13030
b646413c3d0e
Make operators do smarter sparse conversions on permutation matrices.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
11586
diff
changeset
|
61 explicit SparseBoolMatrix (const PermMatrix& a) : Sparse<bool> (a) { }; |
b646413c3d0e
Make operators do smarter sparse conversions on permutation matrices.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
11586
diff
changeset
|
62 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
63 SparseBoolMatrix (const Array<bool>& a, const idx_vector& r, |
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
64 const idx_vector& c, octave_idx_type nr = -1, |
10527
b4d2080b6df7
Replace nzmax by nnz as needed
David Bateman <dbateman@free.fr>
parents:
10480
diff
changeset
|
65 octave_idx_type nc = -1, bool sum_terms = true, |
b4d2080b6df7
Replace nzmax by nnz as needed
David Bateman <dbateman@free.fr>
parents:
10480
diff
changeset
|
66 octave_idx_type nzm = -1) |
b4d2080b6df7
Replace nzmax by nnz as needed
David Bateman <dbateman@free.fr>
parents:
10480
diff
changeset
|
67 : Sparse<bool> (a, r, c, nr, nc, sum_terms, nzm) { } |
10479
ded9beac7582
optimize sparse matrix assembly
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
68 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
69 SparseBoolMatrix (octave_idx_type r, octave_idx_type c, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
70 octave_idx_type num_nz) : Sparse<bool> (r, c, num_nz) { } |
5164 | 71 |
72 SparseBoolMatrix& operator = (const SparseBoolMatrix& a) | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
73 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
74 Sparse<bool>::operator = (a); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
75 return *this; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
76 } |
5164 | 77 |
78 bool operator == (const SparseBoolMatrix& a) const; | |
79 bool operator != (const SparseBoolMatrix& a) const; | |
80 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
81 SparseBoolMatrix transpose (void) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
82 { return Sparse<bool>::transpose (); } |
5164 | 83 |
84 // destructive insert/delete/reorder operations | |
85 | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
86 SparseBoolMatrix& insert (const SparseBoolMatrix& a, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
87 octave_idx_type r, octave_idx_type c); |
5164 | 88 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
89 SparseBoolMatrix& insert (const SparseBoolMatrix& a, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
90 const Array<octave_idx_type>& indx); |
6823 | 91 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
92 SparseBoolMatrix concat (const SparseBoolMatrix& rb, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
93 const Array<octave_idx_type>& ra_idx); |
5164 | 94 |
7515
f3c00dc0912b
Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
95 SparseBoolMatrix diag (octave_idx_type k = 0) const; |
f3c00dc0912b
Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
96 |
5164 | 97 boolMatrix matrix_value (void) const; |
98 | |
99 SparseBoolMatrix squeeze (void) const; | |
100 | |
10421
99e9bae2d81e
improve sparse indexing interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
101 SparseBoolMatrix index (const idx_vector& i, bool resize_ok) const; |
5164 | 102 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
103 SparseBoolMatrix index (const idx_vector& i, const idx_vector& j, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
104 bool resize_ok) const; |
5164 | 105 |
106 SparseBoolMatrix reshape (const dim_vector& new_dims) const; | |
107 | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
108 SparseBoolMatrix permute (const Array<octave_idx_type>& vec, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
109 bool inv = false) const; |
5164 | 110 |
5275 | 111 SparseBoolMatrix ipermute (const Array<octave_idx_type>& vec) const; |
5164 | 112 |
113 // unary operations | |
114 | |
115 SparseBoolMatrix operator ! (void) const; | |
116 | |
117 // other operations | |
118 | |
119 SparseBoolMatrix all (int dim = -1) const; | |
120 SparseBoolMatrix any (int dim = -1) const; | |
10983
4b51c0a20a98
optimize sum of sparse logical matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
10527
diff
changeset
|
121 SparseMatrix sum (int dim = -1) const; |
5164 | 122 |
123 // i/o | |
124 | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
125 friend OCTAVE_API std::ostream& operator << (std::ostream& os, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
126 const SparseBoolMatrix& a); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
127 friend OCTAVE_API std::istream& operator >> (std::istream& is, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
128 SparseBoolMatrix& a); |
5164 | 129 }; |
130 | |
6708 | 131 SPARSE_SMS_EQNE_OP_DECLS (SparseBoolMatrix, bool, OCTAVE_API) |
132 SPARSE_SMS_BOOL_OP_DECLS (SparseBoolMatrix, bool, OCTAVE_API) | |
5164 | 133 |
6708 | 134 SPARSE_SSM_EQNE_OP_DECLS (bool, SparseBoolMatrix, OCTAVE_API) |
135 SPARSE_SSM_BOOL_OP_DECLS (bool, SparseBoolMatrix, OCTAVE_API) | |
5164 | 136 |
6708 | 137 SPARSE_SMSM_EQNE_OP_DECLS (SparseBoolMatrix, SparseBoolMatrix, OCTAVE_API) |
138 SPARSE_SMSM_BOOL_OP_DECLS (SparseBoolMatrix, SparseBoolMatrix, OCTAVE_API) | |
5164 | 139 |
140 #endif |