GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
boolMatrix.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2018 John W. Eaton
4 Copyright (C) 2010 VZLU Prague
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
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with Octave; see the file COPYING. If not, see
20 <https://www.gnu.org/licenses/>.
21 
22 */
23 
24 #if ! defined (octave_boolMatrix_h)
25 #define octave_boolMatrix_h 1
26 
27 #include "octave-config.h"
28 
29 #include "Array.h"
30 #include "boolNDArray.h"
31 #include "mx-defs.h"
32 #include "mx-op-decl.h"
33 
34 class
35 OCTAVE_API
36 boolMatrix : public boolNDArray
37 {
38 public:
39 
40  boolMatrix (void) : boolNDArray () { }
41 
43  : boolNDArray (dim_vector (r, c)) { }
44 
46  : boolNDArray (dim_vector (r, c), val) { }
47 
48  boolMatrix (const dim_vector& dv) : boolNDArray (dv.redim (2)) { }
49 
50  boolMatrix (const dim_vector& dv, bool val)
51  : boolNDArray (dv.redim (2), val) { }
52 
53  boolMatrix (const Array<bool>& a) : boolNDArray (a.as_matrix ()) { }
54 
55  boolMatrix (const boolMatrix& a) : boolNDArray (a) { }
56 
57  bool operator == (const boolMatrix& a) const;
58  bool operator != (const boolMatrix& a) const;
59 
60  boolMatrix transpose (void) const { return Array<bool>::transpose (); }
61 
62  // destructive insert/delete/reorder operations
63 
64  boolMatrix& insert (const boolMatrix& a,
66 
67  // unary operations
68 
69  boolMatrix operator ! (void) const;
70 
71  // other operations
72 
73  boolMatrix diag (octave_idx_type k = 0) const;
74 
75 #if 0
76  // i/o
77 
78  friend std::ostream& operator << (std::ostream& os, const Matrix& a);
79  friend std::istream& operator >> (std::istream& is, Matrix& a);
80 #endif
81 
82  void resize (octave_idx_type nr, octave_idx_type nc, bool rfv = false)
83  {
84  Array<bool>::resize (dim_vector (nr, nc), rfv);
85  }
86 };
87 
89 MS_BOOL_OP_DECLS (boolMatrix, bool, OCTAVE_API)
90 SM_BOOL_OP_DECLS (bool, boolMatrix, OCTAVE_API)
92 
93 #endif
boolMatrix transpose(void) const
Definition: boolMatrix.h:60
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:566
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
Definition: boolSparse.cc:279
boolMatrix(const dim_vector &dv, bool val)
Definition: boolMatrix.h:50
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:4986
for large enough k
Definition: lu.cc:617
boolMatrix(const dim_vector &dv)
Definition: boolMatrix.h:48
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
Definition: file-io.cc:587
boolMatrix(octave_idx_type r, octave_idx_type c)
Definition: boolMatrix.h:42
boolMatrix(void)
Definition: boolMatrix.h:40
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:400
boolMatrix(octave_idx_type r, octave_idx_type c, bool val)
Definition: boolMatrix.h:45
#define SM_BOOL_OP_DECLS(S, M, API)
Definition: mx-op-decl.h:122
#define MM_CMP_OP_DECLS(M1, M2, API)
Definition: mx-op-decl.h:139
#define MM_BOOL_OP_DECLS(M1, M2, API)
Definition: mx-op-decl.h:147
void resize(const dim_vector &dv, const T &rfv)
Resizing (with fill).
Definition: Array.cc:1010
Array< T > transpose(void) const
Definition: Array.cc:1598
Definition: dMatrix.h:36
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:550
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
#define MS_BOOL_OP_DECLS(M, S, API)
Definition: mx-op-decl.h:97
boolMatrix(const Array< bool > &a)
Definition: boolMatrix.h:53
octave_value operator!(const octave_value &a)
Definition: ov.h:1573
void resize(octave_idx_type nr, octave_idx_type nc, bool rfv=false)
Definition: boolMatrix.h:82
write the output to stdout if nargout is
Definition: load-save.cc:1612
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:87
dim_vector dv
Definition: sub2ind.cc:263
octave::stream os
Definition: file-io.cc:627
boolMatrix(const boolMatrix &a)
Definition: boolMatrix.h:55