GNU Octave
6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
sparse-sort.cc
Go to the documentation of this file.
1
////////////////////////////////////////////////////////////////////////
2
//
3
// Copyright (C) 1998-2021 The Octave Project Developers
4
//
5
// See the file COPYRIGHT.md in the top-level directory of this
6
// distribution or <https://octave.org/copyright/>.
7
//
8
// This file is part of Octave.
9
//
10
// Octave is free software: you can redistribute it and/or modify it
11
// under the terms of the GNU General Public License as published by
12
// the Free Software Foundation, either version 3 of the License, or
13
// (at your option) any later version.
14
//
15
// Octave is distributed in the hope that it will be useful, but
16
// WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
// GNU General Public License for more details.
19
//
20
// You should have received a copy of the GNU General Public License
21
// along with Octave; see the file COPYING. If not, see
22
// <https://www.gnu.org/licenses/>.
23
//
24
////////////////////////////////////////////////////////////////////////
25
26
#if defined (HAVE_CONFIG_H)
27
# include "config.h"
28
#endif
29
30
#include <cassert>
31
#include <cstring>
32
33
#include "
oct-sort.cc
"
34
#include "
quit.h
"
35
36
#include "
sparse-sort.h
"
37
38
// A simple class and instantiation of the octave merge sort class
39
// to sort sparse data before matrix creation. This is significantly
40
// faster than using octave_qsort.
41
42
bool
43
octave_sparse_sidxl_comp
(
octave_sparse_sort_idxl
*i,
44
octave_sparse_sort_idxl
*j)
45
{
46
octave_idx_type
tmp = i->
c
- j->
c
;
47
48
if
(tmp < 0)
49
return
true
;
50
else
if
(tmp > 0)
51
return
false
;
52
53
return
(i->
r
< j->
r
);
54
}
55
56
template
class
octave_sort<octave_sparse_sort_idxl *>
;
57
58
// Need to know the original order of the sorted indexes in
59
// sparse assignments, and this class does that
60
bool
61
octave_idx_vector_comp
(
octave_idx_vector_sort
*i,
62
octave_idx_vector_sort
*j)
63
{
64
return
(i->
i
< j->
i
);
65
}
66
67
template
class
octave_sort<octave_idx_vector_sort *>
;
octave_idx_type
octave_idx_vector_sort
Definition:
sparse-sort.h:48
octave_idx_vector_sort::i
octave_idx_type i
Definition:
sparse-sort.h:51
octave_sort
Definition:
oct-sort.h:100
octave_sparse_sort_idxl
Definition:
sparse-sort.h:35
octave_sparse_sort_idxl::r
octave_idx_type r
Definition:
sparse-sort.h:38
octave_sparse_sort_idxl::c
octave_idx_type c
Definition:
sparse-sort.h:39
oct-sort.cc
quit.h
octave_idx_vector_comp
bool octave_idx_vector_comp(octave_idx_vector_sort *i, octave_idx_vector_sort *j)
Definition:
sparse-sort.cc:61
octave_sparse_sidxl_comp
bool octave_sparse_sidxl_comp(octave_sparse_sort_idxl *i, octave_sparse_sort_idxl *j)
Definition:
sparse-sort.cc:43
sparse-sort.h
liboctave
util
sparse-sort.cc
Generated on Tue Apr 13 2021 15:27:51 for GNU Octave by
1.9.1