annotate liboctave/array/Sparse-C.cc @ 33639:65b1cf6aa60a bytecode-interpreter tip

maint: Merge default to bytecode-interpreter
author Arun Giridhar <arungiridhar@gmail.com>
date Mon, 03 Jun 2024 14:38:47 -0400
parents 2e484f9f1f18
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 //
32632
2e484f9f1f18 maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 32426
diff changeset
3 // Copyright (C) 1998-2024 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 ////////////////////////////////////////////////////////////////////////
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
25
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21723
diff changeset
26 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21202
diff changeset
27 # include "config.h"
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
28 #endif
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
29
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
30 // Instantiate Sparse matrix of complex values.
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
31
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
32 #include "oct-cmplx.h"
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7017
diff changeset
33 #include "lo-mappers.h"
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7017
diff changeset
34 #include "lo-ieee.h"
29897
7c7599ad9c5a Sparse.h: Use forward declaration for Array class
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
35 #include "Array.h"
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
36 #include "Sparse.h"
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
37 #include "Sparse.cc"
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
38
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7017
diff changeset
39
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7017
diff changeset
40 static double
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7017
diff changeset
41 xabs (const Complex& x)
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7017
diff changeset
42 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
43 return ((octave::math::isinf (x.real ()) || octave::math::isinf (x.imag ()))
21723
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
44 ? octave::numeric_limits<double>::Inf () : abs (x));
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7017
diff changeset
45 }
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7017
diff changeset
46
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7017
diff changeset
47 template <>
29227
a009cb8ef68f Set API tags in files in liboctave/array (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
48 OCTAVE_API
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7017
diff changeset
49 bool
8752
06b9903a029b fix & clean up complex & sparse sorting
Jaroslav Hajek <highegg@gmail.com>
parents: 7549
diff changeset
50 sparse_ascending_compare<Complex> (const Complex& a, const Complex& b)
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7017
diff changeset
51 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
52 return (octave::math::isnan (b) || (xabs (a) < xabs (b))
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
53 || ((xabs (a) == xabs (b)) && (arg (a) < arg (b))));
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7017
diff changeset
54 }
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7017
diff changeset
55
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7017
diff changeset
56 template <>
29227
a009cb8ef68f Set API tags in files in liboctave/array (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
57 OCTAVE_API
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7017
diff changeset
58 bool
8752
06b9903a029b fix & clean up complex & sparse sorting
Jaroslav Hajek <highegg@gmail.com>
parents: 7549
diff changeset
59 sparse_descending_compare<Complex> (const Complex& a, const Complex& b)
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7017
diff changeset
60 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
61 return (octave::math::isnan (a) || (xabs (a) > xabs (b))
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
62 || ((xabs (a) == xabs (b)) && (arg (a) > arg (b))));
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7017
diff changeset
63 }
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7017
diff changeset
64
29247
d83ae0145030 Export template class instantiations with clang (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29227
diff changeset
65 INSTANTIATE_SPARSE (Complex);