Mercurial > hg > octave-nkf
annotate liboctave/boolMatrix.h @ 13504:13e3d60aff2d
Replaced Quint with OctaveGUI.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Sun, 17 Jul 2011 20:27:03 +0200 |
parents | a83bad07f7e3 |
children | 72c96de7a403 |
rev | line source |
---|---|
2828 | 1 /* |
2 | |
11523 | 3 Copyright (C) 1996-2011 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 | |
24 #if !defined (octave_boolMatrix_int_h) | |
25 #define octave_boolMatrix_int_h 1 | |
26 | |
10351
5150ceb4dbb4
base charMatrix and boolMatrix on Array<char>
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
27 #include "Array.h" |
2828 | 28 |
29 #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
|
30 #include "mx-op-decl.h" |
2828 | 31 |
32 class | |
6108 | 33 OCTAVE_API |
10351
5150ceb4dbb4
base charMatrix and boolMatrix on Array<char>
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
34 boolMatrix : public Array<bool> |
2828 | 35 { |
36 public: | |
37 | |
10351
5150ceb4dbb4
base charMatrix and boolMatrix on Array<char>
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
38 boolMatrix (void) : Array<bool> () { } |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
39 |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
40 boolMatrix (octave_idx_type r, octave_idx_type c) |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
41 : Array<bool> (dim_vector (r, c)) { } |
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, bool val) |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
44 : Array<bool> (dim_vector (r, c), val) { } |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
45 |
10351
5150ceb4dbb4
base charMatrix and boolMatrix on Array<char>
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
46 boolMatrix (const dim_vector& dv) : Array<bool> (dv) { } |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
47 |
10351
5150ceb4dbb4
base charMatrix and boolMatrix on Array<char>
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
48 boolMatrix (const dim_vector& dv, bool val) : Array<bool> (dv, val) { } |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
49 |
10352 | 50 boolMatrix (const Array<bool>& a) : Array<bool> (a.as_matrix ()) { } |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
51 |
10351
5150ceb4dbb4
base charMatrix and boolMatrix on Array<char>
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
52 boolMatrix (const boolMatrix& a) : Array<bool> (a) { } |
2828 | 53 |
54 boolMatrix& operator = (const boolMatrix& a) | |
55 { | |
10351
5150ceb4dbb4
base charMatrix and boolMatrix on Array<char>
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
56 Array<bool>::operator = (a); |
2828 | 57 return *this; |
58 } | |
59 | |
60 bool operator == (const boolMatrix& a) const; | |
61 bool operator != (const boolMatrix& a) const; | |
62 | |
10351
5150ceb4dbb4
base charMatrix and boolMatrix on Array<char>
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
63 boolMatrix transpose (void) const { return Array<bool>::transpose (); } |
3225 | 64 |
2828 | 65 // destructive insert/delete/reorder operations |
66 | |
5275 | 67 boolMatrix& insert (const boolMatrix& a, octave_idx_type r, octave_idx_type c); |
2828 | 68 |
3203 | 69 // unary operations |
70 | |
71 boolMatrix operator ! (void) const; | |
72 | |
73 // other operations | |
74 | |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
75 boolMatrix diag (octave_idx_type k = 0) const; |
6979 | 76 |
4017 | 77 boolMatrix all (int dim = -1) const; |
78 boolMatrix any (int dim = -1) const; | |
2832 | 79 |
2828 | 80 #if 0 |
81 // i/o | |
82 | |
3504 | 83 friend std::ostream& operator << (std::ostream& os, const Matrix& a); |
84 friend std::istream& operator >> (std::istream& is, Matrix& a); | |
2828 | 85 #endif |
86 | |
11574
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
87 void resize (octave_idx_type nr, octave_idx_type nc, |
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
88 bool rfv = resize_fill_value ()) |
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
89 { |
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
90 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
|
91 } |
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
92 |
3933 | 93 static bool resize_fill_value (void) { return false; } |
94 | |
2828 | 95 }; |
96 | |
9550
3d6a9aea2aea
refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
97 MM_BOOL_OP_DECLS (boolMatrix, boolMatrix, OCTAVE_API) |
3d6a9aea2aea
refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
98 MS_BOOL_OP_DECLS (boolMatrix, bool, OCTAVE_API) |
3d6a9aea2aea
refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
99 SM_BOOL_OP_DECLS (bool, boolMatrix, OCTAVE_API) |
6708 | 100 MM_CMP_OP_DECLS (boolMatrix, boolMatrix, OCTAVE_API) |
3685 | 101 |
2828 | 102 #endif |