Mercurial > hg > octave-nkf
annotate src/Cell.cc @ 10884:cc2bc3f46cd4
fix assignment bug with lazy indices
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 11 Aug 2010 10:55:31 +0200 |
parents | 64472dd48517 |
children | e7864673c31f |
rev | line source |
---|---|
3353 | 1 /* |
2 | |
8920 | 3 Copyright (C) 1999, 2002, 2003, 2004, 2005, 2006, 2007, 2008, |
4 2009 John W. Eaton | |
10521
4d1fc073fbb7
add some missing copyright stmts
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
5 Copyright (C) 2009, 2010 VZLU Prague |
3353 | 6 |
7 This file is part of Octave. | |
8 | |
9 Octave is free software; you can redistribute it and/or modify it | |
10 under the terms of the GNU General Public License as published by the | |
7016 | 11 Free Software Foundation; either version 3 of the License, or (at your |
12 option) any later version. | |
3353 | 13 |
14 Octave is distributed in the hope that it will be useful, but WITHOUT | |
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
17 for more details. | |
18 | |
19 You should have received a copy of the GNU General Public License | |
7016 | 20 along with Octave; see the file COPYING. If not, see |
21 <http://www.gnu.org/licenses/>. | |
3353 | 22 |
23 */ | |
24 | |
25 #ifdef HAVE_CONFIG_H | |
26 #include <config.h> | |
27 #endif | |
28 | |
4513 | 29 #include "idx-vector.h" |
30 | |
3353 | 31 #include "Cell.h" |
4919 | 32 #include "error.h" |
5602 | 33 #include "gripes.h" |
8579
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8290
diff
changeset
|
34 #include "oct-obj.h" |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8290
diff
changeset
|
35 |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8290
diff
changeset
|
36 Cell::Cell (const octave_value_list& ovl) |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9415
diff
changeset
|
37 : Array<octave_value> (ovl.cell_value ()) |
8579
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8290
diff
changeset
|
38 { |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8290
diff
changeset
|
39 } |
3353 | 40 |
5805 | 41 Cell::Cell (const string_vector& sv, bool trim) |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9415
diff
changeset
|
42 : Array<octave_value> () |
4216 | 43 { |
5275 | 44 octave_idx_type n = sv.length (); |
4216 | 45 |
46 if (n > 0) | |
47 { | |
4625 | 48 resize (dim_vector (n, 1)); |
4216 | 49 |
5275 | 50 for (octave_idx_type i = 0; i < n; i++) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
51 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
52 std::string s = sv[i]; |
5805 | 53 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
54 if (trim) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
55 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
56 size_t pos = s.find_last_not_of (' '); |
5805 | 57 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
58 s = (pos == std::string::npos) ? "" : s.substr (0, pos+1); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
59 } |
5805 | 60 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
61 elem(i,0) = s; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
62 } |
4216 | 63 } |
64 } | |
3354 | 65 |
8732 | 66 Cell::Cell (const Array<std::string>& sa) |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9415
diff
changeset
|
67 : Array<octave_value> (sa.dims ()) |
8732 | 68 { |
69 octave_idx_type n = sa.numel (); | |
70 | |
71 octave_value *dst = fortran_vec (); | |
72 const std::string *src = sa.data (); | |
73 | |
74 for (octave_idx_type i = 0; i < n; i++) | |
75 dst[i] = src[i]; | |
76 } | |
77 | |
6116 | 78 // Set size to DV, filling with []. Then fill with as many elements of |
79 // SV as possible. | |
7209 | 80 |
6116 | 81 Cell::Cell (const dim_vector& dv, const string_vector& sv, bool trim) |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9415
diff
changeset
|
82 : Array<octave_value> (dv, resize_fill_value ()) |
6116 | 83 { |
84 octave_idx_type n = sv.length (); | |
85 | |
86 if (n > 0) | |
87 { | |
88 octave_idx_type m = numel (); | |
89 | |
90 octave_idx_type len = n > m ? m : n; | |
91 | |
92 for (octave_idx_type i = 0; i < len; i++) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
93 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
94 std::string s = sv[i]; |
6116 | 95 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
96 if (trim) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
97 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
98 size_t pos = s.find_last_not_of (' '); |
6116 | 99 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
100 s = (pos == std::string::npos) ? "" : s.substr (0, pos+1); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
101 } |
6116 | 102 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
103 elem(i) = s; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
104 } |
6116 | 105 } |
106 } | |
107 | |
108 bool | |
109 Cell::is_cellstr (void) const | |
110 { | |
111 bool retval = true; | |
112 | |
10065
64a06079cae4
improve cellstr cache implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
113 octave_idx_type n = numel (); |
64a06079cae4
improve cellstr cache implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
114 |
64a06079cae4
improve cellstr cache implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
115 for (octave_idx_type i = 0; i < n; i++) |
6116 | 116 { |
117 if (! elem(i).is_string ()) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
118 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
119 retval = false; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
120 break; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
121 } |
6116 | 122 } |
123 | |
124 return retval; | |
125 } | |
126 | |
10065
64a06079cae4
improve cellstr cache implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
127 Array<std::string> |
64a06079cae4
improve cellstr cache implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
128 Cell::cellstr_value (void) const |
64a06079cae4
improve cellstr cache implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
129 { |
64a06079cae4
improve cellstr cache implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
130 Array<std::string> retval (dims ()); |
64a06079cae4
improve cellstr cache implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
131 |
64a06079cae4
improve cellstr cache implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
132 octave_idx_type n = numel (); |
64a06079cae4
improve cellstr cache implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
133 |
64a06079cae4
improve cellstr cache implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
134 for (octave_idx_type i = 0; i < n; i++) |
64a06079cae4
improve cellstr cache implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
135 retval.xelem (i) = elem (i).string_value (); |
64a06079cae4
improve cellstr cache implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
136 |
64a06079cae4
improve cellstr cache implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
137 return retval; |
64a06079cae4
improve cellstr cache implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
138 } |
64a06079cae4
improve cellstr cache implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
139 |
4513 | 140 Cell |
4587 | 141 Cell::index (const octave_value_list& idx_arg, bool resize_ok) const |
4513 | 142 { |
143 Cell retval; | |
144 | |
5275 | 145 octave_idx_type n = idx_arg.length (); |
4513 | 146 |
147 switch (n) | |
148 { | |
5539 | 149 case 0: |
150 retval = *this; | |
151 break; | |
152 | |
4513 | 153 case 1: |
154 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
155 idx_vector i = idx_arg(0).index_vector (); |
4513 | 156 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
157 if (! error_state) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
158 retval = Array<octave_value>::index (i, resize_ok, resize_fill_value ()); |
4513 | 159 } |
160 break; | |
161 | |
162 case 2: | |
163 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
164 idx_vector i = idx_arg(0).index_vector (); |
4513 | 165 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
166 if (! error_state) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
167 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
168 idx_vector j = idx_arg(1).index_vector (); |
4919 | 169 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
170 if (! error_state) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
171 retval = Array<octave_value>::index (i, j, resize_ok, |
9415
f16079069972
use proper empty value in Cell::index
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
172 resize_fill_value ()); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
173 } |
4513 | 174 } |
175 break; | |
176 | |
177 default: | |
178 { | |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
179 Array<idx_vector> iv (n, 1); |
4513 | 180 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
181 for (octave_idx_type i = 0; i < n; i++) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
182 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
183 iv(i) = idx_arg(i).index_vector (); |
4513 | 184 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
185 if (error_state) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
186 break; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
187 } |
4919 | 188 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
189 if (!error_state) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
190 retval = Array<octave_value>::index (iv, resize_ok, |
9415
f16079069972
use proper empty value in Cell::index
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
191 resize_fill_value ()); |
4513 | 192 } |
193 break; | |
194 } | |
195 | |
196 return retval; | |
197 } | |
198 | |
10649
64472dd48517
cosmetic changes in Cell interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10521
diff
changeset
|
199 void |
4587 | 200 Cell::assign (const octave_value_list& idx_arg, const Cell& rhs, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
201 const octave_value& fill_val) |
4513 | 202 |
203 { | |
8290
7cbe01c21986
improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8179
diff
changeset
|
204 octave_idx_type len = idx_arg.length (); |
7cbe01c21986
improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8179
diff
changeset
|
205 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
206 Array<idx_vector> ra_idx (len, 1); |
4513 | 207 |
8290
7cbe01c21986
improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8179
diff
changeset
|
208 for (octave_idx_type i = 0; i < len; i++) |
7cbe01c21986
improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8179
diff
changeset
|
209 ra_idx(i) = idx_arg(i).index_vector (); |
7cbe01c21986
improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8179
diff
changeset
|
210 |
7cbe01c21986
improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8179
diff
changeset
|
211 Array<octave_value>::assign (ra_idx, rhs, fill_val); |
4513 | 212 } |
213 | |
10649
64472dd48517
cosmetic changes in Cell interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10521
diff
changeset
|
214 void |
8175
977d5204cf67
fix null assignment for structs
Jaroslav Hajek <highegg@gmail.com>
parents:
8021
diff
changeset
|
215 Cell::delete_elements (const octave_value_list& idx_arg) |
977d5204cf67
fix null assignment for structs
Jaroslav Hajek <highegg@gmail.com>
parents:
8021
diff
changeset
|
216 |
977d5204cf67
fix null assignment for structs
Jaroslav Hajek <highegg@gmail.com>
parents:
8021
diff
changeset
|
217 { |
8290
7cbe01c21986
improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8179
diff
changeset
|
218 octave_idx_type len = idx_arg.length (); |
7cbe01c21986
improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8179
diff
changeset
|
219 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
220 Array<idx_vector> ra_idx (len, 1); |
8290
7cbe01c21986
improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8179
diff
changeset
|
221 |
7cbe01c21986
improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8179
diff
changeset
|
222 for (octave_idx_type i = 0; i < len; i++) |
8175
977d5204cf67
fix null assignment for structs
Jaroslav Hajek <highegg@gmail.com>
parents:
8021
diff
changeset
|
223 ra_idx.xelem (i) = idx_arg(i).index_vector (); |
977d5204cf67
fix null assignment for structs
Jaroslav Hajek <highegg@gmail.com>
parents:
8021
diff
changeset
|
224 |
8290
7cbe01c21986
improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8179
diff
changeset
|
225 Array<octave_value>::delete_elements (ra_idx); |
8175
977d5204cf67
fix null assignment for structs
Jaroslav Hajek <highegg@gmail.com>
parents:
8021
diff
changeset
|
226 } |
977d5204cf67
fix null assignment for structs
Jaroslav Hajek <highegg@gmail.com>
parents:
8021
diff
changeset
|
227 |
5602 | 228 octave_idx_type |
229 Cell::nnz (void) const | |
230 { | |
231 gripe_wrong_type_arg ("nnz", "cell array"); | |
232 return -1; | |
233 } | |
234 | |
4915 | 235 Cell |
5570 | 236 Cell::column (octave_idx_type i) const |
237 { | |
238 Cell retval; | |
239 | |
240 if (ndims () < 3) | |
241 { | |
242 if (i < 0 || i >= cols ()) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
243 error ("invalid column selection"); |
5570 | 244 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
245 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
246 octave_idx_type nr = rows (); |
5570 | 247 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
248 retval.resize (dim_vector (nr, 1)); |
5570 | 249 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
250 for (octave_idx_type j = 0; j < nr; j++) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
251 retval.xelem (j) = elem (j, i); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
252 } |
5570 | 253 } |
254 else | |
255 error ("Cell::column: requires 2-d cell array"); | |
256 | |
257 return retval; | |
258 } | |
259 | |
260 Cell | |
5275 | 261 Cell::concat (const Cell& rb, const Array<octave_idx_type>& ra_idx) |
4806 | 262 { |
5073 | 263 return insert (rb, ra_idx); |
4915 | 264 } |
265 | |
266 Cell& | |
5275 | 267 Cell::insert (const Cell& a, octave_idx_type r, octave_idx_type c) |
4915 | 268 { |
269 Array<octave_value>::insert (a, r, c); | |
270 return *this; | |
271 } | |
272 | |
273 Cell& | |
5275 | 274 Cell::insert (const Cell& a, const Array<octave_idx_type>& ra_idx) |
4915 | 275 { |
276 Array<octave_value>::insert (a, ra_idx); | |
277 return *this; | |
4806 | 278 } |
279 | |
7530
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
280 Cell |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
281 Cell::map (ctype_mapper fcn) const |
7530
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
282 { |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
283 Cell retval (dims ()); |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
284 octave_value *r = retval.fortran_vec (); |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
285 |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
286 const octave_value *p = data (); |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
287 |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
288 for (octave_idx_type i = 0; i < numel (); i++) |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
289 r[i] = ((p++)->*fcn) (); |
7530
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
290 |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
291 return retval; |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
292 } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
293 |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7530
diff
changeset
|
294 Cell |
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7530
diff
changeset
|
295 Cell::diag (octave_idx_type k) const |
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7530
diff
changeset
|
296 { |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9415
diff
changeset
|
297 return Array<octave_value>::diag (k); |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7530
diff
changeset
|
298 } |