CppADCodeGen  HEAD
A C++ Algorithmic Differentiation Package with Source Code Generation
identical.hpp
1 #ifndef CPPAD_CG_IDENTICAL_INCLUDED
2 #define CPPAD_CG_IDENTICAL_INCLUDED
3 /* --------------------------------------------------------------------------
4  * CppADCodeGen: C++ Algorithmic Differentiation with Source Code Generation:
5  * Copyright (C) 2012 Ciengis
6  *
7  * CppADCodeGen is distributed under multiple licenses:
8  *
9  * - Eclipse Public License Version 1.0 (EPL1), and
10  * - GNU General Public License Version 3 (GPL3).
11  *
12  * EPL1 terms and conditions can be found in the file "epl-v10.txt", while
13  * terms and conditions for the GPL3 can be found in the file "gpl3.txt".
14  * ----------------------------------------------------------------------------
15  * Author: Joao Leal
16  */
17 
18 namespace CppAD {
19 
20 template<class Base>
21 inline bool IdenticalPar(const CppAD::cg::CG<Base>& x) {
22  if (!x.isParameter()) {
23  return false; // its value may change after tapping
24  }
25  return CppAD::IdenticalPar(x.getValue());
26 }
27 
28 template<class Base>
29 inline bool IdenticalCon(const CppAD::cg::CG<Base>& x) {
30  if (!x.isParameter()) {
31  return false; // its value may change after tapping
32  }
33  return CppAD::IdenticalCon(x.getValue());
34 }
35 
36 template<class Base>
37 inline bool IdenticalZero(const CppAD::cg::CG<Base>& x) {
38  if (!x.isParameter()) {
39  return false; // its value may change after tapping
40  }
41  return CppAD::IdenticalZero(x.getValue());
42 }
43 
44 template<class Base>
45 inline bool IdenticalOne(const CppAD::cg::CG<Base>& x) {
46  if (!x.isParameter()) {
47  return false; // its value may change after tapping
48  }
49  return CppAD::IdenticalOne(x.getValue());
50 }
51 
52 template<class Base>
53 inline bool IdenticalEqualPar(const CppAD::cg::CG<Base>& x,
54  const CppAD::cg::CG<Base>& y) {
55  return x.isParameter() && y.isParameter() && CppAD::IdenticalEqualPar(x.getValue(), y.getValue());
56 }
57 
58 template<class Base>
59 inline bool IdenticalEqualCon(const CppAD::cg::CG<Base>& x,
60  const CppAD::cg::CG<Base>& y) {
61  return x.isParameter() && y.isParameter() && CppAD::IdenticalEqualCon(x.getValue(), y.getValue());
62 }
63 
64 } // END CppAD namespace
65 
66 #endif
bool IdenticalPar(const cg::CG< Base > &x)
Definition: identical.hpp:21
const Base & getValue() const
Definition: variable.hpp:45
bool IdenticalOne(const cg::CG< Base > &x)
Definition: identical.hpp:45
bool IdenticalZero(const cg::CG< Base > &x)
Definition: identical.hpp:37
bool isParameter() const
Definition: variable.hpp:35