annotate liboctave/array/Array-fC.cc @ 34642:954358d9ce6f

maint: Rename "lo-mappers.[h|cc]" to "mappers.[h|cc]" Add new files with old name that issue cpp warning during compilation if used that points to new files. Update .cc files to use new names and sort #includes. * mappers.cc, mappers.h: New files in Mercurial without "lo-" prefix. * liboctave/numeric/module.mk: Add new files names to build system. * lo-mappers.h: Old file is now shell with #warning for compilation and #include of relevant header file. * lo-mappers.cc: Deleted. * make_int.cc, bsxfun.cc, cellfun.cc, colloc.cc, dasrt.cc, fft.cc, fft2.cc, fftn.cc, gcd.cc, gl-render.cc, gl2ps-print.cc, load-save.cc, ls-hdf5.cc, ls-mat-ascii.cc, ls-mat4.cc, ls-mat5.cc, ls-oct-binary.cc, ls-oct-text.cc, lsode.cc, mappers.cc, max.cc, oct-hist.cc, oct-procbuf.cc, oct-stream.cc, pr-output.cc, quad.cc, rand.cc, sqrtm.cc, sysdep.cc, url-handle-manager.h, utils.cc, ov-base-scalar.h, ov-base.cc, ov-class.cc, ov-complex.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-float.cc, ov-float.h, ov-flt-complex.cc, ov-flt-cx-mat.cc, ov-flt-re-mat.cc, ov-legacy-range.h, ov-magic-int.cc, ov-range.h, ov-re-mat.cc, ov-re-sparse.cc, ov-scalar.cc, ov-scalar.h, lex.ll, Array-C.cc, Array-base.cc, Array-d.cc, Array-f.cc, Array-fC.cc, CMatrix.cc, CNDArray.cc, CSparse.cc, Range.cc, Sparse-C.cc, Sparse-d.cc, boolSparse.cc, chNDArray.cc, dMatrix.cc, dNDArray.cc, dSparse.cc, fCMatrix.cc, fCNDArray.cc, fMatrix.cc, fNDArray.cc, idx-vector.cc, CollocWt.cc, DET.h, lo-specfun.cc, oct-norm.cc, oct-rand.cc, randgamma.cc, randpoisson.cc, sparse-lu.cc, lo-utils.cc, oct-inttypes.h, oct-sort.cc, oct-string.cc: Alphabetize list of #includes.
author Rik <rik@octave.org>
date Fri, 13 Jun 2025 17:33:42 -0700
parents f173757807b0
children
rev   line source
jwe@27923 1 ////////////////////////////////////////////////////////////////////////
jwe@27923 2 //
rik@33983 3 // Copyright (C) 1994-2025 The Octave Project Developers
jwe@27923 4 //
jwe@27923 5 // See the file COPYRIGHT.md in the top-level directory of this
jwe@27923 6 // distribution or <https://octave.org/copyright/>.
jwe@27923 7 //
jwe@27923 8 // This file is part of Octave.
jwe@27923 9 //
jwe@27923 10 // Octave is free software: you can redistribute it and/or modify it
jwe@27923 11 // under the terms of the GNU General Public License as published by
jwe@27923 12 // the Free Software Foundation, either version 3 of the License, or
jwe@27923 13 // (at your option) any later version.
jwe@27923 14 //
jwe@27923 15 // Octave is distributed in the hope that it will be useful, but
jwe@27923 16 // WITHOUT ANY WARRANTY; without even the implied warranty of
jwe@27923 17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
jwe@27923 18 // GNU General Public License for more details.
jwe@27923 19 //
jwe@27923 20 // You should have received a copy of the GNU General Public License
jwe@27923 21 // along with Octave; see the file COPYING. If not, see
jwe@27923 22 // <https://www.gnu.org/licenses/>.
jwe@27923 23 //
jwe@27923 24 ////////////////////////////////////////////////////////////////////////
dbateman@7789 25
jwe@21724 26 #if defined (HAVE_CONFIG_H)
rik@21301 27 # include "config.h"
dbateman@7789 28 #endif
dbateman@7789 29
dbateman@7789 30 // Instantiate Arrays of FloatComplex values.
dbateman@7789 31
rik@34642 32 #include "mappers.h"
dbateman@7789 33 #include "oct-cmplx.h"
dbateman@7789 34
markus@34514 35 #define OCTAVE_EXTERN_TEMPLATE_ARRAY
markus@34514 36 #include "Array-oct.h"
dbateman@7789 37
jwe@21573 38 // Prevent implicit instantiations on some systems (Windows, others?)
jwe@21573 39 // that can lead to duplicate definitions of static data members.
jwe@21573 40
markus@31400 41 extern template class OCTAVE_EXTERN_TEMPLATE_API Array<octave::idx_vector>;
markus@29225 42 extern template class Array<octave_idx_type>;
jwe@21573 43
markus@31400 44 #include "Array-base.cc"
markus@31400 45 #include "oct-sort.cc"
markus@31400 46
highegg@8721 47 template <>
jwe@8725 48 inline bool
jwe@8725 49 sort_isnan<FloatComplex> (const FloatComplex& x)
dbateman@7789 50 {
jwe@21782 51 return octave::math::isnan (x);
dbateman@7789 52 }
dbateman@7789 53
daniel@19635 54 // Sort Criteria: 1) isnan, 2) magnitude of z, 3) phase of z in range (-pi, pi]
daniel@19635 55
jwe@8725 56 static bool
jwe@8725 57 nan_ascending_compare (const FloatComplex& x, const FloatComplex& y)
highegg@8721 58 {
jwe@21782 59 return octave::math::isnan (y) ? ! octave::math::isnan (x) : x < y;
highegg@8721 60 }
highegg@8721 61
jwe@8725 62 static bool
jwe@8725 63 nan_descending_compare (const FloatComplex& x, const FloatComplex& y)
highegg@8721 64 {
jwe@21782 65 return octave::math::isnan (x) ? ! octave::math::isnan (y) : x > y;
highegg@8721 66 }
highegg@8721 67
jwe@8725 68 Array<FloatComplex>::compare_fcn_type
rik@17769 69 safe_comparator (sortmode mode, const Array<FloatComplex>& a, bool allow_chk)
highegg@8721 70 {
rik@23795 71 Array<FloatComplex>::compare_fcn_type result = nullptr;
highegg@8721 72
highegg@8721 73 if (allow_chk)
highegg@8721 74 {
highegg@8721 75 octave_idx_type k = 0;
jwe@21782 76 for (; k < a.numel () && ! octave::math::isnan (a(k)); k++) ;
highegg@8721 77 if (k == a.numel ())
highegg@8721 78 {
highegg@8721 79 if (mode == ASCENDING)
highegg@8721 80 result = octave_sort<FloatComplex>::ascending_compare;
highegg@8721 81 else if (mode == DESCENDING)
highegg@8721 82 result = octave_sort<FloatComplex>::descending_compare;
highegg@8721 83 }
highegg@8721 84 }
highegg@8721 85
highegg@8721 86 if (! result)
highegg@8721 87 {
highegg@8721 88 if (mode == ASCENDING)
highegg@8721 89 result = nan_ascending_compare;
highegg@8721 90 else if (mode == DESCENDING)
highegg@8721 91 result = nan_descending_compare;
highegg@8721 92 }
highegg@8721 93
highegg@8721 94 return result;
dbateman@7789 95 }
dbateman@7789 96
markus@29225 97 template class octave_sort<FloatComplex>;
dbateman@7789 98
markus@31400 99 INSTANTIATE_ARRAY (FloatComplex, OCTAVE_CLASS_TEMPLATE_INSTANTIATION_API);
dbateman@7789 100
rik@17769 101 template OCTAVE_API std::ostream& operator << (std::ostream&,
rik@17769 102 const Array<FloatComplex>&);
dbateman@7789 103
dbateman@7789 104 #include "DiagArray2.h"
dbateman@7789 105 #include "DiagArray2.cc"
dbateman@7789 106
markus@29225 107 template class DiagArray2<FloatComplex>;