Mercurial > hg > octave-nkf
comparison liboctave/Sparse.cc @ 6817:2e7f62e52c13
[project @ 2007-08-19 19:36:40 by dbateman]
author | dbateman |
---|---|
date | Sun, 19 Aug 2007 19:36:40 +0000 |
parents | 8c89a644df8a |
children | c7484dcadd4d |
comparison
equal
deleted
inserted
replaced
6816:ec4c1dfb985a | 6817:2e7f62e52c13 |
---|---|
785 Sparse<T>::permute (const Array<octave_idx_type>& perm_vec, bool) const | 785 Sparse<T>::permute (const Array<octave_idx_type>& perm_vec, bool) const |
786 { | 786 { |
787 // The only valid permutations of a sparse array are [1, 2] and [2, 1]. | 787 // The only valid permutations of a sparse array are [1, 2] and [2, 1]. |
788 | 788 |
789 bool fail = false; | 789 bool fail = false; |
790 bool transpose = false; | 790 bool trans = false; |
791 | 791 |
792 if (perm_vec.length () == 2) | 792 if (perm_vec.length () == 2) |
793 { | 793 { |
794 if (perm_vec(0) == 0 && perm_vec(1) == 1) | 794 if (perm_vec(0) == 0 && perm_vec(1) == 1) |
795 /* do nothing */; | 795 /* do nothing */; |
796 else if (perm_vec(0) == 1 && perm_vec(1) == 0) | 796 else if (perm_vec(0) == 1 && perm_vec(1) == 0) |
797 transpose = true; | 797 trans = true; |
798 else | 798 else |
799 fail = true; | 799 fail = true; |
800 } | 800 } |
801 else | 801 else |
802 fail = true; | 802 fail = true; |
803 | 803 |
804 if (fail) | 804 if (fail) |
805 (*current_liboctave_error_handler) | 805 (*current_liboctave_error_handler) |
806 ("permutation vector contains an invalid element"); | 806 ("permutation vector contains an invalid element"); |
807 | 807 |
808 return transpose ? this->transpose () : *this; | 808 return trans ? this->transpose () : *this; |
809 } | 809 } |
810 | 810 |
811 template <class T> | 811 template <class T> |
812 void | 812 void |
813 Sparse<T>::resize_no_fill (const dim_vector& dv) | 813 Sparse<T>::resize_no_fill (const dim_vector& dv) |