5164
|
1 /* |
|
2 |
|
3 Copyright (C) 2004 David Bateman |
|
4 Copyright (C) 1998-2004 Andy Adler |
|
5 |
|
6 Octave is free software; you can redistribute it and/or modify it |
|
7 under the terms of the GNU General Public License as published by the |
|
8 Free Software Foundation; either version 2, or (at your option) any |
|
9 later version. |
|
10 |
|
11 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 for more details. |
|
15 |
|
16 You should have received a copy of the GNU General Public License |
5307
|
17 along with this program; see the file COPYING. If not, write to the |
|
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
19 Boston, MA 02110-1301, USA. |
5164
|
20 |
|
21 */ |
|
22 |
|
23 #ifdef HAVE_CONFIG_H |
|
24 #include <config.h> |
|
25 #endif |
|
26 |
|
27 #include <cassert> |
|
28 |
|
29 #include "oct-sort.cc" |
|
30 #include "quit.h" |
|
31 |
|
32 #include "sparse-sort.h" |
|
33 |
|
34 // A simple class and instantiation of the octave merge sort class |
|
35 // to sort sparse data before matrix creation. This is significantly |
|
36 // faster than using octave_qsort. |
|
37 |
|
38 bool |
|
39 octave_sparse_sidxl_comp (octave_sparse_sort_idxl* i, |
|
40 octave_sparse_sort_idxl* j) |
|
41 { |
|
42 int tmp = i->c - j->c; |
|
43 if (tmp < 0) |
|
44 return true; |
|
45 else if (tmp > 0) |
|
46 return false; |
|
47 return (i->r < j->r); |
|
48 } |
|
49 |
|
50 // Instantiate the sparse sorting class |
|
51 template class octave_sort<octave_sparse_sort_idxl *>; |
|
52 |
5587
|
53 // Instantiate the sorting class of octave_idx_type, need in MUL macro |
|
54 template class octave_sort<octave_idx_type>; |
|
55 |
5164
|
56 /* |
|
57 ;;; Local Variables: *** |
|
58 ;;; mode: C++ *** |
|
59 ;;; End: *** |
|
60 */ |