Mercurial > octave
annotate liboctave/array/boolMatrix.h @ 22323:bac0d6f07a3e
maint: Update copyright notices for 2016.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 17 Aug 2016 01:05:19 -0400 |
parents | 1473547f50f5 |
children | 4caa7b28d183 |
rev | line source |
---|---|
2828 | 1 /* |
2 | |
22323
bac0d6f07a3e
maint: Update copyright notices for 2016.
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
3 Copyright (C) 1996-2016 John W. Eaton |
10521
4d1fc073fbb7
add some missing copyright stmts
Jaroslav Hajek <highegg@gmail.com>
parents:
10364
diff
changeset
|
4 Copyright (C) 2010 VZLU Prague |
2828 | 5 |
6 This file is part of Octave. | |
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. | |
2828 | 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/>. | |
2828 | 21 |
22 */ | |
23 | |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
24 #if ! defined (octave_boolMatrix_h) |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17769
diff
changeset
|
25 #define octave_boolMatrix_h 1 |
2828 | 26 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
27 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
28 |
10351
5150ceb4dbb4
base charMatrix and boolMatrix on Array<char>
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
29 #include "Array.h" |
19317
25f535b90e52
Change boolMatrix to subclass boolNDArray rather than be another Array<bool>.
Carnë Draug <carandraug@octave.org>
parents:
17822
diff
changeset
|
30 #include "boolNDArray.h" |
2828 | 31 |
32 #include "mx-defs.h" | |
8774
b756ce0002db
split implementation and interface in mx-op-defs and MArray-defs
Jaroslav Hajek <highegg@gmail.com>
parents:
7620
diff
changeset
|
33 #include "mx-op-decl.h" |
2828 | 34 |
35 class | |
6108 | 36 OCTAVE_API |
19317
25f535b90e52
Change boolMatrix to subclass boolNDArray rather than be another Array<bool>.
Carnë Draug <carandraug@octave.org>
parents:
17822
diff
changeset
|
37 boolMatrix : public boolNDArray |
2828 | 38 { |
39 public: | |
40 | |
19317
25f535b90e52
Change boolMatrix to subclass boolNDArray rather than be another Array<bool>.
Carnë Draug <carandraug@octave.org>
parents:
17822
diff
changeset
|
41 boolMatrix (void) : boolNDArray () { } |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
42 |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
43 boolMatrix (octave_idx_type r, octave_idx_type c) |
19317
25f535b90e52
Change boolMatrix to subclass boolNDArray rather than be another Array<bool>.
Carnë Draug <carandraug@octave.org>
parents:
17822
diff
changeset
|
44 : boolNDArray (dim_vector (r, c)) { } |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
45 |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
46 boolMatrix (octave_idx_type r, octave_idx_type c, bool val) |
19317
25f535b90e52
Change boolMatrix to subclass boolNDArray rather than be another Array<bool>.
Carnë Draug <carandraug@octave.org>
parents:
17822
diff
changeset
|
47 : boolNDArray (dim_vector (r, c), val) { } |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
48 |
19322
50922b1c74df
liboctave: confirm that matrices constructors are limited to 2 dimensions.
Carnë Draug <carandraug@octave.org>
parents:
19319
diff
changeset
|
49 boolMatrix (const dim_vector& dv) : boolNDArray (dv.redim (2)) { } |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
50 |
19322
50922b1c74df
liboctave: confirm that matrices constructors are limited to 2 dimensions.
Carnë Draug <carandraug@octave.org>
parents:
19319
diff
changeset
|
51 boolMatrix (const dim_vector& dv, bool val) |
50922b1c74df
liboctave: confirm that matrices constructors are limited to 2 dimensions.
Carnë Draug <carandraug@octave.org>
parents:
19319
diff
changeset
|
52 : boolNDArray (dv.redim (2), val) { } |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
53 |
19317
25f535b90e52
Change boolMatrix to subclass boolNDArray rather than be another Array<bool>.
Carnë Draug <carandraug@octave.org>
parents:
17822
diff
changeset
|
54 boolMatrix (const Array<bool>& a) : boolNDArray (a.as_matrix ()) { } |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
55 |
19317
25f535b90e52
Change boolMatrix to subclass boolNDArray rather than be another Array<bool>.
Carnë Draug <carandraug@octave.org>
parents:
17822
diff
changeset
|
56 boolMatrix (const boolMatrix& a) : boolNDArray (a) { } |
2828 | 57 |
58 bool operator == (const boolMatrix& a) const; | |
59 bool operator != (const boolMatrix& a) const; | |
60 | |
10351
5150ceb4dbb4
base charMatrix and boolMatrix on Array<char>
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
61 boolMatrix transpose (void) const { return Array<bool>::transpose (); } |
3225 | 62 |
2828 | 63 // destructive insert/delete/reorder operations |
64 | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
65 boolMatrix& insert (const boolMatrix& a, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
66 octave_idx_type r, octave_idx_type c); |
2828 | 67 |
3203 | 68 // unary operations |
69 | |
70 boolMatrix operator ! (void) const; | |
71 | |
72 // other operations | |
73 | |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
74 boolMatrix diag (octave_idx_type k = 0) const; |
6979 | 75 |
2828 | 76 #if 0 |
77 // i/o | |
78 | |
3504 | 79 friend std::ostream& operator << (std::ostream& os, const Matrix& a); |
80 friend std::istream& operator >> (std::istream& is, Matrix& a); | |
2828 | 81 #endif |
82 | |
14616
13cc11418393
improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
83 void resize (octave_idx_type nr, octave_idx_type nc, bool rfv = false) |
11574
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
84 { |
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
85 Array<bool>::resize (dim_vector (nr, nc), rfv); |
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
86 } |
2828 | 87 }; |
88 | |
9550
3d6a9aea2aea
refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
89 MM_BOOL_OP_DECLS (boolMatrix, boolMatrix, OCTAVE_API) |
3d6a9aea2aea
refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
90 MS_BOOL_OP_DECLS (boolMatrix, bool, OCTAVE_API) |
3d6a9aea2aea
refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
91 SM_BOOL_OP_DECLS (bool, boolMatrix, OCTAVE_API) |
6708 | 92 MM_CMP_OP_DECLS (boolMatrix, boolMatrix, OCTAVE_API) |
3685 | 93 |
2828 | 94 #endif |