annotate liboctave/numeric/lo-mappers.h @ 23708:750e42a35adc

Use imag, real, arg from std library for Complex types. * lo-mappers.h (imag, real, arg): Delete overloaded functions from octave::math namespace. Add comment about why overload for conj must remain (different behavior desired than prototype under C++). * ls-mat4.cc, ls-mat5.cc, mgorth.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-float.cc, ov-flt-cx-mat.cc, ov-flt-re-mat.cc, ov-re-mat.cc, ov-re-sparse.cc, ov-scalar.cc, CMatrix.cc, CSparse.cc, MatrixType.cc, dMatrix.cc, dSparse.cc, fCMatrix.cc, fMatrix.cc, chol.cc, eigs-base.cc: Replace calls to octave::math::XXX with std::XXX for imag, real, and arg.
author Rik <rik@octave.org>
date Tue, 27 Jun 2017 09:24:08 -0700
parents 08036a7f3660
children 1147e5c912aa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
1 /*
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
2
23219
3ac9f9ecfae5 maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents: 23083
diff changeset
3 Copyright (C) 1996-2017 John W. Eaton
10521
4d1fc073fbb7 add some missing copyright stmts
Jaroslav Hajek <highegg@gmail.com>
parents: 10436
diff changeset
4 Copyright (C) 2010 VZLU Prague
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
5
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
7
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
9 under the terms of the GNU General Public License as published by
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
10 the Free Software Foundation; either version 3 of the License, or
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
11 (at your option) any later version.
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
12
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
13 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
14 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
16 GNU General Public License for more details.
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
17
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6108
diff changeset
19 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6108
diff changeset
20 <http://www.gnu.org/licenses/>.
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
21
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
22 */
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
23
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 20374
diff changeset
24 #if ! defined (octave_lo_mappers_h)
17822
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17769
diff changeset
25 #define octave_lo_mappers_h 1
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
26
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21232
diff changeset
27 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21232
diff changeset
28
23662
bd77ab816e43 eliminate obsolete file lo-math.h
John W. Eaton <jwe@octave.org>
parents: 23619
diff changeset
29 #include <cmath>
bd77ab816e43 eliminate obsolete file lo-math.h
John W. Eaton <jwe@octave.org>
parents: 23619
diff changeset
30
11211
2554b4a0806e use templates for some lo-mappers functions
John W. Eaton <jwe@octave.org>
parents: 11209
diff changeset
31 #include <limits>
2554b4a0806e use templates for some lo-mappers functions
John W. Eaton <jwe@octave.org>
parents: 11209
diff changeset
32
23443
3f1bf237908b maint: Eliminate <cfloat.h> header from liboctave files.
Rik <rik@octave.org>
parents: 23220
diff changeset
33 #include "lo-ieee.h"
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
34 #include "oct-cmplx.h"
22117
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
35 #include "oct-inttypes-fwd.h"
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
36
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
37 namespace octave
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
38 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
39 namespace math
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
40 {
23619
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
41 extern OCTAVE_API bool isna (double x);
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23682
diff changeset
42 OCTAVE_DEPRECATED (4.4, "use 'math::isna' instead")
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23682
diff changeset
43 inline bool is_NA (double x) { return math::isna (x); }
23619
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
44
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
45 extern OCTAVE_API bool isna (float x);
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23682
diff changeset
46 OCTAVE_DEPRECATED (4.4, "use 'math::isna' instead")
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23682
diff changeset
47 inline bool is_NA (float x) { return math::isna (x); }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
48
23619
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
49 extern OCTAVE_API bool isna (const Complex& x);
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23682
diff changeset
50 OCTAVE_DEPRECATED (4.4, "use 'math::isna' instead")
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23682
diff changeset
51 inline bool is_NA (const Complex& x) { return math::isna (x); }
23619
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
52
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
53 extern OCTAVE_API bool isna (const FloatComplex& x);
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23682
diff changeset
54 OCTAVE_DEPRECATED (4.4, "use 'math::isna' instead")
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23682
diff changeset
55 inline bool is_NA (const FloatComplex& x) { return math::isna (x); }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
56
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
57 extern OCTAVE_API bool is_NaN_or_NA (const Complex& x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
58 extern OCTAVE_API bool is_NaN_or_NA (const FloatComplex& x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
59
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
60 inline double copysign (double x, double y) { return std::copysign (x, y); }
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
61 inline float copysign (float x, float y) { return std::copysignf (x, y); }
22274
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
62
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
63 inline double signbit (double x) { return std::signbit (x); }
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
64 inline float signbit (float x) { return std::signbit (x); }
22274
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
65
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
66 // Test for negative sign.
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
67 extern OCTAVE_API bool negative_sign (double x);
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
68 extern OCTAVE_API bool negative_sign (float x);
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
69
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
70 // Test for positive sign.
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
71 inline bool positive_sign (double x) { return ! negative_sign (x); }
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
72 inline bool positive_sign (float x) { return ! negative_sign (x); }
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
73
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
74 extern OCTAVE_API Complex acos (const Complex& x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
75 extern OCTAVE_API FloatComplex acos (const FloatComplex& x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
76
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
77 extern OCTAVE_API Complex asin (const Complex& x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
78 extern OCTAVE_API FloatComplex asin (const FloatComplex& x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
79
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
80 inline Complex atan (const Complex& x) { return std::atan (x); }
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
81 inline FloatComplex atan (const FloatComplex& x) { return std::atan (x); }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
82
23708
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
83 // The C++ standard would normally return a std::complex value for conj
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
84 // even when the input is fully real. Octave overrides this.
22274
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
85 inline double conj (double x) { return x; }
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
86 inline float conj (float x) { return x; }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
87
22274
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
88 template <typename T>
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
89 std::complex<T>
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
90 conj (const std::complex<T>& x)
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
91 {
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
92 return std::conj (x);
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
93 }
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
94
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
95 inline double log2 (double x) { return std::log2 (x); }
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
96 inline float log2 (float x) { return std::log2f (x); }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
97
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
98 extern OCTAVE_API Complex log2 (const Complex& x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
99 extern OCTAVE_API FloatComplex log2 (const FloatComplex& x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
100
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
101 extern OCTAVE_API double log2 (double x, int& exp);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
102 extern OCTAVE_API float log2 (float x, int& exp);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
103
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
104 extern OCTAVE_API Complex log2 (const Complex& x, int& exp);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
105 extern OCTAVE_API FloatComplex log2 (const FloatComplex& x, int& exp);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
106
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
107 inline double exp2 (double x) { return std::exp2 (x); }
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
108 inline float exp2 (float x) { return std::exp2f (x); }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
109
23708
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
110 // FIXME: Is ceil actually acceptably defined for complex values?
23682
6fe13cd3543c Clean up lo-mappers.h, lo-mappers.cc.
Rik <rik@octave.org>
parents: 23665
diff changeset
111 inline double ceil (double x) { return std::ceil (x); }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
112 inline float ceil (float x) { return ::ceilf (x); }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
113
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
114 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
115 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
116 ceil (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
117 {
22274
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
118 return std::complex<T> (ceil (std::real (x)), ceil (std::imag (x)));
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
119 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
120
23708
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
121 // FIXME: Is trunc actually acceptably defined for complex values?
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
122 inline double trunc (double x) { return std::trunc (x); }
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
123 inline float trunc (float x) { return std::truncf (x); }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
124
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
125 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
126 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
127 trunc (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
128 {
22274
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
129 return std::complex<T> (trunc (std::real (x)), trunc (std::imag (x)));
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
130 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
131
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
132 // FIXME: Do we need this alias for trunc?
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
133 inline double fix (double x) { return trunc (x); }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
134 inline float fix (float x) { return trunc (x); }
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
135
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
136 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
137 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
138 fix (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
139 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
140 return trunc (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
141 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
142
23708
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
143 // FIXME: Do we need this alias for floor?
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
144 inline double floor (double x) { return std::floor (x); }
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
145 inline float floor (float x) { return std::floor (x); }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
146
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
147 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
148 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
149 floor (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
150 {
22274
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
151 return std::complex<T> (floor (std::real (x)), floor (std::imag (x)));
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
152 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
153
23708
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
154 // FIXME: Do we need this alias for round?
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
155 inline double round (double x) { return std::round (x); }
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
156 inline float round (float x) { return std::roundf (x); }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
157
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
158 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
159 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
160 round (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
161 {
22274
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
162 return std::complex<T> (round (std::real (x)), round (std::imag (x)));
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
163 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
164
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
165 inline double
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
166 roundb (double x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
167 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
168 double t = round (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
169
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
170 if (fabs (x - t) == 0.5)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
171 t = 2 * trunc (0.5 * t);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
172
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
173 return t;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
174 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
175
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
176 inline float
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
177 roundb (float x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
178 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
179 float t = round (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
180
22274
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
181 if (fabsf (x - t) == 0.5f)
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
182 t = 2 * trunc (0.5f * t);
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
183
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
184 return t;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
185 }
7922
935be827eaf8 error for NaN values in & and | expressions
John W. Eaton <jwe@octave.org>
parents: 7789
diff changeset
186
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
187 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
188 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
189 roundb (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
190 {
22274
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
191 return std::complex<T> (roundb (std::real (x)), roundb (std::imag (x)));
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
192 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
193
22079
e0dbd81fd9b1 provide wrapper for frexp and frexpf (bug #48363)
Mike Miller <mtmiller@octave.org>
parents: 21937
diff changeset
194 extern OCTAVE_API double frexp (double x, int *expptr);
e0dbd81fd9b1 provide wrapper for frexp and frexpf (bug #48363)
Mike Miller <mtmiller@octave.org>
parents: 21937
diff changeset
195 extern OCTAVE_API float frexp (float x, int *expptr);
e0dbd81fd9b1 provide wrapper for frexp and frexpf (bug #48363)
Mike Miller <mtmiller@octave.org>
parents: 21937
diff changeset
196
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
197 inline bool isnan (bool) { return false; }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
198 inline bool isnan (char) { return false; }
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
199
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
200 inline bool isnan (double x) { return std::isnan (x); }
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
201 inline bool isnan (float x) { return std::isnan (x); }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
202
23708
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
203 // FIXME: Do we need the isnan overload for complex?
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
204 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
205 bool
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
206 isnan (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
207 {
22274
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
208 return (isnan (std::real (x)) || isnan (std::imag (x)));
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
209 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
210
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
211 inline bool isfinite (double x) { return std::isfinite (x); }
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
212 inline bool isfinite (float x) { return std::isfinite (x); }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
213
23708
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
214 // FIXME: Do we need isfinite overload for complex?
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
215 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
216 bool
23564
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
217 isfinite (const std::complex<T>& x)
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
218 {
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
219 return (isfinite (std::real (x)) && isfinite (std::imag (x)));
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
220 }
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
221
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23682
diff changeset
222 OCTAVE_DEPRECATED (4.4, "use 'math::isfinite' instead")
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23682
diff changeset
223 inline bool finite (double x) { return math::isfinite (x); }
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23682
diff changeset
224 OCTAVE_DEPRECATED (4.4, "use 'math::isfinite' instead")
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23682
diff changeset
225 inline bool finite (float x) { return math::isfinite (x); }
23564
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
226
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
227 template <typename T>
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23682
diff changeset
228 OCTAVE_DEPRECATED (4.4, "use 'math::isfinite' instead")
23564
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
229 bool
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
230 finite (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
231 {
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23682
diff changeset
232 return math::isfinite (x);
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
233 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
234
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
235 inline bool isinf (double x) { return std::isinf (x); }
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
236 inline bool isinf (float x) { return std::isinf (x); }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
237
23708
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
238 // FIXME: Do we need isinf overload for complex?
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
239 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
240 bool
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
241 isinf (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
242 {
22274
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
243 return (isinf (std::real (x)) || isinf (std::imag (x)));
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
244 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
245
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
246 // Some useful tests, that are commonly repeated.
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
247 // Test for a finite integer.
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
248
23708
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
249 // FIXME: Benchmark whether trunc might be faster than round here.
23564
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
250 inline bool isinteger (double x) { return isfinite (x) && x == round (x); }
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
251 inline bool isinteger (float x) { return isfinite (x) && x == round (x); }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
252
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
253 inline double
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
254 signum (double x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
255 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
256 double tmp = 0.0;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
257
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
258 if (x < 0.0)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
259 tmp = -1.0;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
260 else if (x > 0.0)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
261 tmp = 1.0;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
262
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23682
diff changeset
263 return isnan (x) ? numeric_limits<double>::NaN () : tmp;
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
264 }
3248
68259f410026 [project @ 1999-07-13 03:34:54 by jwe]
jwe
parents: 3156
diff changeset
265
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
266 inline float
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
267 signum (float x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
268 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
269 float tmp = 0.0f;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
270
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
271 if (x < 0.0f)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
272 tmp = -1.0f;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
273 else if (x > 0.0f)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
274 tmp = 1.0f;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
275
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23682
diff changeset
276 return isnan (x) ? numeric_limits<float>::NaN () : tmp;
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
277 }
21937
55f7de37b618 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 21812
diff changeset
278
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
279 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
280 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
281 signum (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
282 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
283 T tmp = abs (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
284
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
285 return tmp == 0 ? 0.0 : x / tmp;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
286 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
287
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
288 // Convert X to the nearest integer value. Should not pass NaN to
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
289 // this function.
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
290
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
291 // For integer types? Hmm. Need to be sure T is an integer type...
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
292 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
293 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
294 x_nint (T x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
295 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
296 return x;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
297 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
298
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
299 template <>
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
300 inline double x_nint (double x)
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
301 {
23564
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
302 return (isfinite (x) ? floor (x + 0.5) : x);
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
303 }
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
304
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
305 template <>
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
306 inline float x_nint (float x)
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
307 {
23564
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
308 return (isfinite (x) ? floor (x + 0.5f) : x);
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
309 }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
310
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
311 extern OCTAVE_API octave_idx_type nint_big (double x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
312 extern OCTAVE_API octave_idx_type nint_big (float x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
313
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
314 extern OCTAVE_API int nint (double x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
315 extern OCTAVE_API int nint (float x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
316
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
317 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
318 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
319 mod (T x, T y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
320 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
321 T retval;
4025
cfb762dc9259 [project @ 2002-08-09 06:32:15 by jwe]
jwe
parents: 3777
diff changeset
322
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
323 if (y == 0)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
324 retval = x;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
325 else
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
326 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
327 T q = x / y;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
328
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
329 if (x_nint (y) != y
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
330 && (std::abs ((q - x_nint (q)) / x_nint (q))
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
331 < std::numeric_limits<T>::epsilon ()))
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
332 retval = 0;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
333 else
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
334 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
335 T n = floor (q);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
336
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
337 // Prevent use of extra precision.
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
338 volatile T tmp = y * n;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
339
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
340 retval = x - tmp;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
341 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
342 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
343
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
344 if (x != y && y != 0)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
345 retval = copysign (retval, y);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
346
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
347 return retval;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
348 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
349
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
350 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
351 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
352 rem (T x, T y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
353 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
354 T retval;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
355
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
356 if (y == 0)
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23682
diff changeset
357 retval = numeric_limits<T>::NaN ();
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
358 else
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
359 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
360 T q = x / y;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
361
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
362 if (x_nint (y) != y
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
363 && (std::abs ((q - x_nint (q)) / x_nint (q))
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
364 < std::numeric_limits<T>::epsilon ()))
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
365 retval = 0;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
366 else
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
367 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
368 T n = trunc (q);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
369
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
370 // Prevent use of extra precision.
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
371 volatile T tmp = y * n;
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
372
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
373 retval = x - tmp;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
374 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
375 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
376
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
377 if (x != y && y != 0)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
378 retval = copysign (retval, x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
379
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
380 return retval;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
381 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
382
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
383 // Generic min, max definitions
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
384 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
385 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
386 min (T x, T y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
387 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
388 return x <= y ? x : y;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
389 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
390
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
391 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
392 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
393 max (T x, T y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
394 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
395 return x >= y ? x : y;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
396 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
397
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
398 // This form is favorable. GCC will translate (x <= y ? x : y) without a
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
399 // jump, hence the only conditional jump involved will be the first
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
400 // (isnan), infrequent and hence friendly to branch prediction.
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
401
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
402 inline double
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
403 min (double x, double y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
404 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
405 return isnan (y) ? x : (x <= y ? x : y);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
406 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
407
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
408 inline double
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
409 max (double x, double y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
410 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
411 return isnan (y) ? x : (x >= y ? x : y);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
412 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
413
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
414 inline float
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
415 min (float x, float y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
416 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
417 return isnan (y) ? x : (x <= y ? x : y);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
418 }
10268
9a16a61ed43d new optimizations for accumarray
Jaroslav Hajek <highegg@gmail.com>
parents: 10158
diff changeset
419
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
420 inline float
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
421 max (float x, float y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
422 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
423 return isnan (y) ? x : (x >= y ? x : y);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
424 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
425
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
426 inline std::complex<double>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
427 min (const std::complex<double>& x, const std::complex<double>& y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
428 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
429 return abs (x) <= abs (y) ? x : (isnan (x) ? x : y);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
430 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
431
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
432 inline std::complex<float>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
433 min (const std::complex<float>& x, const std::complex<float>& y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
434 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
435 return abs (x) <= abs (y) ? x : (isnan (x) ? x : y);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
436 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
437
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
438 inline std::complex<double>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
439 max (const std::complex<double>& x, const std::complex<double>& y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
440 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
441 return abs (x) >= abs (y) ? x : (isnan (x) ? x : y);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
442 }
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
443
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
444 inline std::complex<float>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
445 max (const std::complex<float>& x, const std::complex<float>& y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
446 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
447 return abs (x) >= abs (y) ? x : (isnan (x) ? x : y);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
448 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
449
22117
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
450 template <typename T>
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
451 inline octave_int<T>
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
452 min (const octave_int<T>& x, const octave_int<T>& y)
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
453 {
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
454 return xmin (x, y);
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
455 }
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
456
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
457 template <typename T>
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
458 inline octave_int<T>
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
459 max (const octave_int<T>& x, const octave_int<T>& y)
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
460 {
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
461 return xmax (x, y);
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
462 }
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
463
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
464 // These map reals to Complex.
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
465
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
466 extern OCTAVE_API Complex rc_acos (double);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
467 extern OCTAVE_API FloatComplex rc_acos (float);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
468
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
469 extern OCTAVE_API Complex rc_acosh (double);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
470 extern OCTAVE_API FloatComplex rc_acosh (float);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
471
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
472 extern OCTAVE_API Complex rc_asin (double);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
473 extern OCTAVE_API FloatComplex rc_asin (float);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
474
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
475 extern OCTAVE_API Complex rc_atanh (double);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
476 extern OCTAVE_API FloatComplex rc_atanh (float);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
477
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
478 extern OCTAVE_API Complex rc_log (double);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
479 extern OCTAVE_API FloatComplex rc_log (float);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
480
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
481 extern OCTAVE_API Complex rc_log2 (double);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
482 extern OCTAVE_API FloatComplex rc_log2 (float);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
483
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
484 extern OCTAVE_API Complex rc_log10 (double);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
485 extern OCTAVE_API FloatComplex rc_log10 (float);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
486
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
487 extern OCTAVE_API Complex rc_sqrt (double);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
488 extern OCTAVE_API FloatComplex rc_sqrt (float);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
489 }
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
490 }
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
491
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
492 #if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
493
23619
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
494 OCTAVE_DEPRECATED (4.2, "use 'octave::math::isna' instead")
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
495 inline bool octave_is_NA (double x) { return octave::math::isna (x); }
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
496 OCTAVE_DEPRECATED (4.2, "use 'octave::math::isna' instead")
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
497 inline bool octave_is_NA (float x) { return octave::math::isna (x); }
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
498 OCTAVE_DEPRECATED (4.2, "use 'octave::math::isna' instead")
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
499 inline bool octave_is_NA (const Complex& x) { return octave::math::isna (x); }
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
500 OCTAVE_DEPRECATED (4.2, "use 'octave::math::isna' instead")
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
501 inline bool octave_is_NA (const FloatComplex& x)
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
502 {
23619
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
503 return octave::math::isna (x);
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
504 }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
505
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
506 OCTAVE_DEPRECATED (4.2, "use 'octave::math::acos' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
507 inline Complex acos (const Complex& x) { return octave::math::acos (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
508 OCTAVE_DEPRECATED (4.2, "use 'octave::math::acos' instead")
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
509 inline FloatComplex acos (const FloatComplex& x)
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
510 {
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
511 return octave::math::acos (x);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
512 }
3777
b4f260ddd748 [project @ 2001-02-06 15:57:23 by jwe]
jwe
parents: 3776
diff changeset
513
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
514 OCTAVE_DEPRECATED (4.2, "use 'octave::math::asin' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
515 inline Complex asin (const Complex& x) { return octave::math::asin (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
516 OCTAVE_DEPRECATED (4.2, "use 'octave::math::asin' instead")
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
517 inline FloatComplex asin (const FloatComplex& x)
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
518 {
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
519 return octave::math::asin (x);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
520 }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
521
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
522 OCTAVE_DEPRECATED (4.2, "use 'octave::math::atan' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
523 inline Complex atan (const Complex& x) { return octave::math::atan (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
524 OCTAVE_DEPRECATED (4.2, "use 'octave::math::atan' instead")
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
525 inline FloatComplex atan (const FloatComplex& x)
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
526 {
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
527 return octave::math::atan (x);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
528 }
4469
53ee020af847 [project @ 2003-07-26 03:45:10 by jwe]
jwe
parents: 4065
diff changeset
529
23708
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
530 OCTAVE_DEPRECATED (4.2, "use 'std::arg' instead")
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
531 inline double arg (double x) { return std::arg (x); }
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
532 OCTAVE_DEPRECATED (4.2, "use 'std::arg' instead")
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
533 inline float arg (float x) { return std::arg (x); }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
534
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
535 OCTAVE_DEPRECATED (4.2, "use 'octave::math::conj' instead")
21812
9c3a3d252e80 * lo-mappers.h (arg, conj, imag, real): Delete double and float
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
536 inline double conj (double x) { return x; }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
537 OCTAVE_DEPRECATED (4.2, "use 'octave::math::conj' instead")
21812
9c3a3d252e80 * lo-mappers.h (arg, conj, imag, real): Delete double and float
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
538 inline float conj (float x) { return x; }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
539
23708
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
540 OCTAVE_DEPRECATED (4.2, "use 'std::imag' instead")
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
541 inline double imag (double x) { return std::imag (x); }
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
542 OCTAVE_DEPRECATED (4.2, "use 'std::imag' instead")
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
543 inline float imag (float x) { return std::imag (x); }
3248
68259f410026 [project @ 1999-07-13 03:34:54 by jwe]
jwe
parents: 3156
diff changeset
544
23708
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
545 OCTAVE_DEPRECATED (4.2, "use 'std::real' instead")
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
546 inline double real (double x) { return std::real (x); }
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
547 OCTAVE_DEPRECATED (4.2, "use 'std::real' instead")
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
548 inline float real (float x) { return std::real (x); }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
549
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
550 OCTAVE_DEPRECATED (4.2, "use 'octave::math::log2' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
551 inline double xlog2 (double x) { return octave::math::log2 (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
552 OCTAVE_DEPRECATED (4.2, "use 'octave::math::log2' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
553 inline float xlog2 (float x) { return octave::math::log2 (x); }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
554
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
555 OCTAVE_DEPRECATED (4.2, "use 'octave::math::log2' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
556 inline Complex xlog2 (const Complex& x) { return octave::math::log2 (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
557 OCTAVE_DEPRECATED (4.2, "use 'octave::math::log2' instead")
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
558 inline FloatComplex xlog2 (const FloatComplex& x)
23477
3530b956d707 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
559 {
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
560 return octave::math::log2 (x);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
561 }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
562
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
563 OCTAVE_DEPRECATED (4.2, "use 'octave::math::log2' instead")
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
564 inline double xlog2 (double x, int& exp)
23477
3530b956d707 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
565 {
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
566 return octave::math::log2 (x, exp);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
567 }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
568 OCTAVE_DEPRECATED (4.2, "use 'octave::math::log2' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
569 inline float xlog2 (float x, int& exp) { return octave::math::log2 (x, exp); }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
570
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
571 OCTAVE_DEPRECATED (4.2, "use 'octave::math::log2' instead")
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
572 inline Complex xlog2 (const Complex& x, int& exp)
23477
3530b956d707 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
573 {
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
574 return octave::math::log2 (x, exp);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
575 }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
576 OCTAVE_DEPRECATED (4.2, "use 'octave::math::log2' instead")
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
577 inline FloatComplex xlog2 (const FloatComplex& x, int& exp)
23477
3530b956d707 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
578 {
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
579 return octave::math::log2 (x, exp);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
580 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
581
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
582 OCTAVE_DEPRECATED (4.2, "use 'octave::math::exp2' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
583 inline double xexp2 (double x) { return octave::math::exp2 (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
584 OCTAVE_DEPRECATED (4.2, "use 'octave::math::exp2' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
585 inline float xexp2 (float x) { return octave::math::exp2 (x); }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
586
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
587 OCTAVE_DEPRECATED (4.2, "use 'octave::math::ceil' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
588 inline double xceil (double x) { return octave::math::ceil (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
589 OCTAVE_DEPRECATED (4.2, "use 'octave::math::ceil' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
590 inline float xceil (float x) { return octave::math::ceil (x); }
8998
a48fba01e4ac optimize isnan/isinf/isfinite mappers
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
591
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
592 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
593 OCTAVE_DEPRECATED (4.2, "use 'octave::math::ceil' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
594 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
595 ceil (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
596 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
597 return octave::math::ceil (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
598 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
599
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
600 OCTAVE_DEPRECATED (4.2, "use 'octave::math::copysign' instead")
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
601 inline double xcopysign (double x, double y)
23477
3530b956d707 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
602 {
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
603 return octave::math::copysign (x, y);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
604 }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
605 OCTAVE_DEPRECATED (4.2, "use 'octave::math::copysign' instead")
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
606 inline float xcopysign (float x, float y)
23477
3530b956d707 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
607 {
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
608 return octave::math::copysign (x, y);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
609 }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
610
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
611 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
612 OCTAVE_DEPRECATED (4.2, "use 'octave::math::signbit' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
613 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
614 xsignbit (T x)
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
615 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
616 return octave::math::signbit (x);
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
617 }
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
618
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
619 OCTAVE_DEPRECATED (4.2, "use 'octave::math::negative_sign' instead")
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
620 inline bool xnegative_sign (double x)
23477
3530b956d707 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
621 {
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
622 return octave::math::negative_sign (x);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
623 }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
624 OCTAVE_DEPRECATED (4.2, "use 'octave::math::negative_sign' instead")
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
625 inline bool xnegative_sign (float x)
23477
3530b956d707 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
626 {
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
627 return octave::math::negative_sign (x);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
628 }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
629
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
630 OCTAVE_DEPRECATED (4.2, "use 'octave::math::positive_sign' instead")
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
631 inline bool xpositive_sign (double x)
23477
3530b956d707 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
632 {
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
633 return octave::math::positive_sign (x);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
634 }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
635 OCTAVE_DEPRECATED (4.2, "use 'octave::math::positive_sign' instead")
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
636 inline bool xpositive_sign (float x)
23477
3530b956d707 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
637 {
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
638 return octave::math::positive_sign (x);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
639 }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
640
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
641 OCTAVE_DEPRECATED (4.2, "use 'octave::math::signum' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
642 inline double signum (double x) { return octave::math::signum (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
643 OCTAVE_DEPRECATED (4.2, "use 'octave::math::signum' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
644 inline float signum (float x) { return octave::math::signum (x); }
21937
55f7de37b618 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 21812
diff changeset
645
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
646 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
647 OCTAVE_DEPRECATED (4.2, "use 'octave::math::signum' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
648 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
649 signum (const std::complex<T>& x)
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
650 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
651 return octave::math::signum (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
652 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
653
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
654 OCTAVE_DEPRECATED (4.2, "use 'octave::math::trunc' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
655 inline double xtrunc (double x) { return octave::math::trunc (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
656 OCTAVE_DEPRECATED (4.2, "use 'octave::math::trunc' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
657 inline float xtrunc (float x) { return octave::math::trunc (x); }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
658
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
659 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
660 OCTAVE_DEPRECATED (4.2, "use 'octave::math::trunc' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
661 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
662 xtrunc (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
663 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
664 return octave::math::trunc (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
665 }
21937
55f7de37b618 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 21812
diff changeset
666
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
667 OCTAVE_DEPRECATED (4.2, "use 'octave::math::fix' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
668 inline double fix (double x) { return octave::math::fix (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
669 OCTAVE_DEPRECATED (4.2, "use 'octave::math::fix' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
670 inline float fix (float x) { return octave::math::fix (x); }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
671
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
672 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
673 OCTAVE_DEPRECATED (4.2, "use 'octave::math::fix' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
674 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
675 fix (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
676 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
677 return octave::math::fix (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
678 }
21937
55f7de37b618 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 21812
diff changeset
679
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
680 OCTAVE_DEPRECATED (4.2, "use 'octave::math::floor' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
681 inline double xfloor (double x) { return octave::math::floor (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
682 OCTAVE_DEPRECATED (4.2, "use 'octave::math::floor' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
683 inline float xfloor (float x) { return octave::math::floor (x); }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
684
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
685 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
686 OCTAVE_DEPRECATED (4.2, "use 'octave::math::floor' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
687 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
688 floor (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
689 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
690 return octave::math::floor (x);
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
691 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
692
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
693 OCTAVE_DEPRECATED (4.2, "use 'octave::math::round' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
694 inline double xround (double x) { return octave::math::round (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
695 OCTAVE_DEPRECATED (4.2, "use 'octave::math::round' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
696 inline float xround (float x) { return octave::math::round (x); }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
697
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
698 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
699 OCTAVE_DEPRECATED (4.2, "use 'octave::math::round' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
700 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
701 xround (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
702 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
703 return octave::math::round (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
704 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
705
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
706 OCTAVE_DEPRECATED (4.2, "use 'octave::math::roundb' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
707 inline double xroundb (double x) { return octave::math::roundb (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
708 OCTAVE_DEPRECATED (4.2, "use 'octave::math::roundb' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
709 inline float xroundb (float x) { return octave::math::roundb (x); }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
710
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
711 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
712 OCTAVE_DEPRECATED (4.2, "use 'octave::math::roundb' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
713 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
714 xroundb (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
715 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
716 return octave::math::roundb (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
717 }
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
718
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
719 OCTAVE_DEPRECATED (4.2, "use 'octave::math::isnan' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
720 inline bool xisnan (bool x) { return octave::math::isnan (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
721 OCTAVE_DEPRECATED (4.2, "use 'octave::math::isnan' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
722 inline bool xisnan (char x) { return octave::math::isnan (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
723 OCTAVE_DEPRECATED (4.2, "use 'octave::math::isnan' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
724 inline bool xisnan (double x) { return octave::math::isnan (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
725 OCTAVE_DEPRECATED (4.2, "use 'octave::math::isnan' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
726 inline bool xisnan (float x) { return octave::math::isnan (x); }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
727
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
728 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
729 OCTAVE_DEPRECATED (4.2, "use 'octave::math::isnan' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
730 bool
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
731 xisnan (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
732 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
733 return octave::math::isnan (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
734 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
735
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
736 OCTAVE_DEPRECATED (4.4, "use 'octave::math::isfinite' instead")
23564
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
737 inline bool xfinite (double x) { return octave::math::isfinite (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
738 OCTAVE_DEPRECATED (4.4, "use 'octave::math::isfinite' instead")
23564
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
739 inline bool xfinite (float x) { return octave::math::isfinite (x); }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
740
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
741 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
742 OCTAVE_DEPRECATED (4.4, "use 'octave::math::isfinite' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
743 bool
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
744 xfinite (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
745 {
23564
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
746 return octave::math::isfinite (x);
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
747 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
748
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
749 OCTAVE_DEPRECATED (4.2, "use 'octave::math::isinf' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
750 inline bool xisinf (double x) { return octave::math::isinf (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
751 OCTAVE_DEPRECATED (4.2, "use 'octave::math::isinf' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
752 inline bool xisinf (float x) { return octave::math::isinf (x); }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
753
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
754 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
755 OCTAVE_DEPRECATED (4.2, "use 'octave::math::isinf' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
756 bool
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
757 xisinf (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
758 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
759 return octave::math::isinf (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
760 }
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
761
11010
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
762 // Some useful tests, that are commonly repeated.
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
763 // Test for a finite integer.
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
764
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
765 OCTAVE_DEPRECATED (4.2, "use 'octave::math::isinteger' instead")
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
766 inline bool
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
767 xisinteger (double x)
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
768 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
769 return octave::math::isinteger (x);
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
770 }
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
771
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
772 OCTAVE_DEPRECATED (4.2, "use 'octave::math::isinteger' instead")
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
773 inline bool
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
774 xisinteger (float x)
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
775 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
776 return octave::math::isinteger (x);
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
777 }
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
778
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
779 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
780 OCTAVE_DEPRECATED (4.2, "use 'octave::math::x_nint' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
781 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
782 X_NINT (T x)
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
783 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
784 return octave::math::x_nint (x);
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
785 }
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
786
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
787 OCTAVE_DEPRECATED (4.2, "use 'octave::math::x_nint (x)' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
788 inline double D_NINT (double x) { return octave::math::x_nint (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
789 OCTAVE_DEPRECATED (4.2, "use 'octave::math::x_nint (x)' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
790 inline float F_NINT (float x) { return octave::math::x_nint (x); }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
791
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
792 OCTAVE_DEPRECATED (4.2, "use 'octave::math::nint_big' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
793 inline octave_idx_type NINTbig (double x) { return octave::math::nint_big (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
794 OCTAVE_DEPRECATED (4.2, "use 'octave::math::nint_big' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
795 inline octave_idx_type NINTbig (float x) { return octave::math::nint_big (x); }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
796
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
797 OCTAVE_DEPRECATED (4.2, "use 'octave::math::nint' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
798 inline int NINT (double x) { return octave::math::nint (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
799 OCTAVE_DEPRECATED (4.2, "use 'octave::math::nint' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
800 inline int NINT (float x) { return octave::math::nint (x); }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
801
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
802 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
803 OCTAVE_DEPRECATED (4.2, "use 'octave::math::mod' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
804 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
805 xmod (T x, T y)
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
806 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
807 return octave::math::mod (x, y);
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
808 }
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
809
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
810 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
811 OCTAVE_DEPRECATED (4.2, "use 'octave::math::rem' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
812 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
813 xrem (T x, T y)
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
814 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
815 return octave::math::rem (x, y);
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
816 }
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
817
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
818 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
819 OCTAVE_DEPRECATED (4.2, "use 'octave::math::min' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
820 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
821 xmin (T x, T y)
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
822 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
823 return octave::math::min (x, y);
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
824 }
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
825
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
826 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
827 OCTAVE_DEPRECATED (4.2, "use 'octave::math::max' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
828 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
829 xmax (T x, T y)
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
830 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
831 return octave::math::max (x, y);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
832 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
833
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
834 OCTAVE_DEPRECATED (4.2, "use 'octave::math::min' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
835 inline double
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
836 xmin (double x, double y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
837 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
838 return octave::math::min (x, y);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
839 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
840
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
841 OCTAVE_DEPRECATED (4.2, "use 'octave::math::max' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
842 inline double
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
843 xmax (double x, double y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
844 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
845 return octave::math::max (x, y);
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
846 }
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
847
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
848 OCTAVE_DEPRECATED (4.2, "use 'octave::math::min' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
849 inline float
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
850 xmin (float x, float y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
851 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
852 return octave::math::min (x, y);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
853 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
854
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
855 OCTAVE_DEPRECATED (4.2, "use 'octave::math::max' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
856 inline float
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
857 xmax (float x, float y)
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
858 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
859 return octave::math::max (x, y);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
860 }
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
861
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
862 OCTAVE_DEPRECATED (4.2, "use 'octave::math::min' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
863 inline Complex
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
864 xmin (const Complex& x, const Complex& y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
865 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
866 return octave::math::min (x, y);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
867 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
868
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
869 OCTAVE_DEPRECATED (4.2, "use 'octave::math::max' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
870 inline Complex
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
871 xmax (const Complex& x, const Complex& y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
872 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
873 return octave::math::max (x, y);
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
874 }
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
875
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
876 OCTAVE_DEPRECATED (4.2, "use 'octave::math::min' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
877 inline OCTAVE_API FloatComplex
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
878 xmin (const FloatComplex& x, const FloatComplex& y)
11211
2554b4a0806e use templates for some lo-mappers functions
John W. Eaton <jwe@octave.org>
parents: 11209
diff changeset
879 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
880 return octave::math::min (x, y);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
881 }
11211
2554b4a0806e use templates for some lo-mappers functions
John W. Eaton <jwe@octave.org>
parents: 11209
diff changeset
882
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
883 OCTAVE_DEPRECATED (4.2, "use 'octave::math::max' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
884 inline FloatComplex
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
885 xmax (const FloatComplex& x, const FloatComplex& y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
886 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
887 return octave::math::max (x, y);
11211
2554b4a0806e use templates for some lo-mappers functions
John W. Eaton <jwe@octave.org>
parents: 11209
diff changeset
888 }
2554b4a0806e use templates for some lo-mappers functions
John W. Eaton <jwe@octave.org>
parents: 11209
diff changeset
889
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
890 OCTAVE_DEPRECATED (4.2, "use 'octave::math::rc_acos' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
891 inline Complex rc_acos (double x) { return octave::math::rc_acos (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
892 OCTAVE_DEPRECATED (4.2, "use 'octave::math::rc_acos' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
893 inline FloatComplex rc_acos (float x) { return octave::math::rc_acos (x); }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
894
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
895 OCTAVE_DEPRECATED (4.2, "use 'octave::math::rc_acosh' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
896 inline Complex rc_acosh (double x) { return octave::math::rc_acosh (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
897 OCTAVE_DEPRECATED (4.2, "use 'octave::math::rc_acosh' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
898 inline FloatComplex rc_acosh (float x) { return octave::math::rc_acosh (x); }
11211
2554b4a0806e use templates for some lo-mappers functions
John W. Eaton <jwe@octave.org>
parents: 11209
diff changeset
899
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
900 OCTAVE_DEPRECATED (4.2, "use 'octave::math::rc_asin' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
901 inline Complex rc_asin (double x) { return octave::math::rc_asin (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
902 OCTAVE_DEPRECATED (4.2, "use 'octave::math::rc_asin' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
903 inline FloatComplex rc_asin (float x) { return octave::math::rc_asin (x); }
11211
2554b4a0806e use templates for some lo-mappers functions
John W. Eaton <jwe@octave.org>
parents: 11209
diff changeset
904
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
905 OCTAVE_DEPRECATED (4.2, "use 'octave::math::rc_atanh' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
906 inline Complex rc_atanh (double x) { return octave::math::rc_atanh (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
907 OCTAVE_DEPRECATED (4.2, "use 'octave::math::rc_atanh' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
908 inline FloatComplex rc_atanh (float x) { return octave::math::rc_atanh (x); }
18869
23681c9ea7ba better guess if rem or mod could be zero (bug #42627)
Olaf Till <i7tiol@t-online.de>
parents: 17822
diff changeset
909
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
910 OCTAVE_DEPRECATED (4.2, "use 'octave::math::rc_log' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
911 inline Complex rc_log (double x) { return octave::math::rc_log (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
912 OCTAVE_DEPRECATED (4.2, "use 'octave::math::rc_log' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
913 inline FloatComplex rc_log (float x) { return octave::math::rc_log (x); }
18869
23681c9ea7ba better guess if rem or mod could be zero (bug #42627)
Olaf Till <i7tiol@t-online.de>
parents: 17822
diff changeset
914
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
915 OCTAVE_DEPRECATED (4.2, "use 'octave::math::rc_log2' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
916 inline Complex rc_log2 (double x) { return octave::math::rc_log2 (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
917 OCTAVE_DEPRECATED (4.2, "use 'octave::math::rc_log2' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
918 inline FloatComplex rc_log2 (float x) { return octave::math::rc_log2 (x); }
11211
2554b4a0806e use templates for some lo-mappers functions
John W. Eaton <jwe@octave.org>
parents: 11209
diff changeset
919
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
920 OCTAVE_DEPRECATED (4.2, "use 'octave::math::rc_log10' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
921 inline Complex rc_log10 (double x) { return octave::math::rc_log10 (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
922 OCTAVE_DEPRECATED (4.2, "use 'octave::math::rc_log10' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
923 inline FloatComplex rc_log10 (float x) { return octave::math::rc_log10 (x); }
11010
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
924
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
925 OCTAVE_DEPRECATED (4.2, "use 'octave::math::rc_sqrt' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
926 inline Complex rc_sqrt (double x) { return octave::math::rc_sqrt (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
927 OCTAVE_DEPRECATED (4.2, "use 'octave::math::rc_sqrt' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
928 inline FloatComplex rc_sqrt (float x) { return octave::math::rc_sqrt (x); }
15487
ecf5be238b4a provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents: 15409
diff changeset
929
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
930 #endif
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
931
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
932 #endif