GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
Sparse-C.cc
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1998-2025 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// Instantiate Sparse matrix of complex values.
31
32#include "oct-cmplx.h"
33#include "lo-mappers.h"
34#include "lo-ieee.h"
35#include "Array.h"
36#include "Sparse.h"
37#include "Sparse.cc"
38
39
40static double
41xabs (const Complex& x)
42{
43 return ((octave::math::isinf (x.real ()) || octave::math::isinf (x.imag ()))
44 ? octave::numeric_limits<double>::Inf () : abs (x));
45}
46
47template <>
49bool
51{
52 return (octave::math::isnan (b) || (xabs (a) < xabs (b))
53 || ((xabs (a) == xabs (b)) && (arg (a) < arg (b))));
54}
55
56template <>
58bool
60{
61 return (octave::math::isnan (a) || (xabs (a) > xabs (b))
62 || ((xabs (a) == xabs (b)) && (arg (a) > arg (b))));
63}
64
bool sparse_descending_compare< Complex >(const Complex &a, const Complex &b)
Definition Sparse-C.cc:59
bool sparse_ascending_compare< Complex >(const Complex &a, const Complex &b)
Definition Sparse-C.cc:50
#define INSTANTIATE_SPARSE(T)
Definition Sparse.cc:3113
F77_RET_T const F77_DBLE * x
#define OCTAVE_API
Definition main.in.cc:55
std::complex< double > Complex
Definition oct-cmplx.h:33
template int8_t abs(int8_t)