Mercurial > octave
annotate liboctave/array/Array-d.cc @ 30564:796f54d4ddbf stable
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2021.
In all .txi and .texi files except gpl.txi and gpl.texi in the
doc/liboctave and doc/interpreter directories, change the copyright
to "Octave Project Developers", the same as used for other source
files. Update copyright notices for 2022 (not done since 2019). For
gpl.txi and gpl.texi, change the copyright notice to be "Free Software
Foundation, Inc." and leave the date at 2007 only because this file
only contains the text of the GPL, not anything created by the Octave
Project Developers.
Add Paul Thomas to contributors.in.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 28 Dec 2021 18:22:40 -0500 |
parents | 29a1f8fd8ee6 |
children | 7e60506a5428 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
29569
diff
changeset
|
3 // Copyright (C) 1994-2022 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
757 | 25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21574
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21213
diff
changeset
|
27 # include "config.h" |
2006 | 28 #endif |
29 | |
757 | 30 // Instantiate Arrays of double values. |
31 | |
9003
0631d397fbe0
replace lo_ieee_isnan by xisnan, add missing includes
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
32 #include "lo-mappers.h" |
757 | 33 #include "Array.h" |
34 #include "Array.cc" | |
8377
25bc2d31e1bf
improve OCTAVE_LOCAL_BUFFER
Jaroslav Hajek <highegg@gmail.com>
parents:
8290
diff
changeset
|
35 #include "oct-locbuf.h" |
7433 | 36 |
21213
f7d1050b9b53
maint: Clean up various usages of #ifdef.
Rik <rik@octave.org>
parents:
21202
diff
changeset
|
37 #define INLINE_ASCENDING_SORT 1 |
f7d1050b9b53
maint: Clean up various usages of #ifdef.
Rik <rik@octave.org>
parents:
21202
diff
changeset
|
38 #define INLINE_DESCENDING_SORT 1 |
8700 | 39 #include "oct-sort.cc" |
7433 | 40 |
21573
f3f8e1d3e399
avoid mulitple definitions of static function-scope vars (bug #47372)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
41 // Prevent implicit instantiations on some systems (Windows, others?) |
f3f8e1d3e399
avoid mulitple definitions of static function-scope vars (bug #47372)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
42 // that can lead to duplicate definitions of static data members. |
f3f8e1d3e399
avoid mulitple definitions of static function-scope vars (bug #47372)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
43 |
29569
29a1f8fd8ee6
move idx_vector classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
44 extern template class Array<octave::idx_vector>; |
29225
a65ff1d4f75b
Remove API tag when instantiating Array template class (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27933
diff
changeset
|
45 extern template class Array<octave_idx_type>; |
21573
f3f8e1d3e399
avoid mulitple definitions of static function-scope vars (bug #47372)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
46 |
7433 | 47 template <> |
8725 | 48 inline bool |
49 sort_isnan<double> (double x) | |
7433 | 50 { |
21782
2aef506f3fec
use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
51 return octave::math::isnan (x); |
7433 | 52 } |
53 | |
8725 | 54 static bool |
55 nan_ascending_compare (double x, double y) | |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
56 { |
21782
2aef506f3fec
use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
57 return octave::math::isnan (y) ? ! octave::math::isnan (x) : x < y; |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
58 } |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
59 |
8725 | 60 static bool |
61 nan_descending_compare (double x, double y) | |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
62 { |
21782
2aef506f3fec
use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
63 return octave::math::isnan (x) ? ! octave::math::isnan (y) : x > y; |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
64 } |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
65 |
8725 | 66 Array<double>::compare_fcn_type |
27933
863ae57eee69
maint: Use Octave coding conventions in liboctave/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
67 safe_comparator (sortmode mode, const Array<double>& a, bool allow_chk) |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
68 { |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23588
diff
changeset
|
69 Array<double>::compare_fcn_type result = nullptr; |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
70 |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
71 if (allow_chk) |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
72 { |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
73 octave_idx_type k = 0; |
21782
2aef506f3fec
use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
74 for (; k < a.numel () && ! octave::math::isnan (a(k)); k++) ; |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
75 if (k == a.numel ()) |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
76 { |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
77 if (mode == ASCENDING) |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
78 result = octave_sort<double>::ascending_compare; |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
79 else if (mode == DESCENDING) |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
80 result = octave_sort<double>::descending_compare; |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
81 } |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
82 } |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
83 |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
84 if (! result) |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
85 { |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
86 if (mode == ASCENDING) |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
87 result = nan_ascending_compare; |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
88 else if (mode == DESCENDING) |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
89 result = nan_descending_compare; |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
90 } |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
91 |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
92 return result; |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
93 } |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
94 |
9922
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
95 // The default solution using NaN-safe comparator is OK, but almost twice as |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
96 // slow than this code. |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
97 template <> |
9941
1369f13ae6b2
several fixes by M. Goffioul
Jaroslav Hajek <highegg@gmail.com>
parents:
9922
diff
changeset
|
98 OCTAVE_API |
9922
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
99 sortmode |
23588
0549061d35b9
maint: Deprecate is_sorted and replace with issorted.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
100 Array<double>::issorted (sortmode mode) const |
9922
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
101 { |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
102 octave_idx_type n = numel (); |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
103 |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
104 const double *el = data (); |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
105 |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
106 if (n <= 1) |
26444
5c91daa02f87
Fix static analyzer detected issues with UNSORTED enum (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
107 return (mode == UNSORTED) ? ASCENDING : mode; |
9922
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
108 |
26444
5c91daa02f87
Fix static analyzer detected issues with UNSORTED enum (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
109 if (mode == UNSORTED) |
9922
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
110 { |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
111 // Auto-detect mode. |
21782
2aef506f3fec
use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
112 if (el[n-1] < el[0] || octave::math::isnan (el[0])) |
9922
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
113 mode = DESCENDING; |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
114 else |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
115 mode = ASCENDING; |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
116 } |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
117 |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
118 if (mode == DESCENDING) |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
119 { |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
120 octave_idx_type j = 0; |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
121 double r; |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
122 // Sort out NaNs. |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
123 do |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
124 r = el[j++]; |
21782
2aef506f3fec
use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
125 while (octave::math::isnan (r) && j < n); |
9922
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
126 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
127 // Orient the test so that NaN will not pass through. |
9922
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
128 for (; j < n; j++) |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
129 { |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
130 if (r >= el[j]) |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
131 r = el[j]; |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
132 else |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
133 { |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
134 mode = UNSORTED; |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
135 break; |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
136 } |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
137 } |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
138 |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
139 } |
26477
310143b2c2c4
Array-d.cc, Array-f.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26444
diff
changeset
|
140 else // mode == ASCENDING |
9922
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
141 { |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
142 // Sort out NaNs. |
21782
2aef506f3fec
use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
143 while (n > 0 && octave::math::isnan (el[n-1])) |
9922
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
144 n--; |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
145 |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
146 if (n > 0) |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
147 { |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
148 // Orient the test so that NaN will not pass through. |
9922
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
149 double r = el[0]; |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
150 for (octave_idx_type j = 1; j < n; j++) |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
151 { |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
152 if (r <= el[j]) |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
153 r = el[j]; |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
154 else |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
155 { |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
156 mode = UNSORTED; |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
157 break; |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
158 } |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
159 } |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
160 } |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
161 } |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
162 |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
163 return mode; |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
164 } |
3a8327d51ed4
optimize issorted for doubles & floats
Jaroslav Hajek <highegg@gmail.com>
parents:
9920
diff
changeset
|
165 |
29225
a65ff1d4f75b
Remove API tag when instantiating Array template class (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27933
diff
changeset
|
166 template class octave_sort<double>; |
7433 | 167 |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8700
diff
changeset
|
168 INSTANTIATE_ARRAY (double, OCTAVE_API); |
3836 | 169 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
170 template OCTAVE_API std::ostream& operator << (std::ostream&, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
171 const Array<double>&); |
3665 | 172 |
1989 | 173 #include "DiagArray2.h" |
174 #include "DiagArray2.cc" | |
175 | |
29225
a65ff1d4f75b
Remove API tag when instantiating Array template class (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27933
diff
changeset
|
176 template class DiagArray2<double>; |