Mercurial > hg > octave-lyh
comparison liboctave/Array.h @ 8721:e9cb742df9eb
imported patch sort3.diff
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 11 Feb 2009 15:25:53 +0100 |
parents | 314be237cd5b |
children | d5af326a3ede |
comparison
equal
deleted
inserted
replaced
8720:dda421a1f1e6 | 8721:e9cb742df9eb |
---|---|
552 | 552 |
553 Array<T> sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const; | 553 Array<T> sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const; |
554 Array<T> sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | 554 Array<T> sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, |
555 sortmode mode = ASCENDING) const; | 555 sortmode mode = ASCENDING) const; |
556 | 556 |
557 // Ordering is auto-detected or can be specified. | |
558 sortmode is_sorted (sortmode mode = UNSORTED) const; | |
559 | |
560 // Sort by rows returns only indices. | |
561 Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const; | |
562 | |
563 // Ordering is auto-detected or can be specified. | |
564 sortmode is_sorted_rows (sortmode mode = UNSORTED) const; | |
565 | |
557 Array<T> diag (octave_idx_type k = 0) const; | 566 Array<T> diag (octave_idx_type k = 0) const; |
558 | 567 |
559 template <class U, class F> | 568 template <class U, class F> |
560 Array<U> | 569 Array<U> |
561 map (F fcn) const | 570 map (F fcn) const |
576 | 585 |
577 return result; | 586 return result; |
578 } | 587 } |
579 }; | 588 }; |
580 | 589 |
581 #define INSTANTIATE_ARRAY(T, API) \ | |
582 template class API Array<T> | |
583 | |
584 // FIXME -- these are here for compatibility. In the current | |
585 // implementation, only homogeneous array assignments are actually | |
586 // instantiated. I think heterogeneous indexed assignments are rare | |
587 // enough to be implemented via conversion first. This decision may | |
588 // still be revised, that's why these macros stay here. | |
589 #define INSTANTIATE_ARRAY_AND_ASSIGN(T, API) \ | |
590 INSTANTIATE_ARRAY(T, API) | |
591 | |
592 #define INSTANTIATE_ARRAY_ASSIGN(LT, RT, API) | |
593 // do nothing | |
594 | |
595 #define INSTANTIATE_ARRAY_SORT(T) \ | |
596 template class octave_sort<T>; \ | |
597 | |
598 #define NO_INSTANTIATE_ARRAY_SORT(T) \ | |
599 template <> Array<T> Array<T>::sort \ | |
600 (octave_idx_type, sortmode) const { return *this; } \ | |
601 template <> Array<T> Array<T>::sort (Array<octave_idx_type> &sidx, \ | |
602 octave_idx_type, sortmode) const \ | |
603 { sidx = Array<octave_idx_type> (); return *this; } | |
604 | |
605 #endif | 590 #endif |
606 | 591 |
607 /* | 592 /* |
608 ;;; Local Variables: *** | 593 ;;; Local Variables: *** |
609 ;;; mode: C++ *** | 594 ;;; mode: C++ *** |