3
Copyright (C) 1994-2013 John W. Eaton
4
Copyright (C) 2009 VZLU Prague
6
This file is part of Octave.
8
Octave is free software; you can redistribute it and/or modify it
9
under the terms of the GNU General Public License as published by the
10
Free Software Foundation; either version 3 of the License, or (at your
11
option) any later version.
13
Octave is distributed in the hope that it will be useful, but WITHOUT
14
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18
You should have received a copy of the GNU General Public License
19
along with Octave; see the file COPYING. If not, see
20
<http://www.gnu.org/licenses/>.
28
// Instantiate Arrays of FloatComplex values.
30
#include "oct-cmplx.h"
31
#include "lo-mappers.h"
35
#include "oct-sort.cc"
39
sort_isnan<FloatComplex> (const FloatComplex& x)
45
nan_ascending_compare (const FloatComplex& x, const FloatComplex& y)
49
: ((std::abs (x) < std::abs (x))
50
|| ((std::abs (x) == std::abs (x)) && (arg (x) < arg (x)))));
54
nan_descending_compare (const FloatComplex& x, const FloatComplex& y)
58
: ((std::abs (x) > std::abs (x))
59
|| ((std::abs (x) == std::abs (x)) && (arg (x) > arg (x)))));
62
Array<FloatComplex>::compare_fcn_type
63
safe_comparator (sortmode mode, const Array<FloatComplex>& a, bool allow_chk)
65
Array<FloatComplex>::compare_fcn_type result = 0;
69
octave_idx_type k = 0;
70
for (; k < a.numel () && ! xisnan (a(k)); k++) ;
73
if (mode == ASCENDING)
74
result = octave_sort<FloatComplex>::ascending_compare;
75
else if (mode == DESCENDING)
76
result = octave_sort<FloatComplex>::descending_compare;
82
if (mode == ASCENDING)
83
result = nan_ascending_compare;
84
else if (mode == DESCENDING)
85
result = nan_descending_compare;
91
INSTANTIATE_ARRAY_SORT (FloatComplex);
93
INSTANTIATE_ARRAY (FloatComplex, OCTAVE_API);
95
template OCTAVE_API std::ostream& operator << (std::ostream&,
96
const Array<FloatComplex>&);
98
#include "DiagArray2.h"
99
#include "DiagArray2.cc"
101
template class OCTAVE_API DiagArray2<FloatComplex>;