Mercurial > hg > octave-nkf
comparison liboctave/ArrayN-idx.h @ 4504:f6a61399bc5c
[project @ 2003-09-09 17:48:00 by jwe]
author | jwe |
---|---|
date | Tue, 09 Sep 2003 17:49:13 +0000 |
parents | 124c137af3db |
children | e944fbe3fff2 |
comparison
equal
deleted
inserted
replaced
4503:55db663c15ce | 4504:f6a61399bc5c |
---|---|
284 | 284 |
285 return retval; | 285 return retval; |
286 } | 286 } |
287 | 287 |
288 static inline bool | 288 static inline bool |
289 vector_equivalent (const Array<int>& ra_idx) | |
290 { | |
291 int n = ra_idx.length (); | |
292 | |
293 bool found_first = false; | |
294 | |
295 for (int i = 0; i < n; i++) | |
296 { | |
297 if (ra_idx(i) != 1) | |
298 { | |
299 if (! found_first) | |
300 found_first = true; | |
301 else | |
302 return false; | |
303 } | |
304 } | |
305 | |
306 return true; | |
307 } | |
308 | |
309 static inline bool | |
310 equal_arrays (const Array<int> a, const Array<int> b) | |
311 { | |
312 bool retval = true; | |
313 | |
314 if (a.length () != b.length ()) | |
315 retval = false; | |
316 else | |
317 { | |
318 for (int i = 0; i < a.length (); i++) | |
319 { | |
320 if (a(i) != b(i)) | |
321 retval = false; | |
322 } | |
323 } | |
324 | |
325 return retval; | |
326 } | |
327 | |
328 static inline bool | |
289 all_ok (const Array<idx_vector>& ra_idx) | 329 all_ok (const Array<idx_vector>& ra_idx) |
290 { | 330 { |
291 bool retval = true; | 331 bool retval = true; |
292 | 332 |
293 int n = ra_idx.length (); | 333 int n = ra_idx.length (); |
424 int n = ra_idx.length (); | 464 int n = ra_idx.length (); |
425 | 465 |
426 Array<int> retval (n); | 466 Array<int> retval (n); |
427 | 467 |
428 for (int i = 0; i < n; i++) | 468 for (int i = 0; i < n; i++) |
429 retval(i) = ra_idx(result_idx(i)); | 469 retval(i) = ra_idx(i).elem (result_idx(i)); |
430 | 470 |
431 return retval; | 471 return retval; |
432 } | 472 } |
433 | 473 |
434 template <class T> | 474 template <class T> |