GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
op-sbm-sbm.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2004-2018 David Bateman
4 Copyright (C) 1998-2004 Andy Adler
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 (HAVE_CONFIG_H)
25 # include "config.h"
26 #endif
27 
28 #include "errwarn.h"
29 #include "ovl.h"
30 #include "ov.h"
31 #include "ov-typeinfo.h"
32 #include "ov-bool-mat.h"
33 #include "ov-scalar.h"
34 #include "ops.h"
35 
36 #include "ov-re-sparse.h"
37 #include "ov-bool-sparse.h"
38 
39 // unary sparse bool matrix ops.
40 
41 DEFUNOP_OP (not, sparse_bool_matrix, !)
42 
43 DEFUNOP (uplus, sparse_bool_matrix)
44 {
46  = dynamic_cast<const octave_sparse_bool_matrix&> (a);
47  return octave_value (v.sparse_matrix_value ());
48 }
49 
50 DEFUNOP (uminus, sparse_bool_matrix)
51 {
53  = dynamic_cast<const octave_sparse_bool_matrix&> (a);
54  return octave_value (- v.sparse_matrix_value ());
55 }
56 
57 DEFUNOP (transpose, sparse_bool_matrix)
58 {
60  = dynamic_cast<const octave_sparse_bool_matrix&> (a);
62 }
63 
64 // sparse bool matrix by sparse bool matrix ops.
65 
66 DEFBINOP_FN (eq, sparse_bool_matrix, sparse_bool_matrix, mx_el_eq)
67 DEFBINOP_FN (ne, sparse_bool_matrix, sparse_bool_matrix, mx_el_ne)
68 DEFBINOP_FN (el_and, sparse_bool_matrix, sparse_bool_matrix, mx_el_and)
69 DEFBINOP_FN (el_or, sparse_bool_matrix, sparse_bool_matrix, mx_el_or)
70 
71 DEFNDCATOP_FN (sbm_sbm, sparse_bool_matrix, sparse_bool_matrix,
72  sparse_bool_matrix, sparse_bool_matrix, concat)
73 DEFNDCATOP_FN (sbm_sm, sparse_bool_matrix, sparse_matrix, sparse_matrix,
74  sparse_matrix, concat)
75 DEFNDCATOP_FN (sm_sbm, sparse_matrix, sparse_bool_matrix, sparse_matrix,
76  sparse_matrix, concat)
77 
78 DEFASSIGNOP_FN (assign, sparse_bool_matrix, sparse_bool_matrix,
79  assign)
80 
81 void
82 install_sbm_sbm_ops (octave::type_info& ti)
83 {
89 
94 
99 
101  sbm_sbm);
104 
106  octave_sparse_bool_matrix, assign);
107 }
#define INSTALL_ASSIGNOP_TI(ti, op, t1, t2, f)
Definition: ops.h:62
octave_value op_uplus(const octave_value &a)
Definition: ov.h:1574
#define DEFUNOP(name, t)
Definition: ops.h:213
#define INSTALL_BINOP_TI(ti, op, t1, t2, f)
Definition: ops.h:53
octave_value op_eq(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1613
static void transpose(octave_idx_type N, const octave_idx_type *ridx, const octave_idx_type *cidx, octave_idx_type *ridx2, octave_idx_type *cidx2)
Definition: symrcm.cc:386
ComplexNDArray concat(NDArray &ra, ComplexNDArray &rb, const Array< octave_idx_type > &ra_idx)
Definition: CNDArray.cc:653
SparseBoolMatrix sparse_bool_matrix_value(bool=false) const
#define DEFUNOP_OP(name, t, op)
Definition: ops.h:217
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
#define INSTALL_UNOP_TI(ti, op, t, f)
Definition: ops.h:45
octave_value op_el_or(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1623
octave_value op_not(const octave_value &a)
Definition: ov.h:1573
#define INSTALL_CATOP_TI(ti, t1, t2, f)
Definition: ops.h:58
octave_value op_transpose(const octave_value &a)
Definition: ov.h:1577
octave_value op_el_and(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1622
boolMatrix mx_el_ne(const boolMatrix &m1, const boolMatrix &m2)
Definition: boolMatrix.cc:89
void install_sbm_sbm_ops(octave::type_info &ti)
Definition: op-sbm-sbm.cc:82
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
boolMatrix mx_el_or(const boolMatrix &m1, const boolMatrix &m2)
Definition: boolMatrix.cc:86
octave_value op_ne(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1616
boolMatrix mx_el_and(const boolMatrix &m1, const boolMatrix &m2)
Definition: boolMatrix.cc:86
SparseMatrix sparse_matrix_value(bool=false) const
#define DEFBINOP_FN(name, t1, t2, f)
Definition: ops.h:324
octave_value op_hermitian(const octave_value &a)
Definition: ov.h:1578
#define DEFNDCATOP_FN(name, t1, t2, e1, e2, f)
Definition: ops.h:382
boolMatrix mx_el_eq(const boolMatrix &m1, const boolMatrix &m2)
Definition: boolMatrix.cc:89
octave_value op_uminus(const octave_value &a)
Definition: ov.h:1575
SparseBoolMatrix transpose(void) const
Definition: boolSparse.h:89
#define DEFASSIGNOP_FN(name, t1, t2, f)
Definition: ops.h:121