Mercurial > octave
annotate libinterp/parse-tree/pt-mat.cc @ 21200:fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
* builtins.h, Cell.cc, __contourc__.cc, __dispatch__.cc, __dsearchn__.cc,
__ichol__.cc, __ilu__.cc, __lin_interpn__.cc, __pchip_deriv__.cc, __qp__.cc,
balance.cc, besselj.cc, betainc.cc, bitfcns.cc, bsxfun.cc,
c-file-ptr-stream.cc, c-file-ptr-stream.h, cellfun.cc, colloc.cc,
comment-list.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, debug.cc,
defaults.cc, defaults.in.h, defun-dld.h, defun.cc, defun.h, det.cc, dirfns.cc,
display.cc, dlmread.cc, dot.cc, dynamic-ld.cc, eig.cc, ellipj.cc, error.cc,
errwarn.cc, event-queue.cc, fft.cc, fft2.cc, fftn.cc, file-io.cc, filter.cc,
find.cc, gammainc.cc, gcd.cc, getgrent.cc, getpwent.cc, getrusage.cc,
givens.cc, gl-render.cc, gl2ps-print.cc, graphics.cc, graphics.in.h, gripes.cc,
hash.cc, help.cc, hess.cc, hex2num.cc, input.cc, inv.cc, jit-ir.cc,
jit-typeinfo.cc, jit-util.cc, jit-util.h, kron.cc, load-path.cc, load-save.cc,
lookup.cc, ls-ascii-helper.cc, ls-hdf5.cc, ls-mat-ascii.cc, ls-mat4.cc,
ls-mat5.cc, ls-oct-binary.cc, ls-oct-text.cc, ls-oct-text.h, ls-utils.cc,
ls-utils.h, lsode.cc, lu.cc, luinc.cc, mappers.cc, matrix_type.cc, max.cc,
mex.h, mexproto.h, mgorth.cc, nproc.cc, oct-errno.in.cc, oct-fstrm.cc,
oct-hdf5-types.cc, oct-hdf5.h, oct-hist.cc, oct-iostrm.cc, oct-lvalue.cc,
oct-map.cc, oct-prcstrm.cc, oct-procbuf.cc, oct-stream.cc, oct-strstrm.cc,
octave-link.cc, ordschur.cc, pager.cc, pinv.cc, pr-output.cc, procstream.cc,
profiler.cc, psi.cc, pt-jit.cc, quad.cc, quadcc.cc, qz.cc, rand.cc, rcond.cc,
regexp.cc, schur.cc, sighandlers.cc, sparse-xdiv.cc, sparse-xpow.cc, sparse.cc,
spparms.cc, sqrtm.cc, str2double.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc,
sylvester.cc, symtab.cc, syscalls.cc, sysdep.cc, sysdep.h, time.cc, toplev.cc,
tril.cc, tsearch.cc, txt-eng-ft.cc, txt-eng.cc, typecast.cc, urlwrite.cc,
utils.cc, variables.cc, xdiv.cc, xnorm.cc, xpow.cc, zfstream.cc,
__delaunayn__.cc, __eigs__.cc, __fltk_uigetfile__.cc, __glpk__.cc,
__init_fltk__.cc, __init_gnuplot__.cc, __magick_read__.cc, __osmesa_print__.cc,
__voronoi__.cc, amd.cc, audiodevinfo.cc, audioread.cc, ccolamd.cc, chol.cc,
colamd.cc, convhulln.cc, dmperm.cc, fftw.cc, oct-qhull.h, qr.cc, symbfact.cc,
symrcm.cc, oct-conf.in.cc, ov-base-diag.cc, ov-base-int.cc, ov-base-mat.cc,
ov-base-scalar.cc, ov-base-sparse.cc, ov-base.cc, ov-bool-mat.cc,
ov-bool-sparse.cc, ov-bool.cc, ov-builtin.cc, ov-cell.cc, ov-ch-mat.cc,
ov-class.cc, ov-classdef.cc, ov-colon.cc, ov-complex.cc, ov-cs-list.cc,
ov-cx-diag.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-dld-fcn.cc, ov-fcn-handle.cc,
ov-fcn-inline.cc, ov-fcn.cc, ov-float.cc, ov-flt-complex.cc, ov-flt-cx-diag.cc,
ov-flt-cx-mat.cc, ov-flt-re-diag.cc, ov-flt-re-mat.cc, ov-int16.cc,
ov-int32.cc, ov-int64.cc, ov-int8.cc, ov-java.cc, ov-lazy-idx.cc,
ov-mex-fcn.cc, ov-null-mat.cc, ov-oncleanup.cc, ov-perm.cc, ov-range.cc,
ov-re-diag.cc, ov-re-mat.cc, ov-re-sparse.cc, ov-scalar.cc, ov-str-mat.cc,
ov-struct.cc, ov-typeinfo.cc, ov-uint16.cc, ov-uint32.cc, ov-uint64.cc,
ov-uint8.cc, ov-usr-fcn.cc, ov.cc, ovl.cc, octave.cc, op-b-b.cc, op-b-bm.cc,
op-b-sbm.cc, op-bm-b.cc, op-bm-bm.cc, op-bm-sbm.cc, op-cdm-cdm.cc, op-cell.cc,
op-chm.cc, op-class.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-m.cc, op-cm-s.cc,
op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc,
op-cs-scm.cc, op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc,
op-dm-template.cc, op-dms-template.cc, op-double-conv.cc, op-fcdm-fcdm.cc,
op-fcdm-fdm.cc, op-fcm-fcm.cc, op-fcm-fcs.cc, op-fcm-fm.cc, op-fcm-fs.cc,
op-fcn.cc, op-fcs-fcm.cc, op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc,
op-fdm-fdm.cc, op-float-conv.cc, op-fm-fcm.cc, op-fm-fcs.cc, op-fm-fm.cc,
op-fm-fs.cc, op-fs-fcm.cc, op-fs-fcs.cc, op-fs-fm.cc, op-fs-fs.cc,
op-i16-i16.cc, op-i32-i32.cc, op-i64-i64.cc, op-i8-i8.cc, op-int-concat.cc,
op-int-conv.cc, op-m-cm.cc, op-m-cs.cc, op-m-m.cc, op-m-s.cc, op-m-scm.cc,
op-m-sm.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc, op-pm-template.cc,
op-range.cc, op-s-cm.cc, op-s-cs.cc, op-s-m.cc, op-s-s.cc, op-s-scm.cc,
op-s-sm.cc, op-sbm-b.cc, op-sbm-bm.cc, op-sbm-sbm.cc, op-scm-cm.cc,
op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc,
op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc,
op-str-m.cc, op-str-s.cc, op-str-str.cc, op-struct.cc, op-ui16-ui16.cc,
op-ui32-ui32.cc, op-ui64-ui64.cc, op-ui8-ui8.cc, pt-arg-list.cc,
pt-array-list.cc, pt-assign.cc, pt-binop.cc, pt-bp.cc, pt-cbinop.cc,
pt-cell.cc, pt-check.cc, pt-classdef.cc, pt-cmd.cc, pt-colon.cc, pt-colon.h,
pt-const.cc, pt-decl.cc, pt-eval.cc, pt-except.cc, pt-exp.cc, pt-fcn-handle.cc,
pt-funcall.cc, pt-id.cc, pt-idx.cc, pt-jump.cc, pt-loop.cc, pt-mat.cc,
pt-misc.cc, pt-pr-code.cc, pt-select.cc, pt-stmt.cc, pt-unop.cc, pt.cc,
token.cc, Array-jit.cc, Array-os.cc, Array-sym.cc, Array-tc.cc, version.cc:
Indent #ifdef blocks in libinterp.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 05 Feb 2016 16:29:08 -0800 |
parents | 538b57866b90 |
children | f982cfe3df03 |
rev | line source |
---|---|
1741 | 1 /* |
2 | |
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19401
diff
changeset
|
3 Copyright (C) 1996-2015 John W. Eaton |
1741 | 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 | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
1741 | 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 | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
1741 | 20 |
21 */ | |
22 | |
23 #ifdef HAVE_CONFIG_H | |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
21139
diff
changeset
|
24 # include <config.h> |
1741 | 25 #endif |
26 | |
3503 | 27 #include <iostream> |
1741 | 28 |
19269
65554f5847ac
don't include oct-locbuf.h in header files unnecessarily
John W. Eaton <jwe@octave.org>
parents:
18537
diff
changeset
|
29 #include "oct-locbuf.h" |
5502 | 30 #include "quit.h" |
31 | |
13294
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
32 #include "data.h" |
2172 | 33 #include "defun.h" |
1741 | 34 #include "error.h" |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
35 #include "errwarn.h" |
20940
48b2ad5ee801
maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents:
20853
diff
changeset
|
36 #include "ovl.h" |
2982 | 37 #include "pt-arg-list.h" |
3770 | 38 #include "pt-bp.h" |
1741 | 39 #include "pt-exp.h" |
40 #include "pt-mat.h" | |
2124 | 41 #include "pt-walk.h" |
2201 | 42 #include "utils.h" |
2371 | 43 #include "ov.h" |
44 #include "variables.h" | |
1741 | 45 |
9460
1fddcf651559
avoid complex -> real conversion when constructing arrays with []
John W. Eaton <jwe@octave.org>
parents:
9389
diff
changeset
|
46 #include "ov-cx-mat.h" |
1fddcf651559
avoid complex -> real conversion when constructing arrays with []
John W. Eaton <jwe@octave.org>
parents:
9389
diff
changeset
|
47 #include "ov-flt-cx-mat.h" |
5630 | 48 #include "ov-re-sparse.h" |
49 #include "ov-cx-sparse.h" | |
50 | |
2254 | 51 // The character to fill with when creating string arrays. |
3836 | 52 char Vstring_fill_char = ' '; |
2254 | 53 |
1741 | 54 // General matrices. This list type is much more work to handle than |
55 // constant matrices, but it allows us to construct matrices from | |
56 // other matrices, variables, and functions. | |
57 | |
1827 | 58 // But first, some internal classes that make our job much easier. |
1741 | 59 |
1827 | 60 class |
61 tm_row_const | |
1741 | 62 { |
1827 | 63 private: |
64 | |
65 class | |
4219 | 66 tm_row_const_rep : public octave_base_list<octave_value> |
1827 | 67 { |
68 public: | |
69 | |
70 tm_row_const_rep (void) | |
5514 | 71 : count (1), dv (0, 0), all_str (false), |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
72 all_sq_str (false), all_dq_str (false), |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
73 some_str (false), all_real (false), all_cmplx (false), |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
74 all_mt (true), any_cell (false), any_sparse (false), |
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
75 any_class (false), all_1x1 (false), |
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
76 first_elem_is_struct (false), class_nm (), ok (false) |
5533 | 77 { } |
1827 | 78 |
2971 | 79 tm_row_const_rep (const tree_argument_list& row) |
5514 | 80 : count (1), dv (0, 0), all_str (false), all_sq_str (false), |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
81 some_str (false), all_real (false), all_cmplx (false), |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
82 all_mt (true), any_cell (false), any_sparse (false), |
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
83 any_class (false), all_1x1 (! row.empty ()), |
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
84 first_elem_is_struct (false), class_nm (), ok (false) |
3110 | 85 { init (row); } |
1827 | 86 |
87 ~tm_row_const_rep (void) { } | |
88 | |
12125
a21a3875ca83
implement a common class for reference counts
Jaroslav Hajek <highegg@gmail.com>
parents:
11586
diff
changeset
|
89 octave_refcount<int> count; |
1827 | 90 |
4765 | 91 dim_vector dv; |
1741 | 92 |
1827 | 93 bool all_str; |
5280 | 94 bool all_sq_str; |
95 bool all_dq_str; | |
3110 | 96 bool some_str; |
5502 | 97 bool all_real; |
98 bool all_cmplx; | |
2602 | 99 bool all_mt; |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
100 bool any_cell; |
5630 | 101 bool any_sparse; |
8147
9a5ef4f632a3
Add class dispatch for [] operator to vertcat/horzcat methods
David Bateman <dbateman@free.fr>
parents:
8107
diff
changeset
|
102 bool any_class; |
10764
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
103 bool all_1x1; |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
104 bool first_elem_is_struct; |
1827 | 105 |
5533 | 106 std::string class_nm; |
107 | |
1827 | 108 bool ok; |
109 | |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
110 void do_init_element (const octave_value&, bool&); |
4501 | 111 |
2971 | 112 void init (const tree_argument_list&); |
1827 | 113 |
13144
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
114 void cellify (void); |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
115 |
1827 | 116 private: |
117 | |
118 tm_row_const_rep (const tm_row_const_rep&); | |
119 | |
2971 | 120 tm_row_const_rep& operator = (const tm_row_const_rep&); |
2419 | 121 |
1827 | 122 }; |
123 | |
124 public: | |
125 | |
4219 | 126 typedef tm_row_const_rep::iterator iterator; |
127 typedef tm_row_const_rep::const_iterator const_iterator; | |
128 | |
2990 | 129 tm_row_const (void) |
130 : rep (0) { } | |
1827 | 131 |
2971 | 132 tm_row_const (const tree_argument_list& row) |
133 : rep (new tm_row_const_rep (row)) { } | |
1827 | 134 |
2990 | 135 tm_row_const (const tm_row_const& x) |
136 : rep (x.rep) | |
137 { | |
138 if (rep) | |
139 rep->count++; | |
140 } | |
1827 | 141 |
142 tm_row_const& operator = (const tm_row_const& x) | |
2990 | 143 { |
144 if (this != &x && rep != x.rep) | |
145 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
146 if (rep && --rep->count == 0) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
147 delete rep; |
1741 | 148 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
149 rep = x.rep; |
1827 | 150 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
151 if (rep) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
152 rep->count++; |
2990 | 153 } |
1741 | 154 |
2990 | 155 return *this; |
156 } | |
1827 | 157 |
158 ~tm_row_const (void) | |
2990 | 159 { |
160 if (rep && --rep->count == 0) | |
161 delete rep; | |
162 } | |
1741 | 163 |
5514 | 164 octave_idx_type rows (void) { return rep->dv(0); } |
165 octave_idx_type cols (void) { return rep->dv(1); } | |
4765 | 166 |
6200 | 167 bool empty (void) const { return rep->empty (); } |
168 | |
8147
9a5ef4f632a3
Add class dispatch for [] operator to vertcat/horzcat methods
David Bateman <dbateman@free.fr>
parents:
8107
diff
changeset
|
169 size_t length (void) const { return rep->length (); } |
9a5ef4f632a3
Add class dispatch for [] operator to vertcat/horzcat methods
David Bateman <dbateman@free.fr>
parents:
8107
diff
changeset
|
170 |
4765 | 171 dim_vector dims (void) { return rep->dv; } |
1827 | 172 |
2868 | 173 bool all_strings_p (void) const { return rep->all_str; } |
5280 | 174 bool all_sq_strings_p (void) const { return rep->all_sq_str; } |
175 bool all_dq_strings_p (void) const { return rep->all_dq_str; } | |
3110 | 176 bool some_strings_p (void) const { return rep->some_str; } |
5502 | 177 bool all_real_p (void) const { return rep->all_real; } |
178 bool all_complex_p (void) const { return rep->all_cmplx; } | |
2868 | 179 bool all_empty_p (void) const { return rep->all_mt; } |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
180 bool any_cell_p (void) const { return rep->any_cell; } |
5630 | 181 bool any_sparse_p (void) const { return rep->any_sparse; } |
8147
9a5ef4f632a3
Add class dispatch for [] operator to vertcat/horzcat methods
David Bateman <dbateman@free.fr>
parents:
8107
diff
changeset
|
182 bool any_class_p (void) const { return rep->any_class; } |
10764
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
183 bool all_1x1_p (void) const { return rep->all_1x1; } |
13144
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
184 bool first_elem_struct_p (void) const { return rep->first_elem_is_struct; } |
1827 | 185 |
5533 | 186 std::string class_name (void) const { return rep->class_nm; } |
187 | |
13144
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
188 void cellify (void) { rep->cellify (); } |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
189 |
4219 | 190 operator bool () const { return (rep && rep->ok); } |
1827 | 191 |
4219 | 192 iterator begin (void) { return rep->begin (); } |
193 const_iterator begin (void) const { return rep->begin (); } | |
194 | |
195 iterator end (void) { return rep->end (); } | |
196 const_iterator end (void) const { return rep->end (); } | |
1827 | 197 |
198 private: | |
199 | |
200 tm_row_const_rep *rep; | |
201 }; | |
202 | |
8107
8655dc0906e6
Special case single type conacation in Fcat. Rework cell2mat to take advantage
David Bateman <dbateman@free.fr>
parents:
7789
diff
changeset
|
203 std::string |
5533 | 204 get_concat_class (const std::string& c1, const std::string& c2) |
205 { | |
206 std::string retval = octave_base_value::static_class_name (); | |
207 | |
208 if (c1 == c2) | |
209 retval = c1; | |
9389
0f85d9564057
fix result class calculation in pt-mat.cc
Jaroslav Hajek <highegg@gmail.com>
parents:
9145
diff
changeset
|
210 else if (c1.empty ()) |
9145
53364bb317d4
fix concatenation with all-zero matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
211 retval = c2; |
9389
0f85d9564057
fix result class calculation in pt-mat.cc
Jaroslav Hajek <highegg@gmail.com>
parents:
9145
diff
changeset
|
212 else if (c2.empty ()) |
0f85d9564057
fix result class calculation in pt-mat.cc
Jaroslav Hajek <highegg@gmail.com>
parents:
9145
diff
changeset
|
213 retval = c1; |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
214 else if (c1 == "class" || c2 == "class") |
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
215 retval = "class"; |
5533 | 216 else |
217 { | |
218 bool c1_is_int = (c1 == "int8" || c1 == "uint8" | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
219 || c1 == "int16" || c1 == "uint16" |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
220 || c1 == "int32" || c1 == "uint32" |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
221 || c1 == "int64" || c1 == "uint64"); |
5533 | 222 bool c2_is_int = (c2 == "int8" || c2 == "uint8" |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
223 || c2 == "int16" || c2 == "uint16" |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
224 || c2 == "int32" || c2 == "uint32" |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
225 || c2 == "int64" || c2 == "uint64"); |
5533 | 226 |
227 bool c1_is_char = (c1 == "char"); | |
228 bool c2_is_char = (c2 == "char"); | |
229 | |
230 bool c1_is_double = (c1 == "double"); | |
231 bool c2_is_double = (c2 == "double"); | |
232 | |
233 bool c1_is_single = (c1 == "single"); | |
234 bool c2_is_single = (c2 == "single"); | |
235 | |
236 bool c1_is_logical = (c1 == "logical"); | |
237 bool c2_is_logical = (c2 == "logical"); | |
238 | |
239 bool c1_is_built_in_type | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
240 = (c1_is_int || c1_is_char || c1_is_double || c1_is_single |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
241 || c1_is_logical); |
5533 | 242 |
243 bool c2_is_built_in_type | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
244 = (c2_is_int || c2_is_char || c2_is_double || c2_is_single |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
245 || c2_is_logical); |
5533 | 246 |
247 // Order is important here... | |
248 | |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
249 if (c1 == "struct" && c2 == c1) |
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
250 retval = c1; |
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
251 else if (c1 == "cell" || c2 == "cell") |
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
252 retval = "cell"; |
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
253 else if (c1_is_char && c2_is_built_in_type) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
254 retval = c1; |
5533 | 255 else if (c2_is_char && c1_is_built_in_type) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
256 retval = c2; |
5533 | 257 else if (c1_is_int && c2_is_built_in_type) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
258 retval = c1; |
5533 | 259 else if (c2_is_int && c1_is_built_in_type) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
260 retval = c2; |
5533 | 261 else if (c1_is_single && c2_is_built_in_type) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
262 retval = c1; |
5533 | 263 else if (c2_is_single && c1_is_built_in_type) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
264 retval = c2; |
5533 | 265 else if (c1_is_double && c2_is_built_in_type) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
266 retval = c1; |
5533 | 267 else if (c2_is_double && c1_is_built_in_type) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
268 retval = c2; |
5533 | 269 else if (c1_is_logical && c2_is_logical) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
270 retval = c1; |
5533 | 271 } |
272 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
273 return retval; |
5533 | 274 } |
275 | |
21040
3e7cfee5f786
maint: Rename attributes GCC_ATTR_XXX to OCTAVE_XXX.
Rik <rik@octave.org>
parents:
21029
diff
changeset
|
276 OCTAVE_NORETURN static |
21029
e3b3bb522d62
maint: Move GCC_ attributes to start of declaration for future compatibility.
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
277 void |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
278 eval_error (const char *msg, const dim_vector& x, const dim_vector& y) |
10715
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
279 { |
20428
7ac907da9fba
Use error() rather than ::error() unless explicitly required.
Rik <rik@octave.org>
parents:
20163
diff
changeset
|
280 error ("%s (%s vs %s)", msg, x.str ().c_str (), y.str ().c_str ()); |
10715
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
281 } |
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
282 |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
283 void |
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
284 tm_row_const::tm_row_const_rep::do_init_element (const octave_value& val, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
285 bool& first_elem) |
4501 | 286 { |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
287 std::string this_elt_class_nm |
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
288 = val.is_object () ? std::string ("class") : val.class_name (); |
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
289 |
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
290 class_nm = get_concat_class (class_nm, this_elt_class_nm); |
5533 | 291 |
4765 | 292 dim_vector this_elt_dv = val.dims (); |
293 | |
10715
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
294 if (! this_elt_dv.zero_by_zero ()) |
4501 | 295 { |
296 all_mt = false; | |
297 | |
298 if (first_elem) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
299 { |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
300 if (val.is_map ()) |
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
301 first_elem_is_struct = true; |
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
302 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
303 first_elem = false; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
304 } |
4501 | 305 } |
306 | |
4915 | 307 append (val); |
308 | |
4501 | 309 if (all_str && ! val.is_string ()) |
310 all_str = false; | |
311 | |
5280 | 312 if (all_sq_str && ! val.is_sq_string ()) |
313 all_sq_str = false; | |
314 | |
315 if (all_dq_str && ! val.is_dq_string ()) | |
316 all_dq_str = false; | |
317 | |
4501 | 318 if (! some_str && val.is_string ()) |
319 some_str = true; | |
320 | |
5502 | 321 if (all_real && ! val.is_real_type ()) |
322 all_real = false; | |
323 | |
324 if (all_cmplx && ! (val.is_complex_type () || val.is_real_type ())) | |
325 all_cmplx = false; | |
4501 | 326 |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20940
diff
changeset
|
327 if (! any_cell && val.is_cell ()) |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
328 any_cell = true; |
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
329 |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20940
diff
changeset
|
330 if (! any_sparse && val.is_sparse_type ()) |
5630 | 331 any_sparse = true; |
332 | |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20940
diff
changeset
|
333 if (! any_class && val.is_object ()) |
8147
9a5ef4f632a3
Add class dispatch for [] operator to vertcat/horzcat methods
David Bateman <dbateman@free.fr>
parents:
8107
diff
changeset
|
334 any_class = true; |
9a5ef4f632a3
Add class dispatch for [] operator to vertcat/horzcat methods
David Bateman <dbateman@free.fr>
parents:
8107
diff
changeset
|
335 |
17713
ccc0576641f9
Avoid use of numel for sparse matrix when concatenating (bug #40324)
David Bateman <dbateman@free.fr>
parents:
17281
diff
changeset
|
336 // Special treatment of sparse matrices to avoid out-of-memory error |
ccc0576641f9
Avoid use of numel for sparse matrix when concatenating (bug #40324)
David Bateman <dbateman@free.fr>
parents:
17281
diff
changeset
|
337 all_1x1 = all_1x1 && ! val.is_sparse_type () && val.numel () == 1; |
4501 | 338 } |
339 | |
1827 | 340 void |
2971 | 341 tm_row_const::tm_row_const_rep::init (const tree_argument_list& row) |
1827 | 342 { |
343 all_str = true; | |
5280 | 344 all_sq_str = true; |
345 all_dq_str = true; | |
5502 | 346 all_real = true; |
347 all_cmplx = true; | |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
348 any_cell = false; |
5630 | 349 any_sparse = false; |
8147
9a5ef4f632a3
Add class dispatch for [] operator to vertcat/horzcat methods
David Bateman <dbateman@free.fr>
parents:
8107
diff
changeset
|
350 any_class = false; |
1827 | 351 |
352 bool first_elem = true; | |
353 | |
4219 | 354 for (tree_argument_list::const_iterator p = row.begin (); |
355 p != row.end (); | |
356 p++) | |
1827 | 357 { |
10142
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
10116
diff
changeset
|
358 octave_quit (); |
5502 | 359 |
4219 | 360 tree_expression *elt = *p; |
1827 | 361 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8147
diff
changeset
|
362 octave_value tmp = elt->rvalue1 (); |
1827 | 363 |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
364 if (tmp.is_undefined ()) |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
365 { |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
366 ok = true; |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
367 return; |
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
368 } |
1827 | 369 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
370 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
371 if (tmp.is_cs_list ()) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
372 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
373 octave_value_list tlst = tmp.list_value (); |
2602 | 374 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
375 for (octave_idx_type i = 0; i < tlst.length (); i++) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
376 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
377 octave_quit (); |
5502 | 378 |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
379 do_init_element (tlst(i), first_elem); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
380 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
381 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
382 else |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
383 do_init_element (tmp, first_elem); |
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
384 } |
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
385 } |
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
386 |
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
387 if (any_cell && ! any_class && ! first_elem_is_struct) |
13144
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
388 cellify (); |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
389 |
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
390 first_elem = true; |
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
391 |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
392 for (iterator p = begin (); p != end (); p++) |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
393 { |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
394 octave_quit (); |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
395 |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
396 octave_value val = *p; |
19390
68116bea38ba
Avoid duplicate error message when concatenating cell arrays with dim mismatch.
Rik <rik@octave.org>
parents:
19269
diff
changeset
|
397 |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
398 dim_vector this_elt_dv = val.dims (); |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
399 |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
400 if (! this_elt_dv.zero_by_zero ()) |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
401 { |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
402 all_mt = false; |
19390
68116bea38ba
Avoid duplicate error message when concatenating cell arrays with dim mismatch.
Rik <rik@octave.org>
parents:
19269
diff
changeset
|
403 |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
404 if (first_elem) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
405 { |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
406 first_elem = false; |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
407 dv = this_elt_dv; |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
408 } |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
409 else if ((! any_class) && (! dv.hvcat (this_elt_dv, 1))) |
20832
3951d420556c
eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents:
20558
diff
changeset
|
410 eval_error ("horizontal dimensions mismatch", dv, this_elt_dv); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
411 } |
1827 | 412 } |
413 | |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
414 ok = true; |
1741 | 415 } |
416 | |
2419 | 417 void |
13144
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
418 tm_row_const::tm_row_const_rep::cellify (void) |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
419 { |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
420 bool elt_changed = false; |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
421 |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
422 for (iterator p = begin (); p != end (); p++) |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
423 { |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
424 octave_quit (); |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
425 |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
426 if (! p->is_cell ()) |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
427 { |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
428 elt_changed = true; |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
429 |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
430 *p = Cell (*p); |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
431 } |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
432 } |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
433 |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
434 if (elt_changed) |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
435 { |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
436 bool first_elem = true; |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
437 |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
438 for (iterator p = begin (); p != end (); p++) |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
439 { |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
440 octave_quit (); |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
441 |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
442 octave_value val = *p; |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
443 |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
444 dim_vector this_elt_dv = val.dims (); |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
445 |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
446 if (! this_elt_dv.zero_by_zero ()) |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
447 { |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
448 if (first_elem) |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
449 { |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
450 first_elem = false; |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
451 dv = this_elt_dv; |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
452 } |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
453 else if (! dv.hvcat (this_elt_dv, 1)) |
20832
3951d420556c
eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents:
20558
diff
changeset
|
454 eval_error ("horizontal dimensions mismatch", dv, this_elt_dv); |
13144
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
455 } |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
456 } |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
457 } |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
458 } |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
459 |
1827 | 460 class |
4219 | 461 tm_const : public octave_base_list<tm_row_const> |
1827 | 462 { |
463 public: | |
464 | |
465 tm_const (const tree_matrix& tm) | |
5514 | 466 : dv (0, 0), all_str (false), all_sq_str (false), all_dq_str (false), |
5502 | 467 some_str (false), all_real (false), all_cmplx (false), |
13144
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
468 all_mt (true), any_cell (false), any_sparse (false), |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
469 any_class (false), class_nm (), ok (false) |
5533 | 470 { init (tm); } |
1827 | 471 |
472 ~tm_const (void) { } | |
473 | |
5514 | 474 octave_idx_type rows (void) const { return dv.elem (0); } |
475 octave_idx_type cols (void) const { return dv.elem (1); } | |
4765 | 476 |
477 dim_vector dims (void) const { return dv; } | |
1827 | 478 |
2868 | 479 bool all_strings_p (void) const { return all_str; } |
5280 | 480 bool all_sq_strings_p (void) const { return all_sq_str; } |
481 bool all_dq_strings_p (void) const { return all_dq_str; } | |
3110 | 482 bool some_strings_p (void) const { return some_str; } |
5502 | 483 bool all_real_p (void) const { return all_real; } |
484 bool all_complex_p (void) const { return all_cmplx; } | |
2868 | 485 bool all_empty_p (void) const { return all_mt; } |
13144
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
486 bool any_cell_p (void) const { return any_cell; } |
5630 | 487 bool any_sparse_p (void) const { return any_sparse; } |
8147
9a5ef4f632a3
Add class dispatch for [] operator to vertcat/horzcat methods
David Bateman <dbateman@free.fr>
parents:
8107
diff
changeset
|
488 bool any_class_p (void) const { return any_class; } |
10764
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
489 bool all_1x1_p (void) const { return all_1x1; } |
1827 | 490 |
5533 | 491 std::string class_name (void) const { return class_nm; } |
492 | |
3145 | 493 operator bool () const { return ok; } |
1827 | 494 |
495 private: | |
496 | |
4765 | 497 dim_vector dv; |
1827 | 498 |
499 bool all_str; | |
5280 | 500 bool all_sq_str; |
501 bool all_dq_str; | |
3110 | 502 bool some_str; |
5502 | 503 bool all_real; |
504 bool all_cmplx; | |
2602 | 505 bool all_mt; |
13144
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
506 bool any_cell; |
5630 | 507 bool any_sparse; |
8147
9a5ef4f632a3
Add class dispatch for [] operator to vertcat/horzcat methods
David Bateman <dbateman@free.fr>
parents:
8107
diff
changeset
|
508 bool any_class; |
10764
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
509 bool all_1x1; |
1827 | 510 |
5533 | 511 std::string class_nm; |
512 | |
1827 | 513 bool ok; |
514 | |
515 tm_const (void); | |
516 | |
517 tm_const (const tm_const&); | |
518 | |
519 tm_const& operator = (const tm_const&); | |
520 | |
521 void init (const tree_matrix& tm); | |
522 }; | |
523 | |
524 void | |
525 tm_const::init (const tree_matrix& tm) | |
1741 | 526 { |
1827 | 527 all_str = true; |
5280 | 528 all_sq_str = true; |
529 all_dq_str = true; | |
5502 | 530 all_real = true; |
531 all_cmplx = true; | |
13144
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
532 any_cell = false; |
5630 | 533 any_sparse = false; |
8147
9a5ef4f632a3
Add class dispatch for [] operator to vertcat/horzcat methods
David Bateman <dbateman@free.fr>
parents:
8107
diff
changeset
|
534 any_class = false; |
13754
e652ff4d1522
don't crash when concatenating structs with no fields
John W. Eaton <jwe@octave.org>
parents:
13294
diff
changeset
|
535 all_1x1 = ! tm.empty (); |
1827 | 536 |
537 bool first_elem = true; | |
13144
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
538 bool first_elem_is_struct = false; |
1827 | 539 |
540 // Just eval and figure out if what we have is complex or all | |
541 // strings. We can't check columns until we know that this is a | |
542 // numeric matrix -- collections of strings can have elements of | |
543 // different lengths. | |
544 | |
4219 | 545 for (tree_matrix::const_iterator p = tm.begin (); p != tm.end (); p++) |
1827 | 546 { |
10142
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
10116
diff
changeset
|
547 octave_quit (); |
5502 | 548 |
4219 | 549 tree_argument_list *elt = *p; |
1827 | 550 |
551 tm_row_const tmp (*elt); | |
552 | |
13144
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
553 if (first_elem) |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
554 { |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
555 first_elem_is_struct = tmp.first_elem_struct_p (); |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
556 |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
557 first_elem = false; |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
558 } |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
559 |
6200 | 560 if (tmp && ! tmp.empty ()) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
561 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
562 if (all_str && ! tmp.all_strings_p ()) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
563 all_str = false; |
1827 | 564 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
565 if (all_sq_str && ! tmp.all_sq_strings_p ()) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
566 all_sq_str = false; |
5280 | 567 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
568 if (all_dq_str && ! tmp.all_dq_strings_p ()) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
569 all_dq_str = false; |
5280 | 570 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
571 if (! some_str && tmp.some_strings_p ()) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
572 some_str = true; |
3110 | 573 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
574 if (all_real && ! tmp.all_real_p ()) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
575 all_real = false; |
5502 | 576 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
577 if (all_cmplx && ! tmp.all_complex_p ()) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
578 all_cmplx = false; |
1827 | 579 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
580 if (all_mt && ! tmp.all_empty_p ()) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
581 all_mt = false; |
2602 | 582 |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20940
diff
changeset
|
583 if (! any_cell && tmp.any_cell_p ()) |
13144
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
584 any_cell = true; |
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
585 |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20940
diff
changeset
|
586 if (! any_sparse && tmp.any_sparse_p ()) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
587 any_sparse = true; |
5630 | 588 |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20940
diff
changeset
|
589 if (! any_class && tmp.any_class_p ()) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
590 any_class = true; |
8147
9a5ef4f632a3
Add class dispatch for [] operator to vertcat/horzcat methods
David Bateman <dbateman@free.fr>
parents:
8107
diff
changeset
|
591 |
10764
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
592 all_1x1 = all_1x1 && tmp.all_1x1_p (); |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
593 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
594 append (tmp); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
595 } |
1827 | 596 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
597 break; |
1827 | 598 } |
599 | |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
600 if (any_cell && ! any_class && ! first_elem_is_struct) |
1827 | 601 { |
13219
cf5ebc0e47e4
fix warnings for unused but set variables and shadowed variables
John W. Eaton <jwe@octave.org>
parents:
13144
diff
changeset
|
602 for (iterator q = begin (); q != end (); q++) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
603 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
604 octave_quit (); |
5502 | 605 |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
606 q->cellify (); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
607 } |
1827 | 608 } |
609 | |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
610 first_elem = true; |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
611 |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
612 for (iterator q = begin (); q != end (); q++) |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
613 { |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
614 octave_quit (); |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
615 |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
616 tm_row_const elt = *q; |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
617 |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
618 octave_idx_type this_elt_nr = elt.rows (); |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
619 octave_idx_type this_elt_nc = elt.cols (); |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
620 |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
621 std::string this_elt_class_nm = elt.class_name (); |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
622 class_nm = get_concat_class (class_nm, this_elt_class_nm); |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
623 |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
624 dim_vector this_elt_dv = elt.dims (); |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
625 |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
626 all_mt = false; |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
627 |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
628 if (first_elem) |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
629 { |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
630 first_elem = false; |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
631 |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
632 dv = this_elt_dv; |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
633 } |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
634 else if (all_str && dv.length () == 2 |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
635 && this_elt_dv.length () == 2) |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
636 { |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
637 // FIXME: this is Octave's specialty. Character matrices allow |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
638 // rows of unequal length. |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
639 if (this_elt_nc > cols ()) |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
640 dv(1) = this_elt_nc; |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
641 dv(0) += this_elt_nr; |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
642 } |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20940
diff
changeset
|
643 else if ((! any_class) && (! dv.hvcat (this_elt_dv, 0))) |
20832
3951d420556c
eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents:
20558
diff
changeset
|
644 eval_error ("vertical dimensions mismatch", dv, this_elt_dv); |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
645 } |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
646 |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
647 ok = true; |
1741 | 648 } |
649 | |
2971 | 650 octave_value_list |
651 tree_matrix::rvalue (int nargout) | |
652 { | |
653 if (nargout > 1) | |
654 error ("invalid number of output arguments for matrix list"); | |
655 | |
20832
3951d420556c
eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents:
20558
diff
changeset
|
656 return rvalue1 (nargout); |
2971 | 657 } |
658 | |
8107
8655dc0906e6
Special case single type conacation in Fcat. Rework cell2mat to take advantage
David Bateman <dbateman@free.fr>
parents:
7789
diff
changeset
|
659 void |
5280 | 660 maybe_warn_string_concat (bool all_dq_strings_p, bool all_sq_strings_p) |
661 { | |
5781 | 662 if (! (all_dq_strings_p || all_sq_strings_p)) |
13841
0a158dbdb04a
Remove 3 unused warning ids
Rik <octave@nomad.inbox5.com>
parents:
13754
diff
changeset
|
663 warning_with_id ("Octave:mixed-string-concat", |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
664 "concatenation of different character string types may have unintended consequences"); |
5280 | 665 } |
666 | |
21139
538b57866b90
consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents:
21100
diff
changeset
|
667 template <typename TYPE, typename T> |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
668 static void |
10535
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
669 single_type_concat (Array<T>& result, |
10116
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
670 tm_const& tmp) |
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
671 { |
18100
6a71e5030df5
Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
672 octave_idx_type r = 0; |
6a71e5030df5
Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
673 octave_idx_type c = 0; |
10116
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
674 |
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
675 for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++) |
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
676 { |
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
677 tm_row_const row = *p; |
10715
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
678 // Skip empty arrays to allow looser rules. |
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
679 if (row.dims ().any_zero ()) |
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
680 continue; |
10116
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
681 |
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
682 for (tm_row_const::iterator q = row.begin (); |
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
683 q != row.end (); |
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
684 q++) |
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
685 { |
10142
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
10116
diff
changeset
|
686 octave_quit (); |
10116
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
687 |
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
688 TYPE ra = octave_value_extract<TYPE> (*q); |
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
689 |
10715
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
690 // Skip empty arrays to allow looser rules. |
5502 | 691 |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
692 if (! ra.is_empty ()) |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
693 { |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
694 result.insert (ra, r, c); |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
695 |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
696 c += ra.columns (); |
10116
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
697 } |
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
698 } |
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
699 |
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
700 r += row.rows (); |
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
701 c = 0; |
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
702 } |
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
703 } |
5533 | 704 |
21139
538b57866b90
consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents:
21100
diff
changeset
|
705 template <typename TYPE, typename T> |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
706 static void |
10535
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
707 single_type_concat (Array<T>& result, |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
708 const dim_vector& dv, |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
709 tm_const& tmp) |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
710 { |
10715
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
711 if (dv.any_zero ()) |
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
712 { |
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
713 result = Array<T> (dv); |
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
714 return; |
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
715 } |
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
716 |
10535
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
717 if (tmp.length () == 1) |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
718 { |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
719 // If possible, forward the operation to liboctave. |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
720 // Single row. |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
721 tm_row_const& row = tmp.front (); |
10939
c07cb4ef80db
optimize [a{:}] when a{i} are all scalars
Jaroslav Hajek <highegg@gmail.com>
parents:
10937
diff
changeset
|
722 if (! (equal_types<T, char>::value || equal_types<T, octave_value>::value) |
c07cb4ef80db
optimize [a{:}] when a{i} are all scalars
Jaroslav Hajek <highegg@gmail.com>
parents:
10937
diff
changeset
|
723 && row.all_1x1_p ()) |
c07cb4ef80db
optimize [a{:}] when a{i} are all scalars
Jaroslav Hajek <highegg@gmail.com>
parents:
10937
diff
changeset
|
724 { |
c07cb4ef80db
optimize [a{:}] when a{i} are all scalars
Jaroslav Hajek <highegg@gmail.com>
parents:
10937
diff
changeset
|
725 // Optimize all scalars case. |
c07cb4ef80db
optimize [a{:}] when a{i} are all scalars
Jaroslav Hajek <highegg@gmail.com>
parents:
10937
diff
changeset
|
726 result.clear (dv); |
14592
b99cb1b0ee7c
Silence warning about signed comparsion
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14429
diff
changeset
|
727 assert (static_cast<size_t> (result.numel ()) == row.length ()); |
10939
c07cb4ef80db
optimize [a{:}] when a{i} are all scalars
Jaroslav Hajek <highegg@gmail.com>
parents:
10937
diff
changeset
|
728 octave_idx_type i = 0; |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
729 for (tm_row_const::iterator q = row.begin (); q != row.end (); q++) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
730 result(i++) = octave_value_extract<T> (*q); |
10939
c07cb4ef80db
optimize [a{:}] when a{i} are all scalars
Jaroslav Hajek <highegg@gmail.com>
parents:
10937
diff
changeset
|
731 |
c07cb4ef80db
optimize [a{:}] when a{i} are all scalars
Jaroslav Hajek <highegg@gmail.com>
parents:
10937
diff
changeset
|
732 return; |
c07cb4ef80db
optimize [a{:}] when a{i} are all scalars
Jaroslav Hajek <highegg@gmail.com>
parents:
10937
diff
changeset
|
733 } |
c07cb4ef80db
optimize [a{:}] when a{i} are all scalars
Jaroslav Hajek <highegg@gmail.com>
parents:
10937
diff
changeset
|
734 |
18100
6a71e5030df5
Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
735 octave_idx_type ncols = row.length (); |
6a71e5030df5
Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
736 octave_idx_type i = 0; |
10535
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
737 OCTAVE_LOCAL_BUFFER (Array<T>, array_list, ncols); |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
738 |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
739 for (tm_row_const::iterator q = row.begin (); q != row.end (); q++) |
10535
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
740 { |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
741 octave_quit (); |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
742 |
10937
f42e8c6196c3
tweaks in concatenation of empty structs
Jaroslav Hajek <highegg@gmail.com>
parents:
10840
diff
changeset
|
743 array_list[i] = octave_value_extract<TYPE> (*q); |
10715
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
744 i++; |
10535
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
745 } |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
746 |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
747 result = Array<T>::cat (-2, ncols, array_list); |
10535
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
748 } |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
749 else |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
750 { |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
751 result = Array<T> (dv); |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
752 single_type_concat<TYPE> (result, tmp); |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
753 } |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
754 } |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
755 |
21139
538b57866b90
consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents:
21100
diff
changeset
|
756 template <typename TYPE, typename T> |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
757 static void |
10535
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
758 single_type_concat (Sparse<T>& result, |
10715
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
759 const dim_vector& dv, |
10535
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
760 tm_const& tmp) |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
761 { |
10715
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
762 if (dv.any_zero ()) |
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
763 { |
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
764 result = Sparse<T> (dv); |
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
765 return; |
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
766 } |
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
767 |
10535
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
768 // Sparse matrices require preallocation for efficient indexing; besides, |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
769 // only horizontal concatenation can be efficiently handled by indexing. |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
770 // So we just cat all rows through liboctave, then cat the final column. |
18100
6a71e5030df5
Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
771 octave_idx_type nrows = tmp.length (); |
6a71e5030df5
Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
772 octave_idx_type j = 0; |
10535
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
773 OCTAVE_LOCAL_BUFFER (Sparse<T>, sparse_row_list, nrows); |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
774 for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++) |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
775 { |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
776 tm_row_const row = *p; |
18100
6a71e5030df5
Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
777 octave_idx_type ncols = row.length (); |
6a71e5030df5
Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
778 octave_idx_type i = 0; |
10535
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
779 OCTAVE_LOCAL_BUFFER (Sparse<T>, sparse_list, ncols); |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
780 |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
781 for (tm_row_const::iterator q = row.begin (); q != row.end (); q++) |
10535
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
782 { |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
783 octave_quit (); |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
784 |
10937
f42e8c6196c3
tweaks in concatenation of empty structs
Jaroslav Hajek <highegg@gmail.com>
parents:
10840
diff
changeset
|
785 sparse_list[i] = octave_value_extract<TYPE> (*q); |
10715
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
786 i++; |
10535
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
787 } |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
788 |
10937
f42e8c6196c3
tweaks in concatenation of empty structs
Jaroslav Hajek <highegg@gmail.com>
parents:
10840
diff
changeset
|
789 Sparse<T> stmp = Sparse<T>::cat (-2, ncols, sparse_list); |
f42e8c6196c3
tweaks in concatenation of empty structs
Jaroslav Hajek <highegg@gmail.com>
parents:
10840
diff
changeset
|
790 sparse_row_list[j] = stmp; |
10715
53253f796351
make [] (hopefully) more Matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
10535
diff
changeset
|
791 j++; |
10535
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
792 } |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
793 |
10937
f42e8c6196c3
tweaks in concatenation of empty structs
Jaroslav Hajek <highegg@gmail.com>
parents:
10840
diff
changeset
|
794 result = Sparse<T>::cat (-1, nrows, sparse_row_list); |
10535
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
795 } |
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
796 |
21139
538b57866b90
consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents:
21100
diff
changeset
|
797 template <typename MAP> |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
798 static void |
10764
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
799 single_type_concat (octave_map& result, |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
800 const dim_vector& dv, |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
801 tm_const& tmp) |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
802 { |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
803 if (dv.any_zero ()) |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
804 { |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
805 result = octave_map (dv); |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
806 return; |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
807 } |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
808 |
18100
6a71e5030df5
Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
809 octave_idx_type nrows = tmp.length (); |
6a71e5030df5
Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
810 octave_idx_type j = 0; |
10764
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
811 OCTAVE_LOCAL_BUFFER (octave_map, map_row_list, nrows); |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
812 for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++) |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
813 { |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
814 tm_row_const row = *p; |
18100
6a71e5030df5
Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
815 octave_idx_type ncols = row.length (); |
6a71e5030df5
Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
816 octave_idx_type i = 0; |
10764
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
817 OCTAVE_LOCAL_BUFFER (MAP, map_list, ncols); |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
818 |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
819 for (tm_row_const::iterator q = row.begin (); q != row.end (); q++) |
10764
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
820 { |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
821 octave_quit (); |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
822 |
10937
f42e8c6196c3
tweaks in concatenation of empty structs
Jaroslav Hajek <highegg@gmail.com>
parents:
10840
diff
changeset
|
823 map_list[i] = octave_value_extract<MAP> (*q); |
10764
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
824 i++; |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
825 } |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
826 |
10937
f42e8c6196c3
tweaks in concatenation of empty structs
Jaroslav Hajek <highegg@gmail.com>
parents:
10840
diff
changeset
|
827 octave_map mtmp = octave_map::cat (-2, ncols, map_list); |
f42e8c6196c3
tweaks in concatenation of empty structs
Jaroslav Hajek <highegg@gmail.com>
parents:
10840
diff
changeset
|
828 map_row_list[j] = mtmp; |
10764
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
829 j++; |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
830 } |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
831 |
10937
f42e8c6196c3
tweaks in concatenation of empty structs
Jaroslav Hajek <highegg@gmail.com>
parents:
10840
diff
changeset
|
832 result = octave_map::cat (-1, nrows, map_row_list); |
10764
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
833 } |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
834 |
21139
538b57866b90
consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents:
21100
diff
changeset
|
835 template <typename TYPE> |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
836 static octave_value |
10116
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
837 do_single_type_concat (const dim_vector& dv, |
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
838 tm_const& tmp) |
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
839 { |
10535
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
840 TYPE result; |
10116
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
841 |
10535
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
842 single_type_concat<TYPE> (result, dv, tmp); |
10116
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
843 |
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
844 return result; |
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
845 } |
fecebef27388
improve concatenation code using templates instead of macros
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
846 |
21139
538b57866b90
consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents:
21100
diff
changeset
|
847 template <> |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
848 octave_value |
10764
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
849 do_single_type_concat<octave_map> (const dim_vector& dv, |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
850 tm_const& tmp) |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
851 { |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
852 octave_map result; |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
853 |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
854 if (tmp.all_1x1_p ()) |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
855 single_type_concat<octave_scalar_map> (result, dv, tmp); |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
856 else |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
857 single_type_concat<octave_map> (result, dv, tmp); |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
858 |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
859 return result; |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
860 } |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
861 |
13294
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
862 static octave_value |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
863 do_class_concat (tm_const& tmc) |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
864 { |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
865 octave_value retval; |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
866 |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
867 octave_value_list rows (tmc.length (), octave_value ()); |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
868 |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
869 octave_idx_type j = 0; |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
870 for (tm_const::iterator p = tmc.begin (); p != tmc.end (); p++) |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
871 { |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
872 octave_quit (); |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
873 |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
874 tm_row_const tmrc = *p; |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
875 |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
876 if (tmrc.length () == 1) |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
877 rows(j++) = *(tmrc.begin ()); |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
878 else |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
879 { |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
880 octave_value_list row (tmrc.length (), octave_value ()); |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
881 |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
882 octave_idx_type i = 0; |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
883 for (tm_row_const::iterator q = tmrc.begin (); q != tmrc.end (); q++) |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
884 row(i++) = *q; |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
885 |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
886 rows(j++) = do_class_concat (row, "horzcat", 1); |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
887 } |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
888 } |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
889 |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
890 if (rows.length () == 1) |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
891 retval = rows(0); |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
892 else |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
893 retval = do_class_concat (rows, "vertcat", 0); |
13294
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
894 |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
895 return retval; |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
896 } |
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
897 |
2086 | 898 octave_value |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8147
diff
changeset
|
899 tree_matrix::rvalue1 (int) |
1741 | 900 { |
6200 | 901 octave_value retval = Matrix (); |
1741 | 902 |
19399
2304ddfd736f
Restore warning Octave:num-to-str missing since 3.2.4 (bug #43814).
Rik <rik@octave.org>
parents:
18531
diff
changeset
|
903 bool all_strings_p = false; |
5280 | 904 bool all_sq_strings_p = false; |
905 bool all_dq_strings_p = false; | |
4915 | 906 bool all_empty_p = false; |
5502 | 907 bool all_real_p = false; |
5630 | 908 bool any_sparse_p = false; |
8147
9a5ef4f632a3
Add class dispatch for [] operator to vertcat/horzcat methods
David Bateman <dbateman@free.fr>
parents:
8107
diff
changeset
|
909 bool any_class_p = false; |
4915 | 910 bool frc_str_conv = false; |
1741 | 911 |
4915 | 912 tm_const tmp (*this); |
3110 | 913 |
6200 | 914 if (tmp && ! tmp.empty ()) |
1827 | 915 { |
4765 | 916 dim_vector dv = tmp.dims (); |
19399
2304ddfd736f
Restore warning Octave:num-to-str missing since 3.2.4 (bug #43814).
Rik <rik@octave.org>
parents:
18531
diff
changeset
|
917 all_strings_p = tmp.all_strings_p (); |
5280 | 918 all_sq_strings_p = tmp.all_sq_strings_p (); |
919 all_dq_strings_p = tmp.all_dq_strings_p (); | |
4915 | 920 all_empty_p = tmp.all_empty_p (); |
5502 | 921 all_real_p = tmp.all_real_p (); |
5630 | 922 any_sparse_p = tmp.any_sparse_p (); |
8147
9a5ef4f632a3
Add class dispatch for [] operator to vertcat/horzcat methods
David Bateman <dbateman@free.fr>
parents:
8107
diff
changeset
|
923 any_class_p = tmp.any_class_p (); |
4915 | 924 frc_str_conv = tmp.some_strings_p (); |
1741 | 925 |
5502 | 926 // Try to speed up the common cases. |
4915 | 927 |
5533 | 928 std::string result_type = tmp.class_name (); |
929 | |
8147
9a5ef4f632a3
Add class dispatch for [] operator to vertcat/horzcat methods
David Bateman <dbateman@free.fr>
parents:
8107
diff
changeset
|
930 if (any_class_p) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
931 { |
13294
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13219
diff
changeset
|
932 retval = do_class_concat (tmp); |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
933 } |
8147
9a5ef4f632a3
Add class dispatch for [] operator to vertcat/horzcat methods
David Bateman <dbateman@free.fr>
parents:
8107
diff
changeset
|
934 else if (result_type == "double") |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
935 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
936 if (any_sparse_p) |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
937 { |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
938 if (all_real_p) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
939 retval = do_single_type_concat<SparseMatrix> (dv, tmp); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
940 else |
10814
83896a06adaf
don't skip narrowing when concatenating complex matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
10764
diff
changeset
|
941 retval = do_single_type_concat<SparseComplexMatrix> (dv, tmp); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
942 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
943 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
944 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
945 if (all_real_p) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
946 retval = do_single_type_concat<NDArray> (dv, tmp); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
947 else |
10814
83896a06adaf
don't skip narrowing when concatenating complex matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
10764
diff
changeset
|
948 retval = do_single_type_concat<ComplexNDArray> (dv, tmp); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
949 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
950 } |
5533 | 951 else if (result_type == "single") |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
952 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
953 if (all_real_p) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
954 retval = do_single_type_concat<FloatNDArray> (dv, tmp); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
955 else |
10814
83896a06adaf
don't skip narrowing when concatenating complex matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
10764
diff
changeset
|
956 retval = do_single_type_concat<FloatComplexNDArray> (dv, tmp); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
957 } |
5533 | 958 else if (result_type == "char") |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
959 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
960 char type = all_dq_strings_p ? '"' : '\''; |
5280 | 961 |
19399
2304ddfd736f
Restore warning Octave:num-to-str missing since 3.2.4 (bug #43814).
Rik <rik@octave.org>
parents:
18531
diff
changeset
|
962 if (! all_strings_p) |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
963 warn_implicit_conversion ("Octave:num-to-str", |
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
964 "numeric", result_type); |
19399
2304ddfd736f
Restore warning Octave:num-to-str missing since 3.2.4 (bug #43814).
Rik <rik@octave.org>
parents:
18531
diff
changeset
|
965 else |
2304ddfd736f
Restore warning Octave:num-to-str missing since 3.2.4 (bug #43814).
Rik <rik@octave.org>
parents:
18531
diff
changeset
|
966 maybe_warn_string_concat (all_dq_strings_p, all_sq_strings_p); |
5280 | 967 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
968 charNDArray result (dv, Vstring_fill_char); |
5502 | 969 |
10535
3f973f6c841c
improve sparse concatenation operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
970 single_type_concat<charNDArray> (result, tmp); |
5502 | 971 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
972 retval = octave_value (result, type); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
973 } |
5533 | 974 else if (result_type == "logical") |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
975 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
976 if (any_sparse_p) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
977 retval = do_single_type_concat<SparseBoolMatrix> (dv, tmp); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
978 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
979 retval = do_single_type_concat<boolNDArray> (dv, tmp); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
980 } |
5533 | 981 else if (result_type == "int8") |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
982 retval = do_single_type_concat<int8NDArray> (dv, tmp); |
5533 | 983 else if (result_type == "int16") |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
984 retval = do_single_type_concat<int16NDArray> (dv, tmp); |
5533 | 985 else if (result_type == "int32") |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
986 retval = do_single_type_concat<int32NDArray> (dv, tmp); |
5533 | 987 else if (result_type == "int64") |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
988 retval = do_single_type_concat<int64NDArray> (dv, tmp); |
5533 | 989 else if (result_type == "uint8") |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
990 retval = do_single_type_concat<uint8NDArray> (dv, tmp); |
5533 | 991 else if (result_type == "uint16") |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
992 retval = do_single_type_concat<uint16NDArray> (dv, tmp); |
5533 | 993 else if (result_type == "uint32") |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
994 retval = do_single_type_concat<uint32NDArray> (dv, tmp); |
5533 | 995 else if (result_type == "uint64") |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
996 retval = do_single_type_concat<uint64NDArray> (dv, tmp); |
10764
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
997 else if (result_type == "cell") |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
998 retval = do_single_type_concat<Cell> (dv, tmp); |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
999 else if (result_type == "struct") |
e141bcb1befd
implement map concat optimizations for [] operator
Jaroslav Hajek <highegg@gmail.com>
parents:
10758
diff
changeset
|
1000 retval = do_single_type_concat<octave_map> (dv, tmp); |
4915 | 1001 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1002 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1003 // The line below might seem crazy, since we take a copy of |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1004 // the first argument, resize it to be empty and then resize |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1005 // it to be full. This is done since it means that there is |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1006 // no recopying of data, as would happen if we used a single |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1007 // resize. It should be noted that resize operation is also |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1008 // significantly slower than the do_cat_op function, so it |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1009 // makes sense to have an empty matrix and copy all data. |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1010 // |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1011 // We might also start with a empty octave_value using |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1012 // |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1013 // ctmp = octave_value_typeinfo::lookup_type |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1014 // (tmp.begin() -> begin() -> type_name()); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1015 // |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1016 // and then directly resize. However, for some types there |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1017 // might be some additional setup needed, and so this should |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1018 // be avoided. |
5502 | 1019 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1020 octave_value ctmp; |
5502 | 1021 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1022 // Find the first non-empty object |
5502 | 1023 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1024 if (any_sparse_p) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1025 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1026 // Start with sparse matrix to avoid issues memory issues |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1027 // with things like [ones(1,4),sprandn(1e8,4,1e-4)] |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1028 if (all_real_p) |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
1029 ctmp = octave_sparse_matrix ().resize (dv); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1030 else |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
1031 ctmp = octave_sparse_complex_matrix ().resize (dv); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1032 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1033 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1034 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1035 for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1036 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1037 octave_quit (); |
5502 | 1038 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1039 tm_row_const row = *p; |
5502 | 1040 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
1041 for (tm_row_const::iterator q = row.begin (); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1042 q != row.end (); q++) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1043 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1044 octave_quit (); |
5630 | 1045 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1046 ctmp = *q; |
5164 | 1047 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1048 if (! ctmp.all_zero_dims ()) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1049 goto found_non_empty; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1050 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1051 } |
5164 | 1052 |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14592
diff
changeset
|
1053 ctmp = (*(tmp.begin () -> begin ())); |
5630 | 1054 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1055 found_non_empty: |
5502 | 1056 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1057 if (! all_empty_p) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1058 ctmp = ctmp.resize (dim_vector (0,0)).resize (dv); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1059 } |
4915 | 1060 |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1061 // Now, extract the values from the individual elements and |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1062 // insert them in the result matrix. |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1063 |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1064 int dv_len = dv.length (); |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1065 octave_idx_type ntmp = dv_len > 1 ? dv_len : 2; |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1066 Array<octave_idx_type> ra_idx (dim_vector (ntmp, 1), 0); |
5502 | 1067 |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1068 for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++) |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1069 { |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1070 octave_quit (); |
5502 | 1071 |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1072 tm_row_const row = *p; |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1073 |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1074 for (tm_row_const::iterator q = row.begin (); |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1075 q != row.end (); |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1076 q++) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1077 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1078 octave_quit (); |
5502 | 1079 |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1080 octave_value elt = *q; |
5502 | 1081 |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1082 if (elt.is_empty ()) |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1083 continue; |
5502 | 1084 |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1085 ctmp = do_cat_op (ctmp, elt, ra_idx); |
5502 | 1086 |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1087 ra_idx (1) += elt.columns (); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1088 } |
5502 | 1089 |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1090 ra_idx (0) += row.rows (); |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1091 ra_idx (1) = 0; |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1092 } |
5502 | 1093 |
20558
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1094 retval = ctmp; |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1095 |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1096 if (frc_str_conv && ! retval.is_string ()) |
1a0a433c8263
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
1097 retval = retval.convert_to_str (); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1098 } |
1741 | 1099 } |
1100 | |
1101 return retval; | |
1102 } | |
1103 | |
5861 | 1104 tree_expression * |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
1105 tree_matrix::dup (symbol_table::scope_id scope, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
1106 symbol_table::context_id context) const |
5861 | 1107 { |
1108 tree_matrix *new_matrix = new tree_matrix (0, line (), column ()); | |
1109 | |
16237
70f465930546
rearrange class heirarchy for tree_cell and tree_matrix
John W. Eaton <jwe@octave.org>
parents:
16140
diff
changeset
|
1110 new_matrix->copy_base (*this, scope, context); |
5861 | 1111 |
1112 return new_matrix; | |
1113 } | |
1114 | |
1741 | 1115 void |
2124 | 1116 tree_matrix::accept (tree_walker& tw) |
1741 | 1117 { |
2124 | 1118 tw.visit_matrix (*this); |
1741 | 1119 } |
1120 | |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
12864
diff
changeset
|
1121 /* |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1122 ## test concatenation with all zero matrices |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1123 %!assert ([ "" 65*ones(1,10) ], "AAAAAAAAAA"); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1124 %!assert ([ 65*ones(1,10) "" ], "AAAAAAAAAA"); |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
1125 |
13144
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
1126 %!test |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1127 %! c = {"foo"; "bar"; "bazoloa"}; |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1128 %! assert ([c; "a"; "bc"; "def"], {"foo"; "bar"; "bazoloa"; "a"; "bc"; "def"}); |
13144
c99f24c10ca3
fix vertical concatenation involving cell arrays
John W. Eaton <jwe@octave.org>
parents:
13142
diff
changeset
|
1129 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1130 %!assert (class ([int64(1), int64(1)]), "int64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1131 %!assert (class ([int64(1), int32(1)]), "int64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1132 %!assert (class ([int64(1), int16(1)]), "int64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1133 %!assert (class ([int64(1), int8(1)]), "int64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1134 %!assert (class ([int64(1), uint64(1)]), "int64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1135 %!assert (class ([int64(1), uint32(1)]), "int64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1136 %!assert (class ([int64(1), uint16(1)]), "int64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1137 %!assert (class ([int64(1), uint8(1)]), "int64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1138 %!assert (class ([int64(1), single(1)]), "int64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1139 %!assert (class ([int64(1), double(1)]), "int64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1140 %!assert (class ([int64(1), cell(1)]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1141 %!assert (class ([int64(1), true]), "int64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1142 %!assert (class ([int64(1), "a"]), "char") |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
1143 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1144 %!assert (class ([int32(1), int64(1)]), "int32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1145 %!assert (class ([int32(1), int32(1)]), "int32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1146 %!assert (class ([int32(1), int16(1)]), "int32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1147 %!assert (class ([int32(1), int8(1)]), "int32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1148 %!assert (class ([int32(1), uint64(1)]), "int32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1149 %!assert (class ([int32(1), uint32(1)]), "int32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1150 %!assert (class ([int32(1), uint16(1)]), "int32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1151 %!assert (class ([int32(1), uint8(1)]), "int32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1152 %!assert (class ([int32(1), single(1)]), "int32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1153 %!assert (class ([int32(1), double(1)]), "int32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1154 %!assert (class ([int32(1), cell(1)]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1155 %!assert (class ([int32(1), true]), "int32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1156 %!assert (class ([int32(1), "a"]), "char") |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
1157 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1158 %!assert (class ([int16(1), int64(1)]), "int16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1159 %!assert (class ([int16(1), int32(1)]), "int16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1160 %!assert (class ([int16(1), int16(1)]), "int16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1161 %!assert (class ([int16(1), int8(1)]), "int16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1162 %!assert (class ([int16(1), uint64(1)]), "int16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1163 %!assert (class ([int16(1), uint32(1)]), "int16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1164 %!assert (class ([int16(1), uint16(1)]), "int16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1165 %!assert (class ([int16(1), uint8(1)]), "int16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1166 %!assert (class ([int16(1), single(1)]), "int16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1167 %!assert (class ([int16(1), double(1)]), "int16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1168 %!assert (class ([int16(1), cell(1)]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1169 %!assert (class ([int16(1), true]), "int16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1170 %!assert (class ([int16(1), "a"]), "char") |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
1171 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1172 %!assert (class ([int8(1), int64(1)]), "int8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1173 %!assert (class ([int8(1), int32(1)]), "int8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1174 %!assert (class ([int8(1), int16(1)]), "int8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1175 %!assert (class ([int8(1), int8(1)]), "int8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1176 %!assert (class ([int8(1), uint64(1)]), "int8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1177 %!assert (class ([int8(1), uint32(1)]), "int8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1178 %!assert (class ([int8(1), uint16(1)]), "int8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1179 %!assert (class ([int8(1), uint8(1)]), "int8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1180 %!assert (class ([int8(1), single(1)]), "int8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1181 %!assert (class ([int8(1), double(1)]), "int8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1182 %!assert (class ([int8(1), cell(1)]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1183 %!assert (class ([int8(1), true]), "int8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1184 %!assert (class ([int8(1), "a"]), "char") |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
1185 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1186 %!assert (class ([uint64(1), int64(1)]), "uint64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1187 %!assert (class ([uint64(1), int32(1)]), "uint64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1188 %!assert (class ([uint64(1), int16(1)]), "uint64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1189 %!assert (class ([uint64(1), int8(1)]), "uint64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1190 %!assert (class ([uint64(1), uint64(1)]), "uint64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1191 %!assert (class ([uint64(1), uint32(1)]), "uint64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1192 %!assert (class ([uint64(1), uint16(1)]), "uint64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1193 %!assert (class ([uint64(1), uint8(1)]), "uint64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1194 %!assert (class ([uint64(1), single(1)]), "uint64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1195 %!assert (class ([uint64(1), double(1)]), "uint64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1196 %!assert (class ([uint64(1), cell(1)]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1197 %!assert (class ([uint64(1), true]), "uint64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1198 %!assert (class ([uint64(1), "a"]), "char") |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
1199 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1200 %!assert (class ([uint32(1), int64(1)]), "uint32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1201 %!assert (class ([uint32(1), int32(1)]), "uint32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1202 %!assert (class ([uint32(1), int16(1)]), "uint32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1203 %!assert (class ([uint32(1), int8(1)]), "uint32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1204 %!assert (class ([uint32(1), uint64(1)]), "uint32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1205 %!assert (class ([uint32(1), uint32(1)]), "uint32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1206 %!assert (class ([uint32(1), uint16(1)]), "uint32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1207 %!assert (class ([uint32(1), uint8(1)]), "uint32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1208 %!assert (class ([uint32(1), single(1)]), "uint32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1209 %!assert (class ([uint32(1), double(1)]), "uint32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1210 %!assert (class ([uint32(1), cell(1)]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1211 %!assert (class ([uint32(1), true]), "uint32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1212 %!assert (class ([uint32(1), "a"]), "char") |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
1213 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1214 %!assert (class ([uint16(1), int64(1)]), "uint16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1215 %!assert (class ([uint16(1), int32(1)]), "uint16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1216 %!assert (class ([uint16(1), int16(1)]), "uint16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1217 %!assert (class ([uint16(1), int8(1)]), "uint16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1218 %!assert (class ([uint16(1), uint64(1)]), "uint16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1219 %!assert (class ([uint16(1), uint32(1)]), "uint16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1220 %!assert (class ([uint16(1), uint16(1)]), "uint16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1221 %!assert (class ([uint16(1), uint8(1)]), "uint16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1222 %!assert (class ([uint16(1), single(1)]), "uint16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1223 %!assert (class ([uint16(1), double(1)]), "uint16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1224 %!assert (class ([uint16(1), cell(1)]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1225 %!assert (class ([uint16(1), true]), "uint16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1226 %!assert (class ([uint16(1), "a"]), "char") |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
1227 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1228 %!assert (class ([uint8(1), int64(1)]), "uint8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1229 %!assert (class ([uint8(1), int32(1)]), "uint8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1230 %!assert (class ([uint8(1), int16(1)]), "uint8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1231 %!assert (class ([uint8(1), int8(1)]), "uint8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1232 %!assert (class ([uint8(1), uint64(1)]), "uint8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1233 %!assert (class ([uint8(1), uint32(1)]), "uint8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1234 %!assert (class ([uint8(1), uint16(1)]), "uint8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1235 %!assert (class ([uint8(1), uint8(1)]), "uint8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1236 %!assert (class ([uint8(1), single(1)]), "uint8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1237 %!assert (class ([uint8(1), double(1)]), "uint8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1238 %!assert (class ([uint8(1), cell(1)]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1239 %!assert (class ([uint8(1), true]), "uint8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1240 %!assert (class ([uint8(1), "a"]), "char") |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
1241 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1242 %!assert (class ([single(1), int64(1)]), "int64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1243 %!assert (class ([single(1), int32(1)]), "int32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1244 %!assert (class ([single(1), int16(1)]), "int16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1245 %!assert (class ([single(1), int8(1)]), "int8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1246 %!assert (class ([single(1), uint64(1)]), "uint64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1247 %!assert (class ([single(1), uint32(1)]), "uint32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1248 %!assert (class ([single(1), uint16(1)]), "uint16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1249 %!assert (class ([single(1), uint8(1)]), "uint8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1250 %!assert (class ([single(1), single(1)]), "single") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1251 %!assert (class ([single(1), double(1)]), "single") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1252 %!assert (class ([single(1), cell(1)]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1253 %!assert (class ([single(1), true]), "single") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1254 %!assert (class ([single(1), "a"]), "char") |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
1255 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1256 %!assert (class ([double(1), int64(1)]), "int64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1257 %!assert (class ([double(1), int32(1)]), "int32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1258 %!assert (class ([double(1), int16(1)]), "int16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1259 %!assert (class ([double(1), int8(1)]), "int8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1260 %!assert (class ([double(1), uint64(1)]), "uint64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1261 %!assert (class ([double(1), uint32(1)]), "uint32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1262 %!assert (class ([double(1), uint16(1)]), "uint16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1263 %!assert (class ([double(1), uint8(1)]), "uint8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1264 %!assert (class ([double(1), single(1)]), "single") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1265 %!assert (class ([double(1), double(1)]), "double") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1266 %!assert (class ([double(1), cell(1)]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1267 %!assert (class ([double(1), true]), "double") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1268 %!assert (class ([double(1), "a"]), "char") |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
1269 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1270 %!assert (class ([cell(1), int64(1)]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1271 %!assert (class ([cell(1), int32(1)]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1272 %!assert (class ([cell(1), int16(1)]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1273 %!assert (class ([cell(1), int8(1)]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1274 %!assert (class ([cell(1), uint64(1)]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1275 %!assert (class ([cell(1), uint32(1)]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1276 %!assert (class ([cell(1), uint16(1)]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1277 %!assert (class ([cell(1), uint8(1)]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1278 %!assert (class ([cell(1), single(1)]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1279 %!assert (class ([cell(1), double(1)]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1280 %!assert (class ([cell(1), cell(1)]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1281 %!assert (class ([cell(1), true]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1282 %!assert (class ([cell(1), "a"]), "cell") |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
1283 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1284 %!assert (class ([true, int64(1)]), "int64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1285 %!assert (class ([true, int32(1)]), "int32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1286 %!assert (class ([true, int16(1)]), "int16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1287 %!assert (class ([true, int8(1)]), "int8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1288 %!assert (class ([true, uint64(1)]), "uint64") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1289 %!assert (class ([true, uint32(1)]), "uint32") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1290 %!assert (class ([true, uint16(1)]), "uint16") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1291 %!assert (class ([true, uint8(1)]), "uint8") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1292 %!assert (class ([true, single(1)]), "single") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1293 %!assert (class ([true, double(1)]), "double") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1294 %!assert (class ([true, cell(1)]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1295 %!assert (class ([true, true]), "logical") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1296 %!assert (class ([true, "a"]), "char") |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
1297 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1298 %!assert (class (["a", int64(1)]), "char") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1299 %!assert (class (["a", int32(1)]), "char") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1300 %!assert (class (["a", int16(1)]), "char") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1301 %!assert (class (["a", int8(1)]), "char") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1302 %!assert (class (["a", int64(1)]), "char") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1303 %!assert (class (["a", int32(1)]), "char") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1304 %!assert (class (["a", int16(1)]), "char") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1305 %!assert (class (["a", int8(1)]), "char") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1306 %!assert (class (["a", single(1)]), "char") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1307 %!assert (class (["a", double(1)]), "char") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1308 %!assert (class (["a", cell(1)]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1309 %!assert (class (["a", true]), "char") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1310 %!assert (class (["a", "a"]), "char") |
13142
d803d2702a39
improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents:
13140
diff
changeset
|
1311 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1312 %!assert (class ([cell(1), struct("foo", "bar")]), "cell") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1313 %!error [struct("foo", "bar"), cell(1)] |
16924
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1314 |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1315 %!assert ([,1], 1) |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1316 %!assert ([1,], 1) |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1317 %!assert ([,1,], 1) |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1318 %!assert ([,1,;;], 1) |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1319 %!assert ([,1,;,;], 1) |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1320 |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1321 %!assert ([1,1], ones (1, 2)) |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1322 %!assert ([,1,1], ones (1, 2)) |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1323 %!assert ([1,1,], ones (1, 2)) |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1324 %!assert ([,1,1,], ones (1, 2)) |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1325 %!assert ([,1,1,;;], ones (1, 2)) |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1326 %!assert ([,1,1,;,;], ones (1, 2)) |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1327 %!assert ([,;,1,1], ones (1, 2)) |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1328 |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1329 %!assert ([1;1], ones (2, 1)) |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1330 %!assert ([1,;1], ones (2, 1)) |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1331 %!assert ([1,;,;1], ones (2, 1)) |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1332 |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1333 %!error eval ("[,,]") |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1334 %!error eval ("[,,;,]") |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1335 %!error eval ("[,;,,;,]") |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1336 |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1337 %!assert (isnull ([,])) |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1338 %!assert (isnull ([;])) |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1339 %!assert (isnull ([;;])) |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1340 %!assert (isnull ([;,;])) |
aebb54d99dba
improve compatibility of parsing of matrices and cell arrays
John W. Eaton <jwe@octave.org>
parents:
16237
diff
changeset
|
1341 %!assert (isnull ([,;,;,])) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
12864
diff
changeset
|
1342 */ |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
12864
diff
changeset
|
1343 |
5794 | 1344 DEFUN (string_fill_char, args, nargout, |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1345 "-*- texinfo -*-\n\ |
20853
1142cf6abc0d
2015 Code Sprint: remove class of function from docstring for all C++ files.
Rik <rik@octave.org>
parents:
20832
diff
changeset
|
1346 @deftypefn {} {@var{val} =} string_fill_char ()\n\ |
1142cf6abc0d
2015 Code Sprint: remove class of function from docstring for all C++ files.
Rik <rik@octave.org>
parents:
20832
diff
changeset
|
1347 @deftypefnx {} {@var{old_val} =} string_fill_char (@var{new_val})\n\ |
1142cf6abc0d
2015 Code Sprint: remove class of function from docstring for all C++ files.
Rik <rik@octave.org>
parents:
20832
diff
changeset
|
1348 @deftypefnx {} {} string_fill_char (@var{new_val}, \"local\")\n\ |
5794 | 1349 Query or set the internal variable used to pad all rows of a character\n\ |
20163
075a5e2e1ba5
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
1350 matrix to the same length.\n\ |
075a5e2e1ba5
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
1351 \n\ |
075a5e2e1ba5
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
1352 The value must be a single character and the default is @qcode{\" \"} (a\n\ |
075a5e2e1ba5
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
1353 single space). For example:\n\ |
3361 | 1354 \n\ |
1355 @example\n\ | |
1356 @group\n\ | |
5794 | 1357 string_fill_char (\"X\");\n\ |
3361 | 1358 [ \"these\"; \"are\"; \"strings\" ]\n\ |
14402
cbcaf5602469
doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1359 @result{} \"theseXX\"\n\ |
cbcaf5602469
doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1360 \"areXXXX\"\n\ |
cbcaf5602469
doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1361 \"strings\"\n\ |
3361 | 1362 @end group\n\ |
1363 @end example\n\ | |
13951
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
13841
diff
changeset
|
1364 \n\ |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16924
diff
changeset
|
1365 When called from inside a function with the @qcode{\"local\"} option, the\n\ |
20163
075a5e2e1ba5
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
1366 variable is changed locally for the function and any subroutines it calls.\n\ |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16924
diff
changeset
|
1367 The original variable value is restored when exiting the function.\n\ |
5794 | 1368 @end deftypefn") |
1369 { | |
1370 return SET_INTERNAL_VARIABLE (string_fill_char); | |
2172 | 1371 } |
12842
a52b4e9f45e3
codesprint: new tests for pt-mat.cc
John W. Eaton <jwe@octave.org>
parents:
12483
diff
changeset
|
1372 |
a52b4e9f45e3
codesprint: new tests for pt-mat.cc
John W. Eaton <jwe@octave.org>
parents:
12483
diff
changeset
|
1373 /* |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1374 ## string_fill_char() function call must be outside of %!test block |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1375 ## due to the way a %!test block is wrapped inside a function |
12864
213c791292a6
test: Add 3 tests for string_fill_char()
Rik <octave@nomad.inbox5.com>
parents:
12842
diff
changeset
|
1376 %!shared orig_val, old_val |
12842
a52b4e9f45e3
codesprint: new tests for pt-mat.cc
John W. Eaton <jwe@octave.org>
parents:
12483
diff
changeset
|
1377 %! orig_val = string_fill_char (); |
12864
213c791292a6
test: Add 3 tests for string_fill_char()
Rik <octave@nomad.inbox5.com>
parents:
12842
diff
changeset
|
1378 %! old_val = string_fill_char ("X"); |
213c791292a6
test: Add 3 tests for string_fill_char()
Rik <octave@nomad.inbox5.com>
parents:
12842
diff
changeset
|
1379 %!test |
12842
a52b4e9f45e3
codesprint: new tests for pt-mat.cc
John W. Eaton <jwe@octave.org>
parents:
12483
diff
changeset
|
1380 %! assert (orig_val, old_val); |
a52b4e9f45e3
codesprint: new tests for pt-mat.cc
John W. Eaton <jwe@octave.org>
parents:
12483
diff
changeset
|
1381 %! assert (string_fill_char (), "X"); |
a52b4e9f45e3
codesprint: new tests for pt-mat.cc
John W. Eaton <jwe@octave.org>
parents:
12483
diff
changeset
|
1382 %! assert (["these"; "are"; "strings"], ["theseXX"; "areXXXX"; "strings"]); |
a52b4e9f45e3
codesprint: new tests for pt-mat.cc
John W. Eaton <jwe@octave.org>
parents:
12483
diff
changeset
|
1383 %! string_fill_char (orig_val); |
a52b4e9f45e3
codesprint: new tests for pt-mat.cc
John W. Eaton <jwe@octave.org>
parents:
12483
diff
changeset
|
1384 %! assert (string_fill_char (), orig_val); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1385 |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14402
diff
changeset
|
1386 %!error (string_fill_char (1, 2)) |
12842
a52b4e9f45e3
codesprint: new tests for pt-mat.cc
John W. Eaton <jwe@octave.org>
parents:
12483
diff
changeset
|
1387 */ |