Mercurial > octave
annotate libinterp/operators/op-range.cc @ 27923:bd51beb6205e
update formatting of copyright notices
* Use <https://octave.org/copyright/> instead of
<https://octave.org/COPYRIGHT.html/>.
* For consistency with other comments in the Octave sources, use
C++-style comments for copyright blocks in C and C++ files.
* Use delimiters above and below copyright blocks that are appropriate
for the language used in the file.
* Eliminate extra spacing inside copyright blocks.
* lex.ll (looks_like_copyright): Also allow newlines and carriage
returns before the word "Copyright".
* scripts/mk-doc.pl (gethelp): Also skip empty comment lines.
* bp-table.cc, type.m: Adjust tests.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 08 Jan 2020 11:59:41 -0500 |
parents | 1891570abac8 |
children | c20b7290c778 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
3 // Copyright (C) 1996-2020 The Octave Project Developers |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
3207 | 25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21647
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21200
diff
changeset
|
27 # include "config.h" |
3207 | 28 #endif |
29 | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
20940
diff
changeset
|
30 #include "errwarn.h" |
20940
48b2ad5ee801
maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
31 #include "ovl.h" |
3207 | 32 #include "ov.h" |
33 #include "ov-range.h" | |
4915 | 34 #include "ov-ch-mat.h" |
35 #include "ov-scalar.h" | |
36 #include "ov-re-mat.h" | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
37 #include "ov-flt-re-mat.h" |
4915 | 38 #include "ov-complex.h" |
39 #include "ov-cx-mat.h" | |
40 #include "ov-bool.h" | |
41 #include "ov-bool-mat.h" | |
3207 | 42 #include "ov-typeinfo.h" |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
43 #include "ov-null-mat.h" |
3207 | 44 #include "ops.h" |
9103
10bed8fbec99
optimize scalar .^ range operation
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
45 #include "xpow.h" |
3207 | 46 |
47 // range unary ops. | |
48 | |
49 DEFUNOP (not, range) | |
50 { | |
21647
66cae7a6dc47
eliminate some macros for operator definitions
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
51 const octave_range& v = dynamic_cast<const octave_range&> (a); |
3207 | 52 |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
53 return octave_value (! v.matrix_value ()); |
3207 | 54 } |
55 | |
4965 | 56 DEFUNOP_OP (uplus, range, /* no-op */) |
3207 | 57 DEFUNOP_OP (uminus, range, -) |
58 | |
59 DEFUNOP (transpose, range) | |
60 { | |
21647
66cae7a6dc47
eliminate some macros for operator definitions
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
61 const octave_range& v = dynamic_cast<const octave_range&> (a); |
3207 | 62 |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
63 return octave_value (v.matrix_value ().transpose ()); |
3207 | 64 } |
65 | |
8553
c7ff200e45f5
optimize range-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8333
diff
changeset
|
66 DEFBINOP_OP (addrs, range, scalar, +) |
c7ff200e45f5
optimize range-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8333
diff
changeset
|
67 DEFBINOP_OP (addsr, scalar, range, +) |
c7ff200e45f5
optimize range-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8333
diff
changeset
|
68 DEFBINOP_OP (subrs, range, scalar, -) |
c7ff200e45f5
optimize range-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8333
diff
changeset
|
69 DEFBINOP_OP (subsr, scalar, range, -) |
c7ff200e45f5
optimize range-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8333
diff
changeset
|
70 DEFBINOP_OP (mulrs, range, scalar, *) |
c7ff200e45f5
optimize range-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8333
diff
changeset
|
71 DEFBINOP_OP (mulsr, scalar, range, *) |
c7ff200e45f5
optimize range-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8333
diff
changeset
|
72 |
9103
10bed8fbec99
optimize scalar .^ range operation
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
73 DEFBINOP_FN (el_powsr, scalar, range, elem_xpow) |
10bed8fbec99
optimize scalar .^ range operation
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
74 DEFBINOP_FN (el_powcsr, complex, range, elem_xpow) |
10bed8fbec99
optimize scalar .^ range operation
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
75 |
4915 | 76 DEFNDCATOP_FN (r_r, range, range, array, array, concat) |
77 DEFNDCATOP_FN (r_s, range, scalar, array, array, concat) | |
78 DEFNDCATOP_FN (r_m, range, matrix, array, array, concat) | |
79 DEFNDCATOP_FN (r_cs, range, complex, array, complex_array, concat) | |
80 DEFNDCATOP_FN (r_cm, range, complex_matrix, array, complex_array, concat) | |
81 DEFNDCATOP_FN (r_b, range, bool, array, array, concat) | |
82 DEFNDCATOP_FN (r_bm, range, bool_matrix, array, array, concat) | |
83 DEFNDCATOP_FN (r_chm, range, char_matrix, array, char_array, concat) | |
84 DEFNDCATOP_FN (s_r, scalar, range, array, array, concat) | |
85 DEFNDCATOP_FN (m_r, matrix, range, array, array, concat) | |
86 DEFNDCATOP_FN (cs_r, complex, range, complex_array, array, concat) | |
87 DEFNDCATOP_FN (cm_r, complex_matrix, range, complex_array, array, concat) | |
88 DEFNDCATOP_FN (b_r, bool, range, array, array, concat) | |
89 DEFNDCATOP_FN (bm_r, bool_matrix, range, array, array, concat) | |
90 DEFNDCATOP_FN (chm_r, char_matrix, range, char_array, array, concat) | |
91 | |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
92 CONVDECL (range_to_matrix) |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
93 { |
21647
66cae7a6dc47
eliminate some macros for operator definitions
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
94 const octave_range& v = dynamic_cast<const octave_range&> (a); |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
95 |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
96 return new octave_matrix (v.array_value ()); |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
97 } |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
98 |
3207 | 99 void |
24540
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
100 install_range_ops (octave::type_info& ti) |
3207 | 101 { |
24540
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
102 INSTALL_UNOP_TI (ti, op_not, octave_range, not); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
103 INSTALL_UNOP_TI (ti, op_uplus, octave_range, uplus); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
104 INSTALL_UNOP_TI (ti, op_uminus, octave_range, uminus); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
105 INSTALL_UNOP_TI (ti, op_transpose, octave_range, transpose); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
106 INSTALL_UNOP_TI (ti, op_hermitian, octave_range, transpose); |
4915 | 107 |
24540
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
108 INSTALL_BINOP_TI (ti, op_add, octave_range, octave_scalar, addrs); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
109 INSTALL_BINOP_TI (ti, op_add, octave_scalar, octave_range, addsr); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
110 INSTALL_BINOP_TI (ti, op_sub, octave_range, octave_scalar, subrs); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
111 INSTALL_BINOP_TI (ti, op_sub, octave_scalar, octave_range, subsr); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
112 INSTALL_BINOP_TI (ti, op_mul, octave_range, octave_scalar, mulrs); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
113 INSTALL_BINOP_TI (ti, op_mul, octave_scalar, octave_range, mulsr); |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
114 |
24972
ef8df0a8b358
Add element-by-element multiplication operator for ranges (bug #53232).
maorshutman <maorus12@gmail.com>
parents:
24540
diff
changeset
|
115 INSTALL_BINOP_TI (ti, op_el_mul, octave_range, octave_scalar, mulrs); |
ef8df0a8b358
Add element-by-element multiplication operator for ranges (bug #53232).
maorshutman <maorus12@gmail.com>
parents:
24540
diff
changeset
|
116 INSTALL_BINOP_TI (ti, op_el_mul, octave_scalar, octave_range, mulsr); |
24540
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
117 INSTALL_BINOP_TI (ti, op_el_pow, octave_scalar, octave_range, el_powsr); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
118 INSTALL_BINOP_TI (ti, op_el_pow, octave_complex, octave_range, el_powcsr); |
9103
10bed8fbec99
optimize scalar .^ range operation
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
119 |
24540
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
120 INSTALL_CATOP_TI (ti, octave_range, octave_range, r_r); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
121 INSTALL_CATOP_TI (ti, octave_range, octave_scalar, r_s); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
122 INSTALL_CATOP_TI (ti, octave_range, octave_matrix, r_m); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
123 INSTALL_CATOP_TI (ti, octave_range, octave_complex, r_cs); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
124 INSTALL_CATOP_TI (ti, octave_range, octave_complex_matrix, r_cm); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
125 INSTALL_CATOP_TI (ti, octave_range, octave_bool, r_b); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
126 INSTALL_CATOP_TI (ti, octave_range, octave_bool_matrix, r_bm); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
127 INSTALL_CATOP_TI (ti, octave_range, octave_char_matrix, r_chm); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
128 INSTALL_CATOP_TI (ti, octave_scalar, octave_range, s_r); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
129 INSTALL_CATOP_TI (ti, octave_matrix, octave_range, m_r); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
130 INSTALL_CATOP_TI (ti, octave_complex, octave_range, cs_r); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
131 INSTALL_CATOP_TI (ti, octave_complex_matrix, octave_range, cm_r); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
132 INSTALL_CATOP_TI (ti, octave_bool, octave_range, b_r); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
133 INSTALL_CATOP_TI (ti, octave_bool_matrix, octave_range, bm_r); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
134 INSTALL_CATOP_TI (ti, octave_char_matrix, octave_range, chm_r); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
135 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
136 // FIXME: this would be unneccessary if |
8333 | 137 // octave_base_value::numeric_assign always tried converting lhs |
138 // before rhs. | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
139 |
24540
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
140 INSTALL_ASSIGNCONV_TI (ti, octave_range, octave_null_matrix, octave_matrix); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
141 INSTALL_ASSIGNCONV_TI (ti, octave_range, octave_null_str, octave_matrix); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
142 INSTALL_ASSIGNCONV_TI (ti, octave_range, octave_null_sq_str, octave_matrix); |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
143 |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
144 // However, this should probably be here just in case we need it. |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
145 |
24540
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
146 INSTALL_WIDENOP_TI (ti, octave_range, octave_matrix, range_to_matrix); |
3207 | 147 } |