source: trunk/cppad/local/base_double.hpp @ 3680

Last change on this file since 3680 was 3680, checked in by bradbell, 5 years ago

merge to branch: trunk
from repository: https://github.com/coin-or/CppAD
start hash code: 071875a4beba3363e5fa9752426aec4762cd1caa
end hash code: 0bef506513a519e1073c6279d5c4cba9e5c3b180

commit 0bef506513a519e1073c6279d5c4cba9e5c3b180
Author: Brad Bell <bradbell@…>
Date: Thu May 7 12:14:32 2015 -0700

Add the acosh function (as an atomic operation when defined by compiler).

commit b3264fa17b2f65b65800423a0e243c9c3ccfe06a
Author: Brad Bell <bradbell@…>
Date: Wed May 6 20:25:38 2015 -0700

CMakeLists.txt: Change so test only check for compliation.

commit dcbac4d4f20cc383f2bd9edb02036659df40b791
Author: Brad Bell <bradbell@…>
Date: Wed May 6 15:06:28 2015 -0700

asinh.cpp: check higher orders, relax accuracy on test.

commit 5f8881993fedd18cccc3c74831133a8f8a9d17b0
Author: Brad Bell <bradbell@…>
Date: Wed May 6 14:36:18 2015 -0700

Change Acos to acos.
acos.cpp: remove trailing white space.

commit e828fa1f7c4c3848c727f14b1b7a8030071ee705
Author: Brad Bell <bradbell@…>
Date: Wed May 6 12:07:35 2015 -0700

Change Acos to acos.
acos.cpp: remove redundant index commands, remove trailing with space.

commit 3d16e5b9fe1bdafa4ad01d1d466bb72b792650fa
Author: Brad Bell <bradbell@…>
Date: Wed May 6 11:30:49 2015 -0700

op_code.hpp: Minor edits to AcosOp? commnets.

commit 58beaaad149b4ac29fae44589d7f8900bf8f4c40
Author: Brad Bell <bradbell@…>
Date: Wed May 6 10:51:43 2015 -0700

for_jac_sweep.hpp: Add missing AsinhOp? case.

commit 623c134870c522ae5e80bcf0f89d230902594c80
Author: Brad Bell <bradbell@…>
Date: Wed May 6 10:27:39 2015 -0700

Fix comment about AsinhOp? operator.

commit 226b14f6f4810f5abf1ca247aae541963efaf4d6
Author: Brad Bell <bradbell@…>
Date: Wed May 6 10:14:08 2015 -0700

Add derivative of F to make order zero case clearer.
acos_reverse.omh: Fix some sign errors.
asin_reverse.omh: Fix typo.
acos_forward.omh: Simplify by distributing minus sign.

commit 4682f4ee73e33b600b180086576e986f636a24dc
Author: Brad Bell <bradbell@…>
Date: Wed May 6 08:15:50 2015 -0700

acos_forward.omh: fix sign that depends on acos versus acosh.

commit 906ae10adf019ddda7f57dd165aab08fc55289c4
Author: Brad Bell <bradbell@…>
Date: Wed May 6 07:09:47 2015 -0700

  1. Fix inclusion of some temporary files in package (e.g., git_commit.sh).
  2. Simplify and improve using git ls-files and ls bin/check_*.
  3. Remove trailing white space.

commit 5096f4706a547bd76caa3766aa2c62802ef7f0bf
Author: Brad Bell <bradbell@…>
Date: Wed May 6 06:41:20 2015 -0700

Combine base type documentation for erf, asinh
(will add more functions to this list list).

commit b3535db5ad95bee90672abcaa686032d23bce2fc
Author: Brad Bell <bradbell@…>
Date: Tue May 5 18:01:11 2015 -0700

  1. Change Arc Cosine/Sine? to Inverse Cosine/Sine?.
  2. Change arcsin-> asin and arccos->acos.
  3. Remove index commands that are duplicates of words in titles.


acos_reverse.omh: Add acosh case to this page.

  • Property svn:keywords set to Id
File size: 5.4 KB
Line 
1/* $Id: base_double.hpp 3680 2015-05-07 19:17:37Z bradbell $ */
2# ifndef CPPAD_BASE_DOUBLE_INCLUDED
3# define CPPAD_BASE_DOUBLE_INCLUDED
4/* --------------------------------------------------------------------------
5CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
6
7CppAD is distributed under multiple licenses. This distribution is under
8the terms of the
9                    Eclipse Public License Version 1.0.
10
11A copy of this license is included in the COPYING file of this distribution.
12Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
13-------------------------------------------------------------------------- */
14# include <cppad/configure.hpp>
15# include <limits>
16
17/*
18$begin base_double.hpp$$
19$spell
20        acosh
21        asinh
22        erf
23        endif
24        abs_geq
25        acos
26        asin
27        atan
28        cos
29        sqrt
30        tanh
31        std
32        fabs
33        bool
34        Lt Le Eq Ge Gt
35        Rel
36        CppAD
37        CondExpOp
38        namespace
39        inline
40        enum
41        const
42        exp
43        const
44$$
45
46$index double, Base$$
47$index Base, double$$
48$index double, Base$$
49
50$section Enable use of AD<Base> where Base is double$$
51
52$head CondExpOp$$
53The type $code double$$ is a relatively simple type that supports
54$code <$$, $code <=$$, $code ==$$, $code >=$$, and $code >$$ operators; see
55$cref/ordered type/base_cond_exp/CondExpTemplate/Ordered Type/$$.
56Hence its $code CondExpOp$$ function is defined by
57$codep */
58namespace CppAD {
59        inline double CondExpOp(
60                enum CompareOp     cop          ,
61                const double&       left         ,
62                const double&       right        ,
63                const double&       exp_if_true  ,
64                const double&       exp_if_false )
65        {       return CondExpTemplate(cop, left, right, exp_if_true, exp_if_false);
66        }
67}
68/* $$
69
70$head CondExpRel$$
71The $cref/CPPAD_COND_EXP_REL/base_cond_exp/CondExpRel/$$ macro invocation
72$codep */
73namespace CppAD {
74        CPPAD_COND_EXP_REL(double)
75}
76/* $$
77uses $code CondExpOp$$ above to
78define $codei%CondExp%Rel%$$ for $code double$$ arguments
79and $icode%Rel%$$ equal to
80$code Lt$$, $code Le$$, $code Eq$$, $code Ge$$, and $code Gt$$.
81
82$head EqualOpSeq$$
83The type $code double$$ is simple (in this respect) and so we define
84$codep */
85namespace CppAD {
86        inline bool EqualOpSeq(const double& x, const double& y)
87        {       return x == y; }
88}
89/* $$
90
91$head Identical$$
92The type $code double$$ is simple (in this respect) and so we define
93$codep */
94namespace CppAD {
95        inline bool IdenticalPar(const double& x)
96        {       return true; }
97        inline bool IdenticalZero(const double& x)
98        {       return (x == 0.); }
99        inline bool IdenticalOne(const double& x)
100        {       return (x == 1.); }
101        inline bool IdenticalEqualPar(const double& x, const double& y)
102        {       return (x == y); }
103}
104/* $$
105
106$head Integer$$
107$codep */
108namespace CppAD {
109        inline int Integer(const double& x)
110        {       return static_cast<int>(x); }
111}
112/* $$
113
114$head Ordered$$
115The $code double$$ type supports ordered comparisons
116$codep */
117namespace CppAD {
118        inline bool GreaterThanZero(const double& x)
119        {       return x > 0.; }
120        inline bool GreaterThanOrZero(const double& x)
121        {       return x >= 0.; }
122        inline bool LessThanZero(const double& x)
123        {       return x < 0.; }
124        inline bool LessThanOrZero(const double& x)
125        {       return x <= 0.; }
126        inline bool abs_geq(const double& x, const double& y)
127        {       return std::fabs(x) >= std::fabs(y); }
128}
129/* $$
130
131$head Unary Standard Math$$
132The following macro invocations define the unary standard math functions
133required to use $code AD<double>$$:
134$codep */
135namespace CppAD {
136        CPPAD_STANDARD_MATH_UNARY(double, acos)
137        CPPAD_STANDARD_MATH_UNARY(double, asin)
138        CPPAD_STANDARD_MATH_UNARY(double, atan)
139        CPPAD_STANDARD_MATH_UNARY(double, cos)
140        CPPAD_STANDARD_MATH_UNARY(double, cosh)
141        CPPAD_STANDARD_MATH_UNARY(double, exp)
142        CPPAD_STANDARD_MATH_UNARY(double, fabs)
143        CPPAD_STANDARD_MATH_UNARY(double, log)
144        CPPAD_STANDARD_MATH_UNARY(double, log10)
145        CPPAD_STANDARD_MATH_UNARY(double, sin)
146        CPPAD_STANDARD_MATH_UNARY(double, sinh)
147        CPPAD_STANDARD_MATH_UNARY(double, sqrt)
148        CPPAD_STANDARD_MATH_UNARY(double, tan)
149        CPPAD_STANDARD_MATH_UNARY(double, tanh)
150# if CPPAD_COMPILER_HAS_ASINH
151        CPPAD_STANDARD_MATH_UNARY(double, asinh)
152# endif
153# if CPPAD_COMPILER_HAS_ACOSH
154        CPPAD_STANDARD_MATH_UNARY(double, acosh)
155# endif
156# if CPPAD_COMPILER_HAS_ERF
157        CPPAD_STANDARD_MATH_UNARY(double, erf)
158# endif
159}
160/* $$
161The absolute value function is special because its $code std$$ name is
162$code fabs$$
163$codep */
164namespace CppAD {
165        inline double abs(const double& x)
166        {       return std::fabs(x); }
167}
168/* $$
169
170$head sign$$
171The following defines the $code CppAD::sign$$ function that
172is required to use $code AD<double>$$:
173$codep */
174namespace CppAD {
175        inline double sign(const double& x)
176        {       if( x > 0. )
177                        return 1.;
178                if( x == 0. )
179                        return 0.;
180                return -1.;
181        }
182}
183/* $$
184
185$head pow $$
186The following defines a $code CppAD::pow$$ function that
187is required to use $code AD<double>$$:
188$codep */
189namespace CppAD {
190        inline double pow(const double& x, const double& y)
191        { return std::pow(x, y); }
192}
193/*$$
194
195$head limits$$
196The following defines the numeric limits functions
197$code epsilon$$, $code min$$, and $code max$$ for the type
198$code double$$.
199It also defines the deprecated $code epsilon$$ function:
200$codep */
201namespace CppAD {
202        template <>
203        class numeric_limits<double> {
204        public:
205                // machine epsilon
206                static double epsilon(void)
207                {       return std::numeric_limits<double>::epsilon(); }
208                // minimum positive normalized value
209                static double min(void)
210                {       return std::numeric_limits<double>::min(); }
211                // maximum finite value
212                static double max(void)
213                {       return std::numeric_limits<double>::max(); }
214        };
215        // deprecated machine epsilon
216        template <>
217        inline double epsilon<double>(void)
218        {       return numeric_limits<double>::epsilon(); }
219}
220/* $$
221$end
222*/
223
224# endif
Note: See TracBrowser for help on using the repository browser.