annotate liboctave/numeric/lo-mappers.h @ 27923:bd51beb6205e

update formatting of copyright notices * Use <https://octave.org/copyright/> instead of <https://octave.org/COPYRIGHT.html/>. * For consistency with other comments in the Octave sources, use C++-style comments for copyright blocks in C and C++ files. * Use delimiters above and below copyright blocks that are appropriate for the language used in the file. * Eliminate extra spacing inside copyright blocks. * lex.ll (looks_like_copyright): Also allow newlines and carriage returns before the word "Copyright". * scripts/mk-doc.pl (gethelp): Also skip empty comment lines. * bp-table.cc, type.m: Adjust tests.
author John W. Eaton <jwe@octave.org>
date Wed, 08 Jan 2020 11:59:41 -0500
parents 1891570abac8
children ef0775fdab2c 0a5b15007766
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
3 // Copyright (C) 1996-2020 The Octave Project Developers
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
25
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 20374
diff changeset
26 #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
27 #define octave_lo_mappers_h 1
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
28
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21232
diff changeset
29 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21232
diff changeset
30
23662
bd77ab816e43 eliminate obsolete file lo-math.h
John W. Eaton <jwe@octave.org>
parents: 23619
diff changeset
31 #include <cmath>
bd77ab816e43 eliminate obsolete file lo-math.h
John W. Eaton <jwe@octave.org>
parents: 23619
diff changeset
32
11211
2554b4a0806e use templates for some lo-mappers functions
John W. Eaton <jwe@octave.org>
parents: 11209
diff changeset
33 #include <limits>
2554b4a0806e use templates for some lo-mappers functions
John W. Eaton <jwe@octave.org>
parents: 11209
diff changeset
34
23443
3f1bf237908b maint: Eliminate <cfloat.h> header from liboctave files.
Rik <rik@octave.org>
parents: 23220
diff changeset
35 #include "lo-ieee.h"
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
36 #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
37 #include "oct-inttypes-fwd.h"
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
38
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
39 namespace octave
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
40 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
41 namespace math
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
42 {
23619
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
43 extern OCTAVE_API bool isna (double x);
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
44 extern OCTAVE_API bool isna (float x);
6ed4d6e306ba maint: Deprecate is_NA and replace with isna.
Rik <rik@octave.org>
parents: 23615
diff changeset
45 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
46 extern OCTAVE_API bool isna (const FloatComplex& x);
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
47
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
48 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
49 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
50
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
51 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
52 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
53
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
54 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
55 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
56
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
57 // 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
58 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
59 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
60
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
61 // 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
62 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
63 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
64
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
65 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
66 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
67
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
68 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
69 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
70
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
71 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
72 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
73
23708
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
74 // The C++ standard would normally return a std::complex value for conj
23780
96e36ba3be65 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23733
diff changeset
75 // even when the input is fully real. Octave overrides this.
22274
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
76 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
77 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
78
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
79 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
80 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
81 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
82 {
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
83 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
84 }
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
85
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
86 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
87 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
88
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
89 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
90 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
91
23815
4d11ada80395 Restore using gnulib wrapper for frexp until MinGW C library is fixed (bug #51630).
Rik <rik@octave.org>
parents: 23780
diff changeset
92 extern OCTAVE_API double log2 (double x, int& exp);
4d11ada80395 Restore using gnulib wrapper for frexp until MinGW C library is fixed (bug #51630).
Rik <rik@octave.org>
parents: 23780
diff changeset
93 extern OCTAVE_API float log2 (float x, int& exp);
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
94
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
95 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
96 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
97
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
98 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
99 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
100
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
101 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
102 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
103 ceil (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
104 {
23726
1147e5c912aa Remove unnecessary octave::math::(ceil,trunc,floor) declarations.
Rik <rik@octave.org>
parents: 23708
diff changeset
105 return std::complex<T> (std::ceil (std::real (x)),
1147e5c912aa Remove unnecessary octave::math::(ceil,trunc,floor) declarations.
Rik <rik@octave.org>
parents: 23708
diff changeset
106 std::ceil (std::imag (x)));
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
107 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
108
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
109 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
110 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
111 trunc (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
112 {
23726
1147e5c912aa Remove unnecessary octave::math::(ceil,trunc,floor) declarations.
Rik <rik@octave.org>
parents: 23708
diff changeset
113 return std::complex<T> (std::trunc (std::real (x)),
1147e5c912aa Remove unnecessary octave::math::(ceil,trunc,floor) declarations.
Rik <rik@octave.org>
parents: 23708
diff changeset
114 std::trunc (std::imag (x)));
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
115 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
116
23726
1147e5c912aa Remove unnecessary octave::math::(ceil,trunc,floor) declarations.
Rik <rik@octave.org>
parents: 23708
diff changeset
117 // Provide alias for trunc under the more familiar name of fix.
1147e5c912aa Remove unnecessary octave::math::(ceil,trunc,floor) declarations.
Rik <rik@octave.org>
parents: 23708
diff changeset
118 inline double fix (double x) { return std::trunc (x); }
1147e5c912aa Remove unnecessary octave::math::(ceil,trunc,floor) declarations.
Rik <rik@octave.org>
parents: 23708
diff changeset
119 inline float fix (float x) { return std::trunc (x); }
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
120
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
121 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
122 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
123 fix (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
124 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
125 return trunc (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
126 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
127
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
128 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
129 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
130 floor (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
131 {
23726
1147e5c912aa Remove unnecessary octave::math::(ceil,trunc,floor) declarations.
Rik <rik@octave.org>
parents: 23708
diff changeset
132 return std::complex<T> (std::floor (std::real (x)),
1147e5c912aa Remove unnecessary octave::math::(ceil,trunc,floor) declarations.
Rik <rik@octave.org>
parents: 23708
diff changeset
133 std::floor (std::imag (x)));
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
134 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
135
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
136 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
137 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
138
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
139 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
140 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
141 round (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
142 {
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
143 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
144 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
145
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
146 inline double
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
147 roundb (double 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 double t = round (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
150
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
151 if (fabs (x - t) == 0.5)
23726
1147e5c912aa Remove unnecessary octave::math::(ceil,trunc,floor) declarations.
Rik <rik@octave.org>
parents: 23708
diff changeset
152 t = 2 * std::trunc (0.5 * t);
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
153
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
154 return t;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
155 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
156
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
157 inline float
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
158 roundb (float x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
159 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
160 float t = round (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
161
22274
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22117
diff changeset
162 if (fabsf (x - t) == 0.5f)
23726
1147e5c912aa Remove unnecessary octave::math::(ceil,trunc,floor) declarations.
Rik <rik@octave.org>
parents: 23708
diff changeset
163 t = 2 * std::trunc (0.5f * t);
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 return t;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
166 }
7922
935be827eaf8 error for NaN values in & and | expressions
John W. Eaton <jwe@octave.org>
parents: 7789
diff changeset
167
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
168 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
169 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
170 roundb (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
171 {
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
172 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
173 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
174
23815
4d11ada80395 Restore using gnulib wrapper for frexp until MinGW C library is fixed (bug #51630).
Rik <rik@octave.org>
parents: 23780
diff changeset
175 extern OCTAVE_API double frexp (double x, int *expptr);
4d11ada80395 Restore using gnulib wrapper for frexp until MinGW C library is fixed (bug #51630).
Rik <rik@octave.org>
parents: 23780
diff changeset
176 extern OCTAVE_API float frexp (float x, int *expptr);
22079
e0dbd81fd9b1 provide wrapper for frexp and frexpf (bug #48363)
Mike Miller <mtmiller@octave.org>
parents: 21937
diff changeset
177
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
178 inline bool isnan (bool) { return false; }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
179 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
180
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
181 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
182 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
183
23708
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
184 // FIXME: Do we need the isnan overload for complex?
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
185 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
186 bool
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
187 isnan (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
188 {
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
189 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
190 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
191
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
192 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
193 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
194
23708
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
195 // FIXME: Do we need isfinite overload for complex?
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
196 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
197 bool
23564
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
198 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
199 {
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
200 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
201 }
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
202
23665
90fdfe448ae6 Promote simple functions from lo-mappers.cc to inline versions in lo-mappers.h
Rik <rik@octave.org>
parents: 23662
diff changeset
203 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
204 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
205
23708
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
206 // FIXME: Do we need isinf overload for complex?
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
207 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
208 bool
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
209 isinf (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
210 {
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
211 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
212 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
213
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
214 // 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
215 // Test for a finite integer.
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
216
23708
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
217 // FIXME: Benchmark whether trunc might be faster than round here.
23564
7049da1648c0 Deprecate octave::math::finite in favor of octave::math::isfinite.
Rik <rik@octave.org>
parents: 23477
diff changeset
218 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
219 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
220
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
221 inline double
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
222 signum (double x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
223 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
224 double tmp = 0.0;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
225
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
226 if (x < 0.0)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
227 tmp = -1.0;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
228 else if (x > 0.0)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
229 tmp = 1.0;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
230
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23682
diff changeset
231 return isnan (x) ? numeric_limits<double>::NaN () : tmp;
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
232 }
3248
68259f410026 [project @ 1999-07-13 03:34:54 by jwe]
jwe
parents: 3156
diff changeset
233
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
234 inline float
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
235 signum (float x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
236 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
237 float tmp = 0.0f;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
238
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
239 if (x < 0.0f)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
240 tmp = -1.0f;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
241 else if (x > 0.0f)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
242 tmp = 1.0f;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
243
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23682
diff changeset
244 return isnan (x) ? numeric_limits<float>::NaN () : tmp;
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
245 }
21937
55f7de37b618 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 21812
diff changeset
246
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
247 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
248 std::complex<T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
249 signum (const std::complex<T>& x)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
250 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
251 T tmp = abs (x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
252
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
253 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
254 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
255
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
256 // 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
257 // this function.
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
258
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
259 // 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
260 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
261 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
262 x_nint (T x)
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 return x;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
265 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
266
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
267 template <>
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
268 inline double x_nint (double x)
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
269 {
23726
1147e5c912aa Remove unnecessary octave::math::(ceil,trunc,floor) declarations.
Rik <rik@octave.org>
parents: 23708
diff changeset
270 return (isfinite (x) ? std::floor (x + 0.5) : x);
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
271 }
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
272
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
273 template <>
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
274 inline float x_nint (float x)
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
275 {
23726
1147e5c912aa Remove unnecessary octave::math::(ceil,trunc,floor) declarations.
Rik <rik@octave.org>
parents: 23708
diff changeset
276 return (isfinite (x) ? std::floor (x + 0.5f) : x);
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23443
diff changeset
277 }
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
278
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
279 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
280 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
281
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
282 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
283 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
284
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
285 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
286 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
287 mod (T x, T y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
288 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
289 T retval;
4025
cfb762dc9259 [project @ 2002-08-09 06:32:15 by jwe]
jwe
parents: 3777
diff changeset
290
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
291 if (y == 0)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
292 retval = x;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
293 else
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
294 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
295 T q = x / y;
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 if (x_nint (y) != y
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
298 && (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
299 < std::numeric_limits<T>::epsilon ()))
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
300 retval = 0;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
301 else
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
302 {
23726
1147e5c912aa Remove unnecessary octave::math::(ceil,trunc,floor) declarations.
Rik <rik@octave.org>
parents: 23708
diff changeset
303 T n = std::floor (q);
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
304
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
305 // Prevent use of extra precision.
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
306 volatile T tmp = y * n;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
307
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
308 retval = x - tmp;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
309 }
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
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
312 if (x != y && y != 0)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
313 retval = copysign (retval, y);
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 return retval;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
316 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
317
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
318 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
319 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
320 rem (T x, T y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
321 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
322 T retval;
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 if (y == 0)
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23682
diff changeset
325 retval = numeric_limits<T>::NaN ();
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
326 else
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
327 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
328 T q = x / y;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
329
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
330 if (x_nint (y) != y
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
331 && (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
332 < std::numeric_limits<T>::epsilon ()))
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
333 retval = 0;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
334 else
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
335 {
23726
1147e5c912aa Remove unnecessary octave::math::(ceil,trunc,floor) declarations.
Rik <rik@octave.org>
parents: 23708
diff changeset
336 T n = std::trunc (q);
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
337
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
338 // Prevent use of extra precision.
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
339 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
340
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
341 retval = x - tmp;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
342 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
343 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
344
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
345 if (x != y && y != 0)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
346 retval = copysign (retval, x);
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
347
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
348 return retval;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
349 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
350
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
351 // Generic min, max definitions
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
352 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
353 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
354 min (T x, T y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
355 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
356 return x <= y ? x : y;
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
357 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
358
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
359 template <typename T>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
360 T
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
361 max (T x, T y)
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 return x >= y ? x : y;
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
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
366 // 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
367 // 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
368 // (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
369
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
370 inline double
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
371 min (double x, double y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
372 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
373 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
374 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
375
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
376 inline double
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
377 max (double x, double y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
378 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
379 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
380 }
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 inline float
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
383 min (float x, float y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
384 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
385 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
386 }
10268
9a16a61ed43d new optimizations for accumarray
Jaroslav Hajek <highegg@gmail.com>
parents: 10158
diff changeset
387
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
388 inline float
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
389 max (float x, float y)
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
390 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
391 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
392 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
393
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
394 inline std::complex<double>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
395 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
396 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
397 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
398 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
399
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
400 inline std::complex<float>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
401 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
402 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
403 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
404 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
405
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
406 inline std::complex<double>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
407 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
408 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
409 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
410 }
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
411
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
412 inline std::complex<float>
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
413 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
414 {
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
415 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
416 }
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
417
22117
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
418 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
419 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
420 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
421 {
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
422 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
423 }
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
424
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
425 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
426 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
427 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
428 {
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
429 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
430 }
9b832e9caae6 define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 22079
diff changeset
431
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
432 // These map reals to Complex.
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
433
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
434 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
435 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
436
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
437 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
438 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
439
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
440 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
441 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
442
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
443 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
444 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
445
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
446 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
447 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
448
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
449 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
450 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
451
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
452 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
453 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
454
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
455 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
456 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
457 }
11212
ce27d6f4e134 use templates and inline for more lo-mappers functionos
John W. Eaton <jwe@octave.org>
parents: 11211
diff changeset
458 }
1967
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
459
4cb6aaa0f2c7 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents:
diff changeset
460 #endif