Mercurial > hg > octave-nkf
annotate liboctave/CColVector.cc @ 10396:a0b51ac0f88a
optimize accumdim with summation
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 05 Mar 2010 12:31:30 +0100 |
parents | a0728e81ed25 |
children | 4d1fc073fbb7 |
rev | line source |
---|---|
1993 | 1 // ColumnVector manipulations. |
458 | 2 /* |
3 | |
7017 | 4 Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2004, |
8920 | 5 2005, 2007, 2008 John W. Eaton |
458 | 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. | |
458 | 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/>. | |
458 | 22 |
23 */ | |
24 | |
25 #ifdef HAVE_CONFIG_H | |
1192 | 26 #include <config.h> |
458 | 27 #endif |
28 | |
3503 | 29 #include <iostream> |
458 | 30 |
4669 | 31 #include "Array-util.h" |
1847 | 32 #include "f77-fcn.h" |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7482
diff
changeset
|
33 #include "functor.h" |
1368 | 34 #include "lo-error.h" |
458 | 35 #include "mx-base.h" |
36 #include "mx-inlines.cc" | |
1650 | 37 #include "oct-cmplx.h" |
458 | 38 |
39 // Fortran functions we call. | |
40 | |
41 extern "C" | |
42 { | |
4552 | 43 F77_RET_T |
44 F77_FUNC (zgemv, ZGEMV) (F77_CONST_CHAR_ARG_DECL, | |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
45 const octave_idx_type&, const octave_idx_type&, const Complex&, |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
46 const Complex*, const octave_idx_type&, const Complex*, |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
47 const octave_idx_type&, const Complex&, Complex*, const octave_idx_type& |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
48 F77_CHAR_ARG_LEN_DECL); |
458 | 49 } |
50 | |
1360 | 51 // Complex Column Vector class |
458 | 52 |
53 ComplexColumnVector::ComplexColumnVector (const ColumnVector& a) | |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10314
diff
changeset
|
54 : MArray<Complex> (a) |
458 | 55 { |
56 } | |
57 | |
2386 | 58 bool |
458 | 59 ComplexColumnVector::operator == (const ComplexColumnVector& a) const |
60 { | |
5275 | 61 octave_idx_type len = length (); |
458 | 62 if (len != a.length ()) |
63 return 0; | |
9550
3d6a9aea2aea
refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
8999
diff
changeset
|
64 return mx_inline_equal (len, data (), a.data ()); |
458 | 65 } |
66 | |
2386 | 67 bool |
458 | 68 ComplexColumnVector::operator != (const ComplexColumnVector& a) const |
69 { | |
70 return !(*this == a); | |
71 } | |
72 | |
73 // destructive insert/delete/reorder operations | |
74 | |
75 ComplexColumnVector& | |
5275 | 76 ComplexColumnVector::insert (const ColumnVector& a, octave_idx_type r) |
458 | 77 { |
5275 | 78 octave_idx_type a_len = a.length (); |
4316 | 79 |
1699 | 80 if (r < 0 || r + a_len > length ()) |
458 | 81 { |
82 (*current_liboctave_error_handler) ("range error for insert"); | |
83 return *this; | |
84 } | |
85 | |
4316 | 86 if (a_len > 0) |
87 { | |
88 make_unique (); | |
89 | |
5275 | 90 for (octave_idx_type i = 0; i < a_len; i++) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
91 xelem (r+i) = a.elem (i); |
4316 | 92 } |
458 | 93 |
94 return *this; | |
95 } | |
96 | |
97 ComplexColumnVector& | |
5275 | 98 ComplexColumnVector::insert (const ComplexColumnVector& a, octave_idx_type r) |
458 | 99 { |
5275 | 100 octave_idx_type a_len = a.length (); |
4316 | 101 |
1699 | 102 if (r < 0 || r + a_len > length ()) |
458 | 103 { |
104 (*current_liboctave_error_handler) ("range error for insert"); | |
105 return *this; | |
106 } | |
107 | |
4316 | 108 if (a_len > 0) |
109 { | |
110 make_unique (); | |
111 | |
5275 | 112 for (octave_idx_type i = 0; i < a_len; i++) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
113 xelem (r+i) = a.elem (i); |
4316 | 114 } |
458 | 115 |
116 return *this; | |
117 } | |
118 | |
119 ComplexColumnVector& | |
120 ComplexColumnVector::fill (double val) | |
121 { | |
5275 | 122 octave_idx_type len = length (); |
4316 | 123 |
458 | 124 if (len > 0) |
4316 | 125 { |
126 make_unique (); | |
127 | |
5275 | 128 for (octave_idx_type i = 0; i < len; i++) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
129 xelem (i) = val; |
4316 | 130 } |
131 | |
458 | 132 return *this; |
133 } | |
134 | |
135 ComplexColumnVector& | |
136 ComplexColumnVector::fill (const Complex& val) | |
137 { | |
5275 | 138 octave_idx_type len = length (); |
4316 | 139 |
458 | 140 if (len > 0) |
4316 | 141 { |
142 make_unique (); | |
143 | |
5275 | 144 for (octave_idx_type i = 0; i < len; i++) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
145 xelem (i) = val; |
4316 | 146 } |
147 | |
148 | |
458 | 149 return *this; |
150 } | |
151 | |
152 ComplexColumnVector& | |
5275 | 153 ComplexColumnVector::fill (double val, octave_idx_type r1, octave_idx_type r2) |
458 | 154 { |
5275 | 155 octave_idx_type len = length (); |
4316 | 156 |
458 | 157 if (r1 < 0 || r2 < 0 || r1 >= len || r2 >= len) |
158 { | |
159 (*current_liboctave_error_handler) ("range error for fill"); | |
160 return *this; | |
161 } | |
162 | |
5275 | 163 if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } |
458 | 164 |
4316 | 165 if (r2 >= r1) |
166 { | |
167 make_unique (); | |
168 | |
5275 | 169 for (octave_idx_type i = r1; i <= r2; i++) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
170 xelem (i) = val; |
4316 | 171 } |
458 | 172 |
173 return *this; | |
174 } | |
175 | |
176 ComplexColumnVector& | |
5275 | 177 ComplexColumnVector::fill (const Complex& val, octave_idx_type r1, octave_idx_type r2) |
458 | 178 { |
5275 | 179 octave_idx_type len = length (); |
4316 | 180 |
458 | 181 if (r1 < 0 || r2 < 0 || r1 >= len || r2 >= len) |
182 { | |
183 (*current_liboctave_error_handler) ("range error for fill"); | |
184 return *this; | |
185 } | |
186 | |
5275 | 187 if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } |
458 | 188 |
4316 | 189 if (r2 >= r1) |
190 { | |
191 make_unique (); | |
192 | |
5275 | 193 for (octave_idx_type i = r1; i <= r2; i++) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
194 xelem (i) = val; |
4316 | 195 } |
458 | 196 |
197 return *this; | |
198 } | |
199 | |
200 ComplexColumnVector | |
201 ComplexColumnVector::stack (const ColumnVector& a) const | |
202 { | |
5275 | 203 octave_idx_type len = length (); |
204 octave_idx_type nr_insert = len; | |
458 | 205 ComplexColumnVector retval (len + a.length ()); |
206 retval.insert (*this, 0); | |
207 retval.insert (a, nr_insert); | |
208 return retval; | |
209 } | |
210 | |
211 ComplexColumnVector | |
212 ComplexColumnVector::stack (const ComplexColumnVector& a) const | |
213 { | |
5275 | 214 octave_idx_type len = length (); |
215 octave_idx_type nr_insert = len; | |
458 | 216 ComplexColumnVector retval (len + a.length ()); |
217 retval.insert (*this, 0); | |
218 retval.insert (a, nr_insert); | |
219 return retval; | |
220 } | |
221 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7503
diff
changeset
|
222 ComplexRowVector |
458 | 223 ComplexColumnVector::hermitian (void) const |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7503
diff
changeset
|
224 { |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7503
diff
changeset
|
225 return MArray<Complex>::hermitian (std::conj); |
458 | 226 } |
227 | |
228 ComplexRowVector | |
229 ComplexColumnVector::transpose (void) const | |
230 { | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7503
diff
changeset
|
231 return MArray<Complex>::transpose (); |
458 | 232 } |
233 | |
10363
a0728e81ed25
improve diag matrix interface & implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
234 ColumnVector |
a0728e81ed25
improve diag matrix interface & implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
235 ComplexColumnVector::abs (void) const |
a0728e81ed25
improve diag matrix interface & implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
236 { |
a0728e81ed25
improve diag matrix interface & implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
237 return do_mx_unary_map<double, Complex, std::abs> (*this); |
a0728e81ed25
improve diag matrix interface & implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
238 } |
a0728e81ed25
improve diag matrix interface & implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
239 |
458 | 240 ComplexColumnVector |
241 conj (const ComplexColumnVector& a) | |
242 { | |
10363
a0728e81ed25
improve diag matrix interface & implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
243 return do_mx_unary_map<Complex, Complex, std::conj> (a); |
458 | 244 } |
245 | |
246 // resize is the destructive equivalent for this one | |
247 | |
248 ComplexColumnVector | |
5275 | 249 ComplexColumnVector::extract (octave_idx_type r1, octave_idx_type r2) const |
458 | 250 { |
5275 | 251 if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } |
458 | 252 |
5275 | 253 octave_idx_type new_r = r2 - r1 + 1; |
458 | 254 |
255 ComplexColumnVector result (new_r); | |
256 | |
5275 | 257 for (octave_idx_type i = 0; i < new_r; i++) |
458 | 258 result.elem (i) = elem (r1+i); |
259 | |
260 return result; | |
261 } | |
262 | |
4316 | 263 ComplexColumnVector |
5275 | 264 ComplexColumnVector::extract_n (octave_idx_type r1, octave_idx_type n) const |
4316 | 265 { |
266 ComplexColumnVector result (n); | |
267 | |
5275 | 268 for (octave_idx_type i = 0; i < n; i++) |
4316 | 269 result.elem (i) = elem (r1+i); |
270 | |
271 return result; | |
272 } | |
273 | |
458 | 274 // column vector by column vector -> column vector operations |
275 | |
276 ComplexColumnVector& | |
277 ComplexColumnVector::operator += (const ColumnVector& a) | |
278 { | |
5275 | 279 octave_idx_type len = length (); |
2386 | 280 |
5275 | 281 octave_idx_type a_len = a.length (); |
2386 | 282 |
283 if (len != a_len) | |
458 | 284 { |
2386 | 285 gripe_nonconformant ("operator +=", len, a_len); |
458 | 286 return *this; |
287 } | |
288 | |
289 if (len == 0) | |
290 return *this; | |
291 | |
292 Complex *d = fortran_vec (); // Ensures only one reference to my privates! | |
293 | |
9550
3d6a9aea2aea
refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
8999
diff
changeset
|
294 mx_inline_add2 (len, d, a.data ()); |
458 | 295 return *this; |
296 } | |
297 | |
298 ComplexColumnVector& | |
299 ComplexColumnVector::operator -= (const ColumnVector& a) | |
300 { | |
5275 | 301 octave_idx_type len = length (); |
2386 | 302 |
5275 | 303 octave_idx_type a_len = a.length (); |
2386 | 304 |
305 if (len != a_len) | |
458 | 306 { |
2386 | 307 gripe_nonconformant ("operator -=", len, a_len); |
458 | 308 return *this; |
309 } | |
310 | |
311 if (len == 0) | |
312 return *this; | |
313 | |
314 Complex *d = fortran_vec (); // Ensures only one reference to my privates! | |
315 | |
9550
3d6a9aea2aea
refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
8999
diff
changeset
|
316 mx_inline_sub2 (len, d, a.data ()); |
458 | 317 return *this; |
318 } | |
319 | |
1205 | 320 // matrix by column vector -> column vector operations |
321 | |
322 ComplexColumnVector | |
323 operator * (const ComplexMatrix& m, const ColumnVector& a) | |
324 { | |
325 ComplexColumnVector tmp (a); | |
326 return m * tmp; | |
327 } | |
328 | |
329 ComplexColumnVector | |
330 operator * (const ComplexMatrix& m, const ComplexColumnVector& a) | |
331 { | |
1947 | 332 ComplexColumnVector retval; |
333 | |
5275 | 334 octave_idx_type nr = m.rows (); |
335 octave_idx_type nc = m.cols (); | |
1947 | 336 |
5275 | 337 octave_idx_type a_len = a.length (); |
2386 | 338 |
339 if (nc != a_len) | |
340 gripe_nonconformant ("operator *", nr, nc, a_len, 1); | |
1947 | 341 else |
458 | 342 { |
9625
cbabf50315ca
optimize Matrix*ColumnVector
Jaroslav Hajek <highegg@gmail.com>
parents:
9550
diff
changeset
|
343 retval.clear (nr); |
cbabf50315ca
optimize Matrix*ColumnVector
Jaroslav Hajek <highegg@gmail.com>
parents:
9550
diff
changeset
|
344 |
cbabf50315ca
optimize Matrix*ColumnVector
Jaroslav Hajek <highegg@gmail.com>
parents:
9550
diff
changeset
|
345 if (nr != 0) |
cbabf50315ca
optimize Matrix*ColumnVector
Jaroslav Hajek <highegg@gmail.com>
parents:
9550
diff
changeset
|
346 { |
cbabf50315ca
optimize Matrix*ColumnVector
Jaroslav Hajek <highegg@gmail.com>
parents:
9550
diff
changeset
|
347 Complex *y = retval.fortran_vec (); |
1947 | 348 |
9625
cbabf50315ca
optimize Matrix*ColumnVector
Jaroslav Hajek <highegg@gmail.com>
parents:
9550
diff
changeset
|
349 F77_XFCN (zgemv, ZGEMV, (F77_CONST_CHAR_ARG2 ("N", 1), |
cbabf50315ca
optimize Matrix*ColumnVector
Jaroslav Hajek <highegg@gmail.com>
parents:
9550
diff
changeset
|
350 nr, nc, 1.0, m.data (), nr, |
cbabf50315ca
optimize Matrix*ColumnVector
Jaroslav Hajek <highegg@gmail.com>
parents:
9550
diff
changeset
|
351 a.data (), 1, 0.0, y, 1 |
cbabf50315ca
optimize Matrix*ColumnVector
Jaroslav Hajek <highegg@gmail.com>
parents:
9550
diff
changeset
|
352 F77_CHAR_ARG_LEN (1))); |
cbabf50315ca
optimize Matrix*ColumnVector
Jaroslav Hajek <highegg@gmail.com>
parents:
9550
diff
changeset
|
353 } |
458 | 354 } |
355 | |
1947 | 356 return retval; |
458 | 357 } |
358 | |
1205 | 359 // matrix by column vector -> column vector operations |
360 | |
361 ComplexColumnVector | |
362 operator * (const Matrix& m, const ComplexColumnVector& a) | |
363 { | |
364 ComplexMatrix tmp (m); | |
365 return tmp * a; | |
366 } | |
367 | |
368 // diagonal matrix by column vector -> column vector operations | |
369 | |
370 ComplexColumnVector | |
371 operator * (const DiagMatrix& m, const ComplexColumnVector& a) | |
372 { | |
5275 | 373 octave_idx_type nr = m.rows (); |
374 octave_idx_type nc = m.cols (); | |
2386 | 375 |
5275 | 376 octave_idx_type a_len = a.length (); |
2386 | 377 |
1205 | 378 if (nc != a_len) |
379 { | |
2386 | 380 gripe_nonconformant ("operator *", nr, nc, a_len, 1); |
3585 | 381 return ComplexColumnVector (); |
1205 | 382 } |
383 | |
384 if (nc == 0 || nr == 0) | |
385 return ComplexColumnVector (0); | |
386 | |
387 ComplexColumnVector result (nr); | |
388 | |
5275 | 389 for (octave_idx_type i = 0; i < a_len; i++) |
1205 | 390 result.elem (i) = a.elem (i) * m.elem (i, i); |
391 | |
5275 | 392 for (octave_idx_type i = a_len; i < nr; i++) |
1205 | 393 result.elem (i) = 0.0; |
394 | |
395 return result; | |
396 } | |
397 | |
398 ComplexColumnVector | |
399 operator * (const ComplexDiagMatrix& m, const ColumnVector& a) | |
400 { | |
5275 | 401 octave_idx_type nr = m.rows (); |
402 octave_idx_type nc = m.cols (); | |
2386 | 403 |
5275 | 404 octave_idx_type a_len = a.length (); |
2386 | 405 |
1205 | 406 if (nc != a_len) |
407 { | |
2386 | 408 gripe_nonconformant ("operator *", nr, nc, a_len, 1); |
1205 | 409 return ComplexColumnVector (); |
410 } | |
411 | |
412 if (nc == 0 || nr == 0) | |
413 return ComplexColumnVector (0); | |
414 | |
415 ComplexColumnVector result (nr); | |
416 | |
5275 | 417 for (octave_idx_type i = 0; i < a_len; i++) |
1205 | 418 result.elem (i) = a.elem (i) * m.elem (i, i); |
419 | |
5275 | 420 for (octave_idx_type i = a_len; i < nr; i++) |
1205 | 421 result.elem (i) = 0.0; |
422 | |
423 return result; | |
424 } | |
425 | |
426 ComplexColumnVector | |
427 operator * (const ComplexDiagMatrix& m, const ComplexColumnVector& a) | |
428 { | |
5275 | 429 octave_idx_type nr = m.rows (); |
430 octave_idx_type nc = m.cols (); | |
2386 | 431 |
5275 | 432 octave_idx_type a_len = a.length (); |
2386 | 433 |
1205 | 434 if (nc != a_len) |
435 { | |
2386 | 436 gripe_nonconformant ("operator *", nr, nc, a_len, 1); |
1205 | 437 return ComplexColumnVector (); |
438 } | |
439 | |
440 if (nc == 0 || nr == 0) | |
441 return ComplexColumnVector (0); | |
442 | |
443 ComplexColumnVector result (nr); | |
444 | |
5275 | 445 for (octave_idx_type i = 0; i < a_len; i++) |
1205 | 446 result.elem (i) = a.elem (i) * m.elem (i, i); |
447 | |
5275 | 448 for (octave_idx_type i = a_len; i < nr; i++) |
1205 | 449 result.elem (i) = 0.0; |
450 | |
451 return result; | |
452 } | |
453 | |
458 | 454 // other operations |
455 | |
456 Complex | |
457 ComplexColumnVector::min (void) const | |
458 { | |
5275 | 459 octave_idx_type len = length (); |
458 | 460 if (len == 0) |
461 return 0.0; | |
462 | |
463 Complex res = elem (0); | |
5260 | 464 double absres = std::abs (res); |
458 | 465 |
5275 | 466 for (octave_idx_type i = 1; i < len; i++) |
5260 | 467 if (std::abs (elem (i)) < absres) |
458 | 468 { |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
469 res = elem (i); |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
470 absres = std::abs (res); |
458 | 471 } |
472 | |
473 return res; | |
474 } | |
475 | |
476 Complex | |
477 ComplexColumnVector::max (void) const | |
478 { | |
5275 | 479 octave_idx_type len = length (); |
458 | 480 if (len == 0) |
481 return 0.0; | |
482 | |
483 Complex res = elem (0); | |
5260 | 484 double absres = std::abs (res); |
458 | 485 |
5275 | 486 for (octave_idx_type i = 1; i < len; i++) |
5260 | 487 if (std::abs (elem (i)) > absres) |
458 | 488 { |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
489 res = elem (i); |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
490 absres = std::abs (res); |
458 | 491 } |
492 | |
493 return res; | |
494 } | |
495 | |
496 // i/o | |
497 | |
3504 | 498 std::ostream& |
499 operator << (std::ostream& os, const ComplexColumnVector& a) | |
458 | 500 { |
501 // int field_width = os.precision () + 7; | |
5275 | 502 for (octave_idx_type i = 0; i < a.length (); i++) |
458 | 503 os << /* setw (field_width) << */ a.elem (i) << "\n"; |
504 return os; | |
505 } | |
506 | |
3504 | 507 std::istream& |
508 operator >> (std::istream& is, ComplexColumnVector& a) | |
458 | 509 { |
5275 | 510 octave_idx_type len = a.length(); |
458 | 511 |
8999
dc07bc4157b8
allow empty matrices in stream input operators
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
512 if (len > 0) |
458 | 513 { |
514 double tmp; | |
5275 | 515 for (octave_idx_type i = 0; i < len; i++) |
458 | 516 { |
517 is >> tmp; | |
518 if (is) | |
519 a.elem (i) = tmp; | |
520 else | |
521 break; | |
522 } | |
523 } | |
532 | 524 return is; |
458 | 525 } |