Mercurial > hg > octave-jordi
comparison liboctave/sparse-sort.cc @ 5603:2c66c36d2698
[project @ 2006-01-31 11:57:47 by dbateman]
author | dbateman |
---|---|
date | Tue, 31 Jan 2006 11:57:47 +0000 |
parents | b4cb3f93c1e1 |
children | 93c65f2a5668 |
comparison
equal
deleted
inserted
replaced
5602:dfa2da0563e5 | 5603:2c66c36d2698 |
---|---|
37 | 37 |
38 bool | 38 bool |
39 octave_sparse_sidxl_comp (octave_sparse_sort_idxl* i, | 39 octave_sparse_sidxl_comp (octave_sparse_sort_idxl* i, |
40 octave_sparse_sort_idxl* j) | 40 octave_sparse_sort_idxl* j) |
41 { | 41 { |
42 int tmp = i->c - j->c; | 42 octave_idx_type tmp = i->c - j->c; |
43 if (tmp < 0) | 43 if (tmp < 0) |
44 return true; | 44 return true; |
45 else if (tmp > 0) | 45 else if (tmp > 0) |
46 return false; | 46 return false; |
47 return (i->r < j->r); | 47 return (i->r < j->r); |
48 } | 48 } |
49 | 49 |
50 // Instantiate the sparse sorting class | 50 // Instantiate the sparse sorting class |
51 template class octave_sort<octave_sparse_sort_idxl *>; | 51 template class octave_sort<octave_sparse_sort_idxl *>; |
52 | 52 |
53 // Need to know the original order of the sorted indexes in | |
54 // sparse assignments, and this class does that | |
55 bool | |
56 octave_idx_vector_comp (octave_idx_vector_sort* i, | |
57 octave_idx_vector_sort* j) | |
58 { | |
59 return (i->i < j->i); | |
60 } | |
61 | |
62 // Instantiate the sparse index sorting class | |
63 template class octave_sort<octave_idx_vector_sort *>; | |
64 | |
53 // Instantiate the sorting class of octave_idx_type, need in MUL macro | 65 // Instantiate the sorting class of octave_idx_type, need in MUL macro |
54 template class octave_sort<octave_idx_type>; | 66 template class octave_sort<octave_idx_type>; |
55 | 67 |
56 /* | 68 /* |
57 ;;; Local Variables: *** | 69 ;;; Local Variables: *** |