GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
op-b-b.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2017 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if defined (HAVE_CONFIG_H)
24 # include "config.h"
25 #endif
26 
27 #include "errwarn.h"
28 #include "ovl.h"
29 #include "ov.h"
30 #include "ov-bool.h"
31 #include "ov-bool-mat.h"
32 #include "ov-scalar.h"
33 #include "ov-float.h"
34 #include "ov-re-mat.h"
35 #include "ov-typeinfo.h"
36 #include "ov-null-mat.h"
37 #include "ops.h"
38 #include "xdiv.h"
39 #include "xpow.h"
40 
41 // bool unary ops.
42 
43 // scalar unary ops.
44 
45 DEFUNOP_OP (not, bool, !)
46 
47 static octave_value
49 {
50  const octave_bool& v = dynamic_cast<const octave_bool&> (a);
51  return octave_value (v.double_value ());
52 }
53 
54 static octave_value
56 {
57  const octave_bool& v = dynamic_cast<const octave_bool&> (a);
58  return octave_value (- v.double_value ());
59 }
60 
61 DEFUNOP_OP (transpose, bool, /* no-op */)
62 DEFUNOP_OP (hermitian, bool, /* no-op */)
63 
64 // bool by bool ops.
65 
66 DEFBINOP_OP (eq, bool, bool, ==)
67 DEFBINOP_OP (ne, bool, bool, !=)
68 DEFBINOP_OP (el_and, bool, bool, &&)
69 DEFBINOP_OP (el_or, bool, bool, ||)
70 
71 DEFNDCATOP_FN (b_b, bool, bool, bool_array, bool_array, concat)
72 DEFNDCATOP_FN (b_s, bool, scalar, array, array, concat)
73 DEFNDCATOP_FN (s_b, scalar, bool, array, array, concat)
74 DEFNDCATOP_FN (b_f, bool, float_scalar, float_array, float_array, concat)
75 DEFNDCATOP_FN (f_b, float_scalar, bool, float_array, float_array, concat)
76 
77 void
79 {
85 
90 
96 
98 
102 }
octave_value op_uplus(const octave_value &a)
Definition: ov.h:1485
octave_value op_eq(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1524
nd group nd example oindent but is performed more efficiently If only and it is a scalar
Definition: data.cc:5342
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:382
ComplexNDArray concat(NDArray &ra, ComplexNDArray &rb, const Array< octave_idx_type > &ra_idx)
Definition: CNDArray.cc:655
double double_value(bool=false) const
Definition: ov-bool.h:148
#define DEFUNOP_OP(name, t, op)
Definition: ops.h:176
#define DEFBINOP_OP(name, t1, t2, op)
Definition: ops.h:228
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:398
octave_value op_el_or(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1534
#define INSTALL_BINOP(op, t1, t2, f)
Definition: ops.h:48
octave_value op_not(const octave_value &a)
Definition: ov.h:1484
then the function must return scalars which will be concatenated into the return array(s).If code
Definition: cellfun.cc:398
octave_value op_transpose(const octave_value &a)
Definition: ov.h:1488
octave_value op_el_and(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1533
#define INSTALL_CATOP(t1, t2, f)
Definition: ops.h:53
octave_value op_ne(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1527
#define INSTALL_UNOP(op, t, f)
Definition: ops.h:40
octave_value op_hermitian(const octave_value &a)
Definition: ov.h:1489
#define INSTALL_ASSIGNCONV(t1, t2, tr)
Definition: ops.h:66
static octave_value oct_unop_uplus(const octave_base_value &a)
Definition: op-b-b.cc:48
#define DEFNDCATOP_FN(name, t1, t2, e1, e2, f)
Definition: ops.h:341
octave_value op_uminus(const octave_value &a)
Definition: ov.h:1486
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))
void install_b_b_ops(void)
Definition: op-b-b.cc:78
static octave_value oct_unop_uminus(const octave_base_value &a)
Definition: op-b-b.cc:55