GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Array-fC.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1994-2017 John W. Eaton
4 Copyright (C) 2009 VZLU Prague
5 
6 This file is part of Octave.
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
10 Free Software Foundation; either version 3 of the License, or (at your
11 option) any later version.
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
19 along with Octave; see the file COPYING. If not, see
20 <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #if defined (HAVE_CONFIG_H)
25 # include "config.h"
26 #endif
27 
28 // Instantiate Arrays of FloatComplex values.
29 
30 #include "oct-cmplx.h"
31 #include "lo-mappers.h"
32 
33 #include "Array.h"
34 #include "Array.cc"
35 #include "oct-sort.cc"
36 
37 // Prevent implicit instantiations on some systems (Windows, others?)
38 // that can lead to duplicate definitions of static data members.
39 
40 extern template class OCTAVE_API Array<idx_vector>;
41 extern template class OCTAVE_API Array<octave_idx_type>;
42 
43 template <>
44 inline bool
46 {
47  return octave::math::isnan (x);
48 }
49 
50 // Sort Criteria: 1) isnan, 2) magnitude of z, 3) phase of z in range (-pi, pi]
51 
52 static bool
54 {
55  return octave::math::isnan (y) ? ! octave::math::isnan (x) : x < y;
56 }
57 
58 static bool
60 {
61  return octave::math::isnan (x) ? ! octave::math::isnan (y) : x > y;
62 }
63 
66 {
68 
69  if (allow_chk)
70  {
71  octave_idx_type k = 0;
72  for (; k < a.numel () && ! octave::math::isnan (a(k)); k++) ;
73  if (k == a.numel ())
74  {
75  if (mode == ASCENDING)
77  else if (mode == DESCENDING)
79  }
80  }
81 
82  if (! result)
83  {
84  if (mode == ASCENDING)
85  result = nan_ascending_compare;
86  else if (mode == DESCENDING)
87  result = nan_descending_compare;
88  }
89 
90  return result;
91 }
92 
93 template class OCTAVE_API octave_sort<FloatComplex>;
94 
96 
97 template OCTAVE_API std::ostream& operator << (std::ostream&,
98  const Array<FloatComplex>&);
99 
100 #include "DiagArray2.h"
101 #include "DiagArray2.cc"
102 
103 template class OCTAVE_API DiagArray2<FloatComplex>;
sortmode
Definition: oct-sort.h:105
octave_idx_type numel(void) const
Number of elements in the array.
Definition: Array.h:363
Array< FloatComplex >::compare_fcn_type safe_comparator(sortmode mode, const Array< FloatComplex > &a, bool allow_chk)
Definition: Array-fC.cc:65
Return the CPU time used by your Octave session The first output is the total time spent executing your process and is equal to the sum of second and third which are the number of CPU seconds spent executing in user mode and the number of CPU seconds spent executing in system mode
Definition: data.cc:6386
bool isnan(double x)
Definition: lo-mappers.cc:347
static bool nan_descending_compare(const FloatComplex &x, const FloatComplex &y)
Definition: Array-fC.cc:59
for large enough k
Definition: lu.cc:606
static bool nan_ascending_compare(const FloatComplex &x, const FloatComplex &y)
Definition: Array-fC.cc:53
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:398
bool sort_isnan< FloatComplex >(const FloatComplex &x)
Definition: Array-fC.cc:45
#define INSTANTIATE_ARRAY(T, API)
Definition: Array.cc:2767
With real return the complex result
Definition: data.cc:3375
N Dimensional Array with copy-on-write semantics.
Definition: Array.h:126
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< FloatComplex > &)
the element is set to zero In other the statement xample y
Definition: data.cc:5342
std::complex< float > FloatComplex
Definition: oct-cmplx.h:32
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE * x