annotate liboctave/numeric/lo-mappers.h @ 23682:6fe13cd3543c

Clean up lo-mappers.h, lo-mappers.cc. * lo-mappers.h: Remove using std::FUNCTION lines. Prefer to specifically declare std:: namespace at point in code where function is used. Specifically call std::ceil rather than just ::ceil which leaves it up to the linker. * lo-mappers.cc: Add explanatory comments to code. Use constants from math.h rather than calculating our own. Place frexp code in alphabetical order in list of functions. Call std::acos, std::asin rather than ::acos, ::asin which leaves decision to linker. Use all upper case for constants in code. * lo-specfun.cc: Replace asin with call to std::asin so that code compiles.
author Rik <rik@octave.org>
date Fri, 23 Jun 2017 12:32:19 -0700
parents 90fdfe448ae6
children 08036a7f3660
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);
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
42 OCTAVE_DEPRECATED (4.4, "use 'octave::math::isna' instead")
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
43 inline bool 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
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);
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
46 OCTAVE_DEPRECATED (4.4, "use 'octave::math::isna' instead")
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
47 inline bool is_NA (float x) { return octave::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);
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
50 OCTAVE_DEPRECATED (4.4, "use 'octave::math::isna' instead")
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
51 inline bool 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
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);
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
54 OCTAVE_DEPRECATED (4.4, "use 'octave::math::isna' instead")
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
55 inline bool is_NA (const FloatComplex& x) { return octave::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
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
83 // C++ now provides versions of the following functions for arguments of
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
84 // type std::complex<T> and T. But some compilers (I'm looking at you,
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
85 // clang) apparently don't get this right yet... So we provide our own
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
86 // wrappers for real-valued arguments.
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
87
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 inline double arg (double x) { return signbit (x) ? M_PI : 0; }
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
89 inline float arg (float x)
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
90 {
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
91 return signbit (x) ? static_cast<float> (M_PI) : 0;
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
92 }
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
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 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
95 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
96 arg (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
97 {
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
98 return std::arg (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
99 }
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
100
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
101 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
102 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
103
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
104 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
105 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
106 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
107 {
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
108 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
109 }
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
110
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
111 inline double imag (double) { return 0; }
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
112 inline float imag (float) { return 0; }
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
113
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
114 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
115 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
116 imag (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
117 {
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::imag (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
119 }
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
120
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
121 inline double real (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
122 inline float real (float 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
123
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
124 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
125 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
126 real (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
127 {
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
128 return std::real (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
129 }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
130
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
131 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
132 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
133
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
134 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
135 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
136
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
137 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
138 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
139
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
140 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
141 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
142
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
143 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
144 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
145
23682
6fe13cd3543c Clean up lo-mappers.h, lo-mappers.cc.
Rik <rik@octave.org>
parents: 23665
diff changeset
146 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
147 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
148
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
149 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
150 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
151 ceil (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
152 {
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
153 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
154 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
155
23665
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 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
157 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
158
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
159 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
160 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
161 trunc (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
162 {
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
163 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
164 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
165
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
166 // 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
167 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
168 inline float fix (float x) { return trunc (x); }
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
169
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
170 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
171 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
172 fix (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
173 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
174 return trunc (x);
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
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
177 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
178 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
179
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
180 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
181 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
182 floor (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
183 {
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
184 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
185 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
186
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
187 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
188 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
189
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
190 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
191 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
192 round (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
193 {
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
194 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
195 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
196
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
197 inline double
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
198 roundb (double x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
199 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
200 double t = round (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
201
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
202 if (fabs (x - t) == 0.5)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
203 t = 2 * trunc (0.5 * t);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
204
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
205 return t;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
206 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
207
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
208 inline float
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
209 roundb (float x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
210 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
211 float t = round (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
212
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
213 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
214 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
215
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
216 return t;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
217 }
7922
935be827eaf8 error for NaN values in & and | expressions
John W. Eaton <jwe@octave.org>
parents: 7789
diff changeset
218
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
219 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
220 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
221 roundb (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
222 {
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
223 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
224 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
225
22079
e0dbd81fd9b1 provide wrapper for frexp and frexpf (bug #48363)
Mike Miller <mtmiller@octave.org>
parents: 21937
diff changeset
226 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
227 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
228
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
229 inline bool isnan (bool) { return false; }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
230 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
231
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
232 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
233 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
234
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
235 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
236 bool
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
237 isnan (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
238 {
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
239 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
240 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
241
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
242 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
243 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
244
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
245 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
246 bool
23564
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
247 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
248 {
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
249 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
250 }
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
251
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
252 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
253 inline bool finite (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
254 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
255 inline bool finite (float x) { return octave::math::isfinite (x); }
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
256
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
257 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
258 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
259 bool
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
260 finite (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
261 {
23564
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
262 return octave::math::isfinite (x);
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
263 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
264
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
265 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
266 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
267
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
268 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
269 bool
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
270 isinf (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
271 {
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
272 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
273 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
274
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
275 // 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
276 // Test for a finite integer.
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
277
23564
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
278 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
279 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
280
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
281 inline double
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
282 signum (double x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
283 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
284 double tmp = 0.0;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
285
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
286 if (x < 0.0)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
287 tmp = -1.0;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
288 else if (x > 0.0)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
289 tmp = 1.0;
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 return isnan (x) ? octave::numeric_limits<double>::NaN () : tmp;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
292 }
3248
68259f410026 [project @ 1999-07-13 03:34:54 by jwe]
jwe
parents: 3156
diff changeset
293
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
294 inline float
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
295 signum (float x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
296 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
297 float tmp = 0.0f;
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 if (x < 0.0f)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
300 tmp = -1.0f;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
301 else if (x > 0.0f)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
302 tmp = 1.0f;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
303
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
304 return isnan (x) ? octave::numeric_limits<float>::NaN () : tmp;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
305 }
21937
55f7de37b618 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 21812
diff changeset
306
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
307 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
308 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
309 signum (const std::complex<T>& x)
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 T tmp = abs (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
312
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
313 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
314 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
315
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
316 // 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
317 // this function.
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
318
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
319 // 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
320 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
321 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
322 x_nint (T x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
323 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
324 return x;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
325 }
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 template <>
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
328 inline double x_nint (double x)
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
329 {
23564
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
330 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
331 }
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
332
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
333 template <>
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
334 inline float x_nint (float x)
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
335 {
23564
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
336 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
337 }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
338
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
339 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
340 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
341
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
342 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
343 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
344
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
345 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
346 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
347 mod (T x, T y)
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 T retval;
4025
cfb762dc9259 [project @ 2002-08-09 06:32:15 by jwe]
jwe
parents: 3777
diff changeset
350
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
351 if (y == 0)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
352 retval = x;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
353 else
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
354 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
355 T q = x / y;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
356
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
357 if (x_nint (y) != y
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
358 && (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
359 < std::numeric_limits<T>::epsilon ()))
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
360 retval = 0;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
361 else
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
362 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
363 T n = floor (q);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
364
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
365 // Prevent use of extra precision.
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
366 volatile T tmp = y * n;
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 retval = x - tmp;
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 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
371
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
372 if (x != y && y != 0)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
373 retval = copysign (retval, y);
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 return retval;
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
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
378 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
379 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
380 rem (T x, T y)
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 T retval;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
383
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
384 if (y == 0)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
385 retval = octave::numeric_limits<T>::NaN ();
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
386 else
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 T q = 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 if (x_nint (y) != y
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
391 && (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
392 < std::numeric_limits<T>::epsilon ()))
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
393 retval = 0;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
394 else
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
395 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
396 T n = trunc (q);
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 // Prevent use of extra precision.
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
399 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
400
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
401 retval = x - tmp;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
402 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
403 }
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 if (x != y && y != 0)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
406 retval = copysign (retval, x);
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 return retval;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
409 }
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 // Generic min, max definitions
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
412 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
413 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
414 min (T x, T y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
415 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
416 return x <= y ? x : y;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
417 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
418
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
419 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
420 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
421 max (T x, T 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 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 // 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
427 // 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
428 // (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
429
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
430 inline double
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
431 min (double x, double y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
432 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
433 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
434 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
435
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
436 inline double
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
437 max (double x, double y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
438 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
439 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
440 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
441
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
442 inline float
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
443 min (float x, float y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
444 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
445 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
446 }
10268
9a16a61ed43d new optimizations for accumarray
Jaroslav Hajek <highegg@gmail.com>
parents: 10158
diff changeset
447
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
448 inline float
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
449 max (float x, float y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
450 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
451 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
452 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
453
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
454 inline std::complex<double>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
455 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
456 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
457 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
458 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
459
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
460 inline std::complex<float>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
461 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
462 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
463 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
464 }
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 inline std::complex<double>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
467 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
468 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
469 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
470 }
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
471
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
472 inline std::complex<float>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
473 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
474 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
475 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
476 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
477
22117
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
478 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
479 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
480 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
481 {
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
482 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
483 }
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
484
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
485 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
486 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
487 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
488 {
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
489 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
490 }
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
491
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
492 // These map reals to Complex.
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
493
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
494 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
495 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
496
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
497 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
498 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
499
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
500 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
501 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
502
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
503 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
504 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
505
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
506 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
507 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
508
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
509 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
510 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
511
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
512 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
513 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
514
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
515 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
516 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
517 }
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
518 }
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
519
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
520 #if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
521
23619
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
522 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
523 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
524 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
525 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
526 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
527 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
528 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
529 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
530 {
23619
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
531 return octave::math::isna (x);
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
532 }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
533
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
534 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
535 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
536 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
537 inline FloatComplex acos (const FloatComplex& x)
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
538 {
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
539 return octave::math::acos (x);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
540 }
3777
b4f260ddd748 [project @ 2001-02-06 15:57:23 by jwe]
jwe
parents: 3776
diff changeset
541
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
542 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
543 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
544 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
545 inline FloatComplex asin (const FloatComplex& x)
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
546 {
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
547 return octave::math::asin (x);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
548 }
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::atan' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
551 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
552 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
553 inline FloatComplex atan (const FloatComplex& x)
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
554 {
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
555 return octave::math::atan (x);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
556 }
4469
53ee020af847 [project @ 2003-07-26 03:45:10 by jwe]
jwe
parents: 4065
diff changeset
557
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
558 OCTAVE_DEPRECATED (4.2, "use 'octave::math::arg' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
559 inline double arg (double x) { return octave::math::arg (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
560 OCTAVE_DEPRECATED (4.2, "use 'octave::math::arg' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
561 inline float arg (float x) { return octave::math::arg (x); }
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::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
564 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
565 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
566 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
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::imag' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
569 inline double imag (double x) { return octave::math::imag (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
570 OCTAVE_DEPRECATED (4.2, "use 'octave::math::imag' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
571 inline float imag (float x) { return octave::math::imag (x); }
3248
68259f410026 [project @ 1999-07-13 03:34:54 by jwe]
jwe
parents: 3156
diff changeset
572
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
573 OCTAVE_DEPRECATED (4.2, "use 'octave::math::real' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
574 inline double real (double x) { return octave::math::real (x); }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
575 OCTAVE_DEPRECATED (4.2, "use 'octave::math::real' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
576 inline float real (float x) { return octave::math::real (x); }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
577
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
578 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
579 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
580 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
581 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
582
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
583 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
584 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
585 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
586 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
587 {
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
588 return octave::math::log2 (x);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
589 }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
590
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
591 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
592 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
593 {
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
594 return octave::math::log2 (x, exp);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
595 }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
596 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
597 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
598
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
599 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
600 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
601 {
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
602 return octave::math::log2 (x, exp);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
603 }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
604 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
605 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
606 {
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
607 return octave::math::log2 (x, exp);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
608 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
609
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
610 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
611 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
612 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
613 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
614
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
615 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
616 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
617 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
618 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
619
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
620 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
621 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
622 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
623 ceil (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
624 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
625 return octave::math::ceil (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
626 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
627
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
628 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
629 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
630 {
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
631 return octave::math::copysign (x, y);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
632 }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
633 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
634 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
635 {
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
636 return octave::math::copysign (x, y);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
637 }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
638
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
639 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
640 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
641 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
642 xsignbit (T x)
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
643 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
644 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
645 }
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
646
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::negative_sign' instead")
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
648 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
649 {
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
650 return octave::math::negative_sign (x);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
651 }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
652 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
653 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
654 {
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
655 return octave::math::negative_sign (x);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
656 }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
657
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
658 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
659 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
660 {
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
661 return octave::math::positive_sign (x);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
662 }
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
663 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
664 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
665 {
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
666 return octave::math::positive_sign (x);
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
667 }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
668
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::signum' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
670 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
671 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
672 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
673
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
674 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
675 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
676 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
677 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
678 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
679 return octave::math::signum (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
680 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
681
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::trunc' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
683 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
684 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
685 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
686
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
687 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
688 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
689 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
690 xtrunc (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
691 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
692 return octave::math::trunc (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
693 }
21937
55f7de37b618 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 21812
diff changeset
694
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::fix' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
696 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
697 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
698 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
699
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
700 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
701 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
702 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
703 fix (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
704 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
705 return octave::math::fix (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
706 }
21937
55f7de37b618 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 21812
diff changeset
707
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::floor' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
709 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
710 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
711 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
712
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
713 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
714 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
715 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
716 floor (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
717 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
718 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
719 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
720
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::round' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
722 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
723 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
724 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
725
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
726 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
727 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
728 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
729 xround (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
730 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
731 return octave::math::round (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
732 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
733
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
734 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
735 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
736 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
737 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
738
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
739 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
740 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
741 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
742 xroundb (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
743 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
744 return octave::math::roundb (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
745 }
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
746
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
747 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
748 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
749 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
750 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
751 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
752 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
753 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
754 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
755
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
756 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
757 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
758 bool
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
759 xisnan (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
760 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
761 return octave::math::isnan (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
762 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
763
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
764 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
765 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
766 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
767 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
768
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
769 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
770 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
771 bool
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
772 xfinite (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
773 {
23564
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
774 return octave::math::isfinite (x);
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
775 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
776
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
777 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
778 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
779 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
780 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
781
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
782 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
783 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
784 bool
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
785 xisinf (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
786 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
787 return octave::math::isinf (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
788 }
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
789
11010
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
790 // Some useful tests, that are commonly repeated.
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
791 // Test for a finite integer.
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
792
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
793 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
794 inline bool
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
795 xisinteger (double x)
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
796 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
797 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
798 }
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
799
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
800 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
801 inline bool
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
802 xisinteger (float x)
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
803 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
804 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
805 }
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
806
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
807 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
808 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
809 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
810 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
811 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
812 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
813 }
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
814
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
815 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
816 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
817 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
818 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
819
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
820 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
821 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
822 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
823 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
824
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
825 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
826 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
827 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
828 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
829
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
830 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
831 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
832 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
833 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
834 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
835 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
836 }
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
837
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
838 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
839 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
840 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
841 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
842 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
843 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
844 }
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
845
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
846 template <typename T>
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
847 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
848 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
849 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
850 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
851 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
852 }
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
853
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
854 template <typename T>
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 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
857 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
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 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
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 double
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
864 xmin (double x, double 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 double
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
871 xmax (double x, double 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 float
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
878 xmin (float x, float y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
879 {
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 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
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 float
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
885 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
886 {
21782
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);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
888 }
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
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::min' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
891 inline Complex
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
892 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
893 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
894 return octave::math::min (x, y);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
895 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
896
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::max' instead")
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
898 inline Complex
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
899 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
900 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
901 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
902 }
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
903
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
904 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
905 inline OCTAVE_API FloatComplex
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
906 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
907 {
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
908 return octave::math::min (x, y);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
909 }
11211
2554b4a0806e use templates for some lo-mappers functions
John W. Eaton <jwe@octave.org>
parents: 11209
diff changeset
910
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
911 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
912 inline FloatComplex
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
913 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
914 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
915 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
916 }
2554b4a0806e use templates for some lo-mappers functions
John W. Eaton <jwe@octave.org>
parents: 11209
diff changeset
917
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
918 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
919 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
920 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
921 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
922
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
923 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
924 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
925 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
926 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
927
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
928 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
929 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
930 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
931 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
932
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
933 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
934 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
935 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
936 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
937
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
938 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
939 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
940 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
941 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
942
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
943 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
944 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
945 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
946 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
947
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
948 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
949 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
950 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
951 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
952
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
953 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
954 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
955 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
956 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
957
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
958 #endif
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
959
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
960 #endif