Mercurial > hg > octave-nkf
annotate liboctave/array/Sparse-C.cc @ 20830:b65888ec820e draft default tip gccjit
dmalcom gcc jit import
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Fri, 27 Feb 2015 16:59:36 +0100 |
parents | 4197fc428c7d |
children |
rev | line source |
---|---|
5164 | 1 /* |
2 | |
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
3 Copyright (C) 2004-2015 David Bateman |
11523 | 4 Copyright (C) 1998-2004 Andy Adler |
7016 | 5 |
6 This file is part of Octave. | |
5164 | 7 |
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 | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
5164 | 12 |
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 | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
5164 | 21 |
22 */ | |
23 | |
24 #ifdef HAVE_CONFIG_H | |
25 #include <config.h> | |
26 #endif | |
27 | |
28 // Instantiate Sparse matrix of complex values. | |
29 | |
30 #include "oct-cmplx.h" | |
7433 | 31 #include "lo-mappers.h" |
32 #include "lo-ieee.h" | |
5164 | 33 #include "Sparse.h" |
34 #include "Sparse.cc" | |
35 | |
7433 | 36 |
37 static double | |
38 xabs (const Complex& x) | |
39 { | |
40 return (xisinf (x.real ()) || xisinf (x.imag ())) ? octave_Inf : abs (x); | |
41 } | |
42 | |
7549
ff9c2bb7abc7
workaround to enable compiling with Intel C++ 10.1
Jaroslav Hajek <highegg@gmail.com>
parents:
7470
diff
changeset
|
43 |
7433 | 44 template <> |
45 bool | |
8752
06b9903a029b
fix & clean up complex & sparse sorting
Jaroslav Hajek <highegg@gmail.com>
parents:
7549
diff
changeset
|
46 sparse_ascending_compare<Complex> (const Complex& a, const Complex& b) |
7433 | 47 { |
48 return (xisnan (b) || (xabs (a) < xabs (b)) | |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
49 || ((xabs (a) == xabs (b)) && (arg (a) < arg (b)))); |
7433 | 50 } |
51 | |
52 template <> | |
53 bool | |
8752
06b9903a029b
fix & clean up complex & sparse sorting
Jaroslav Hajek <highegg@gmail.com>
parents:
7549
diff
changeset
|
54 sparse_descending_compare<Complex> (const Complex& a, const Complex& b) |
7433 | 55 { |
56 return (xisnan (a) || (xabs (a) > xabs (b)) | |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
57 || ((xabs (a) == xabs (b)) && (arg (a) > arg (b)))); |
7433 | 58 } |
59 | |
10512
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10314
diff
changeset
|
60 INSTANTIATE_SPARSE (Complex, OCTAVE_API); |
5164 | 61 |
62 #if 0 | |
63 template std::ostream& operator << (std::ostream&, const Sparse<Complex>&); | |
64 #endif |